/* UCC Manager, styled with the Momentum Design System (Cisco / Webex).
   Values come from momentum-design/momentum-design packages/assets/tokens:
   core/value.json (colour primitives), core/dimension.json (radius, sizes),
   theme/stable/dark.json and light.json (semantic colours). Token names are in the comments.
   The theme follows the system unless the user picks one (html[data-theme], set by theme.ts). */

:root {
  /* typography: --mds-font-family-primary. The Momentum face is Cisco's own; Inter or Arial stand in. */
  --font: Momentum, Inter, Arial, "Helvetica Neue", Helvetica, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* dimension: radius/sm 8, radius/md 12, radius/full; size/32 default control, size/28 compact */
  --r-sm: 8px;
  --r-md: 12px;
  --r-full: 9999px;
  --h-ctl: 32px;
  --h-ctl-sm: 28px;
  /* elevation 2 and 3 */
  --elev-2: 0 4px 16px rgba(0, 0, 0, 0.2);
  --elev-3: 0 6px 24px rgba(0, 0, 0, 0.25);
  /* theme-independent: button.accent = blue.60, button.cancel = red.60, indicator.* (dark values) */
  --accent: #1170cf;
  --accent-h: #0353a8;
  --cancel: #db1f2e;
  --cancel-h: #ab0a15;
  --ind-stable: #27a17a;      /* green.50 */
  --ind-attention: #f55868;   /* red.50 */
  --ind-caution: #cf7900;     /* yellow.50 */
  --ind-locked: #8f8f8f;      /* gray.50 */
  --sidenav-w: 232px;
}

/* Light theme (theme/stable/light.json) */
:root, html[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f7;              /* gray.5 */
  --surface: #ffffff;         /* background.solid.primary = white-alpha.100 */
  --surface-2: #ededed;       /* background.solid.tertiary = gray.10 */
  --surface-3: #dedede;       /* gray.20 */
  --hover: #00000012;         /* background.primary.hover = black-alpha.7 */
  --active: #0000001c;        /* black-alpha.11 */
  --text: #000000f2;          /* text.primary = black-alpha.95 */
  --text-2: #000000b3;        /* text.secondary = black-alpha.70 */
  --text-3: #00000066;        /* text.primary.disabled = black-alpha.40 */
  --outline: #00000075;       /* outline.primary = black-alpha.46 */
  --outline-2: #00000033;     /* outline.secondary = black-alpha.20 */
  --outline-btn: #00000080;   /* outline.button / outline.input = black-alpha.50 */
  --accent-text: #0353a8;     /* text.accent = blue.70 */
  --success-text: #185e46;    /* text.success = green.70 */
  --warning-text: #7d4705;    /* text.warning = yellow.70 */
  --error-text: #ab0a15;      /* text.error = red.70 */
  --btn-primary: #000000f2;   /* button.primary = black-alpha.95 */
  --btn-primary-h: #000000cc; /* black-alpha.80 */
  --btn-primary-ink: #fffffff2;
  --alert-success: #cef5eb;   /* background.alert.success = green.10 */
  --alert-warning: #ffebc2;   /* yellow.10 */
  --alert-error: #ffe8ea;     /* red.10 */
  --alert-theme: #dbf0ff;     /* blue.10 */
  --alert-default: #dedede;   /* gray.20 */
  --control-active: #1170cf;  /* control.active = blue.60 */
  --backdrop: rgba(0, 0, 0, 0.4);
}

