:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --sidebar: #101318;
  --surface: #14181e;
  --surface-2: #191e25;
  --line: #262d36;
  --muted: #8f9aa8;
  --text: #f3f6f8;
  --accent: #39d98a;
  --accent-dark: #102b20;
  --danger: #ff6b70;
  --warning: #f6c75b;
  --radius: 7px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-width: 320px; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px 14px 14px; background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand-lockup { min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 0 8px; font-weight: 750; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; color: #06150e; background: var(--accent); font-weight: 900; }
nav { display: grid; gap: 5px; margin-top: 28px; }
nav button { width: 100%; height: 42px; border: 0; border-radius: 6px; background: transparent; color: #aab3bf; display: flex; align-items: center; gap: 12px; padding: 0 11px; text-align: left; }
nav button:hover, nav button.active { color: var(--text); background: var(--surface-2); }
.nav-icon { width: 23px; color: #66717f; font-size: 10px; font-weight: 800; }
nav button.active .nav-icon { color: var(--accent); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 4px 0; display: grid; grid-template-columns: 34px 1fr 30px; align-items: center; gap: 9px; min-width: 0; }
.workspace-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #29313b; font-weight: 750; }
.sidebar-foot div:nth-child(2) { min-width: 0; }
.sidebar-foot strong, .sidebar-foot span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot strong { font-size: 13px; }
.sidebar-foot span { margin-top: 2px; color: var(--muted); font-size: 11px; }
main { min-width: 0; }
.topbar { min-height: 78px; padding: 15px clamp(18px, 3vw, 38px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; background: rgba(11, 13, 16, .96); position: sticky; top: 0; z-index: 5; }
.topbar h2 { margin: 0; font-size: 18px; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.button { min-height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 0 13px; color: var(--text); background: var(--surface-2); font-weight: 650; font-size: 12px; }
.button:hover { border-color: #3a4654; }
.button.primary { color: #06150e; border-color: var(--accent); background: var(--accent); }
.button.secondary { background: transparent; }
.button.danger { color: #ffd9da; border-color: #6f3337; background: #32181b; }
.button.danger:hover { border-color: var(--danger); }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button.full { width: 100%; min-height: 42px; }
.icon-button { width: 32px; height: 32px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; display: grid; place-items: center; }
.icon-button:hover { color: var(--text); background: var(--surface-2); }
.text-button { border: 0; color: var(--accent); background: transparent; padding: 5px; font-weight: 700; font-size: 12px; }
.status-pill { min-height: 25px; display: inline-flex; align-items: center; border-radius: 999px; padding: 0 9px; font-size: 10px; font-weight: 750; }
.status-pill.neutral { background: #252b33; color: #aab3bf; }
.status-pill.good { background: var(--accent-dark); color: var(--accent); }
.status-pill.warn { background: #332b17; color: var(--warning); }
.view { display: none; padding: 26px clamp(18px, 3vw, 38px) 44px; }
.view.active { display: block; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { min-height: 112px; border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; background: var(--surface); }
.metric span { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 750; }
.metric strong { display: block; margin-top: 15px; font-size: 29px; font-weight: 750; }
.metric small { display: block; margin-top: 4px; color: #6f7b88; font-size: 11px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, .8fr); gap: 14px; align-items: start; }
.connection-strip { margin-bottom: 14px; min-height: 94px; padding: 17px 18px; border: 1px solid #28513f; border-radius: var(--radius); background: #101b16; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.connection-strip .eyebrow { display: block; color: var(--accent); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.connection-strip strong { display: block; margin-top: 6px; font-size: 18px; }
.connection-strip p { margin: 6px 0 0; color: #96a79d; font-size: 11px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; overflow: hidden; }
.panel.compact { max-width: 720px; }
.panel-head { min-height: 68px; padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h3 { margin: 0; font-size: 14px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 650px; border-collapse: collapse; table-layout: auto; }
th, td { padding: 12px 16px; border-bottom: 1px solid #20262e; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
th { color: #7f8a98; font-size: 10px; text-transform: uppercase; font-weight: 750; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #171c22; }
.primary-cell { font-weight: 700; }
.secondary-line { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.healthy { color: var(--accent); }
.system-list { padding: 7px 16px 14px; }
.system-list div { min-height: 46px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #20262e; font-size: 12px; }
.system-list div:last-child { border: 0; }
.system-list span { color: var(--muted); }
.stack-list { padding: 8px; display: grid; gap: 6px; }
.stack-item { padding: 12px; border-radius: 6px; background: var(--surface-2); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack-item strong { display: block; font-size: 12px; }
.stack-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.provider-copy { min-width: 0; }
.provider-copy > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.provider-health { flex: 0 0 auto; text-align: right; }
.provider-health small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.provider-edit { display: block; margin: 5px 0 0 auto; padding: 2px; }
.row-action { min-height: 30px; padding: 0 10px; }
.empty-state { min-height: 250px; display: grid; place-content: center; text-align: center; gap: 7px; color: var(--muted); }
.empty-state strong { color: var(--text); font-size: 14px; }
.empty-state span { max-width: 330px; font-size: 12px; }
.details { margin: 0; padding: 12px 16px 20px; }
.details div { min-height: 48px; display: grid; grid-template-columns: 150px 1fr; align-items: center; border-bottom: 1px solid var(--line); }
.details dt { color: var(--muted); font-size: 12px; }
.details dd { margin: 0; font-size: 12px; font-weight: 650; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #0b0d10; }
.login-panel { width: min(100%, 390px); padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.login-panel .brand-lockup { padding: 0; }
.login-panel h1 { margin: 30px 0 7px; font-size: 24px; }
.login-panel > p { color: var(--muted); font-size: 12px; margin: 0 0 22px; }
label { display: grid; gap: 7px; color: #b4bdc8; font-size: 11px; font-weight: 700; }
.login-panel label { margin-bottom: 13px; }
input, select { width: 100%; height: 40px; border: 1px solid #303842; border-radius: 5px; padding: 0 11px; color: var(--text); background: #0f1318; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(57,217,138,.12); }
.form-error { min-height: 16px; color: var(--danger) !important; font-size: 11px !important; margin: 10px 0 0 !important; }
dialog { width: min(92vw, 620px); max-height: 86vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 0; color: var(--text); background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,.55); }
dialog::backdrop { background: rgba(2,4,7,.72); }
dialog form { padding: 0; }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.form-grid { padding: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid fieldset { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 6px; padding: 13px; }
.form-note { grid-column: 1 / -1; min-height: 62px; padding: 12px 14px; border: 1px solid #28513f; border-radius: 6px; background: #101b16; }
.form-note strong, .form-note span { display: block; }
.form-note strong { color: #9eaaaf; font-size: 10px; text-transform: uppercase; }
.form-note span { margin-top: 7px; color: var(--accent); font-size: 16px; font-weight: 750; }
label small { color: var(--muted); font-size: 10px; font-weight: 500; }
.form-grid legend { color: var(--muted); font-size: 11px; padding: 0 5px; }
.check-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check-list label { display: flex; align-items: center; gap: 8px; padding: 9px; border-radius: 5px; background: var(--surface-2); }
.check-list input { width: 15px; height: 15px; }
dialog .form-error { margin: 0 20px !important; }
.modal-actions { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions.split-actions { justify-content: space-between; }
.modal-actions.split-actions > div { display: flex; gap: 8px; }
.neutral-note { border-color: var(--line); background: var(--surface-2); }
.neutral-note span { color: var(--text); font-size: 12px; overflow-wrap: anywhere; }
.confirm-body { padding: 22px 20px; }
.confirm-body strong { display: block; font-size: 15px; }
.confirm-body p { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.audio-settings { padding: 20px; display: grid; gap: 16px; }
.audio-choice { padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #101419; display: grid; gap: 11px; }
.audio-choice audio { display: block; width: 100%; height: 36px; }
.audio-choice > small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.audio-choice input[type="file"] { height: auto; min-height: 42px; padding: 8px; }
.audio-note { min-height: 74px; padding: 15px; border: 1px solid #3a4654; border-radius: 6px; background: var(--surface-2); display: grid; align-content: center; gap: 5px; }
.audio-note strong { font-size: 12px; }
.audio-note span { color: var(--muted); font-size: 10px; }
.test-call-body { padding: 24px 20px; }
.test-call-body > .eyebrow { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.test-call-body > strong { display: block; margin-top: 7px; font-size: 24px; }
.test-call-body > p { margin: 6px 0 22px; color: var(--muted); font-size: 12px; }
.test-call-state { min-height: 76px; padding: 15px; border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: center; gap: 13px; background: var(--surface-2); }
.test-call-state strong, .test-call-state small { display: block; }
.test-call-state strong { font-size: 12px; }
.test-call-state small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.test-pulse { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 0 rgba(246,199,91,.35); animation: test-pulse 1.6s infinite; }
.test-call-state.success { border-color: #28513f; background: #101b16; }
.test-call-state.success .test-pulse { background: var(--accent); animation: none; }
@keyframes test-pulse { 70% { box-shadow: 0 0 0 9px rgba(246,199,91,0); } 100% { box-shadow: 0 0 0 0 rgba(246,199,91,0); } }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 20; min-width: 240px; max-width: min(420px, calc(100vw - 40px)); padding: 12px 14px; border: 1px solid #385145; border-radius: 6px; color: var(--text); background: #14251d; transform: translateY(90px); opacity: 0; transition: .2s ease; font-size: 12px; }
.toast.show { transform: translateY(0); opacity: 1; }
.mobile-only { display: none; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -250px; z-index: 20; width: 238px; transition: left .2s ease; box-shadow: 20px 0 60px rgba(0,0,0,.4); }
  .sidebar.open { left: 0; }
  .mobile-only { display: grid; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-grid { grid-template-columns: 1fr; }
  .top-actions .status-pill { display: none; }
}
@media (max-width: 600px) {
  .topbar { min-height: 68px; padding: 11px 14px; }
  .topbar p { display: none; }
  #quickAddButton { display: none; }
  #applyButton { min-height: 34px; padding: 0 10px; }
  .view { padding: 15px 12px 30px; }
  .metrics { gap: 8px; }
  .metric { min-height: 90px; padding: 13px; }
  .metric strong { margin-top: 10px; font-size: 24px; }
  .panel-head { padding: 12px; }
  .table-wrap { overscroll-behavior-inline: contain; scrollbar-width: thin; }
  th, td { padding: 11px 12px; }
  .form-grid { grid-template-columns: 1fr; padding: 16px; }
  .modal-actions.split-actions { align-items: stretch; flex-direction: column-reverse; }
  .modal-actions.split-actions > div { justify-content: flex-end; }
  .connection-strip { align-items: flex-start; }
  .check-list { grid-template-columns: 1fr; }
  .login-panel { padding: 22px; }
}
