:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e5e7eb;
  --accent: #e11d48; --accent-2: #fde7ec; --ok: #059669; --warn: #d97706;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* hidden must win over display rules like label.block */
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: #111827; color: #fff; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; }
.brand span { font-weight: 400; opacity: .7; }
.ws-bar { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ws-bar select { min-width: 200px; }
header button.ghost { background: transparent; color: #fff; border-color: #4b5563; }
nav { display: flex; gap: 2px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
nav button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 12px 14px; white-space: nowrap; }
nav button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
main { max-width: 1200px; margin: 0 auto; padding: 20px; }
.tab { display: none; }
.tab.active { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.spacer { flex: 1; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); }
.row > input:not([type=checkbox]) { flex: 1; min-width: 220px; }
textarea { width: 100%; resize: vertical; }
button { font: inherit; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
button:disabled { opacity: .5; cursor: wait; }
button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
button.danger { background: #fff; color: #b91c1c; border-color: #fecaca; }
button.link { background: none; border: 0; color: var(--muted); padding: 2px 6px; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filters label.check { flex-direction: row; align-items: center; padding-bottom: 8px; }
.filters input[type=number] { width: 130px; }
label.block { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; cursor: pointer; user-select: none; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
.thumb { width: 96px; height: 54px; object-fit: cover; border-radius: 4px; background: #eee; display: block; }
a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }
.badge { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 10px; background: var(--accent-2); color: var(--accent); font-size: 12px; text-align: center; }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 600; background: #eef2ff; color: #3730a3; }
.tag.new { background: #dcfce7; color: #166534; }
.tag.short { background: #fef3c7; color: #92400e; }
.score { font-weight: 700; color: var(--accent); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid3 .col h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); }
.vcard { display: flex; gap: 8px; margin-bottom: 10px; }
.vcard .t { font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--text); font-size: 12px; cursor: pointer; }
.chip.active { border-color: var(--accent); color: var(--accent); }
.group-title { margin: 14px 0 6px; font-weight: 600; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.result-line { font-size: 13px; margin: 2px 0; }
.result-line.err { color: #b91c1c; }
.result-line.ok { color: var(--ok); }
.report { white-space: pre-wrap; background: #f9fafb; border: 1px dashed var(--line); border-radius: 8px; padding: 12px; font-size: 13px; }
.empty { padding: 20px; text-align: center; color: var(--muted); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.err { background: #b91c1c; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { background: #fff; color: var(--text); border: 0; border-radius: 0; padding: 6px 12px; }
.seg button.on { background: var(--accent); color: #fff; }
.bar { display: grid; grid-template-columns: 170px 1fr 70px; gap: 8px; align-items: center; margin: 5px 0; font-size: 13px; }
.bar .track { background: #f1f5f9; border-radius: 4px; height: 10px; overflow: hidden; }
.bar .fill { background: var(--accent); height: 100%; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fafafa; }
tr.detail td { background: #fafafa; padding: 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.detail-grid h3 { font-size: 12px; margin: 0 0 6px; color: var(--muted); text-transform: uppercase; }
.mini { font-size: 12px; margin: 3px 0; }
.flow-ch { border-top: 1px solid var(--line); padding: 10px 0; }
.flow-ch .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flow-ch .vids { margin: 6px 0 0 0; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.notice { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.notice ol { margin: 6px 0 0 18px; padding: 0; }
.idea { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.idea.approved { border-color: #86efac; background: #f0fdf4; }
.idea.rejected { opacity: .5; }
.idea .head { display: flex; gap: 8px; align-items: flex-start; }
.idea .title { font-weight: 700; font-size: 15px; flex: 1; }
.idea .stars { color: #f59e0b; white-space: nowrap; }
.idea p { margin: 6px 0; }
.idea ul { margin: 4px 0 6px 18px; padding: 0; font-size: 13px; color: #374151; }
.idea .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.idea .actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.kw { display: inline-block; padding: 1px 8px; border-radius: 10px; background: #f1f5f9; font-size: 12px; }
.thumbtext { font-weight: 800; letter-spacing: .02em; background: #111827; color: #fde047; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.comment { border-top: 1px solid var(--line); padding: 8px 0; font-size: 13px; }
.comment .src { font-size: 12px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
#scRows { min-width: 1100px; font-size: 13px; }
#scRows td { white-space: pre-wrap; vertical-align: top; cursor: copy; max-width: 320px; word-break: break-word; }
#scRows td.copied { background: #dcfce7; }
#scRows tr.k-round td { background: #fff; }
#scRows tr.k-mini td { background: #fefce8; }
#scRows tr.k-greeting td, #scRows tr.k-outro td, #scRows tr.k-cta td { background: #eff6ff; }
#scRows tr.done td { opacity: .45; }
#scRows td[contenteditable="true"] { cursor: text; outline: 1px dashed #cbd5e1; }
#scRows td.warn { color: #b45309; }
.round-box { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.round-box .rhead { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.round-box .rhead input { flex: 1; padding: 4px 8px; }
.song-line { display: flex; gap: 6px; align-items: center; font-size: 13px; padding: 2px 0; flex-wrap: wrap; }
.song-line .nm { flex: 1; min-width: 200px; }
.flag { font-size: 11px; padding: 0 5px; border-radius: 4px; }
.flag.ok { background: #dcfce7; color: #166534; }
.flag.no { background: #fee2e2; color: #991b1b; }
.flag.new { background: #e0e7ff; color: #3730a3; }
#sbTable td { font-size: 13px; vertical-align: top; }
#sbTable .lyr { max-width: 280px; white-space: pre-wrap; color: var(--muted); font-size: 12px; max-height: 3.2em; overflow: hidden; }
.status-pill { padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #f1f5f9; }
.status-pill.draft { background: #fef3c7; } .status-pill.approved { background: #dcfce7; }
.status-pill.editing { background: #e0e7ff; } .status-pill.done, .status-pill.published { background: #d1fae5; }
.pastezone { border: 2px dashed #cbd5e1; border-radius: 8px; padding: 12px; margin-top: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.pastezone:focus { outline: none; border-color: var(--accent); background: #fff7f9; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs .t { position: relative; }
.thumbs img { height: 72px; border-radius: 4px; border: 1px solid var(--line); display: block; }
.thumbs .t button { position: absolute; top: -6px; right: -6px; padding: 0 6px; font-size: 11px; border-radius: 10px; }
.link-like { color: #1d4ed8; cursor: pointer; text-decoration: underline; }
.research { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.research h3 { margin: 0 0 4px; font-size: 14px; }
.research .grid2 { gap: 12px; margin-top: 8px; }
.research ul { margin: 4px 0 4px 18px; padding: 0; font-size: 13px; }
.research .imgs img { height: 64px; border-radius: 4px; margin-right: 6px; border: 1px solid var(--line); }
.idea-mini { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-top: 8px; font-size: 13px; }
.idea-mini pre { white-space: pre-wrap; font-family: inherit; margin: 4px 0; background: #fff; padding: 6px; border-radius: 4px; }
.score-pill { background: #111827; color: #fde047; border-radius: 10px; padding: 0 8px; font-size: 12px; font-weight: 700; }
#authScreen { position: fixed; inset: 0; background: #111827; display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
#authScreen[hidden] { display: none; }
.auth-card { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 360px; }
.auth-card input { width: 100%; margin-top: 4px; }
.brand.dark { color: #111827; margin-bottom: 8px; }
.user-box { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; font-size: 13px; }
.user-box .tag { background: #374151; color: #fff; }
[data-hidden-role] { display: none !important; }
@media (max-width: 760px) {
  .user-box { margin-left: 0; }
  .grid3, .grid2, .detail-grid { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 120px 1fr 56px; }
  main { padding: 12px; }
  .ws-bar { margin-left: 0; width: 100%; }
  .ws-bar select { flex: 1; min-width: 0; }
  .hide-sm { display: none; }
}