/* Dark theme (theme/stable/dark.json) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;            /* background.solid.primary = black-alpha.100 */
    --surface: #1a1a1a;       /* background.solid.secondary = gray.95 */
    --surface-2: #262626;     /* background.solid.tertiary = gray.90 */
    --surface-3: #3b3b3b;     /* background.solid.quaternary = gray.80 */
    --hover: #ffffff12;       /* white-alpha.7 */
    --active: #ffffff1c;      /* white-alpha.11 */
    --text: #fffffff2;        /* white-alpha.95 */
    --text-2: #ffffffb3;      /* white-alpha.70 */
    --text-3: #ffffff66;      /* white-alpha.40 */
    --outline: #ffffff66;     /* outline.primary = white-alpha.40 */
    --outline-2: #ffffff33;   /* outline.secondary = white-alpha.20 */
    --outline-btn: #ffffff80; /* white-alpha.50 */
    --accent-text: #64b4fa;   /* blue.40 */
    --success-text: #3cc29a;  /* green.40 */
    --warning-text: #f2990a;  /* yellow.40 */
    --error-text: #fc8b98;    /* red.40 */
    --btn-primary: #fffffff2; /* button.primary = white-alpha.95 */
    --btn-primary-h: #ffffffcc;
    --btn-primary-ink: #000000f2;
    --alert-success: #0e2b20; /* green.90 */
    --alert-warning: #36220c; /* yellow.90 */
    --alert-error: #4f0e10;   /* red.90 */
    --alert-theme: #0a274a;   /* blue.90 */
    --alert-default: #3b3b3b; /* gray.80 */
    --control-active: #64b4fa;/* blue.40 */
    --backdrop: rgba(0, 0, 0, 0.6);
  }
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000; --surface: #1a1a1a; --surface-2: #262626; --surface-3: #3b3b3b;
  --hover: #ffffff12; --active: #ffffff1c;
  --text: #fffffff2; --text-2: #ffffffb3; --text-3: #ffffff66;
  --outline: #ffffff66; --outline-2: #ffffff33; --outline-btn: #ffffff80;
  --accent-text: #64b4fa; --success-text: #3cc29a; --warning-text: #f2990a; --error-text: #fc8b98;
  --btn-primary: #fffffff2; --btn-primary-h: #ffffffcc; --btn-primary-ink: #000000f2;
  --alert-success: #0e2b20; --alert-warning: #36220c; --alert-error: #4f0e10; --alert-theme: #0a274a; --alert-default: #3b3b3b;
  --control-active: #64b4fa; --backdrop: rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 400 14px/20px var(--font);   /* body-midsize-regular */
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-columns: var(--sidenav-w) minmax(0, 1fr);
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.mono { font-family: var(--mono); font-size: 12px; }
.spacer { flex: 1; }
.small-text { font-size: 12px; line-height: 16px; }
.warn-text { color: var(--warning-text); }
:focus-visible { outline: 2px solid var(--control-active); outline-offset: 2px; }   /* focus.default */

/* ---------- side navigation ---------- */
.sidenav {
  grid-column: 1; grid-row: 1 / span 3;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px; padding: 16px 12px;
  background: var(--surface); border-right: 1px solid var(--outline-2);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; font: 700 16px/24px var(--font); }
.brand-mark { width: 28px; height: 28px; border-radius: var(--r-full); background: conic-gradient(from 200deg, #3492eb, #3cc29a, #64b4fa, #3492eb); flex: none; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-section { font: 500 12px/16px var(--font); color: var(--text-2); padding: 4px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px;
  border-radius: var(--r-full); color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav-item svg { width: 20px; height: 20px; flex: none; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--text); }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full);
  background: var(--ind-attention); color: #fff; font: 500 12px/20px var(--font); text-align: center; font-variant-numeric: tabular-nums;
}
.sidenav-foot { margin-top: auto; display: grid; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--outline-2); color: var(--text-2); font-size: 12px; line-height: 16px; }
.live { display: inline-flex; align-items: center; gap: 8px; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ind-locked); }
.live[data-state="open"] .dot { background: var(--ind-stable); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ind-stable) 25%, transparent); }
.live[data-state="error"] .dot { background: var(--ind-attention); }
.theme-switch { display: inline-flex; padding: 2px; border-radius: var(--r-full); border: 1px solid var(--outline-2); justify-self: start; }
.theme-switch button { height: 24px; padding: 0 10px; border: 0; border-radius: var(--r-full); background: none; cursor: pointer; font: 500 12px/16px var(--font); color: var(--text-2); }
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--active); color: var(--text); }

/* ---------- page ---------- */
.page { grid-column: 2; padding: 24px 32px 48px; width: 100%; max-width: 1440px; }
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font: 700 24px/32px var(--font); }   /* heading-midsize-bold */
.page-head .sub { margin: 2px 0 0; color: var(--text-2); }

.summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px;
  background: var(--surface); border: 1px solid var(--outline-2); border-radius: var(--r-md); cursor: pointer; text-align: left;
}
.stat:hover { border-color: var(--outline); }
.stat.selected { border-color: var(--control-active); box-shadow: inset 0 0 0 1px var(--control-active); }
.stat-value { font: 700 32px/40px var(--font); font-variant-numeric: tabular-nums; }   /* heading-large */
.stat-label { color: var(--text-2); font-weight: 500; }
.stat.warn.has-items .stat-value { color: var(--error-text); }

