/* ============================================================
   TV Designer — base UI (editor chrome)
   ============================================================ */
:root {
  --bg-0: #0d0f14;
  --bg-1: #12151c;
  --bg-2: #181c25;
  --bg-3: #20252f;
  --line: #2a3140;
  --line-soft: #232a36;
  --txt-0: #eef1f6;
  --txt-1: #aeb6c5;
  --txt-2: #6c7689;
  --accent: #5b8cff;
  --accent-2: #36e0c0;
  --accent-warn: #ffb02e;
  --accent-err: #ff5d6c;
  --focus: #ff3d71;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-1: 0 2px 8px rgba(0,0,0,.4);
  --shadow-2: 0 8px 28px rgba(0,0,0,.55);
  --tb-h: 52px;
  --bottom-h: 230px;
  --side-w: 286px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-0);
  color: var(--txt-0);
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 13px;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c3340; border-radius: 6px; border: 2px solid var(--bg-1); }
::-webkit-scrollbar-thumb:hover { background: #3a4354; }
::-webkit-scrollbar-track { background: transparent; }

.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
}

#app {
  display: grid;
  grid-template-rows: var(--tb-h) 1fr var(--bottom-h);
  height: 100vh;
}

/* ---------------- Toolbar ---------------- */
#toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.tb-group { display: flex; align-items: center; gap: 4px; }
.tb-spacer { flex: 0 0 1px; height: 26px; background: var(--line); margin: 0 6px; }
#toolbar > .tb-spacer:nth-of-type(1) { flex: 1; background: transparent; }
.tb-brand { gap: 8px; padding-right: 10px; }
.brand-icon { color: var(--accent); font-size: 26px; }
.brand-name { font-weight: 900; letter-spacing: .3px; }
.brand-sub {
  font-size: 10px; color: var(--accent-2); background: rgba(54,224,192,.12);
  padding: 2px 7px; border-radius: 20px; font-weight: 700; text-transform: uppercase;
}
.tb-label { font-size: 11px; color: var(--txt-2); text-transform: uppercase; letter-spacing: .5px; }
.tb-zoom { font-size: 12px; color: var(--txt-1); min-width: 42px; text-align: center; }

.tb-select {
  background: var(--bg-3); color: var(--txt-0); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 5px 8px; font-size: 12px; outline: none;
  max-width: 170px;
}
.tb-select:focus { border-color: var(--accent); }

.tb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  background: var(--bg-3); color: var(--txt-1); border: 1px solid var(--line);
  border-radius: var(--radius-sm); height: 32px; min-width: 32px; padding: 0 8px;
  cursor: pointer; transition: .12s; font-size: 12px; font-weight: 600;
}
.tb-btn:hover { background: #283040; color: var(--txt-0); border-color: #38425a; }
.tb-btn:active { transform: translateY(1px); }
.tb-btn.tb-text { padding: 0 11px; }
.tb-toggle.is-on { background: rgba(91,140,255,.16); color: var(--accent); border-color: rgba(91,140,255,.5); }
.tb-play { background: linear-gradient(180deg,#2ecc71,#1f9d57); color: #fff; border-color: #1f9d57; padding: 0 14px; }
.tb-play:hover { background: linear-gradient(180deg,#36d97c,#23ab60); color:#fff; }

/* ---------------- Main grid ---------------- */
#main { display: grid; grid-template-columns: var(--side-w) 1fr var(--side-w); min-height: 0; }
#left, #right { background: var(--bg-1); display: flex; flex-direction: column; min-height: 0; }
#left { border-right: 1px solid var(--line); }
#right { border-left: 1px solid var(--line); }

/* ---------------- Panels / tabs ---------------- */
.panel-tabs { display: flex; gap: 2px; padding: 6px 8px 0; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.ptab {
  background: transparent; border: none; color: var(--txt-2); padding: 8px 12px;
  cursor: pointer; font-size: 12px; font-weight: 700; border-radius: 8px 8px 0 0; position: relative;
}
.ptab:hover { color: var(--txt-1); }
.ptab.is-active { color: var(--txt-0); background: var(--bg-1); }
.ptab.is-active::after { content:""; position:absolute; left:0; right:0; bottom:-1px; height:2px; background: var(--accent); }
.panel-body { flex: 1; min-height: 0; overflow: auto; }
.tab-pane { display: none; }
.tab-pane.is-active { display: block; }
.badge {
  display: inline-block; min-width: 16px; padding: 0 5px; border-radius: 10px;
  background: var(--accent-err); color: #fff; font-size: 10px; line-height: 16px; text-align: center; margin-left: 4px;
}
.badge.zero { background: #2a3140; color: var(--txt-2); }

#bottom { background: var(--bg-1); border-top: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }

/* ---------------- Toast ---------------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-3); border: 1px solid var(--line); color: var(--txt-0);
  padding: 10px 18px; border-radius: 24px; box-shadow: var(--shadow-2); z-index: 200;
  font-size: 13px; opacity: 0; transition: .25s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { border-color: var(--accent-2); }
#toast.err { border-color: var(--accent-err); }
