/* Simulcast Studio — shared design system */
:root {
  --bg: #0a0c11;
  --bg-2: #0f1218;
  --bg-3: #151922;
  --bg-4: #1c212d;
  --bg-5: #252b3a;
  --border: #232937;
  --border-2: #2f3647;
  --text: #e9ecf3;
  --text-2: #a4acbf;
  --text-3: #6c7590;
  --accent: #7c5cff;
  --accent-2: #9a84ff;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --live: #ff3b55;
  --live-soft: rgba(255, 59, 85, 0.14);
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.14);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, 0.14);
  --err: #f04452;
  --err-soft: rgba(240, 68, 82, 0.14);
  --info: #38bdf8;
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-5); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 600; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- icons */
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 15px; height: 15px; }
.ico.lg { width: 22px; height: 22px; }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--bg-4); color: var(--text);
  font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap; user-select: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, opacity 0.15s;
}
.btn:hover { background: var(--bg-5); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible, .input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-primary:hover { background: #6d4cf5; }
.btn-live { background: var(--live); border-color: transparent; color: #fff; }
.btn-live:hover { background: #e92d46; }
.btn-danger { background: var(--err-soft); border-color: rgba(240, 68, 82, 0.35); color: #ff8a94; }
.btn-danger:hover { background: rgba(240, 68, 82, 0.24); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-4); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14.5px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-icon.btn-xs { width: 26px; }
.btn-block { width: 100%; }

/* --------------------------------------------------------------- inputs */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input {
  width: 100%; height: 36px; padding: 0 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text);
  font: 13.5px var(--font); transition: border-color 0.15s;
}
textarea.input { height: auto; min-height: 70px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--accent); outline: none; }
.input::placeholder { color: var(--text-3); }
select.input { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.input-group { display: flex; gap: 6px; }
.input-group .input { flex: 1; min-width: 0; }
input[type='color'].input { padding: 3px; width: 44px; cursor: pointer; }
input[type='range'] { accent-color: var(--accent); width: 100%; }
input[type='checkbox'], input[type='radio'] { accent-color: var(--accent); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 36px; height: 20px; border-radius: 20px; background: var(--bg-5); position: relative; transition: background 0.18s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.18s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:disabled + .track { opacity: 0.5; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; min-width: 0; }
.card.flat { background: var(--bg-2); }
.card.tight { padding: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 650; margin: 0 0 10px; }

/* --------------------------------------------------------------- pills */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 30px; font-size: 12px; font-weight: 650; background: var(--bg-5); color: var(--text-2); white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-live { background: var(--live-soft); color: #ff6b80; }
.pill-live .dot { animation: pulse 1.4s ease-in-out infinite; }
.pill-ok { background: var(--ok-soft); color: #4ade80; }
.pill-warn { background: var(--warn-soft); color: #fbbf24; }
.pill-err { background: var(--err-soft); color: #ff7a85; }
.pill-accent { background: var(--accent-soft); color: var(--accent-2); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 16px; height: 16px; border: 2px solid var(--bg-5); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }

/* platform badge */
.pbadge { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; font: 800 10.5px var(--font); letter-spacing: -0.02em; color: #fff; flex: none; text-transform: none; }
.pbadge.sm { width: 20px; height: 20px; border-radius: 6px; font-size: 8.5px; }
.pbadge.lg { width: 40px; height: 40px; border-radius: 11px; font-size: 13px; }

/* ----------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 14px; color: var(--text-2); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; font-family: var(--font); font-size: 13.5px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- table */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--bg-4); }
.table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------------- modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(4, 6, 10, 0.7); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 1000; overflow-y: auto; animation: fadein 0.15s; }
.modal { background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--radius-lg); width: 100%; max-width: 520px; box-shadow: var(--shadow); animation: pop 0.18s ease-out; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; gap: 12px; }
.modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 16px; }
@keyframes fadein { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* --------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 2000; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--bg-4); border: 1px solid var(--border-2); border-left: 3px solid var(--info); border-radius: var(--radius); padding: 11px 13px; box-shadow: var(--shadow); font-size: 13px; animation: pop 0.2s ease-out; }
.toast.success { border-left-color: var(--ok); }
.toast.warning { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--err); }
.toast .x { margin-left: auto; cursor: pointer; color: var(--text-3); }

/* ----------------------------------------------------------------- menu */
.menu { position: fixed; z-index: 1500; background: var(--bg-4); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 5px; min-width: 190px; animation: pop 0.12s ease-out; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 6px; background: none; border: 0; color: var(--text); font: 13px var(--font); cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--bg-5); }
.menu-item.danger { color: #ff8a94; }
.menu-sep { height: 1px; background: var(--border-2); margin: 4px 2px; }

/* --------------------------------------------------------------- misc */
.empty { text-align: center; padding: 36px 16px; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ico { width: 34px; height: 34px; color: var(--text-3); }
.callout { display: flex; gap: 10px; padding: 11px 13px; border-radius: var(--radius); background: var(--bg-4); border: 1px solid var(--border-2); font-size: 13px; color: var(--text-2); }
.callout.warn { background: var(--warn-soft); border-color: rgba(245, 165, 36, 0.3); color: #fcd27b; }
.callout.err { background: var(--err-soft); border-color: rgba(240, 68, 82, 0.3); color: #ffadb4; }
.callout.info { background: rgba(56, 189, 248, 0.08); border-color: rgba(56, 189, 248, 0.25); color: #a5dcf7; }
.callout .ico { margin-top: 1px; }
.progress { height: 6px; border-radius: 6px; background: var(--bg-5); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width 0.2s; }
.kbd { font: 11px var(--mono); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border-2); background: var(--bg-4); color: var(--text-2); }
.copy-field { display: flex; gap: 6px; }
.copy-field .input { font-family: var(--mono); font-size: 12.5px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: #fff; flex: none; }
.dot-status { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--text-3); }
.dot-status.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot-status.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot-status.err { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.dot-status.live { background: var(--live); box-shadow: 0 0 0 3px var(--live-soft); animation: pulse 1.4s infinite; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px 4px 5px; border-radius: 30px; background: var(--bg-4); border: 1px solid var(--border-2); font-size: 12.5px; }

/* chat feed (dashboard + studio) */
.chat-feed { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; padding: 4px; }
.chat-msg { display: flex; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: 13px; line-height: 1.4; align-items: flex-start; }
.chat-msg:hover { background: var(--bg-4); }
.chat-msg .pbadge { margin-top: 1px; }
.chat-msg .author { font-weight: 650; margin-right: 4px; }
.chat-msg .txt { word-break: break-word; }
.chat-msg .when { font-size: 11px; color: var(--text-3); margin-left: auto; padding-left: 6px; flex: none; }
.chat-msg.superchat { background: rgba(245, 165, 36, 0.12); }
.chat-msg .btn { flex: none; }