/* ---------- inputs ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
input[type="search"], input[type="text"], input[type="password"], input[type="url"], select, #prompt-input, dialog input:not([type="checkbox"]) {
  height: var(--h-ctl); padding: 0 12px; border: 1px solid var(--outline-btn); border-radius: var(--r-sm); background: transparent; color: var(--text);
}
input::placeholder { color: var(--text-3); }
input[type="search"] {
  width: 320px; padding-left: 36px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23888' stroke-width='1.5'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='m10.5 10.5 3 3'/%3E%3C/svg%3E") no-repeat 12px center / 16px;
}
select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background: linear-gradient(45deg, transparent 50%, currentColor 50%) calc(100% - 16px) 50% / 5px 5px no-repeat,
              linear-gradient(135deg, currentColor 50%, transparent 50%) calc(100% - 11px) 50% / 5px 5px no-repeat;
}
select option { background: var(--surface); color: var(--text); }
input:hover, select:hover { border-color: var(--text-2); }

/* ---------- buttons: pill; primary, secondary (default), tertiary, accent, cancel ---------- */
.btn {
  height: var(--h-ctl); padding: 0 16px; border-radius: var(--r-full); border: 1px solid var(--outline-btn);
  background: transparent; cursor: pointer; white-space: nowrap; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { background: var(--hover); }
.btn:active { background: var(--active); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--btn-primary); border-color: transparent; color: var(--btn-primary-ink); }
.btn.primary:hover { background: var(--btn-primary-h); }
.btn.tertiary, .btn.danger { border-color: transparent; }
.btn.danger { color: var(--error-text); }
.btn.danger.solid { background: var(--cancel); color: #fff; }
.btn.danger.solid:hover { background: var(--cancel-h); }
.btn.accent { background: var(--accent); border-color: transparent; color: #fff; }
.btn.accent:hover { background: var(--accent-h); }
.btn:disabled, .btn:disabled:hover { opacity: 0.4; cursor: not-allowed; background: transparent; }
.btn.primary:disabled { background: var(--btn-primary); }
.btn.danger.solid:disabled { background: var(--cancel); }
.btn.small { height: var(--h-ctl-sm); padding: 0 12px; font-size: 12px; }
.btn.icon { width: var(--h-ctl-sm); padding: 0; }

/* ---------- table ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--outline-2); border-radius: var(--r-md); overflow-x: auto; }
table.devices { width: 100%; border-collapse: collapse; }
.devices th {
  text-align: left; font: 500 12px/16px var(--font); color: var(--text-2);
  padding: 12px 16px; border-bottom: 1px solid var(--outline-2); white-space: nowrap;
}
.devices td { padding: 12px 16px; border-bottom: 1px solid var(--outline-2); white-space: nowrap; }
.devices tbody tr { cursor: pointer; }
.devices tbody tr:hover { background: var(--hover); }
.devices tbody tr.selected { background: var(--active); }
.devices tbody tr:last-child td { border-bottom: 0; }
.devices .num { text-align: right; font-variant-numeric: tabular-nums; }
.device-cell { display: flex; align-items: center; gap: 12px; }
.device-name { font-weight: 500; }
.device-sub { color: var(--text-2); font-size: 12px; line-height: 16px; }

/* status indicators (indicator.stable / attention / caution / locked) */
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ind-locked); }
.status-dot.online { background: var(--ind-stable); }
.status-dot.offline, .status-dot.auth-failed { background: var(--ind-attention); }
.status-dot.connecting { background: var(--ind-caution); }

/* tags: soft-tinted pills on background.alert.* */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-full);
  font: 500 12px/16px var(--font); background: var(--alert-default); color: var(--text-2); white-space: nowrap;
}
.pill.ok { background: var(--alert-success); color: var(--success-text); }
.pill.warn { background: var(--alert-warning); color: var(--warning-text); }
.pill.bad { background: var(--alert-error); color: var(--error-text); }
.pill.accent { background: var(--alert-theme); color: var(--accent-text); }

.empty { padding: 48px 20px; text-align: center; }
.empty-title { font: 700 16px/24px var(--font); margin: 0 0 4px; }
.empty-text { color: var(--text-2); margin: 0; }

