:root{
  --bg:#0f1117;
  --panel:#171b24;
  --panel2:#1f2530;
  --text:#eef2f7;
  --muted:#9ba7b8;
  --line:#2b3340;
  --accent:#6ee7ff;
  --danger:#ff6b6b;
  --ok:#45d483;
}
*{box-sizing:border-box}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font:15px/1.45 system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}
header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:20px;
  padding:22px 28px;
  border-bottom:1px solid var(--line);
  background:#111722;
}
h1,h2{margin:0}
header p{margin:4px 0 0;color:var(--muted)}
main{padding:24px;max-width:1500px;margin:0 auto}
a{color:var(--accent);text-decoration:none}
.button,button{
  border:1px solid var(--line);
  background:var(--panel2);
  color:var(--text);
  border-radius:10px;
  padding:10px 14px;
  cursor:pointer;
}
.primary,.button.primary{background:#17485a;border-color:#287a94}
.danger{color:#fff;background:#5a1f27;border-color:#8a2f3c}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:16px}
.stats div,.panel,.table-card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:16px;
}
.stats div{padding:18px}
.stats strong{display:block;font-size:30px}
.stats span{color:var(--muted)}
.toolbar{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:center;
  margin-bottom:16px;
}
.toolbar form{display:flex;gap:10px;flex:1}
input,select,textarea{
  width:100%;
  background:#0c1018;
  color:var(--text);
  border:1px solid var(--line);
  border-radius:10px;
  padding:11px;
}
.toolbar input{min-width:420px}
table{width:100%;border-collapse:collapse}
th,td{padding:12px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}
th{color:var(--muted);font-weight:600;background:#141a24}
.muted{color:var(--muted)}
.pill{display:inline-block;border-radius:999px;padding:3px 9px;font-size:12px}
.pill.ok{background:#123d28;color:#8df0b4}
.pill.off{background:#3a3030;color:#ffb3b3}
.actions{display:flex;gap:10px;align-items:center}
.actions form{margin:0}
.empty{text-align:center;color:var(--muted);padding:30px}
.editor{display:grid;gap:16px}
.panel{padding:18px}
.panel h2{margin-bottom:14px}
.grid{display:grid;grid-template-columns:repeat(3,minmax(220px,1fr));gap:14px}
label{display:grid;gap:7px;color:var(--muted)}
label input,label textarea{color:var(--text)}
.check{display:flex;align-items:center;gap:10px;padding-top:26px}
.check input{width:auto}
textarea{
  min-height:220px;
  resize:vertical;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  line-height:1.5;
}
.savebar{
  position:sticky;
  bottom:0;
  display:flex;
  justify-content:flex-end;
  gap:12px;
  padding:14px;
  background:rgba(15,17,23,.92);
  border:1px solid var(--line);
  border-radius:16px;
  backdrop-filter:blur(10px);
}
@media(max-width:900px){
  .toolbar,.toolbar form{flex-direction:column;align-items:stretch}
  .toolbar input{min-width:0}
  .grid,.stats{grid-template-columns:1fr}
}

.stats.tight{grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:12px}
.stats.tight div{padding:12px 16px}
.stats.tight strong{font-size:24px}
.toolbar{margin-bottom:12px}
.table-card{overflow:hidden}
td,th{padding:10px 14px}
.source{margin-top:4px;color:var(--muted);font-size:12px;max-width:520px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
details summary{cursor:pointer;color:var(--accent)}
details pre{max-width:360px;max-height:180px;overflow:auto;white-space:pre-wrap;background:#0b0f16;border:1px solid var(--line);border-radius:10px;padding:10px;color:var(--text)}
.panel summary{display:flex;align-items:center;gap:8px}
.panel summary h2{display:inline;font-size:18px}
.panel.compact{padding:14px}
.hint{margin:0 0 12px;color:var(--muted)}
.grid.slim{grid-template-columns:2fr .4fr 1.6fr .3fr}

.grid.phase2{grid-template-columns:1fr 2fr .4fr .6fr 1.4fr 2fr .8fr 1fr .6fr}
.checks{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px}
.checks .check{padding:7px 10px;border:1px solid var(--line);border-radius:999px;background:#101620;color:var(--text)}
.pill.warn{background:#47380f;color:#ffd36e}
td details{margin:2px 0}

.editor-buttons{display:flex;gap:6px;flex-wrap:wrap}
.mini-button{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:7px 9px;
  border:1px solid var(--line);
  border-radius:9px;
  background:#101620;
  color:var(--text);
  font-size:13px;
}
.mini-button span{
  color:var(--muted);
  font-size:12px;
}
.editor-page{
  max-width:1500px;
  margin:0 auto;
}
.editor-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  position:sticky;
  top:0;
  z-index:5;
}
.editor-jumps{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.text-editor-panel textarea{
  min-height:360px;
}
#transcript,#lyrics,#notes,#ai-notes,#internal-comments,#metadata{
  scroll-margin-top:95px;
}

.resource-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:7px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  border:1px solid var(--line);
}
.resource-pill span{
  opacity:.78;
  font-weight:600;
}
.resource-pill.has{
  background:#123d28;
  border-color:#28794d;
  color:#8df0b4;
}
.resource-pill.missing{
  background:#4a1820;
  border-color:#8a2f3c;
  color:#ff9aa8;
}

/* Keep editor resource pills on one line */
.editor-buttons{
    display:flex;
    flex-wrap:nowrap;
    gap:6px;
    white-space:nowrap;
    overflow-x:auto;
    overflow-y:hidden;
}

.editor-buttons::-webkit-scrollbar{
    height:6px;
}

.resource-pill{
    flex:0 0 auto;
}


/* Keep editor resource pills on one line */
.editor-buttons{
  display:flex;
  flex-wrap:nowrap;
  gap:6px;
  white-space:nowrap;
  overflow-x:auto;
  overflow-y:hidden;
}

.editor-buttons::-webkit-scrollbar{
  height:6px;
}

.resource-pill{
  flex:0 0 auto;
}
