/* DeepMood — admin panel styling. Tokens mirror PLAN.md; the public shell builds on the same variables. */
/* Design tokens live in tokens.css (loaded before this file). */

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; font: 14px/1.5 var(--font-ui); color: var(--text);
  background: radial-gradient(1200px 700px at 10% -10%, #1a1410 0%, transparent 60%),
              radial-gradient(900px 600px at 100% 100%, #0b1420 0%, transparent 60%), var(--void);
}
a { color: var(--ember); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 26px; font-family: var(--font-display); font-weight: 500; }
h1 small.step, h1 small.muted { font: 12px var(--font-ui); color: var(--text-faint); margin-left: .5em; vertical-align: middle; }
h2 { font-size: 18px; }
code { font-size: 12px; background: var(--surface-hi); padding: 1px 5px; border-radius: 5px; }
pre { font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.muted { color: var(--text-dim); }
.ok { color: var(--ok); } .bad { color: var(--danger); } .warn { color: var(--ember); }
.nowrap { white-space: nowrap; }
.inline { display: inline; }

/* Glass surfaces */
.card, .sidebar {
  background: var(--panel); backdrop-filter: var(--panel-blur); -webkit-backdrop-filter: var(--panel-blur);
  border: 1px solid var(--stroke); border-radius: var(--r-card);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,.07);
}
.card { padding: 20px 22px; margin-bottom: 18px; }
.card.narrow { max-width: 440px; margin: 8vh auto; }
.card.narrow-wide { max-width: 720px; margin: 6vh auto; }
form.card.narrow { margin: 0; }

/* Layouts */
.page-base .container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--stroke); }
.topnav a { color: var(--text-dim); margin-left: 18px; } .topnav a:hover { color: var(--text); text-decoration: none; }
.brand { font-family: var(--font-display); font-size: 22px; color: var(--text); display: flex; flex-direction: column; line-height: 1.1; }
.brand small { font: 9px var(--font-ui); text-transform: uppercase; letter-spacing: .22em; color: var(--text-faint); margin-top: 4px; }
.brand:hover { text-decoration: none; }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; border-radius: 0; border-width: 0 1px 0 0; display: flex; flex-direction: column; padding: 22px 16px; box-shadow: none; }
.sidenav { display: flex; flex-direction: column; gap: 2px; margin-top: 26px; }
.sidenav a { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 10px; color: var(--text-dim); transition: background .15s, color .15s; }
.sidenav a:hover { background: var(--surface-hi); color: var(--text); text-decoration: none; }
.sidenav a.active { background: var(--ember-soft); color: var(--ember); }
.pill { background: var(--cream); color: var(--on-cream); font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: var(--r-pill); }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--stroke); }
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ember-soft); color: var(--ember); display: grid; place-items: center; font-weight: 600; }
.me-name { display: flex; flex-direction: column; line-height: 1.2; } .me-name a { color: var(--text); } .me-name small { color: var(--text-faint); font-size: 11px; }
.content { padding: 28px 32px; max-width: 1400px; width: 100%; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head p { margin: 2px 0 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.two-col.wide-left { grid-template-columns: 2fr 1fr; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; padding: 14px 16px; background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-card); color: var(--text-dim); transition: border-color .15s, transform .15s; }
.stat b { font-size: 26px; color: var(--text); font-weight: 600; }
.stat:hover { border-color: var(--stroke-hi); transform: translateY(-2px); text-decoration: none; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > span, .field legend { font-size: 12px; color: var(--text-dim); } .field span b { color: var(--ember); }
.field small, .hint { color: var(--text-faint); font-size: 11px; }
.field-row { display: flex; gap: 12px; } .field-row .field { flex: 1; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
fieldset.field { margin-top: 4px; } fieldset.field legend { padding: 0; margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.form-col { display: flex; flex-direction: column; gap: 14px; }
.form-actions { display: flex; gap: 10px; align-items: flex-end; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--stroke); }
.form-actions .inline-field { flex-direction: column; } .form-actions .grow { flex: 1; }
.radio-row { display: flex; gap: 18px; margin-bottom: 10px; } .radio-row label, .check { display: flex; align-items: center; gap: 6px; color: var(--text-dim); cursor: pointer; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--stroke); border-radius: 10px; padding: 8px 11px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(240,168,92,.55); box-shadow: 0 0 0 3px var(--ember-soft); }
input[type=file] { color: var(--text-dim); font-size: 12px; }
input:disabled { opacity: .6; }
textarea { resize: vertical; }
select option { background: #11161d; }
.field-error { color: var(--danger); font-size: 12px; }
.current-file { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; color: var(--text-dim); font-size: 12px; }
audio { height: 34px; max-width: 100%; }
.cover-preview { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.cover-preview img { width: 120px; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; border: 1px solid var(--stroke); }
.detail-cover { width: 100%; max-width: 420px; aspect-ratio: 4/3; object-fit: cover; border-radius: 12px; border: 1px solid var(--stroke); margin-bottom: 12px; display: block; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; color: var(--text);
  background: var(--surface-hi); border: 1px solid var(--stroke); border-radius: var(--r-pill); padding: 8px 16px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s; white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,.11); border-color: var(--stroke-hi); text-decoration: none; }
.btn-primary { background: var(--cream); color: var(--on-cream); border-color: transparent; }
.btn-primary:hover { background: #f8e6cd; }
.btn-ghost { background: transparent; }
.btn-danger { background: rgba(226,104,92,.14); color: #f1a097; border-color: rgba(226,104,92,.3); }
.btn-danger:hover { background: rgba(226,104,92,.24); }
.btn-sm { padding: 4px 11px; font-size: 12px; }
.btn-block { width: 100%; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); padding: 6px 10px; border-bottom: 1px solid var(--stroke); }
.table td { padding: 10px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td { padding: 6px 8px; }
.card-table { background: var(--panel); border: 1px solid var(--stroke); border-radius: var(--r-card); overflow: hidden; }
.card-table td, .card-table th { padding-left: 14px; padding-right: 14px; }
.table .actions { text-align: right; white-space: nowrap; } .table .actions form { margin-left: 4px; }
tr.dim { opacity: .55; }
.thumb { width: 52px; aspect-ratio: 4/3; object-fit: cover; border-radius: 7px; display: inline-block; background: var(--surface-hi); vertical-align: middle; }
.thumb-cell { width: 60px; }
.note { color: var(--ember); font-size: 12px; }
.diff tr.changed td { background: var(--ember-soft); } .diff tr.same { color: var(--text-dim); }
.diff td:first-child { white-space: nowrap; font-weight: 500; width: 140px; }
.json-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .json-pair pre { background: var(--surface); padding: 8px; border-radius: 8px; margin: 6px 0 0; max-height: 240px; overflow: auto; }
.audit details summary { cursor: pointer; color: var(--text-dim); font-size: 12px; }

.badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: var(--r-pill); background: var(--surface-hi); color: var(--text-dim); border: 1px solid var(--stroke); }
.badge-published, .badge-approved { background: rgba(127,196,138,.14); color: var(--ok); border-color: rgba(127,196,138,.3); }
.badge-pending { background: var(--ember-soft); color: var(--ember); border-color: rgba(240,168,92,.3); }
.badge-rejected { background: rgba(226,104,92,.14); color: #f1a097; border-color: rgba(226,104,92,.3); }
.badge-admin { background: var(--cream); color: var(--on-cream); border-color: transparent; }
.chip { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--stroke); color: var(--text-dim); font-size: 12px; }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid var(--stroke); background: var(--surface); display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.flash-success { border-color: rgba(127,196,138,.35); background: rgba(127,196,138,.09); }
.flash-error { border-color: rgba(226,104,92,.35); background: rgba(226,104,92,.09); }
.flash-info { border-color: rgba(240,168,92,.3); background: var(--ember-soft); }
.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 160px; }
.pagination { display: flex; gap: 6px; margin: 16px 0; }
.pagination a { padding: 4px 10px; border-radius: 8px; color: var(--text-dim); background: var(--surface); border: 1px solid var(--stroke); }
.pagination a.active { background: var(--cream); color: var(--on-cream); }
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
.dl dt { color: var(--text-faint); } .dl dd { margin: 0; }
.danger-zone summary { cursor: pointer; color: var(--text-dim); } .danger-zone[open] summary { margin-bottom: 12px; }
.review-actions { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 20px; }
.trace { background: var(--surface); padding: 12px; border-radius: 10px; }
.lead { font-size: 16px; color: var(--text-dim); }

/* Public placeholder pages */
.hero-lite { padding: 30px 0 22px; } .hero-lite h1 { font-size: 40px; line-height: 1.05; max-width: 600px; }
.sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.sound-card { display: block; background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-card); overflow: hidden; color: var(--text); transition: transform .15s, border-color .15s; }
.sound-card:hover { transform: translateY(-2px); border-color: var(--stroke-hi); text-decoration: none; }
.sound-card .cover { aspect-ratio: 4/3; background: linear-gradient(180deg, #1b2230, #0d1117); }
.sound-card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sound-card .body { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }

@media (max-width: 1100px) { .two-col, .two-col.wide-left, .form-grid { grid-template-columns: 1fr; } .review-actions { position: static; } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; border-width: 0 0 1px; }
  .content { padding: 18px; } .field-row { flex-direction: column; } .page-head { flex-direction: column; }
}

/* ---- Statistics ---- */
.stats-range { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-pill); }
.stats-range .seg { padding: 6px 14px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--text-dim); font: inherit; cursor: pointer; }
.stats-range .seg.active { background: var(--cream); color: var(--on-cream); font-weight: 500; }
.stats-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stats-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--stroke); }
.stats-tabs button { padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-dim); font: inherit; cursor: pointer; margin-bottom: -1px; }
.stats-tabs button:hover { color: var(--text); } .stats-tabs button.active { color: var(--ember); border-bottom-color: var(--ember); }
.stats-filters { display: flex; gap: 8px; align-items: center; } .stats-filters select { width: auto; }
.stats-status { font-size: 12px; min-width: 70px; }
.stats-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stats-kpis .stat small { color: var(--text-faint); font-size: 11px; margin-top: 2px; }
.chart-card { padding-bottom: 12px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-head h2 { margin: 0; }
.chart { width: 100%; min-height: 200px; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--stroke); stroke-width: 1; }
.chart .axis { fill: var(--text-faint); font-size: 11px; font-family: var(--font-ui); }
.chart .guide { stroke: var(--stroke-hi); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-dim); }
.chart-legend i, .chart-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-tip { position: fixed; z-index: 50; pointer-events: none; padding: 8px 12px; border-radius: 10px; background: #11161d; border: 1px solid var(--stroke-hi); box-shadow: var(--shadow-card); font-size: 12px; color: var(--text-dim); line-height: 1.6; }
.chart-tip > b { display: block; color: var(--text); margin-bottom: 2px; } .chart-tip div b { color: var(--text); }
.stats-table .num { text-align: right; white-space: nowrap; }
.stats-table th.sortable { cursor: pointer; user-select: none; } .stats-table th.sortable:hover, .stats-table th.sorted { color: var(--ember); }
.stats-table tr.clickable { cursor: pointer; } .stats-table tr.clickable:hover td { background: var(--surface); } .stats-table tr.selected td { background: var(--ember-soft); }
.stat-sound { display: inline-flex; align-items: center; gap: 10px; } .stat-sound img, .stat-sound i { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; background: var(--surface-hi); display: inline-block; flex: none; }
.stat-sound span { display: flex; flex-direction: column; line-height: 1.25; } .stat-sound small { color: var(--text-faint); font-size: 11px; }
.stat-bar { display: inline-block; width: 90px; height: 6px; border-radius: 3px; background: var(--surface-hi); vertical-align: middle; margin-right: 8px; overflow: hidden; }
.stat-bar i { display: block; height: 100%; border-radius: 3px; }
.stat-mix { display: flex; flex-wrap: wrap; gap: 4px; max-width: 420px; }
.stat-mix .chip { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* two-column field grid (settings → mobile apps) */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