/* ---------- drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw);
  background: var(--surface); border-left: 1px solid var(--outline-2); box-shadow: var(--elev-3);
  display: flex; flex-direction: column; z-index: 4;
}
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 16px; border-bottom: 1px solid var(--outline-2); }
.drawer-head h2 { margin: 0; font: 700 20px/28px var(--font); }   /* heading-small-bold */
.drawer-head .sub { color: var(--text-2); margin-top: 2px; }
.drawer-head .close { margin-left: auto; }
.head-dot { margin-top: 9px; }
.drawer-body { overflow-y: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 24px; }
.section h3 { font: 700 14px/20px var(--font); color: var(--text); margin: 0 0 8px; }
.banner { padding: 10px 12px; border-radius: var(--r-sm); font-weight: 500; }
.banner.bad { background: var(--alert-error); color: var(--error-text); }
.banner.warn { background: var(--alert-warning); color: var(--warning-text); }

dl.facts { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
dl.facts dt { color: var(--text-2); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

.controls { display: flex; flex-direction: column; gap: 12px; }
.control-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.control-row label { min-width: 110px; color: var(--text-2); }
.control-row input[type="range"] { flex: 1; accent-color: var(--control-active); }
.control-row input[type="text"] { flex: 1; }
.dial-row { margin-top: 12px; }
/* segmented toggle */
.toggle { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--outline-btn); border-radius: var(--r-full); }
.toggle button { border: 0; background: transparent; padding: 0 12px; height: 24px; border-radius: var(--r-full); cursor: pointer; font-weight: 500; font-size: 12px; color: var(--text-2); }
.toggle button:hover { background: var(--hover); color: var(--text); }
.toggle button.on { background: var(--btn-primary); color: var(--btn-primary-ink); }
.toggle button:disabled { opacity: 0.4; cursor: not-allowed; }
.vol-value { width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

.calls { display: flex; flex-direction: column; gap: 8px; }
.call { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-sm); }
.call .who { font-weight: 500; }
.call .meta { color: var(--text-2); font-size: 12px; line-height: 16px; }
.call .btn { margin-left: auto; }

.log { list-style: none; margin: 0; padding: 0; font-size: 12px; line-height: 16px; max-height: 280px; overflow-y: auto; background: var(--surface-2); border-radius: var(--r-sm); }
.log li { display: grid; grid-template-columns: 64px 1fr; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--outline-2); }
.log li:last-child { border-bottom: 0; }
.log time { color: var(--text-2); font-variant-numeric: tabular-nums; }
.log .k-error { color: var(--error-text); }
.log .k-command { color: var(--accent-text); }
.log .k-connection { color: var(--text-2); }
.log .text { overflow-wrap: anywhere; font-family: var(--mono); }

.danger-zone { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- dialogs ---------- */
dialog {
  border: 1px solid var(--outline-2); border-radius: var(--r-md); padding: 0; width: min(480px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--elev-3);
}
dialog::backdrop { background: var(--backdrop); }
dialog form { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
dialog h2 { margin: 0; font: 700 20px/28px var(--font); }
dialog label { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-weight: 500; }
dialog label input { color: var(--text); font-weight: 400; }
dialog label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
dialog input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--control-active); }
.optional { font-weight: 400; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.form-error { color: var(--error-text); margin: 0; }
.hint { margin: -8px 0 0; color: var(--text-2); font-size: 12px; line-height: 16px; }
#prompt-text { margin: 0; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 24px; left: calc(50% + var(--sidenav-w) / 2); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 20; }
.toast {
  padding: 10px 16px; border-radius: var(--r-full); background: var(--btn-primary); color: var(--btn-primary-ink);
  box-shadow: var(--elev-2); font-weight: 500; max-width: 520px;
}
.toast.bad { background: var(--cancel); color: #fff; }

/* ---------- Meeting Servers ---------- */
.alarms { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alarm { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--alert-error); border-radius: var(--r-sm); }
.alarm .who { font-weight: 500; }
.alarm .meta { color: var(--text-2); font-size: 12px; line-height: 16px; }

.cms-calls { display: flex; flex-direction: column; gap: 8px; }
.cms-call { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px; }
.cms-call-head { display: flex; align-items: flex-start; gap: 12px; }
.cms-call-head .btn { margin-left: auto; }
.cms-call .who { font-weight: 500; }
.cms-call .meta { color: var(--text-2); font-size: 12px; line-height: 16px; }
.legs { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--outline-2); }
.leg { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--outline-2); }
.leg-who { flex: 1; min-width: 0; }
.leg-who .who, .leg-who .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legs-empty { margin-top: 8px; }
.chip {
  height: 24px; padding: 0 10px; border-radius: var(--r-full); border: 1px solid var(--outline-btn); background: transparent;
  font: 500 12px/16px var(--font); cursor: pointer; white-space: nowrap;
}
.chip:hover { background: var(--hover); }
.chip.muted-on { background: var(--alert-error); color: var(--error-text); border-color: transparent; }
.chip:disabled { opacity: 0.4; cursor: not-allowed; }

