:root {
  --bg: #f4f2ee;
  --card: #ffffff;
  --ink: #1d2430;
  --muted: #6b7280;
  --line: #e3e0da;
  --accent: #1F4E78;
  --accent-ink: #ffffff;
  --accent-soft: #e4edf5;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --err: #b42318;
  --err-soft: #fde8e6;
  --ok: #1d7a46;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417; --card: #1c1f24; --ink: #e8e9eb; --muted: #9aa1ab; --line: #2c3036;
    --accent: #6ea8dc; --accent-ink: #0d1520; --accent-soft: #1e2b38;
    --warn: #f0b45a; --warn-soft: #33270f; --err: #ff8a80; --err-soft: #3a1c1a; --ok: #6fd39b;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
  padding-top: var(--safe-top);
  padding-bottom: calc(84px + var(--safe-bottom));
}
main { max-width: 680px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 28px; letter-spacing: -0.02em; margin: 14px 0 10px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 8px; font-weight: 600; }
h3 { font-size: 15px; margin: 14px 0 6px; color: var(--accent); }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; padding: 40px 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.topbar { display: flex; align-items: center; gap: 8px; padding-top: 8px; }
.topbar h1 { flex: 1; margin: 6px 0; }
.back { background: none; border: 0; color: var(--accent); font-size: 17px; padding: 8px 0; cursor: pointer; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item { display: block; padding: 12px 14px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.item:first-child { border-top: 0; }
.item:active { background: var(--accent-soft); }
.item .t { font-weight: 600; }
.item .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sub-h { padding: 8px 14px; font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--accent); border-top: 1px solid var(--line); }
.sub-h:first-child { border-top: 0; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); margin-left: 6px; vertical-align: 2px; }

.search { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 16px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

label.f { display: block; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.f .req { color: var(--err); }
input, select, textarea {
  width: 100%; margin-top: 5px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-size: 16px;
}
textarea { min-height: 70px; resize: vertical; }
input[type=date] { min-height: 44px; }
.seg { display: flex; margin-top: 5px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; padding: 10px 0; border: 0; background: var(--card); color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; border-left: 1px solid var(--line); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.filebox { margin-top: 6px; border: 1.5px dashed var(--line); border-radius: 12px; padding: 12px; text-align: center; color: var(--muted); position: relative; }
.filebox input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.filebox.has { border-color: var(--accent); color: var(--accent); font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.block { width: 100%; margin-top: 18px; }
.btn.sm { padding: 7px 11px; font-size: 14px; border-radius: 9px; }
.btn.danger { color: var(--err); }
.btn:disabled { opacity: .5; }

.fab { position: fixed; right: 16px; bottom: calc(76px + var(--safe-bottom)); background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 14px 20px; font-size: 16px; font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,.18); cursor: pointer; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: space-around; padding: 6px 0 calc(6px + var(--safe-bottom)); z-index: 5; }
.tabbar a { flex: 1; text-align: center; font-size: 12px; color: var(--muted); text-decoration: none; padding: 4px 0; position: relative; }
.tabbar a .ic { display: block; font-size: 20px; line-height: 1.2; }
.tabbar a.on { color: var(--accent); font-weight: 600; }
.badge { position: absolute; top: 0; left: 55%; background: var(--err); color: #fff; border-radius: 999px; font-size: 11px; min-width: 18px; padding: 1px 5px; font-weight: 700; }

.banner { position: sticky; top: 0; z-index: 6; background: var(--accent-soft); color: var(--accent); font-size: 13px; padding: 8px 16px; text-align: center; }
.banner.err { background: var(--err-soft); color: var(--err); }
.bar { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .2s; }

.kv { display: grid; grid-template-columns: 112px 1fr; gap: 6px 10px; font-size: 15px; }
.kv dt { color: var(--muted); font-size: 13px; padding-top: 1px; }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 0 14px 12px; }
.thumbs a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--line); position: relative; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs .vid { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 22px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.thumbs .noimg { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: var(--muted); padding: 4px; text-align: center; word-break: break-all; }
.folder-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.folder-h:first-child { border-top: 0; }
.folder-h .t { flex: 1; font-weight: 600; }

.job { padding: 12px 14px; border-top: 1px solid var(--line); }
.job:first-child { border-top: 0; }
.job .err { color: var(--err); font-size: 13px; margin-top: 4px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-bottom)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 10; max-width: calc(100% - 32px); }
.login { padding-top: 18vh; text-align: center; }
.login .logo { width: 84px; height: 84px; border-radius: 20px; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
