:root {
  --green: #435a56;
  --green-dark: #33463f;
  --green-soft: #e6ecea;
  --grey: #808080;
  --text: #1f2624;
  --muted: #5f6a67;
  --bg: #f4f6f5;
  --card: #ffffff;
  --line: #d9dfdd;
  --danger: #a33a32;
  --ok: #2f7a4f;
  --warn: #9a6a12;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --green: #7fa59d;
    --green-dark: #a3c4bd;
    --green-soft: #22302d;
    --text: #e8ecea;
    --muted: #a5b0ad;
    --bg: #131816;
    --card: #1c2321;
    --line: #2e3836;
    --danger: #e07a70;
    --ok: #6cc08e;
    --warn: #e0b45a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
[hidden] { display: none !important; }
h1 { font-size: 1.3rem; margin: 0 0 14px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
small { color: var(--muted); font-weight: normal; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--green); color: #fff;
}
@media (prefers-color-scheme: dark) { .top { background: #24312e; } }
.brand { font-weight: 650; letter-spacing: .01em; }
.who { font-size: .9rem; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.narrow { max-width: 420px; margin: 8vh auto 0; }

label { display: block; margin: 0 0 14px; font-weight: 550; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  min-height: 48px;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .picker:focus-within {
  outline: 3px solid color-mix(in srgb, var(--green) 45%, transparent); outline-offset: 2px;
}
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 650; margin-bottom: 8px; }
.req { font-size: .75rem; font-weight: 600; color: var(--warn); margin-left: 6px; text-transform: none; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.primary { background: var(--green); color: #fff; width: 100%; }
@media (prefers-color-scheme: dark) { .primary { color: #0f1513; } }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
.wide { width: 100%; margin-top: 10px; }
.row { display: flex; gap: 10px; margin-top: 10px; }
.row > * { flex: 1; }

.error { color: var(--danger); min-height: 0; margin: 0 0 10px; }
.error:empty { display: none; }
.hint { color: var(--muted); font-size: .9rem; margin: 10px 0 0; }

.picker {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 150px; border: 2px dashed color-mix(in srgb, var(--green) 55%, transparent);
  border-radius: var(--radius); background: var(--green-soft); color: var(--green-dark);
  text-align: center; cursor: pointer; margin: 0; padding: 16px;
}
.picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.picker-icon { font-size: 2.2rem; line-height: 1; }

.selected { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.selected li { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; }
.selected .thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--line); display: grid; place-items: center; font-size: .7rem; color: var(--muted); overflow: hidden; }
.selected .thumb img, .selected .thumb video { width: 100%; height: 100%; object-fit: cover; }
.selected .name { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected .status { font-size: .8rem; color: var(--muted); }
.selected .status.ok { color: var(--ok); }
.selected .status.err { color: var(--danger); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }
.remove { min-height: 40px; padding: 0 10px; background: transparent; border: 0; color: var(--muted); font-size: 1.2rem; }

.choice { display: flex; gap: 12px; align-items: flex-start; font-weight: normal; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.choice input { width: 22px; height: 22px; min-height: 0; margin: 2px 0 0; accent-color: var(--green); flex: none; }
.choice span { display: flex; flex-direction: column; }
.choice:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.check { display: flex; gap: 10px; align-items: center; font-weight: normal; }
.check input { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--green); }

.filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.filter-row select, .filter-row input { margin: 0; }
@media (min-width: 640px) { .filter-row { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; } }
.tile { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--line); border: 0; padding: 0; width: 100%; min-height: 0; display: block; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .ph { display: grid; place-items: center; height: 100%; font-size: .75rem; color: var(--muted); padding: 4px; text-align: center; }
.badge { position: absolute; left: 4px; bottom: 4px; font-size: .68rem; font-weight: 650; padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; }
.badge.no { background: rgba(163,58,50,.92); }
.badge.vid { left: auto; right: 4px; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

.inline-form .check { margin-bottom: 14px; }
.notice { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--green-soft); border: 1px solid var(--green); }
.notice code { font-size: 1.15rem; font-weight: 700; letter-spacing: .03em; user-select: all; }
.users { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.users li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; }
.users .u-name { font-weight: 600; }
.users .u-meta { font-size: .85rem; color: var(--muted); grid-column: 1; }
.users .u-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 6px; }
.users .u-actions button { min-height: 38px; padding: 0 12px; font-size: .85rem; }
.users li.off { opacity: .6; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { flex: 1; flex-direction: column; gap: 2px; min-height: 62px; border-radius: 0; background: transparent; color: var(--muted); font-size: .78rem; font-weight: 600; }
.tab span:first-child { font-size: 1.3rem; line-height: 1; }
.tab.active { color: var(--green); }

dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.55); }
.detail-media { background: #000; display: grid; place-items: center; max-height: 55vh; }
.detail-media img, .detail-media video { max-width: 100%; max-height: 55vh; display: block; }
.detail-media .ph { color: #ccc; padding: 40px 16px; text-align: center; }
.detail-body { padding: 16px; }
.meta { color: var(--muted); font-size: .88rem; margin: 0 0 12px; }