table.mini { width: 100%; border-collapse: collapse; }
table.mini th { text-align: left; color: var(--text-2); font: 500 12px/16px var(--font); padding: 6px 8px; border-bottom: 1px solid var(--outline-2); }
table.mini td { padding: 6px 8px; border-bottom: 1px solid var(--outline-2); }
table.mini tr:last-child td { border-bottom: 0; }
table.mini .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- CMS: live calls under a server's row ---------- */
.calls-open {
  height: var(--h-ctl-sm); min-width: 36px; padding: 0 10px; margin: -4px -10px -4px 0;
  border-radius: var(--r-full); border: 1px solid var(--outline-btn); background: none; cursor: pointer;
  font-weight: 500; font-variant-numeric: tabular-nums;
}
.calls-open:hover { background: var(--hover); }
.calls-open.open { background: var(--btn-primary); color: var(--btn-primary-ink); border-color: transparent; }
.devices tbody tr:has(+ .live-row) td { border-bottom-color: transparent; background: var(--hover); }
.devices tbody tr.live-row { cursor: default; background: var(--hover); }
.devices tbody tr.live-row:hover { background: var(--hover); }
.devices tr.live-row > td { padding: 0 16px 16px; white-space: normal; }

.panel { background: var(--bg); border: 1px solid var(--outline-2); border-radius: var(--r-md); box-shadow: var(--elev-2); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--outline-2); }
.panel-head h2 { margin: 0; font: 700 16px/24px var(--font); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.live-panel.opening { animation: lc-open 0.18s ease-out; }
@keyframes lc-open { from { opacity: 0; transform: translateY(-4px); } }
.btn.collapse { border-color: transparent; }
.btn.collapse::before {
  content: ""; width: 7px; height: 7px; margin-top: 4px;
  border-left: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(45deg);
}

.lc-calls { padding: 12px; display: grid; gap: 8px; align-content: start; }
.lc-calls .empty { padding: 28px 20px; }
.lc-call { background: var(--surface); border: 1px solid var(--outline-2); border-radius: var(--r-sm); overflow: hidden; }
.lc-call.flash { animation: lc-flash 1.2s ease-out; }
@keyframes lc-flash { from { box-shadow: 0 0 0 3px color-mix(in srgb, var(--control-active) 50%, transparent); } to { box-shadow: none; } }
.lc-call-head {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid var(--outline-2);
}
.lc-call-head:hover { background: var(--hover); }
.lc-call.collapsed .lc-call-head { border-bottom: 0; }
.lc-call-head .chev {
  flex: none; width: 7px; height: 7px; margin: 0 4px 0 2px;
  border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2); transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.15s;
}
.lc-call.collapsed .lc-call-head .chev { transform: rotate(-45deg); }
.lc-count { margin-left: 4px; color: var(--text-2); }
.lc-call-head .title { font-weight: 700; }
.lc-call-head .mono { color: var(--text-2); }
.lc-call-head .dur { margin-left: auto; color: var(--text-2); font-variant-numeric: tabular-nums; }
.lc-legs { list-style: none; margin: 0; padding: 4px 0; }
.lc-leg { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px 12px; }
.lc-leg + .lc-leg { border-top: 1px solid var(--outline-2); }
.lc-leg .who { min-width: 0; }
.lc-leg .who b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-leg .who small { display: block; color: var(--text-2); font-family: var(--mono); font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-leg .pill { font-variant-numeric: tabular-nums; }
.pill.ringing::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: lc-pulse 1s infinite; }
@keyframes lc-pulse { 50% { opacity: 0.2; } }
.muted-flag { color: var(--error-text); }
.pill .muted-flag::before { content: "· "; }
.lc-call-head .muted-flag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--r-full); background: var(--alert-error); font: 500 12px/16px var(--font); }
.lc-call .waiting { padding: 14px 12px; margin: 0; }
.lc-call-foot { display: flex; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--outline-2); }

