/* TACBOARD — slate theme */
:root {
  --bg: #020617; --bg1: #0b1220; --bg2: #0f172a; --bg3: #1e293b; --line: #1e293b; --line2: #334155;
  --tx: #e2e8f0; --tx2: #94a3b8; --tx3: #64748b; --ac: #38bdf8; --ac2: #0284c7; --ok: #34d399; --warn: #fbbf24; --err: #f87171;
  --blue: #3b82f6; --red: #ef4444; --neutral: #f59e0b;
  --fn: "Inter", "Segoe UI", system-ui, sans-serif; --mono: "JetBrains Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--tx); font: 13px/1.4 var(--fn); }
.hidden { display: none !important; }
.grow { flex: 1; }
.muted { color: var(--tx3); }
.small { font-size: 12px; }
button { font-family: var(--fn); }
input, select, textarea { font-family: var(--fn); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line2);
       background: var(--bg2); color: var(--tx); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #475569; background: var(--bg3); }
.btn.primary { background: var(--ac2); border-color: var(--ac2); color: #fff; }
.btn.primary:hover { background: #0369a1; }
.btn.ghost { background: none; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.danger { color: #fecaca; border-color: #7f1d1d; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--tx); text-decoration: none; }
.brand .logo { width: 30px; height: 30px; border-radius: 7px; background: linear-gradient(135deg, #0284c7, #1e3a8a); display: grid;
               place-items: center; font-weight: 800; color: #fff; }
.brand b { display: block; font-size: 11px; letter-spacing: 3px; color: var(--tx2); font-weight: 600; }
.brand i { display: block; font-style: normal; font-weight: 700; letter-spacing: 2px; }
.brand.sm .logo { width: 24px; height: 24px; font-size: 12px; border-radius: 5px; }
.brand.sm i { font-size: 13px; }

/* ── dashboard ── */
#dash { min-height: 100%; }
.dash-top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--bg1); }
.dash-main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.hero { display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 26px; }
.hero .kicker { font-size: 12px; letter-spacing: 3px; color: var(--ac); text-transform: uppercase; font-weight: 600; }
.hero h1 { margin: 4px 0 8px; font-size: 34px; letter-spacing: 4px; }
.hero p { margin: 0; max-width: 640px; color: var(--tx2); font-size: 14px; line-height: 1.6; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.dash-tools input { background: var(--bg2); border: 1px solid var(--line2); color: var(--tx); border-radius: 6px; padding: 7px 10px; min-width: 220px; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; }
.seg button { background: var(--bg2); color: var(--tx2); border: 0; padding: 6px 12px; font-size: 12px; cursor: pointer; border-right: 1px solid var(--line2); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--bg3); color: #fff; }
.seg.sm button { padding: 4px 8px; font-size: 11px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 11px; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line2); color: var(--tx2); background: none; cursor: pointer; }
.chip.on { background: var(--ac2); border-color: var(--ac2); color: #fff; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px;
        cursor: pointer; transition: border-color .15s; min-height: 120px; }
.card:hover { border-color: var(--ac2); }
.card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card .desc { color: var(--tx2); font-size: 12px; flex: 1; }
.card .meta { color: var(--tx3); font-size: 11.5px; display: flex; gap: 8px; flex-wrap: wrap; }
.card .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.card .tag { font-size: 10.5px; padding: 1px 7px; border-radius: 99px; background: var(--bg3); color: var(--tx2); }
.card .acts { display: flex; gap: 6px; margin-top: 4px; }
.card .acts button { font-size: 11px; padding: 3px 8px; border-radius: 5px; border: 1px solid var(--line2); background: none; color: var(--tx2); cursor: pointer; }
.card .acts button:hover { color: #fff; }
.card .lock { font-size: 11px; color: var(--warn); }
.empty { color: var(--tx3); padding: 30px; text-align: center; grid-column: 1 / -1; }
#dNote { margin-top: 22px; max-width: 760px; line-height: 1.6; }

/* ── editor layout ── */
#editor { position: fixed; inset: 0; display: grid; grid-template-rows: 48px 1fr 46px; }
#top { display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--bg1); border-bottom: 1px solid var(--line); min-width: 0; }
.title-in { background: none; border: 1px solid transparent; color: var(--tx); font-size: 14px; font-weight: 600; padding: 5px 8px; border-radius: 5px;
            width: 220px; min-width: 80px; }
.title-in:hover, .title-in:focus { border-color: var(--line2); outline: none; background: var(--bg2); }
.pill { font-size: 11px; color: var(--tx3); white-space: nowrap; }
.pill.dirty { color: var(--warn); }
.zoom { font: 12px var(--mono); color: var(--tx2); padding: 3px 7px; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.track { display: flex; align-items: center; gap: 4px; }
.track select { background: var(--bg2); border: 1px solid var(--line2); color: var(--tx); border-radius: 5px; font-size: 12px; padding: 3px 4px; max-width: 120px; }
.trkx { color: var(--tx3); }
.trkread { font: 12px var(--mono); color: var(--ac); min-width: 90px; white-space: nowrap; }
.btns { display: flex; gap: 6px; align-items: center; }
.dd { position: relative; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 4px;
           min-width: 240px; z-index: 40; display: none; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.dd-menu.open { display: block; }
.dd-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--tx); padding: 7px 10px; font-size: 12.5px;
                  border-radius: 5px; cursor: pointer; }
.dd-menu button:hover { background: var(--bg3); }
.dd-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

#main { display: grid; grid-template-columns: 44px 210px 1fr 300px; min-height: 0; }
#tools { background: var(--bg1); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
         overflow-y: auto; }
#tools button { width: 34px; height: 32px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--tx2); font-size: 15px;
                cursor: pointer; display: grid; place-items: center; flex: none; }
#tools button:hover { background: var(--bg3); color: #fff; }
#tools button.on { background: var(--ac2); color: #fff; }
#tools button.toggled { border-color: var(--ac2); color: var(--ac); }
#tools .sep { width: 22px; border-top: 1px solid var(--line2); margin: 5px 0; flex: none; }

#left { background: var(--bg1); border-right: 1px solid var(--line); overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.phead { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--tx2); font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.phead .muted { letter-spacing: 0; text-transform: none; font-weight: 400; font-size: 11px; }
.coa { display: flex; gap: 4px; }
.coa button { flex: 1; border-radius: 5px; border: 1px solid var(--line2); background: var(--bg2); color: var(--tx2); padding: 4px 0; font-size: 12px; cursor: pointer; }
.coa button[data-coa="blue"].on { background: #1d4ed8; border-color: #3b82f6; color: #fff; }
.coa button[data-coa="red"].on { background: #b91c1c; border-color: #ef4444; color: #fff; }
.coa button[data-coa="neutral"].on { background: #b45309; border-color: #f59e0b; color: #fff; }
#left input[type=search] { background: var(--bg2); border: 1px solid var(--line2); color: var(--tx); border-radius: 5px; padding: 5px 8px; font-size: 12px; }
.pgroup-h { font-size: 10.5px; color: var(--tx3); letter-spacing: 1.5px; text-transform: uppercase; margin: 6px 0 3px; }
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.punit { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px; border-radius: 6px; border: 1px solid var(--line);
         background: var(--bg2); cursor: grab; user-select: none; }
.punit:hover { border-color: var(--ac2); }
.punit.on { border-color: var(--ac); background: #0c2233; }
.punit canvas { width: 30px; height: 30px; }
.punit span { font-size: 10px; color: var(--tx2); text-align: center; line-height: 1.15; }
.subtools { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.swatches button { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatches button.on { border-color: #fff; }
.row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--tx2); }
.hint { font-size: 11.5px; color: var(--tx3); line-height: 1.5; border-top: 1px solid var(--line); padding-top: 8px; margin-top: auto; }

#stage { position: relative; overflow: hidden; background: #0b1220; min-width: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#inlineEdit { position: absolute; z-index: 5; background: #fef3c7; color: #1c1917; border: 2px solid var(--ac); border-radius: 4px; padding: 6px;
              font: 13px var(--fn); resize: both; min-width: 120px; min-height: 40px; }
#ctxMenu { position: absolute; z-index: 30; background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 4px; min-width: 190px;
           box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
#ctxMenu button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--tx); padding: 6px 10px; font-size: 12.5px;
                  border-radius: 5px; cursor: pointer; }
#ctxMenu button:hover { background: var(--bg3); }
#ctxMenu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
#viewOnly { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); background: rgba(15, 23, 42, .92); border: 1px solid var(--line2);
            border-radius: 99px; padding: 5px 14px; font-size: 12px; color: var(--tx2); z-index: 4; white-space: nowrap; }
#viewOnly b { color: var(--warn); }
#toast { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--bg2); border: 1px solid var(--line2);
         border-radius: 8px; padding: 8px 14px; font-size: 12.5px; z-index: 20; max-width: calc(100% - 32px); }
#toast.err { border-color: #7f1d1d; color: #fecaca; }

#right { background: var(--bg1); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--tx3); padding: 10px 4px; font-size: 12px;
               font-weight: 600; cursor: pointer; }
.tabs button.on { color: var(--tx); border-bottom-color: var(--ac); }
.tabs span { font-weight: 400; color: var(--tx3); }
.rpane { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.fld { display: flex; flex-direction: column; gap: 3px; }
.fld > span { font-size: 11px; color: var(--tx3); }
.fld input, .fld select, .fld textarea { background: var(--bg2); border: 1px solid var(--line2); color: var(--tx); border-radius: 5px; padding: 5px 7px;
                                          font-size: 12.5px; width: 100%; }
.fld textarea { min-height: 60px; resize: vertical; }
.fld input[type=checkbox] { width: auto; }
.fld input[type=range] { padding: 0; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.f3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.chk { display: flex; gap: 7px; align-items: center; font-size: 12.5px; color: var(--tx2); cursor: pointer; }
.chk input { accent-color: var(--ac2); }
.sec { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.sec h4 { margin: 0; font-size: 11px; letter-spacing: 2px; color: var(--tx2); text-transform: uppercase; font-weight: 600; display: flex; gap: 8px;
          align-items: center; }
.sec h4 .grow { flex: 1; }
.wp { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--bg2); display: flex; flex-direction: column; gap: 5px; }
.wp.sel { border-color: var(--ac2); }
.wp-h { display: flex; gap: 6px; align-items: center; font-size: 12px; cursor: pointer; }
.wp-h b { font-family: var(--mono); font-size: 11.5px; }
.kchip { font: 10px var(--mono); padding: 1px 5px; border-radius: 4px; background: var(--bg3); color: var(--ac); }
.kchip.fox { color: #fca5a5; } .kchip.msg { color: #fde68a; } .kchip.pause { color: #c4b5fd; }
.act { display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--tx2); }
.act .x { margin-left: auto; cursor: pointer; color: var(--tx3); }
.act .x:hover { color: var(--err); }
.mini { background: none; border: 1px solid var(--line2); color: var(--tx2); border-radius: 4px; font-size: 11px; padding: 2px 7px; cursor: pointer; }
.mini:hover { color: #fff; border-color: #475569; }
.objrow { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 5px; cursor: pointer; font-size: 12.5px; }
.objrow:hover { background: var(--bg2); }
.objrow.sel { background: #0c2233; }
.objrow .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.objrow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.objrow .ic { color: var(--tx3); cursor: pointer; font-size: 12px; width: 16px; text-align: center; }
.objrow .ic:hover { color: #fff; }
.objrow .ty { color: var(--tx3); font-size: 11px; }

#timeline { display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--bg1); border-top: 1px solid var(--line); }
.tbtn { width: 32px; height: 30px; border-radius: 6px; border: 1px solid var(--line2); background: var(--bg2); color: var(--tx); cursor: pointer; font-size: 13px; }
.tbtn.play { width: 44px; background: var(--ac2); border-color: var(--ac2); color: #fff; }
.tl-sp, .tl-chk { font-size: 12px; color: var(--tx2); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.tl-sp select { background: var(--bg2); border: 1px solid var(--line2); color: var(--tx); border-radius: 4px; font-size: 12px; }
#tScrub { flex: 1; accent-color: var(--ac2); min-width: 80px; }
.tl-time { font: 12px var(--mono); color: var(--tx2); white-space: nowrap; }

#modal { position: fixed; inset: 0; z-index: 100; background: rgba(2, 6, 23, .7); display: flex; align-items: flex-start; justify-content: center;
         padding: 60px 16px; overflow-y: auto; }
.mbox { width: 560px; max-width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 12px; padding: 18px; }
.mbox h3 { margin: 0 0 12px; font-size: 16px; }
.mbox table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mbox td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mbox td:first-child { font-family: var(--mono); color: var(--ac); white-space: nowrap; padding-right: 14px; }
.mbox .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

@media (max-width: 1100px) {
  #main { grid-template-columns: 44px 170px 1fr 260px; }
  .track select { max-width: 90px; }
  .title-in { width: 140px; }
}
@media (max-width: 820px) {
  #editor { grid-template-rows: auto 1fr auto; }
  #top { flex-wrap: wrap; padding: 6px 8px; height: auto; }
  .track { order: 9; width: 100%; }
  #main { grid-template-columns: 40px 1fr; grid-template-rows: 1fr 220px; }
  #left { display: none; }
  #right { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  #timeline { flex-wrap: wrap; padding: 6px 8px; }
  #routeSeg { display: none; }
}

/* the shared LOGIN button (gvaw-auth.js) sits above the timeline, over the palette */
body.tb-editor #gvawAuthBtn { left: 52px; bottom: 54px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.tb-editor #left { padding-bottom: 44px; }
