:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2f6bff;
  --accent-soft: #e8efff;
  --danger: #d92d20;
  --ok: #12805c;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #1a1d23;
    --text: #eceef2;
    --muted: #9aa1ad;
    --line: #2a2e36;
    --accent: #5b8cff;
    --accent-soft: #1e2a47;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.app { max-width: 880px; margin: 0 auto; padding: 12px 16px 80px; }
.center { text-align: center; padding: 48px 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

.header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 12px; }
.header h1 { font-size: 20px; margin: 0; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; white-space: nowrap; cursor: pointer; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.filters { display: flex; gap: 8px; margin-bottom: 12px; }
.filters input, .filters select { flex: 1; min-width: 0; }
input, select, textarea { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; }
textarea { min-height: 110px; resize: vertical; }
label { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; margin: 12px 0; color: var(--text); font-size: 15px; }
.check input { width: auto; }

.list { display: grid; gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; text-align: left; width: 100%; }
.item .icon { flex: 0 0 44px; height: 44px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; font-size: 20px; overflow: hidden; }
.item .icon img { width: 100%; height: 100%; object-fit: cover; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.item .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: middle; }

.btn { border: 0; border-radius: 10px; padding: 10px 16px; background: var(--accent); color: #fff; cursor: pointer; font-weight: 600; }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn:disabled { opacity: .6; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.panel h2 { font-size: 16px; margin: 0 0 8px; }
.table { width: 100%; border-collapse: collapse; }
.table td { padding: 8px 4px; border-top: 1px solid var(--line); vertical-align: middle; }
.table select { width: auto; padding: 6px 8px; }

.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet .inner { background: var(--bg); width: 100%; max-width: 880px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet h2 { margin: 0 0 6px; font-size: 18px; }
.preview { margin: 12px 0; border-radius: 12px; overflow: hidden; background: var(--card); border: 1px solid var(--line); }
.preview img, .preview video { display: block; width: 100%; max-height: 60vh; object-fit: contain; background: #000; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: calc(100% - 32px); }
.toast.error { background: var(--danger); }

.urow { display: flex; flex-wrap: wrap; gap: 6px 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.urow .uname { flex: 1 1 100%; }
.urow select { flex: 1 1 140px; width: auto; padding: 6px 8px; }