/* ---------- CUCM: devices and users panel under a cluster's row ---------- */
.cp-body { padding: 4px 12px 12px; }
.cp-section + .cp-section { border-top: 1px solid var(--outline-2); }
.cp-section-head { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.cp-section-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; margin-left: -4px; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; color: inherit; }
.cp-section-toggle:hover { background: var(--hover); }
.cp-section-toggle h3 { margin: 0; font: 700 14px/20px var(--font); }
.cp-section-toggle .chev { flex: none; width: 7px; height: 7px; margin: 0 4px 0 2px; border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2); transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.15s; }
.cp-section.collapsed .cp-section-toggle .chev { transform: rotate(-45deg); }
.cp-section-body { padding-bottom: 8px; }
.cp-list { padding: 0; }
.cp-list .empty { padding: 16px; }
.cp-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.cp-main .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-sub { color: var(--text-2); font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-meta { flex: 0 0 auto; width: 110px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-where { display: flex; flex-direction: column; font-size: 12px; line-height: 16px; }
.cp-tag { flex: none; width: 56px; }
.cp-end { flex: none; margin-left: auto; min-width: 168px; display: flex; justify-content: flex-end; }
.cp-card-body { padding: 12px; }
.cp-card-body .facts { margin: 0 0 8px; }
.cp-user-devices { border-top: 1px solid var(--outline-2); margin-top: 4px; }
.cp-user-devices .lc-leg { grid-template-columns: minmax(0, 1fr) auto auto; padding: 8px 0; }

/* ---------- Infinity: media load meters and participant tags ---------- */
.load { display: inline-flex; align-items: center; gap: 8px; }
.meter { position: relative; width: 64px; height: 6px; border-radius: var(--r-full); background: var(--outline-2); overflow: hidden; }
.meter > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--ind-stable); }
.meter.warn > span { background: var(--ind-caution); }
.meter.bad > span { background: var(--ind-attention); }
.load-pct { font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 3ch; }
.inf-leg { grid-template-columns: 32px minmax(0, 1fr) auto auto; }
.inf-tags { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

/* avatar: initials on a decorative accent, with the call direction in a corner badge */
.avatar { position: relative; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 500 12px/1 var(--font); }
.avatar .dir {
  position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; line-height: 1;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--outline-2);
}
.av-0 { background: var(--alert-theme); color: var(--accent-text); }
.av-1 { background: var(--alert-success); color: var(--success-text); }
.av-2 { background: var(--alert-warning); color: var(--warning-text); }
.av-3 { background: var(--alert-error); color: var(--error-text); }

/* ---------- home ---------- */
a.brand { color: var(--text); text-decoration: none; border-radius: var(--r-sm); }
a.brand:hover .brand-name, a.brand[aria-current="page"] .brand-name { color: var(--text); }
a.brand:hover .brand-mark { filter: brightness(1.1); }
.ok-text { color: var(--success-text); }
.bad-text { color: var(--error-text); }
.banner.ok { background: var(--alert-success); color: var(--success-text); }
#home-overall { margin: 0 0 24px; }
.home-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.home-card {
  display: flex; flex-direction: column; gap: 12px; padding: 16px;
  background: var(--surface); border: 1px solid var(--outline-2); border-radius: var(--r-md);
}
.home-card-head { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 700 16px/24px var(--font); }
.home-card-head:hover .home-card-title { text-decoration: underline; }
.home-card-icon { display: inline-flex; width: 32px; height: 32px; align-items: center; justify-content: center; border-radius: var(--r-full); background: var(--surface-2); flex: none; }
.home-card-icon svg { width: 20px; height: 20px; }
.home-card-open { margin-left: auto; color: var(--text-2); font-weight: 500; }
.home-card-status { margin: 0; color: var(--text-2); font-weight: 500; }
.home-card-status.ok-text { color: var(--success-text); }
.home-card-status.bad-text { color: var(--error-text); }
.home-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.home-tiles .stat { background: var(--bg); }

