/* Shared design system for every Aiqutell console — lifted from the original
   Claude Design canvases (Main.dc.html) so the standalone apps look identical.
   Extended with a scrollable/paginated table pattern for large live datasets. */

:root {
  --navy: #14205C;
  --blue: #2451D6;
  --blue-light: #4F8FF0;
  --sky: #EAF2FE;
  --rust: #8B4A2B;
  --bg: #F3F5FA;
  --surface: #FFFFFF;
  --surface-alt: #F8F9FC;
  --ink: #14205C;
  --ink-muted: #5B6785;
  --rule: #E2E6F0;
  --success: #1F8A5F;
  --success-bg: #E7F5EE;
  --warning: #B8791E;
  --warning-bg: #FBF1E1;
  --danger: #C13B3B;
  --danger-bg: #FBEAEA;
  --neutral-bg: #EEF0F5;
  --violet: #6A46C4;
  --violet-bg: #EFE9FB;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Public Sans", -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
a:hover { color: var(--navy); }
button { font: inherit; }
h3 { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 18px; letter-spacing: -0.005em; margin: 0 0 14px; color: var(--ink); }

.app-shell { display: flex; flex-direction: column; min-height: 100vh; width: 100%; }

.header { display: grid; grid-template-columns: 0.6fr auto 1.4fr; align-items: center; height: 92px; flex-shrink: 0; background: var(--surface); border-bottom: 1px solid var(--rule); padding: 0 28px; position: sticky; top: 0; z-index: 20; }
.header-left { display: flex; align-items: center; gap: 16px; justify-self: start; }
.banner-img { display: block; height: 76px; width: auto; }
.header-center { display: flex; align-items: center; justify-content: center; justify-self: center; }
.header-center img { display: block; height: 44px; width: auto; }
.header-right { display: flex; align-items: center; gap: 14px; justify-self: end; }
.header-customer-name { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 24px; letter-spacing: 0.005em; color: var(--rust); white-space: nowrap; padding-left: 18px; border-left: 2px solid var(--rule); }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--rule); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: 12px; flex-shrink: 0; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-weight: 800; font-size: 17px; color: var(--ink); }
.user-role { font-size: 14px; font-weight: 700; color: var(--ink-muted); }

.body-row { display: flex; flex: 1; min-height: 0; }

.sidebar { width: 250px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--rule); padding: 18px 12px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.sidebar-group-label { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-muted); padding: 16px 12px 6px; }
.sidebar-group-label.first { padding-top: 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 13.6px; font-family: "Public Sans", sans-serif; border: none; text-align: left; width: 100%; background: none; color: var(--ink-muted); }
.nav-item svg { flex-shrink: 0; }
.nav-item.active { background: var(--sky); color: var(--blue); font-weight: 600; }
.nav-badge { margin-left: auto; font-family: "IBM Plex Mono", monospace; font-size: 10.5px; font-weight: 600; background: var(--danger-bg); color: var(--danger); padding: 1px 7px; border-radius: 999px; }

.content { flex: 1; overflow-y: auto; padding: 30px 34px 56px; }
.screen-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.screen-title { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 23px; color: var(--ink); margin: 0; letter-spacing: -0.01em; }
.screen-sub { color: var(--ink-muted); font-size: 13.5px; margin: 5px 0 0; max-width: 62ch; }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 8px; font-family: "Public Sans", sans-serif; font-weight: 600; font-size: 13px; cursor: pointer; border: 1px solid transparent; white-space: nowrap; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 1px 2px rgba(20,32,92,0.05); }
.card-pad { padding: 20px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 28px; }
.kpi-card { padding: 18px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; border: 1px solid var(--rule); }
.kpi-card:hover { border-color: var(--blue); }
.kpi-label { font-family: "IBM Plex Mono", monospace; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); }
.kpi-value { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 27px; color: var(--ink); }

.two-col { display: grid; grid-template-columns: minmax(0,1fr) minmax(320px,380px); gap: 20px; align-items: start; }
.two-col-list { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(300px,1fr); gap: 20px; align-items: start; }

.section-card-title { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 18px; letter-spacing: -0.005em; margin: 0 0 14px; }

.table-wrap { overflow-x: auto; }
table.dt { width: 100%; border-collapse: collapse; }
.dt th { text-align: left; font-family: "IBM Plex Mono", monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); padding: 10px 14px; border-bottom: 1px solid var(--rule); background: var(--surface-alt); white-space: nowrap; }
.dt td { padding: 12px 14px; border-bottom: 1px solid var(--rule); font-size: 13px; color: var(--ink); vertical-align: middle; }
.dt tbody tr:last-child td { border-bottom: none; }
.row-clickable { cursor: pointer; }
.row-clickable:hover { background: var(--surface-alt); }
.row-selected { background: var(--sky) !important; }
.row-zero-given td { color: #8B0000; }
.cell-muted { color: var(--ink-muted); font-size: 12.5px; }
.cell-mono { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--ink-muted); }

.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.input, select.input, textarea { font-family: "Public Sans", sans-serif; font-size: 13px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); width: 100%; }
textarea { resize: vertical; min-height: 88px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--rule); font-size: 12.6px; font-weight: 600; cursor: pointer; background: var(--surface); color: var(--ink-muted); }
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.ghost.active { background: var(--sky); border-color: var(--blue); color: var(--blue); }

.toggle-track { position: relative; width: 40px; height: 22px; border-radius: 999px; cursor: pointer; flex-shrink: 0; }
.toggle-knob { position: absolute; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: left 0.15s ease; }

.detail-panel { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.detail-title { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 17px; margin: 0; }
.detail-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--rule); }
.detail-row:last-child { border-bottom: none; }
.detail-row-label { color: var(--ink-muted); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.detail-empty { color: var(--ink-muted); font-size: 13px; padding: 8px 0; }

.subtabs { display: flex; gap: 8px; margin-bottom: 20px; }

.domain-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.domain-head { display: flex; align-items: center; justify-content: space-between; }
.domain-name { font-family: "Archivo", sans-serif; font-weight: 700; font-size: 14.5px; }
.agent-list { font-size: 12px; color: var(--ink-muted); line-height: 1.6; }

.stack-gap { display: flex; flex-direction: column; gap: 16px; }
.row-gap { display: flex; align-items: center; gap: 10px; }

/* ---- Scrollable / searchable data table (for large live datasets) ---- */
.scroll-table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.scroll-table-search { max-width: 280px; }
.scroll-table-count { font-size: 12px; color: var(--ink-muted); font-family: "IBM Plex Mono", monospace; white-space: nowrap; }
.scroll-table-body { max-height: 480px; overflow-y: auto; position: relative; }
.scroll-table-body table.dt { border-collapse: separate; border-spacing: 0; }
.scroll-table-body .dt th { position: sticky; top: 0; z-index: 1; box-shadow: 0 1px 0 var(--rule); }
.scroll-table-empty { padding: 24px 14px; color: var(--ink-muted); font-size: 13px; text-align: center; }

/* ---- Save/error toast ---- */
.toast { position: fixed; bottom: 22px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast-item { font-family: "Public Sans", sans-serif; font-size: 13px; font-weight: 600; padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 18px rgba(20,32,92,0.18); color: #fff; background: var(--ink); animation: toast-in 0.15s ease; }
.toast-item.ok { background: var(--success); }
.toast-item.err { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.loading-note { color: var(--ink-muted); font-size: 13px; padding: 20px 0; }