/* ---------- responsive ---------- */
/* ---------- signed-in user (side navigation foot) ---------- */
.user { display: flex; align-items: center; gap: 8px; min-width: 0; }
.user-avatar {
  width: 28px; height: 28px; flex: none; border-radius: var(--r-full); background: var(--alert-theme); color: var(--accent-text);
  display: grid; place-items: center; font: 500 12px/16px var(--font);
}
.user-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.user .btn { margin-right: -8px; }

/* ---------- sign-in page ---------- */
body.auth { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; padding: 32px; display: grid; gap: 24px;
  background: var(--surface); border: 1px solid var(--outline-2); border-radius: var(--r-md); box-shadow: var(--elev-2);
}
.auth-card .brand { padding: 0; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { margin: 0; font: 700 20px/28px var(--font); }
.auth-card label { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-weight: 500; }
.auth-card label input { color: var(--text); font-weight: 400; }
.auth-card .muted { margin: -8px 0 0; }
.auth-card .btn.primary { align-self: stretch; }
.auth-actions { display: flex; gap: 8px; }
.auth-actions .btn.primary { flex: 1; }

@media (max-width: 1100px) {
  :root { --sidenav-w: 72px; }
  .brand-name, .nav-label, .nav-section, .sidenav-foot .version, .sidenav-foot .live-text, .user-name { display: none; }
  .user { flex-direction: column; }
  .user .btn { margin-right: 0; }
  .auth-card .brand-name { display: inline; }
  .brand { justify-content: center; padding: 4px 0 20px; }
  .nav-item { justify-content: center; padding: 0; position: relative; }
  .nav-badge { position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; font-size: 10px; line-height: 16px; padding: 0 4px; }
  .sidenav-foot { justify-items: center; padding: 12px 0 0; }
  .theme-switch { flex-direction: column; justify-self: center; }
  .page { padding: 20px 20px 40px; }
  .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #view-devices .devices th:nth-child(4), #view-devices .devices td:nth-child(4), #view-devices .devices th:nth-child(5), #view-devices .devices td:nth-child(5) { display: none; }
  #view-cms .devices th:nth-child(3), #view-cms .devices td:nth-child(3), #view-cms .devices th:nth-child(7), #view-cms .devices td:nth-child(7) { display: none; }
}
@media (max-width: 760px) {
  .cp-meta { display: none; }
  .page { padding: 16px 12px 32px; }
  .page-head { flex-wrap: wrap; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-cards { grid-template-columns: 1fr; }
  .toolbar { flex-wrap: wrap; }
  input[type="search"] { width: 100%; }
  #view-devices .devices th:nth-child(n+3):not(:nth-child(7)), #view-devices .devices td:nth-child(n+3):not(:nth-child(7)) { display: none; }
  #view-cms .devices th:nth-child(n+2):not(:nth-child(5)):not(:nth-child(8)), #view-cms .devices td:nth-child(n+2):not(:nth-child(5)):not(:nth-child(8)) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .live-panel, .lc-call.flash, .pill.ringing::before { animation: none; }
  .lc-call-head .chev { transition: none; }
}

/* ---------- CUCM ---------- */
.drawer.wide { width: min(780px, 100vw); }
dialog select { width: 100%; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.section-head h3 { margin: 0; }
.phone-tools { margin-bottom: 8px; }
.phone-tools input[type="search"] { flex: 1; width: auto; min-width: 180px; }
.table-wrap.inner { border-radius: var(--r-sm); max-height: 420px; overflow-y: auto; }
table.mini.phones td { vertical-align: top; }
table.mini.phones tr.selected { background: var(--active); }
table.mini.phones tr:not(.detail-row):hover { background: var(--hover); }
.phone-toggle {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  border: 0; background: transparent; color: inherit; padding: 0; cursor: pointer; font: inherit;
}
.phone-toggle:hover .device-name { text-decoration: underline; }
.detail-row > td { background: var(--surface-2); }
.phone-detail { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.phone-detail dd { white-space: pre-line; }
.stopped-service { margin-top: 8px; }
@media (max-width: 760px) {
  #view-cucm .devices th:nth-child(n+3):not(:nth-child(7)), #view-cucm .devices td:nth-child(n+3):not(:nth-child(7)) { display: none; }
}
