* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --cm-bg: #f4f6f9;
  --cm-surface: #ffffff;
  --cm-border: #e2e8f0;
  --cm-border-strong: #cbd5e1;
  --cm-text: #0f172a;
  --cm-text-muted: #64748b;
  --cm-primary: #5bb4f4;
  --cm-primary-hover: #3a9de0;
  --cm-primary-soft: #e8f4fc;
  --cm-accent: #5bb4f4;
  --cm-accent-soft: rgba(91, 180, 244, 0.18);
  --cm-notice: #ea580c;
  --cm-danger: #b91c1c;
  --cm-danger-soft: #fef2f2;
  --cm-danger-border: #fecaca;
  --cm-radius: 10px;
  --cm-radius-sm: 6px;
  --cm-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  --cm-shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.08);
  --cm-font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --cm-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --cm-surface-2: #f8fafc;
  --cm-hover: #f1f5f9;
  --cm-row-hover: #fafbfc;
  --cm-on-primary: #ffffff;
  --cm-shadow-md: 0 4px 16px rgba(15, 23, 42, 0.1);
  --cm-overlay: rgba(255, 255, 255, 0.86);
  --cm-chart-grid: #e2e8f0;
  --cm-chart-axis: #64748b;
  --cm-presence-unknown: #94a3b8;
  --cm-presence-available: #22c55e;
  --cm-presence-ringing: #ef4444;
  --cm-presence-busy: #dc2626;
  --cm-presence-meeting: #3b82f6;
  --cm-presence-away: #ca8a04;
  --cm-presence-ooo: #9333ea;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.22s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

::view-transition-group(hub-topbar),
::view-transition-group(hub-brand) {
  animation: none;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --cm-bg: #0f172a;
  --cm-surface: #1a2436;
  --cm-border: #2c3a52;
  --cm-border-strong: #3d4f6c;
  --cm-text: #e8eef6;
  --cm-text-muted: #94a3b8;
  --cm-primary: #8bb4e3;
  --cm-primary-hover: #b7d0ef;
  --cm-primary-soft: #1e2d44;
  --cm-accent: #5bb4f4;
  --cm-accent-soft: rgba(91, 180, 244, 0.22);
  --cm-notice: #ea580c;
  --cm-danger: #f87171;
  --cm-danger-soft: #3f1d1d;
  --cm-danger-border: #7f1d1d;
  --cm-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.28);
  --cm-shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.4);
  --cm-surface-2: #152033;
  --cm-hover: #243044;
  --cm-row-hover: #1e2a3d;
  --cm-on-primary: #0f172a;
  --cm-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --cm-overlay: rgba(15, 23, 42, 0.82);
  --cm-chart-grid: #2c3a52;
  --cm-chart-axis: #94a3b8;
  --cm-presence-unknown: #64748b;
  --cm-presence-available: #4ade80;
  --cm-presence-ringing: #f87171;
  --cm-presence-busy: #f87171;
  --cm-presence-meeting: #60a5fa;
  --cm-presence-away: #facc15;
  --cm-presence-ooo: #c084fc;
}

html[data-theme="dark"] .data-table th,
html[data-theme="dark"] th {
  background: #152033;
  color: var(--cm-text-muted);
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: #121a28;
  color: var(--cm-text);
  border-color: var(--cm-border);
}

html, body.app-page:not(.app-page-login) {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--cm-font);
  background: var(--cm-bg);
  color: var(--cm-text);
  line-height: 1.5;
  min-height: 100vh;
}

body.app-page:not(.app-page-login) {
  overflow: hidden;
}

/* —— App shell —— */
.app-shell {
  max-width: none;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}

body.app-page:not(.app-page-login) .app-shell {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.app-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  view-transition-name: hub-topbar;
  column-gap: 1rem;
  padding: 0.65rem 1.5rem 0.6rem;
  border-bottom: none;
  margin-bottom: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 200;
  view-transition-name: hub-topbar;
  background:
    linear-gradient(180deg, var(--cm-accent-soft) 0%, transparent 70%),
    linear-gradient(90deg, #163152 0%, #254d81 48%, #1a3558 100%);
  color: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

[data-theme="light"] .app-topbar {
  background:
    linear-gradient(180deg, rgba(76, 151, 205, 0.14) 0%, transparent 78%),
    linear-gradient(90deg, #e7eef6 0%, #dde7f2 48%, #d2deec 100%);
  color: var(--cm-text);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--cm-text) 8%, transparent),
    0 8px 22px rgba(15, 23, 42, 0.06);
}

/* Frosted pills: center stack style, shared with right tools/account. */
[data-theme="light"] .app-nav-stack > .app-nav,
[data-theme="light"] .app-nav-tools,
[data-theme="light"] .app-nav-account {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid color-mix(in srgb, var(--cm-text) 30%, transparent);
  box-shadow: none;
}

[data-theme="light"] .app-nav-link {
  color: var(--cm-text-muted);
}

[data-theme="light"] .app-nav-link:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--cm-text);
}

[data-theme="light"] .app-nav-link.is-active {
  background: var(--cm-accent);
  color: #fff;
}

[data-theme="light"] .app-nav-account .app-bug-link {
  background: transparent;
  border-color: transparent;
  color: var(--cm-text-muted);
}

[data-theme="light"] .app-nav-account .app-bug-link:hover,
[data-theme="light"] .app-nav-account .app-bug-link:focus-visible {
  background: rgba(15, 23, 42, 0.06);
  color: var(--cm-text);
}

[data-theme="light"] .app-nav-account .app-bug-link.is-active {
  background: var(--cm-accent);
  color: #fff;
}

[data-theme="light"] .app-nav-account .app-logout-btn {
  color: var(--cm-text-muted);
  border-color: transparent;
  background: transparent;
}

[data-theme="light"] .app-nav-account .app-logout-btn:hover {
  color: var(--cm-text);
  border-color: transparent;
  background: rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .app-user {
  color: var(--cm-text-muted);
}

[data-theme="light"] .app-nav-tools .app-nav-link {
  color: var(--cm-text-muted);
}

.app-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.22rem;
  text-decoration: none;
  color: inherit;
  justify-self: start;
  min-width: 0;
  view-transition-name: hub-brand;
}

.app-brand-tools {
  align-items: center;
  display: flex;
  gap: 0.45rem;
  justify-self: start;
  min-width: 0;
}

.app-bug-link {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 1rem;
  height: 2.25rem;
  justify-content: center;
  text-decoration: none;
  width: 2.25rem;
}

.app-bug-link:hover,
.app-bug-link:focus-visible {
  background: var(--cm-accent);
  color: #1a3558;
}

.app-nav-account .app-bug-link {
  width: auto;
  min-width: 2.1rem;
  height: auto;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  padding: 0.32rem 0.7rem;
  font-size: 0.95rem;
  line-height: 1;
}

.app-nav-account .app-bug-link:hover,
.app-nav-account .app-bug-link:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.app-nav-account .app-bug-link.is-active {
  background: var(--cm-accent);
  color: #1a3558;
}

.app-nav-account .app-logout-btn {
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 999px;
}

.app-nav-account .app-logout-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: transparent;
  color: #fff;
}

.app-brand-logo {
  width: auto;
  height: 28px;
  flex-shrink: 0;
  display: block;
}

.app-brand-logo-light {
  display: none;
}

[data-theme="light"] .app-brand-logo-light {
  display: block;
}

[data-theme="light"] .app-brand-logo-dark {
  display: none;
}

.app-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.app-brand-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cm-accent);
  line-height: 1.2;
}

.app-brand-title {
  font-family: "HubBrand", "Segoe UI", system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--cm-accent);
  margin-left: 2.05rem;
}

.app-brand:hover .app-brand-title {
  color: var(--cm-accent);
}

.app-brand-version {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.app-nav-topright,
.app-account {
  justify-self: end;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

html[data-theme="dark"] .assistant-msg-bot,
html[data-theme="dark"] .assistant-threads,
html[data-theme="dark"] .assistant-fold,
html[data-theme="dark"] .card {
  background: var(--cm-surface);
}

html[data-theme="dark"] .data-table th,
html[data-theme="dark"] th {
  background: #152033;
  color: var(--cm-text-muted);
}

.app-account-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.app-nav-tools {
  min-height: 0;
  padding: 0.1rem 0.28rem;
  gap: 0.2rem;
}

.app-nav-tools .app-nav-link {
  padding: 0.32rem 0.75rem;
  font-size: 0.78rem;
}

.app-nav-account {
  min-height: 0;
  padding: 0.1rem 0.28rem;
  gap: 0.15rem;
}

.app-nav-account .app-logout-btn,
.app-nav-account .app-bug-link {
  white-space: nowrap;
}

.app-user {
  margin: 0;
  max-width: 16rem;
  min-height: 0.85em;
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.72);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

::view-transition-group(hub-topbar),
::view-transition-group(hub-brand) {
  animation: none;
}

.app-page-settings .app-main.settings-main,
.app-page-settings .app-footer {
  max-width: 1100px;
}

.settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.85rem 1rem;
  max-width: none;
  align-items: start;
}

.settings-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.settings-saved {
  grid-column: 1 / -1;
  color: #059669;
  font-weight: 600;
  margin: 0.15rem 0 0;
  min-height: 1.35em;
  opacity: 0;
  pointer-events: none;
}

.settings-form fieldset {
  border: 1px solid var(--cm-border);
  border-radius: 12px;
  margin: 0;
  padding: 0.65rem 1rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
  min-width: 0;
  max-width: 100%;
  background: var(--cm-surface-2);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.settings-form legend {
  font-weight: 600;
  padding: 0 0.4rem;
  float: none;
  width: auto;
  color: var(--cm-text);
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: 999px;
  font-size: 0.82rem;
}

.settings-form label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  white-space: nowrap;
}

.settings-form fieldset.is-locked {
  opacity: 0.55;
}

.settings-form fieldset.is-locked input:disabled {
  cursor: not-allowed;
}

.settings-saved.is-visible {
  opacity: 1;
}

html[data-theme="dark"] .settings-saved {
  color: #34d399;
}

.app-logout-btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 0.32rem 0.85rem;
  text-decoration: none;
  cursor: pointer;
}

.app-logout-btn:hover {
  color: #fff;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.app-page-login {
  background:
    radial-gradient(1200px 480px at 80% -10%, var(--cm-accent-soft), transparent 55%),
    var(--cm-bg);
  color: var(--cm-text);
  user-select: none;
  -webkit-user-select: none;
}

/* Landing is read-only except Microsoft SSO, theme/lang toggles, and (when enabled) dummy reveal. */
.app-page-login .login-page,
.app-page-login .login-page * {
  pointer-events: none;
}

.app-page-login .ms-signin-btn,
.app-page-login .ms-signin-btn *,
.app-page-login .login-prefs,
.app-page-login .login-prefs *,
.app-page-login[data-hub-dummy="1"] .login-footer-brand,
.app-page-login .login-dummy:not([hidden]),
.app-page-login .login-dummy:not([hidden]) * {
  pointer-events: auto;
}

.login-page {
  min-height: 100vh;
  display: flex;
}

.login-hero {
  display: none;
  flex: 1 1 46%;
  background:
    linear-gradient(165deg, var(--cm-accent-soft) 0%, transparent 42%),
    linear-gradient(180deg, #1b3a62 0%, #254d81 55%, #1a3558 100%);
  color: #fff;
  padding: 3rem 3.25rem;
  align-items: center;
}

[data-theme="light"] .login-hero {
  background:
    linear-gradient(165deg, var(--cm-accent-soft) 0%, transparent 42%),
    linear-gradient(180deg, #f3f7fb 0%, #e4eef8 55%, #d7e6f5 100%);
  color: var(--cm-text);
}

.login-hero-inner {
  max-width: 28rem;
  --login-logo-w: min(300px, 78vw);
}

@font-face {
  font-family: "HubBrand";
  src: url("/static/fonts/dm-sans-semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

.login-hero-logo {
  width: var(--login-logo-w);
  height: auto;
  aspect-ratio: 420 / 64;
  display: block;
  object-fit: contain;
  object-position: left center;
}

.login-hero-company {
  margin: 1.35rem 0 0.15rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cm-accent);
}

.login-hero-product {
  /* Align under “telsmart” in the wordmark (icon ends ~70/420 of logo width). */
  margin: 0.85rem 0 1rem;
  margin-left: calc(var(--login-logo-w) * 70 / 400);
  font-family: "HubBrand", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(1.85rem, 3.2vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--cm-accent);
}

[data-theme="light"] .login-hero-tagline,
[data-theme="light"] .login-hero-list {
  color: var(--cm-text-muted);
}

[data-theme="light"] .login-hero-product {
  color: var(--cm-accent);
}

.login-hero-tagline {
  margin: 0 0 1.15rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.86);
}

.login-hero-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
}

.login-hero-list li {
  padding-left: 1.15rem;
  position: relative;
}

.login-hero-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--cm-accent);
}

.login-main {
  flex: 1 1 54%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: 14px;
  box-shadow: var(--cm-shadow-lg);
  padding: 2.15rem 1.85rem 1.65rem;
}

.login-card-header {
  margin-bottom: 1.5rem;
}

.login-card-logo {
  width: min(260px, 78%);
  height: auto;
  aspect-ratio: 420 / 64;
  display: block;
  margin-bottom: 1rem;
  object-fit: contain;
  object-position: left center;
}

.login-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cm-primary);
}

.login-heading {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  color: var(--cm-text);
}

.login-desc {
  margin: 0;
  color: var(--cm-text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.login-error {
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  background: var(--cm-danger-soft);
  color: var(--cm-danger);
  border-radius: var(--cm-radius-sm);
  font-size: 0.875rem;
}

.ms-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.8rem 1rem;
  background: #fff;
  color: #323130;
  border: 1px solid #8a8886;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.ms-signin-btn:hover {
  background: #f3f2f1;
}

.ms-signin-btn:focus-visible {
  outline: 2px solid #254d81;
  outline-offset: 2px;
}

.ms-signin-logo {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

.login-note {
  margin: 1.1rem 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--cm-text-muted);
}

.login-dummy {
  margin-top: 0.85rem;
  flex-direction: column;
  gap: 0.45rem;
}

.login-dummy:not([hidden]) {
  display: flex;
}

.login-dummy[hidden] {
  display: none !important;
}

.login-dummy input {
  width: 100%;
  min-height: 44px;
  font-size: 16px;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--cm-border);
  background: var(--cm-bg);
  color: var(--cm-text);
}

.login-dummy button {
  min-height: 44px;
}

.login-prefs {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--cm-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.login-seg {
  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid var(--cm-border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--cm-surface-2);
}

.login-seg-btn {
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--cm-text-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-seg-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.login-seg-btn + .login-seg-btn {
  border-left: 1px solid var(--cm-border);
}

.login-seg-btn.is-active {
  background: var(--cm-primary-soft);
  color: var(--cm-primary);
}

.login-seg-btn:focus-visible {
  outline: 2px solid var(--cm-primary);
  outline-offset: -2px;
}

.login-footer {
  width: 100%;
  max-width: 420px;
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: center;
  color: var(--cm-text-muted);
  font-size: 0.75rem;
}

.login-footer p {
  margin: 0;
}

.login-footer-brand {
  cursor: default;
  user-select: none;
}

@media (min-width: 880px) {
  .login-hero {
    display: flex;
  }

  .login-card-logo {
    display: none !important;
  }
}

.card-header-title-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.section-info-btn {
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  color: var(--cm-text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
}

.section-info-btn:hover {
  color: var(--cm-primary);
  background: var(--cm-primary-soft);
  border-color: #c5d2e3;
}

.section-info-btn:focus-visible {
  outline: 2px solid var(--cm-primary);
  outline-offset: 2px;
}

.app-nav-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-self: center;
  gap: 0.2rem;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.app-nav {
  display: flex;
  gap: 0.3rem;
  min-height: 2.55rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.18rem;
  box-shadow: none;
}

.app-nav-stack > .app-nav {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.18rem;
}

.app-nav-stack > .app-nav-primary {
  min-height: 2.4rem;
}

/* Hide department-gated links until /me paints access (avoids Calls/Tech Corner flash). */
.app-nav-primary:not(.is-access-ready) > a[data-nav-id="calls"],
.app-nav-primary:not(.is-access-ready) > a[data-nav-id="oncall"],
.app-nav-primary:not(.is-access-ready) > a[data-nav-id="hosts"],
.app-nav-primary:not(.is-access-ready) > a[data-nav-id="logs"] {
  display: none !important;
}

.app-nav-stack > .app-nav-secondary {
  width: max-content;
  max-width: 100%;
  min-height: 0;
  padding: 0.1rem 0.28rem;
  gap: 0.2rem;
}

.app-nav-stack > .app-nav-secondary .app-nav-link {
  padding: 0.32rem 0.85rem;
  font-size: 0.8125rem;
}

.app-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.app-nav-badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #fff;
  color: #1a3558;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}

.app-nav-edit-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--cm-notice);
  flex-shrink: 0;
}

.app-nav-link.is-active .app-nav-badge {
  background: #1a3558;
  color: #fff;
}

.app-nav-link.is-active .app-nav-edit-dot {
  background: #fff;
}

.app-nav-link.is-oncall {
  animation: oncall-nav-pulse 1.8s ease-in-out infinite;
  box-shadow: 0 0 0 1px rgba(234, 88, 12, 0.55);
}

@keyframes oncall-nav-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(234, 88, 12, 0.45), 0 0 0 0 rgba(244, 153, 19, 0.35);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.7), 0 0 18px 2px rgba(244, 153, 19, 0.55);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-nav-link.is-oncall {
    animation: none;
    box-shadow: 0 0 0 2px #ea580c;
  }
}

.app-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.app-nav-link.is-active {
  background: var(--cm-accent);
  color: #1a3558;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 1.5rem;
}

.app-main > .card {
  scroll-margin-top: 5.5rem;
}

.app-footer {
  width: 100%;
  max-width: 1680px;
  margin: auto auto 1.25rem;
  padding: 1rem 1.25rem 0.25rem;
  border-top: 1px solid var(--cm-border);
  font-size: 0.8rem;
  color: var(--cm-text-muted);
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* —— Cards —— */
.card {
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: 14px;
  box-shadow: var(--cm-shadow);
}

.card-header {
  padding: 1.1rem 1.25rem 0;
}

.card-header-collapsible .card-header-title-row {
  align-items: center;
}

.section-collapse-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-right: 0.35rem;
  padding: 0;
  border: 1px solid var(--cm-border);
  border-radius: 6px;
  background: var(--cm-surface);
  color: var(--cm-text-muted);
  cursor: pointer;
}

.section-collapse-btn:hover {
  background: var(--cm-hover);
  color: var(--cm-text);
}

.section-collapse-icon {
  display: block;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  margin-left: -0.1rem;
}

.card:not(.is-collapsed) > .card-header .section-collapse-icon,
.card:not(.is-collapsed) > .card-header-split .section-collapse-icon {
  transform: rotate(45deg);
  margin-top: -0.15rem;
}

.card.is-collapsed > .collapsible-panel,
.card.is-collapsed > .card-body.collapsible-panel {
  display: none;
}

.card-table-panel > .collapsible-panel {
  padding: 0 0 1rem;
}

.card-table-panel > .collapsible-panel > .filter-bar {
  margin: 0 1.25rem;
}

.card-table-panel > .collapsible-panel > .table-wrap {
  margin: 0 1.25rem;
}

.card-table-panel.call-log-busy > .card-header {
  opacity: 0.92;
}

.card-header-split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.25rem;
}

.card-body {
  padding: 0.75rem 1.25rem 1.25rem;
}

.card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.card-desc {
  margin: 0.35rem 0 0;
  min-height: 2.5em;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--cm-text-muted);
  max-width: 52rem;
}

.app-page-home .home-widgets .card {
  min-height: 11rem;
}

.app-page-home .home-cal-card {
  min-height: 18rem;
}

.app-scroll {
  contain: layout;
}

/* —— Search mode tabs —— */
.search-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.search-mode-tab {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--cm-text-muted);
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}

.search-mode-tab:hover {
  color: var(--cm-text);
  border-color: var(--cm-border-strong);
  background: var(--cm-hover);
}

.search-mode-tab.is-active {
  color: var(--cm-on-primary);
  background: var(--cm-primary);
  border-color: var(--cm-primary);
}

.search-panel.hidden {
  display: none;
}

.group-combobox,
.phone-field-input {
  margin-bottom: 1rem;
}

.group-combobox-label,
.phone-field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--cm-text-muted);
  margin-bottom: 0.35rem;
}

.group-combobox {
  position: relative;
}

.group-combobox-input,
.phone-field-input {
  width: 100%;
  max-width: 36rem;
  font: inherit;
  font-family: var(--cm-mono);
  font-size: 1rem;
  color: var(--cm-text);
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  padding: 0.65rem 0.85rem;
}

.group-combobox-input:focus,
.phone-field-input:focus {
  outline: none;
  border-color: var(--cm-primary);
  box-shadow: 0 0 0 3px var(--cm-primary-soft);
}

.group-combobox-input:disabled,
.phone-field-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.group-options {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 0.15rem);
  max-width: 36rem;
  max-height: 14rem;
  overflow: auto;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  box-shadow: var(--cm-shadow-md);
  color: var(--cm-text);
}

.group-options.hidden {
  display: none;
}

.group-option {
  padding: 0.55rem 0.85rem;
  cursor: pointer;
}

.group-option:hover,
.group-option.is-active {
  background: var(--cm-primary-soft);
}

.group-option-name {
  display: block;
  font-weight: 600;
  color: var(--cm-text);
}

.group-option-domain {
  display: block;
  font-family: var(--cm-mono);
  font-size: 0.8125rem;
  color: var(--cm-text-muted);
  margin-top: 0.15rem;
}

.group-option-empty {
  padding: 0.65rem 0.85rem;
  color: var(--cm-text-muted);
  font-size: 0.875rem;
}

/* —— Domain search —— */
.domain-field {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-family: var(--cm-mono);
  font-size: 1.05rem;
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
}

.domain-field-prefix,
.domain-field-suffix {
  color: var(--cm-text-muted);
  user-select: none;
}

.domain-field-input,
#search {
  width: 4.5rem;
  min-width: 2.5rem;
  font: inherit;
  border: none;
  background: transparent;
  text-align: center;
  color: var(--cm-text);
  padding: 0.15rem 0;
}

.domain-field-input::placeholder,
#search::placeholder {
  color: var(--cm-text-muted);
  opacity: 0.5;
}

.domain-field-input:focus,
#search:focus {
  outline: none;
}

.domain-field:focus-within {
  border-color: var(--cm-primary);
  box-shadow: 0 0 0 3px rgba(37, 77, 129, 0.18);
}

.domain-field-input:disabled,
#search:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .app-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    row-gap: 0.55rem;
  }

  .app-nav-stack {
    order: 3;
    width: max-content;
    max-width: 100%;
  }

  .app-nav {
    order: unset;
    width: auto;
    max-width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    border-radius: 14px;
  }

  .app-nav-stack > .app-nav-primary,
  .app-nav-stack > .app-nav-secondary {
    border-radius: 999px;
  }

  .app-account,
  .app-nav-topright {
    align-self: flex-end;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-primary,
  .toolbar-secondary {
    width: 100%;
  }

  .toolbar-secondary {
    justify-content: flex-end;
  }

  .poll-duration {
    margin-left: 0;
  }
}

/* —— Toolbar & buttons —— */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.toolbar-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-secondary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: var(--cm-radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn[hidden] {
  display: none !important;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary,
#startBtn.btn-primary {
  background: var(--cm-primary);
  color: var(--cm-on-primary);
  border-color: var(--cm-primary);
}

.btn-primary:hover:not(:disabled),
#startBtn.btn-primary:hover:not(:disabled) {
  background: var(--cm-primary-hover);
  border-color: var(--cm-primary-hover);
}

.btn-secondary,
#startBtn.btn-secondary {
  background: var(--cm-surface);
  color: var(--cm-text);
  border-color: var(--cm-border-strong);
}

.btn-secondary:hover:not(:disabled),
#startBtn.btn-secondary:hover:not(:disabled) {
  background: var(--cm-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--cm-text-muted);
  border-color: var(--cm-border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--cm-hover);
  color: var(--cm-text);
}

.btn-danger,
.btn-ghost.btn-danger {
  background: transparent;
  color: var(--cm-danger);
  border-color: var(--cm-danger-border);
}

.btn-danger:hover:not(:disabled),
.btn-ghost.btn-danger:hover:not(:disabled) {
  background: var(--cm-danger-soft);
  color: var(--cm-danger);
  border-color: var(--cm-danger);
}

.poll-duration {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--cm-text-muted);
  margin-left: 0.25rem;
}

.poll-duration-label {
  white-space: nowrap;
}

.poll-duration input,
#pollDuration {
  width: 3.75rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--cm-border-strong);
  border-radius: var(--cm-radius-sm);
  font-size: 0.875rem;
  text-align: center;
  font-family: var(--cm-mono);
}

.poll-duration input:disabled,
#pollDuration:disabled {
  opacity: 0.6;
  background: var(--cm-hover);
}

.poll-duration-unit {
  color: var(--cm-text-muted);
  font-size: 0.8rem;
}

/* —— Status —— */
.status-banner,
.status {
  margin: 0;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  border-radius: var(--cm-radius-sm);
  background: var(--cm-primary-soft);
  border: 1px solid #c5d2e3;
  color: var(--cm-primary);
}

.status-banner.is-error,
.status.error {
  background: var(--cm-danger-soft);
  border-color: #fecaca;
  color: var(--cm-danger);
}

/* —— Data tables —— */
.card-table-panel .table-wrap {
  border: none;
  border-radius: 0;
  border-top: 1px solid var(--cm-border);
  box-shadow: none;
}

.card-table-panel .table-wrap.table-wrap-fit {
  overflow-x: hidden;
}

#callsTable.data-table {
  table-layout: fixed;
  width: 100%;
}

#callsTable.data-table td {
  padding: 0.32rem 0.38rem;
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

#callsTable.data-table td.qual-cell {
  overflow: visible;
  text-overflow: clip;
}

#callsTable.data-table th {
  padding: 0.38rem 0.38rem 0.32rem;
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: normal;
  vertical-align: bottom;
}

#callsTable .status-badge {
  font-size: 0.58rem;
  padding: 0.1rem 0.25rem;
  margin-right: 0.2rem;
}

#callsTable .party-number {
  font-size: 0.75rem;
}

#callsTable .party-name {
  font-size: 0.65rem;
  max-width: 100%;
}

#callsTable .alert-badge {
  font-size: 0.62rem;
  padding: 0.1rem 0.3rem;
}

#callsTable .col-start .start-date {
  font-size: 0.62rem;
}

#callsTable .col-start .start-time {
  font-size: 0.72rem;
}

.table-wrap {
  overflow-x: auto;
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  box-shadow: var(--cm-shadow);
}

.data-table,
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table th,
.data-table td,
th,
td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--cm-border);
  white-space: nowrap;
}

.data-table th,
th {
  background: var(--cm-surface-2);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cm-text-muted);
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table tbody tr:hover:not(.empty-row):not([class*="row-call-color-"]),
tbody tr:hover:not(.empty-row):not([class*="row-call-color-"]) {
  background: var(--cm-row-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

.empty-row td {
  text-align: center;
  color: var(--cm-text-muted);
  font-style: italic;
  padding: 2rem 1rem !important;
  white-space: normal;
}

/* Legacy layout (unused on redesigned pages) */
.container {
  max-width: 1800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-header-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.page-nav {
  font-size: 0.85rem;
}

.page-nav a {
  color: #2563eb;
  text-decoration: none;
}

.search-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-family: var(--cm-mono);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.domain-prefix,
.domain-suffix {
  color: #555;
}

.logo {
  height: 2.5rem;
  width: auto;
}

h1 {
  font-size: 1.5rem;
  margin: 0;
}

h1 small {
  font-size: 0.5em;
  font-weight: normal;
}

.hidden {
  display: none !important;
}

.chart-view-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.chart-view-toggle {
  display: flex;
  gap: 0.25rem;
}

.chart-view-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.chart-view-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.stream-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: #475569;
}

.stream-controls select {
  margin-left: 0.35rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

.chart-stream-panel {
  margin-bottom: 1rem;
}

.stream-graph-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin-bottom: 0.75rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.stream-graph-img.hidden {
  display: none;
}

.chart-box-wide canvas {
  width: 100%;
  height: auto;
}

.stream-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
}

.legend-band {
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
}

.legend-good { background: #dcfce7; color: #166534; }
.legend-fair { background: #fef3c7; color: #92400e; }
.legend-poor { background: #fee2e2; color: #991b1b; }
.legend-mark { color: #64748b; font-weight: normal; }

/* Global button reset for non-.btn controls (modals, SIP, etc.) */
:where(button:not(.btn):not(.home-task-link):not(.quality-pill):not(.sip-view-tab):not(.chart-view-btn):not(.modal-close):not(.sip-messages-row):not(.sip-diagram-row)) {
  padding: 0.45rem 1rem;
  border: none;
  border-radius: var(--cm-radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
}

button:not(.btn):not(.quality-pill):not(.sip-view-tab):not(.chart-view-btn):not(.modal-close):disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.quality-pill {
  border: none;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

.history-load-toast {
  margin: 0.75rem 1.25rem 0;
  padding: 0.75rem 1rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #bfdbfe;
  background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
  transition: opacity 0.6s ease, max-height 0.6s ease, margin 0.6s ease, padding 0.6s ease;
  max-height: 120px;
  overflow: hidden;
}

.history-load-toast.hidden {
  display: none;
}

.history-load-toast.is-hiding {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

.history-load-toast-text {
  font-size: 0.84rem;
  font-weight: 600;
  color: #1e3a8a;
  margin-bottom: 0.55rem;
}

.history-load-toast-track {
  height: 6px;
  border-radius: 999px;
  background: #dbeafe;
  overflow: hidden;
}

.history-load-toast-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb 0%, #3b82f6 55%, #60a5fa 100%);
  transition: width 0.35s ease;
}

.quality-pill:hover {
  filter: brightness(0.95);
}

.quality-excellent {
  background: #d1fae5;
  color: #065f46;
}

.quality-good {
  background: #dbeafe;
  color: #1e40af;
}

.quality-fair {
  background: #fef3c7;
  color: #92400e;
}

.quality-poor {
  background: #fee2e2;
  color: #991b1b;
}

.quality-unknown {
  background: #e5e7eb;
  color: #4b5563;
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-panel {
  position: relative;
  background: var(--cm-surface);
  color: var(--cm-text);
  border-radius: 8px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--cm-text-muted);
  padding: 0 0.25rem;
}

.modal-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--cm-text-muted);
}

.modal-hint {
  margin: 0.25rem 0 0.75rem;
  font-size: 0.8rem;
  color: var(--cm-text-muted);
}

.modal-quality-summary {
  margin: 0 0 0.85rem;
}

.modal-quality-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cm-text-muted);
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.quality-leg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.quality-leg-card {
  border: 1px solid var(--cm-border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  background: var(--cm-surface-2);
}

.quality-leg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--cm-text);
  margin-bottom: 0.35rem;
}

.quality-leg-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--cm-text-muted);
}

.quality-leg-card.quality-excellent .quality-leg-badge { background: #dcfce7; color: #166534; }
.quality-leg-card.quality-good .quality-leg-badge { background: #dbeafe; color: #1d4ed8; }
.quality-leg-card.quality-fair .quality-leg-badge { background: #fef3c7; color: #b45309; }
.quality-leg-card.quality-poor .quality-leg-badge { background: #fee2e2; color: #b91c1c; }

.quality-leg-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.78rem;
  color: var(--cm-text-muted);
}

.quality-leg-metrics strong {
  color: var(--cm-text-muted);
  font-weight: 600;
  margin-right: 0.15rem;
}

.chart-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chart-box {
  position: relative;
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem 0.3rem;
}

.chart-box h3 {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--cm-text);
}

.chart-box canvas {
  width: 100%;
  height: auto;
  display: block;
  background: transparent;
  border-radius: 4px;
  cursor: crosshair;
}

.chart-tooltip {
  position: fixed;
  z-index: 1100;
  pointer-events: none;
  background: var(--cm-text);
  color: var(--cm-bg);
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.45;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.28);
  max-width: min(280px, calc(100vw - 24px));
  overflow-wrap: anywhere;
  word-wrap: break-word;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 10px));
  transition: opacity 0.12s ease;
}

.chart-tooltip-wide {
  max-width: min(360px, calc(100vw - 24px));
}

.chart-tooltip .tip-detail.tip-wrap {
  white-space: normal;
  font-weight: 400;
  line-height: 1.5;
}

.chart-tooltip .tip-leg {
  white-space: normal;
}

#callsTable [data-ui-tooltip],
#callsTable [data-ui-tooltip-html],
.card-table-panel [data-ui-tooltip],
.card-table-panel [data-ui-tooltip-html] {
  cursor: help;
}

#callsTable .quality-pill[data-ui-tooltip],
#callsTable .sip-ladder-btn[data-ui-tooltip] {
  cursor: pointer;
}

.chart-tooltip.visible {
  opacity: 1;
}

.chart-tooltip .tip-time {
  display: block;
  color: color-mix(in srgb, var(--cm-bg) 72%, var(--cm-text));
  font-size: 0.72rem;
  margin-bottom: 0.3rem;
}

.chart-tooltip .tip-leg + .tip-leg {
  margin-top: 0.45rem;
}

.chart-tooltip .tip-leg {
  display: block;
  font-weight: 600;
}

.chart-tooltip .tip-detail {
  display: block;
  color: color-mix(in srgb, var(--cm-bg) 78%, var(--cm-text));
  font-size: 0.76rem;
}

.chart-tooltip .tip-leg,
.chart-tooltip strong {
  color: var(--cm-bg);
}

.modal-actions {
  margin-top: 1rem;
}

#analyzeBtn {
  background: var(--cm-primary);
  color: var(--cm-on-primary);
}

#analyzeBtn:hover:not(:disabled) {
  background: #1d4ed8;
}

#analyzeBtn:disabled {
  opacity: 0.55;
}

.analysis-result {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--cm-surface-2);
  color: var(--cm-text);
  border-radius: 6px;
  font-size: 0.875rem;
  line-height: 1.55;
}

.analysis-result.hidden {
  display: none;
}

.analysis-result h4 {
  margin: 0.9rem 0 0.35rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--cm-text-muted);
}

.analysis-result h4:first-child {
  margin-top: 0;
}

.analysis-result ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.analysis-overall {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  padding: 0.65rem 0.8rem;
  border-radius: 6px;
  background: var(--cm-surface);
  border-left: 4px solid var(--cm-text-muted);
}

.analysis-overall p {
  margin: 0;
  flex: 1 1 100%;
  font-weight: 500;
}

.analysis-level-excellent { border-left-color: #059669; }
.analysis-level-good { border-left-color: #2563eb; }
.analysis-level-fair { border-left-color: #d97706; }
.analysis-level-poor { border-left-color: #dc2626; }

.analysis-badge {
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--cm-text-muted);
}

.analysis-level-excellent .analysis-badge { background: #d1fae5; color: #065f46; }
.analysis-level-good .analysis-badge { background: #dbeafe; color: #1e40af; }
.analysis-level-fair .analysis-badge { background: #fef3c7; color: #92400e; }
.analysis-level-poor .analysis-badge { background: #fee2e2; color: #991b1b; }

.analysis-samples {
  font-size: 0.72rem;
  color: #94a3b8;
}

.analysis-flow {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.analysis-flow li {
  margin-bottom: 0.2rem;
}

.analysis-streams {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stream-card {
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-left: 4px solid var(--cm-text-muted);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  color: var(--cm-text);
}

.stream-card p {
  margin: 0.3rem 0 0;
  color: var(--cm-text);
}

.stream-dir {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--cm-text);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.stream-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  background: var(--cm-primary-soft);
  color: var(--cm-text);
}

.stream-excellent { border-left-color: #059669; }
.stream-good { border-left-color: #2563eb; }
.stream-fair { border-left-color: #d97706; }
.stream-poor { border-left-color: #dc2626; }
.stream-excellent .stream-badge { background: #d1fae5; color: #065f46; }
.stream-good .stream-badge { background: #dbeafe; color: #1e40af; }
.stream-fair .stream-badge { background: #fef3c7; color: #92400e; }
.stream-poor .stream-badge { background: #fee2e2; color: #991b1b; }

#callsTable.stale-data tbody {
  opacity: 0.78;
  filter: grayscale(0.2);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

#callsTable.stale-data .quality-pill,
#callsTable.stale-data .sip-ladder-btn {
  opacity: 1;
  filter: none;
}

.diag-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.diag-card.diag-collapsible {
  padding: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left-width: 4px;
  border-radius: 6px;
}

.diag-card.diag-collapsible > summary {
  list-style: none;
  cursor: pointer;
  display: block;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid transparent;
}

.diag-card.diag-collapsible > summary::-webkit-details-marker {
  display: none;
}

.diag-card.diag-collapsible > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.35rem;
  font-size: 0.75rem;
  color: var(--cm-text-muted);
  transition: transform 0.15s ease;
}

.diag-card.diag-collapsible[open] > summary::before {
  transform: rotate(90deg);
}

.diag-card.diag-collapsible .diag-body {
  padding: 0 0.75rem 0.65rem 1.35rem;
}

.diag-collapsed-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #92400e;
}

.diag-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #94a3b8;
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
}

.diag-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.3rem;
}

.diag-sev {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: #e2e8f0;
  color: #334155;
  flex-shrink: 0;
}

.diag-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: #1e293b;
}

.diag-line {
  font-size: 0.82rem;
  color: #475569;
  margin-top: 0.15rem;
}

.diag-key {
  display: inline-block;
  font-weight: 600;
  color: #334155;
  margin-right: 0.35rem;
}

.diag-key::after {
  content: ":";
}

.diag-high {
  border-left-color: #dc2626;
}

.diag-high .diag-sev {
  background: #fee2e2;
  color: #991b1b;
}

.diag-medium {
  border-left-color: #d97706;
}

.diag-medium .diag-sev {
  background: #fef3c7;
  color: #92400e;
}

.diag-low {
  border-left-color: #2563eb;
}

.diag-low .diag-sev {
  background: #dbeafe;
  color: #1e40af;
}

.diag-info {
  border-left-color: #0891b2;
}

.diag-info .diag-sev {
  background: #cffafe;
  color: #155e75;
}

.modal-panel-wide {
  max-width: min(96vw, 1280px);
  width: min(96vw, 1280px);
}

tbody tr.row-active:not([class*="row-call-color-"]) {
  background: var(--cm-surface);
}

tbody tr.row-ended:not([class*="row-call-color-"]) {
  background: var(--cm-surface-2);
  color: var(--cm-text-muted);
}

tbody tr.row-ended td {
  font-style: normal;
}

.status-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.status-active {
  background: #dbeafe;
  color: #1e40af;
}

.status-ended {
  background: #e2e8f0;
  color: #475569;
}

.bye-indicator {
  display: inline-block;
  margin-left: 0.35rem;
  color: #dc2626;
  font-size: 0.85rem;
  cursor: help;
}

.sip-ladder-btn {
  border: none;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}

.sip-ladder-btn:hover {
  background: #dbeafe;
}

.sip-muted {
  color: var(--cm-text-muted);
}

.sip-waiting {
  color: #d97706;
  cursor: help;
}

.col-start {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--cm-text);
  white-space: nowrap;
}

.sip-leg-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.sip-leg-title {
  font-weight: 700;
  font-size: 0.8rem;
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.3rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.sip-leg-heading {
  margin: 0.65rem 0 0.35rem;
  font-size: 0.85rem;
  color: var(--cm-text);
}

.sip-unavailable {
  color: #92400e;
  background: var(--cm-surface-2);
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  margin: 0.35rem 0;
  font-size: 0.85rem;
}

.sip-retry-banner {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.sip-retry-btn {
  border: 1px solid #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.sip-retry-btn:hover {
  background: #dbeafe;
}

.sip-debug {
  margin-top: 1rem;
  border-top: 1px dashed var(--cm-border-strong);
  padding-top: 0.5rem;
}

.sip-debug summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--cm-text-muted);
  font-weight: 600;
}

.sip-debug-block {
  margin-top: 0.5rem;
}

.sip-debug-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cm-text-muted);
  margin-bottom: 0.25rem;
}

.sip-debug-curl,
.sip-debug-body {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0.25rem 0;
  max-height: 200px;
  overflow-y: auto;
}

.sip-debug-curl {
  background: #1e293b;
  color: #bae6fd;
}

.sip-ladder {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.sip-msg {
  border: 1px solid var(--cm-border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  background: var(--cm-surface);
  color: var(--cm-text);
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.sip-msg:hover {
  border-color: var(--cm-primary);
  background: var(--cm-hover);
}

.sip-msg.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.sip-msg-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sip-msg-time {
  font-size: 0.72rem;
  color: var(--cm-text-muted);
  font-family: ui-monospace, monospace;
}

.sip-msg-kind {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  background: #e2e8f0;
  color: var(--cm-text-muted);
}

.sip-msg-kind.request {
  background: #dbeafe;
  color: #1e40af;
}

.sip-msg-kind.response {
  background: #fef3c7;
  color: #92400e;
}

.sip-msg-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--cm-text);
}

.sip-msg-route {
  font-size: 0.75rem;
  color: var(--cm-text-muted);
  margin-top: 0.15rem;
}

.sip-packet-detail {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow-y: auto;
}

.sip-packet-detail.hidden {
  display: none;
}

.sip-participants {
  margin: 0.5rem 0 0.75rem;
  padding: 0.55rem 0.65rem;
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  border-radius: 6px;
}

.sip-participants-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cm-text-muted);
  margin-bottom: 0.35rem;
}

.sip-participants-route {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}

.sip-participants-chip {
  background: var(--cm-surface);
  border: 1px solid var(--cm-border-strong);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
}

.sip-participants-arrow {
  color: var(--cm-text-muted);
}

.hosts-intro {
  margin-bottom: 0;
}

.hosts-toolbar {
  margin-bottom: 1rem;
}

.hosts-table-wrap {
  margin: 0;
}

.hosts-status {
  font-size: 0.875rem;
  color: var(--cm-text-muted);
  margin-left: auto;
}

.hosts-status.error {
  color: var(--cm-danger);
}

.hosts-table .col-actions {
  width: 6rem;
  text-align: right;
}

.hosts-table input,
.hosts-table .hosts-ip,
.hosts-table .hosts-name {
  width: 100%;
  min-width: 8rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--cm-border-strong);
  border-radius: var(--cm-radius-sm);
  font-family: var(--cm-mono);
  font-size: 0.8125rem;
  background: var(--cm-surface);
  color: var(--cm-text);
}

.hosts-table input:focus {
  outline: none;
  border-color: var(--cm-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.hosts-remove.btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
}

button.primary {
  background: var(--cm-primary);
  color: #fff;
  border-color: var(--cm-primary);
}

button.primary:hover {
  background: var(--cm-primary-hover);
}

.sip-view-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0.5rem 0 0.65rem;
}

.sip-view-tab {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--cm-border);
  background: var(--cm-surface);
  color: var(--cm-text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.sip-view-tab.active {
  background: var(--cm-primary);
  color: var(--cm-on-primary);
  border-color: var(--cm-primary);
}

.sip-leg-content {
  margin-top: 0.25rem;
}

.sip-messages-table {
  border: 1px solid var(--cm-border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.8rem;
}

.sip-messages-head,
.sip-messages-row {
  display: grid;
  grid-template-columns: 36px 92px 76px minmax(140px, 1.1fr) minmax(320px, 2.5fr) 36px;
  gap: 0.5rem;
  align-items: start;
  padding: 0.5rem 0.6rem;
}

.sip-messages-head {
  background: var(--cm-surface-2);
  font-weight: 600;
  color: var(--cm-text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sip-messages-row {
  border: none;
  border-top: 1px solid var(--cm-border);
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: var(--cm-surface);
  color: var(--cm-text);
}

.sip-messages-row:hover:not([class*="sip-call-color-"]) {
  background: var(--cm-row-hover);
}

.sip-row-request {
  border-left: none;
}

.sip-row-response {
  border-left: none;
}

.sip-row-rtp {
  border-left: none;
  color: inherit;
}

/* VoIPmonitor-style full-row backgrounds */
.sip-messages-row.sip-row-vm-neutral,
.sip-diagram-row.sip-row-vm-neutral {
  background-color: #e0e7ff !important;
  color: var(--cm-text);
}

.sip-messages-row.sip-row-vm-setup,
.sip-diagram-row.sip-row-vm-setup {
  background-color: #dbeafe !important;
  color: var(--cm-text);
}

.sip-messages-row.sip-row-vm-cancel,
.sip-diagram-row.sip-row-vm-cancel {
  background-color: #fde8e8 !important;
  color: var(--cm-text);
}

.sip-messages-row.sip-row-vm-terminated,
.sip-diagram-row.sip-row-vm-terminated {
  background-color: #fde8e8 !important;
  color: var(--cm-text);
}

.sip-messages-row.sip-row-vm-rtp,
.sip-diagram-row.sip-row-vm-rtp {
  background-color: #fde8e8 !important;
  color: var(--cm-text);
}

.sip-messages-row.sip-row-vm-update,
.sip-diagram-row.sip-row-vm-update {
  background-color: #dbeafe !important;
  color: var(--cm-text);
}

.sip-messages-row.sip-row-vm-sip,
.sip-diagram-row.sip-row-vm-sip {
  background-color: #ebe4f7 !important;
  color: var(--cm-text);
}

.sip-messages-row[class*="sip-row-vm-"]:hover,
.sip-diagram-row[class*="sip-row-vm-"]:hover {
  filter: brightness(0.98);
}

.sip-reason-sub {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #b45309;
  letter-spacing: 0.02em;
}

.sip-row-alert {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
  flex-shrink: 0;
}

.sip-alert-low {
  background: #94a3b8;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.5);
}

.sip-alert-medium {
  background: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.45);
}

.sip-alert-high {
  background: #dc2626;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.4);
}

.sip-messages-row.sip-row-sip-failure,
.sip-diagram-row.sip-row-sip-failure {
  background-color: rgba(220, 38, 38, 0.14) !important;
  box-shadow: inset 4px 0 0 #dc2626;
}

.sip-messages-row.sip-row-call-outcome,
.sip-diagram-row.sip-row-call-outcome {
  background-color: rgba(148, 163, 184, 0.16) !important;
  box-shadow: inset 4px 0 0 #64748b;
}

.sip-col-msg {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  font-size: 0.76rem;
}

.sip-col-route {
  font-size: 0.72rem;
  line-height: 1.3;
  word-break: break-word;
}

.sip-col-open {
  opacity: 0.55;
  text-align: center;
}

.sip-diagram {
  border: 1px solid var(--cm-border);
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.78rem;
}

.sip-diagram-header,
.sip-diagram-row {
  display: grid;
  grid-template-columns: 88px 76px minmax(280px, 2fr) minmax(220px, 1.5fr) 36px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
}

.sip-diagram-header {
  background: #f1f5f9;
  font-weight: 600;
  color: var(--cm-text-muted);
  border-bottom: 1px solid #e2e8f0;
}

.sip-diagram-row {
  border: none;
  border-top: 1px solid var(--cm-border);
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: var(--cm-surface);
}

.sip-diagram-row:hover:not([class*="sip-call-color-"]):not([class*="sip-row-vm-"]) {
  background: var(--cm-surface-2);
}

.sip-diagram-ip-row {
  overflow: hidden;
}

.sip-diagram-ip-inner {
  display: grid;
  grid-template-columns: repeat(var(--sip-cols, 2), minmax(64px, 1fr));
  gap: 0.25rem;
}

.sip-diagram-ip {
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  color: var(--cm-text-muted);
  padding: 0.2rem 0.15rem;
  line-height: 1.25;
  word-break: break-word;
}

.sip-diagram-lanes-cell {
  min-width: 280px;
  overflow: hidden;
}

.sip-messages-row.sip-row-static,
.sip-diagram-row.sip-row-static {
  cursor: default;
}

.sip-messages-row.sip-row-static:hover,
.sip-diagram-row.sip-row-static:hover {
  background: inherit;
}

.sip-row-vm-rtp .sip-col-num {
  color: #b91c1c;
  font-weight: 600;
}

.sip-diagram-lanes {
  display: grid;
  grid-template-columns: repeat(var(--sip-cols, 2), 1fr);
  position: relative;
  min-height: 28px;
  align-items: center;
}

.sip-diagram-col .lifeline {
  border-left: 2px solid #cbd5e1;
  height: 100%;
  min-height: 34px;
  margin: 0 auto;
  width: 0;
}

.sip-diagram-arrow-line {
  position: absolute;
  top: 50%;
  height: 2px;
  background: #3b82f6;
  transform: translateY(-50%);
  pointer-events: none;
}

.sip-diagram-arrow-line.dir-right::after,
.sip-diagram-arrow-line.dir-left::before {
  content: "";
  position: absolute;
  top: -4px;
  border: 5px solid transparent;
}

.sip-diagram-arrow-line.dir-right::after {
  right: -2px;
  border-left-color: #3b82f6;
}

.sip-diagram-arrow-line.dir-left::before {
  left: -2px;
  border-right-color: #3b82f6;
}

.sip-diagram-arrow-line.sip-arrow-request,
.sip-diagram-row.sip-row-request .sip-diagram-arrow-line {
  background: #3b82f6;
}

.sip-diagram-arrow-line.sip-arrow-response,
.sip-diagram-row.sip-row-response .sip-diagram-arrow-line {
  background: var(--cm-text);
}

.sip-diagram-arrow-line.sip-arrow-response.dir-right::after {
  border-left-color: var(--cm-text);
}

.sip-diagram-arrow-line.sip-arrow-response.dir-left::before {
  border-right-color: var(--cm-text);
}

.sip-diagram-arrow-line.sip-arrow-rtp,
.sip-diagram-row.sip-row-rtp .sip-diagram-arrow-line {
  background: #f97316;
}

.sip-diagram-arrow-line.sip-arrow-rtp.dir-right::after {
  border-left-color: #f97316;
}

.sip-diagram-arrow-line.sip-arrow-rtp.dir-left::before {
  border-right-color: #f97316;
}

.sip-diagram-label {
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
}

.sip-packet-panel {
  max-width: 920px;
  width: min(92vw, 920px);
}

.sip-packet-context {
  margin: 0.75rem 0 1rem;
  padding: 1rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--cm-border);
  background: var(--cm-surface-2);
  color: var(--cm-text);
  font-size: 0.88rem;
  line-height: 1.5;
}

.sip-packet-context.hidden {
  display: none;
}

.sip-packet-context.severity-error {
  border-color: #fecaca;
  background: #fef2f2;
}

.sip-packet-context.severity-warning {
  border-color: #fde68a;
  background: var(--cm-surface-2);
}

.sip-packet-context-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--cm-text);
}

.sip-packet-context-summary {
  margin: 0 0 0.65rem;
  color: var(--cm-text);
  font-weight: 500;
}

.sip-packet-context-block {
  margin: 0.5rem 0 0;
  color: var(--cm-text-muted);
}

.sip-packet-context-block strong {
  color: var(--cm-text);
}

.sip-packet-context-list {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
  color: var(--cm-text-muted);
}

.sip-packet-context-pass {
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-size: 0.82rem;
}

.sip-call-story-wrap {
  margin: 0.75rem 0 1rem;
}

.sip-call-story-wrap .sip-call-story {
  margin: 0;
}

.sip-codec-diff {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--cm-border-strong);
  background: var(--cm-surface);
}

.sip-codec-diff.verdict-no_overlap {
  border-color: #fca5a5;
  background: var(--cm-surface);
}

.sip-codec-diff.verdict-overlap_exists {
  border-color: #fcd34d;
  background: var(--cm-surface);
}

.sip-codec-diff-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--cm-text);
  margin-bottom: 0.65rem;
}

.sip-codec-diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .sip-codec-diff-grid {
    grid-template-columns: 1fr;
  }
}

.sip-codec-diff-head {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cm-text-muted);
  margin-bottom: 0.4rem;
}

.sip-codec-packet {
  font-weight: 400;
  color: var(--cm-text-muted);
}

.sip-codec-diff-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.sip-codec-chip {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.3;
}

.sip-codec-chip.sip-codec-shared {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.sip-codec-chip.sip-codec-caller {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.sip-codec-chip.sip-codec-callee {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
}

.sip-codec-chip.sip-codec-missing {
  background: #f1f5f9;
  color: var(--cm-text-muted);
  border: 1px dashed #cbd5e1;
  font-style: italic;
}

.sip-codec-overlap {
  margin-top: 0.65rem;
  font-size: 0.82rem;
}

.sip-codec-overlap-label {
  font-weight: 600;
  color: #166534;
}

.sip-codec-only {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--cm-text-muted);
}

.sip-codec-diff-verdict {
  margin: 0.65rem 0 0;
  font-size: 0.84rem;
  color: var(--cm-text-muted);
  line-height: 1.45;
}

.sip-glossary {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--cm-border);
  border-radius: 8px;
  background: #fafafa;
  font-size: 0.84rem;
}

.sip-glossary summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--cm-text-muted);
  user-select: none;
}

.sip-glossary-list {
  margin: 0.65rem 0 0;
  padding: 0;
}

.sip-glossary-list dt {
  font-weight: 600;
  color: var(--cm-text);
  margin-top: 0.55rem;
}

.sip-glossary-list dt:first-child {
  margin-top: 0;
}

.sip-glossary-list dd {
  margin: 0.15rem 0 0;
  color: var(--cm-text-muted);
  line-height: 1.45;
}

.sip-call-story {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--cm-border-strong);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.sip-call-story.scenario-completed {
  border-color: #86efac;
  background: linear-gradient(180deg, #f0fdf4 0%, #ecfdf5 100%);
}

.sip-call-story.scenario-failed,
.sip-call-story.scenario-busy,
.sip-call-story.scenario-declined,
.sip-call-story.scenario-codec_mismatch,
.sip-call-story.scenario-unavailable,
.sip-call-story.scenario-not_found,
.sip-call-story.scenario-forbidden {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fef2f2 0%, #fff1f2 100%);
}

.sip-call-story.scenario-cancelled {
  border-color: #fde68a;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
}

.sip-call-story-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--cm-text);
}

.sip-call-story-summary {
  margin: 0;
  color: var(--cm-text-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.sip-call-story-bullets {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  color: var(--cm-text-muted);
  font-size: 0.84rem;
}

.sip-call-insights {
  margin: 0.65rem 0 0;
  padding-left: 0;
  list-style: none;
}

.sip-call-insights .sip-insight {
  margin: 0.4rem 0 0;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.sip-insight-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}

.sip-insight-warning {
  background: var(--cm-surface-2);
  border: 1px solid #fde68a;
  color: #92400e;
}

.sip-insight-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.sip-col-hint {
  display: block;
  margin-top: 0.2rem;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.72rem;
  color: var(--cm-text-muted);
  line-height: 1.35;
}

.sip-diagram-hint {
  display: block;
  margin-top: 0.15rem;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.68rem;
  color: var(--cm-text-muted);
  line-height: 1.3;
}

.sip-row-bye-first {
  border-left-color: #dc2626 !important;
  background: #fef2f2 !important;
}

.sip-row-bye-first:hover {
  background: #fee2e2 !important;
}

.sip-row-bye-first .sip-col-msg,
.sip-row-bye-first .sip-diagram-label {
  color: #991b1b;
}

.sip-row-bye-first .sip-col-hint,
.sip-row-bye-first .sip-diagram-hint {
  color: #b91c1c;
  font-weight: 500;
}

.sip-packet-body {
  margin: 0;
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 8px;
  max-height: 70vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* —— Section help modal —— */
.import-status {
  font-size: 0.8125rem;
  color: var(--cm-text-muted);
}

.import-status.is-error {
  color: var(--cm-danger);
}

/* —— History card —— */
.card-history,
.card-history .card-body,
.history-controls {
  overflow: visible;
}

.history-controls-main {
  --history-input-offset: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.5rem 0.55rem;
  overflow: visible;
  padding-bottom: 0.15rem;
}

.card-history.is-group-open {
  overflow: visible;
}

.history-group-combobox .group-options {
  position: fixed;
  z-index: 1200;
  max-width: min(40rem, calc(100vw - 1.5rem));
}

.history-group-combobox .group-options:not(.hidden) {
  display: block;
}

.history-controls-main > .history-field,
.history-controls-main > .history-group-combobox,
.history-controls-main > .history-from-stack,
.history-controls-main > .history-checkbox {
  flex: 0 0 auto;
}

.history-import-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 0.85rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--cm-border);
}

.history-import-field {
  flex: 1 1 14rem;
  max-width: 28rem;
}

.history-import-input {
  font-family: var(--cm-mono);
  min-width: 10rem;
}

.history-group-combobox {
  position: relative;
  flex: 0 0 28rem;
  width: 28rem;
  min-width: 18rem;
  max-width: 32rem;
  margin-bottom: 0;
}

.history-group-combobox .group-combobox-label {
  margin-bottom: 0.25rem;
}

.history-group-combobox .group-combobox-input {
  padding: 0.45rem 0.55rem;
  font-size: 0.875rem;
  width: 100%;
  max-width: none;
}

.history-from-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  flex: 0 0 auto;
}

.history-from-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.4rem;
}

.history-from-stack .history-range-presets {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: nowrap;
  max-width: none;
}

.history-from-stack .history-range-presets .history-field-label {
  font-size: 0.7rem;
  flex-shrink: 0;
}

.history-from-stack .history-preset {
  font-size: 0.68rem;
  padding: 0.12rem 0.38rem;
  line-height: 1.2;
}

.history-preset.is-active {
  color: #fff;
  background: var(--cm-primary);
  border-color: var(--cm-primary);
}

.history-field-date {
  position: relative;
}

.history-field-date .history-text-input {
  width: 10.75rem;
  min-width: 9.5rem;
  font-size: 1rem;
}

.history-field-date .task-due-cal {
  z-index: 80;
}

.history-date-cal-end {
  left: auto;
  right: 0;
}

.history-field-narrow .history-text-input {
  width: 6.75rem;
  min-width: 5.5rem;
}

.history-load-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.history-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8125rem;
}

.history-field-label {
  font-weight: 600;
  color: var(--cm-text-muted);
}

.history-field select,
.history-text-input {
  font: inherit;
  font-size: 0.875rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  min-width: 5rem;
}

.history-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  margin-top: var(--history-input-offset);
  height: 2.05rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.history-controls-main > .history-load-btn {
  margin-top: var(--history-input-offset);
  margin-left: 0;
}

.history-status {
  margin-top: 0.65rem;
  font-size: 0.8125rem;
  color: var(--cm-text-muted);
}

.history-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.history-kpi-row.hidden {
  display: none;
}

.history-kpi-card {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  background: var(--cm-surface);
  min-width: 0;
}

.history-kpi-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cm-text-muted);
}

.history-kpi-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--cm-text);
  line-height: 1.2;
}

.history-kpi-hint {
  font-size: 0.68rem;
  color: var(--cm-text-muted);
  line-height: 1.25;
}

.history-kpi-good {
  border-left: 3px solid #059669;
}

.history-kpi-warn {
  border-left: 3px solid #d97706;
}

.history-kpi-bad {
  border-left: 3px solid #dc2626;
}

.history-kpi-neutral {
  border-left: 3px solid #94a3b8;
}

.history-insights {
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: var(--cm-primary-soft);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  font-size: 0.78rem;
  color: var(--cm-text);
}

.history-insights.hidden {
  display: none;
}

.history-insights-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
  color: var(--cm-primary);
}

.history-insights-list {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.45;
}

.history-insights-list li + li {
  margin-top: 0.2rem;
}

.history-charts-summary {
  font-size: 0.78rem;
  color: var(--cm-text-muted);
  margin-top: 0.85rem;
  margin-bottom: 0.35rem;
}

.history-charts {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.35rem;
}

.sparkline-box {
  width: 100%;
  max-width: none;
  min-width: 0;
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  padding: 0.45rem 0.55rem 0.35rem;
}

.sparkline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}

.sparkline-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cm-text-muted);
}

.sparkline-value {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cm-text);
  white-space: nowrap;
}

.sparkline-caption {
  font-size: 0.68rem;
  color: var(--cm-text-muted);
  margin-top: 0.2rem;
  line-height: 1.3;
  white-space: normal;
}

.sparkline-box canvas {
  width: 100%;
  height: 96px;
  display: block;
  cursor: crosshair;
}

.history-field-hour .history-hour-select {
  min-width: 5.5rem;
}

/* Custom hour picker (replaces native <select> so its popup can't be
   clipped or re-anchored by the browser). The native <select> is kept in
   the DOM as the value source but hidden. */
.hour-native-hidden {
  display: none;
}

.hour-combobox {
  position: relative;
  display: inline-block;
}

.hour-combobox-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-width: 6rem;
  font: inherit;
  font-size: 0.875rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  background: var(--cm-surface);
  color: var(--cm-text);
  cursor: pointer;
  text-align: left;
}

.hour-combobox-btn:focus,
.hour-combobox-btn:focus-visible {
  outline: none;
  border-color: var(--cm-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

.hour-combobox-value {
  flex: 1 1 auto;
}

.hour-combobox-caret {
  width: 0;
  height: 0;
  flex-shrink: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.55;
}

.hour-options {
  position: fixed;
  z-index: 1200;
  margin: 0;
  padding: 0.3rem 0;
  list-style: none;
  min-width: 6rem;
  max-height: 15rem;
  overflow-y: auto;
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  box-shadow: var(--cm-shadow-lg);
}

.hour-options.hidden {
  display: none;
}

.hour-option {
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  color: var(--cm-text);
}

.hour-option:hover,
.hour-option.is-active {
  background: #eff6ff;
}

.hour-option[aria-selected="true"] {
  font-weight: 600;
  color: var(--cm-primary);
}

.history-range-presets {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.heatmap-timeline-row {
  margin-bottom: 0.65rem;
}

.heatmap-row-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cm-text-muted);
  margin-bottom: 0.25rem;
}

.table-wrap {
  position: relative;
}

.table-wrap.is-loading {
  min-height: 8rem;
}

.call-log-loading-row td {
  background: var(--cm-primary-soft);
  color: var(--cm-primary);
  font-weight: 600;
  text-align: center;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--cm-border);
}

.call-log-loading {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: var(--cm-overlay);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--cm-text);
}

.call-log-loading.hidden {
  display: none;
}

.call-log-loading-spinner {
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid #cbd5e1;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: cm-spin 0.7s linear infinite;
}

@keyframes cm-spin {
  to { transform: rotate(360deg); }
}

.heatmap-block {
  margin-bottom: 1rem;
}

.heatmap-block-issues {
  padding-top: 0.75rem;
  border-top: 1px dashed var(--cm-border);
}

.history-heatmap-wrap {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--cm-border);
}

.heatmap-section-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
}

.heatmap-section-head strong {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cm-text-muted);
}

.heatmap-section-head span {
  color: var(--cm-text-muted);
  font-size: 0.72rem;
}

.history-heatmap-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1.35rem;
  justify-content: start;
  gap: 3px;
}

.heatmap-hour-labels {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1.35rem;
  justify-content: start;
  gap: 3px;
  margin-top: 0.2rem;
}

.heatmap-hour-labels span {
  font-size: 0.62rem;
  color: var(--cm-text-muted);
  text-align: center;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
  flex-wrap: wrap;
}

.heatmap-legend-label {
  font-size: 0.68rem;
  color: var(--cm-text-muted);
}

.heatmap-legend-swatch {
  width: 1.25rem;
  height: 0.65rem;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.heatmap-swatch-low {
  background: #f1f5f9;
}

.heatmap-swatch-mid {
  background: rgba(220, 38, 38, 0.35);
}

.heatmap-swatch-high {
  background: rgba(220, 38, 38, 0.85);
}

.heatmap-swatch-vol-low {
  background: rgba(37, 99, 235, 0.25);
}

.heatmap-swatch-vol-mid {
  background: rgba(37, 99, 235, 0.55);
}

.heatmap-swatch-vol-high {
  background: rgba(37, 99, 235, 0.85);
}

.heatmap-cell {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 3px;
  background: var(--cm-border);
  position: relative;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.heatmap-cell-selected {
  box-shadow: 0 0 0 2px #2563eb, 0 0 0 4px rgba(37, 99, 235, 0.25);
  transform: scale(1.08);
  z-index: 2;
}

.heatmap-cell-selected.heatmap-cell-hover {
  box-shadow: 0 0 0 2px #2563eb, 0 0 0 4px rgba(37, 99, 235, 0.35);
}

.heatmap-cell-hover:not(.heatmap-cell-selected) {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.45);
  z-index: 1;
}

.heatmap-legend-hint {
  font-size: 0.68rem;
  color: var(--cm-text-muted);
  margin-left: auto;
}

.heatmap-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-top: 0.65rem;
  padding: 0.5rem 0.65rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--cm-radius-sm);
}

.heatmap-filter-bar.hidden {
  display: none;
}

.heatmap-filter-label {
  font-size: 0.8125rem;
  color: #1e40af;
  flex: 1 1 12rem;
}

.btn-sm {
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
}

.heatmap-cell[data-count="0"] {
  background: #f1f5f9;
}

.data-table th.col-draggable {
  cursor: grab;
  user-select: none;
  padding-right: 0.35rem;
}

.data-table th.col-draggable:active {
  cursor: grabbing;
}

.data-table th.th-dragging {
  opacity: 0.55;
}

.data-table th.th-drag-over {
  box-shadow: inset 2px 0 0 #2563eb;
}

.col-resizer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  user-select: none;
}

.col-resizer:hover {
  background: rgba(37, 99, 235, 0.18);
}

.data-table td.col-index,
.data-table th.col-index-header {
  text-align: center;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  color: var(--cm-text-muted);
  font-size: 0.72rem;
}

/* —— Filter bar —— */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--cm-border);
  background: var(--cm-surface-2);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.filter-field-grow {
  flex: 1 1 12rem;
  min-width: 10rem;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--cm-text-muted);
}

.filter-input {
  font: inherit;
  font-size: 0.875rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  min-width: 7rem;
}

.filter-quality-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.filter-quality-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.btn-filter-quality {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  background: var(--cm-surface);
  color: var(--cm-text);
  cursor: pointer;
  white-space: nowrap;
}

.btn-filter-quality:hover {
  background: var(--cm-hover);
}

.btn-filter-quality.active {
  border-color: #d97706;
  background: #fffbeb;
  color: #92400e;
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.25);
}

.btn-filter-sip-failure.active {
  border-color: #dc2626;
  background: #fee2e2;
  color: #991b1b;
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.2);
}

/* —— Column picker —— */
.table-header-actions {
  position: relative;
}

.column-picker-btn {
  font-size: 1.1rem;
  padding: 0.35rem 0.55rem;
}

.column-picker {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 30;
  min-width: 12rem;
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  box-shadow: var(--cm-shadow-lg);
  padding: 0.5rem 0.65rem;
  color: var(--cm-text);
}

.column-picker label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  padding: 0.25rem 0;
  cursor: pointer;
}

/* —— Row colors & alerts —— */
.data-table tbody tr[class*="row-call-color-"] {
  transition: background 0.12s ease;
}

.data-table tbody tr.row-active.row-call-color-0,
.data-table tbody tr.row-ended.row-call-color-0 {
  background-color: rgba(59, 130, 246, 0.14);
  box-shadow: inset 4px 0 0 #3b82f6;
}
.data-table tbody tr.row-active.row-call-color-1,
.data-table tbody tr.row-ended.row-call-color-1 {
  background-color: rgba(5, 150, 105, 0.14);
  box-shadow: inset 4px 0 0 #059669;
}
.data-table tbody tr.row-active.row-call-color-2,
.data-table tbody tr.row-ended.row-call-color-2 {
  background-color: rgba(217, 119, 6, 0.15);
  box-shadow: inset 4px 0 0 #d97706;
}
.data-table tbody tr.row-active.row-call-color-3,
.data-table tbody tr.row-ended.row-call-color-3 {
  background-color: rgba(124, 58, 237, 0.14);
  box-shadow: inset 4px 0 0 #7c3aed;
}
.data-table tbody tr.row-active.row-call-color-4,
.data-table tbody tr.row-ended.row-call-color-4 {
  background-color: rgba(219, 39, 119, 0.14);
  box-shadow: inset 4px 0 0 #db2777;
}
.data-table tbody tr.row-active.row-call-color-5,
.data-table tbody tr.row-ended.row-call-color-5 {
  background-color: rgba(8, 145, 178, 0.14);
  box-shadow: inset 4px 0 0 #0891b2;
}
.data-table tbody tr.row-active.row-call-color-6,
.data-table tbody tr.row-ended.row-call-color-6 {
  background-color: rgba(101, 163, 13, 0.15);
  box-shadow: inset 4px 0 0 #65a30d;
}
.data-table tbody tr.row-active.row-call-color-7,
.data-table tbody tr.row-ended.row-call-color-7 {
  background-color: rgba(71, 85, 105, 0.12);
  box-shadow: inset 4px 0 0 #475569;
}

.data-table tbody tr[class*="row-call-color-"] td {
  background-color: transparent;
}

.data-table tbody tr[class*="row-call-color-"]:hover:not(.empty-row) {
  filter: brightness(0.98);
}

/* SIP ladder rows — hop tints (Call-ID + from/to IP pair) */
.sip-messages-row[class*="sip-call-color-"],
.sip-diagram-row[class*="sip-call-color-"] {
  transition: background 0.12s ease, filter 0.12s ease;
}

.sip-messages-row.sip-call-color-0,
.sip-diagram-row.sip-call-color-0 {
  background-color: rgba(37, 99, 235, 0.16) !important;
  box-shadow: inset 4px 0 0 #2563eb;
  color: var(--cm-text);
}
.sip-messages-row.sip-call-color-1,
.sip-diagram-row.sip-call-color-1 {
  background-color: rgba(5, 150, 105, 0.16) !important;
  box-shadow: inset 4px 0 0 #059669;
  color: var(--cm-text);
}
.sip-messages-row.sip-call-color-2,
.sip-diagram-row.sip-call-color-2 {
  background-color: rgba(234, 88, 12, 0.16) !important;
  box-shadow: inset 4px 0 0 #ea580c;
  color: var(--cm-text);
}
.sip-messages-row.sip-call-color-3,
.sip-diagram-row.sip-call-color-3 {
  background-color: rgba(190, 24, 93, 0.15) !important;
  box-shadow: inset 4px 0 0 #be185d;
  color: var(--cm-text);
}
.sip-messages-row.sip-call-color-4,
.sip-diagram-row.sip-call-color-4 {
  background-color: rgba(13, 148, 136, 0.16) !important;
  box-shadow: inset 4px 0 0 #0d9488;
  color: var(--cm-text);
}
.sip-messages-row.sip-call-color-5,
.sip-diagram-row.sip-call-color-5 {
  background-color: rgba(202, 138, 4, 0.18) !important;
  box-shadow: inset 4px 0 0 #ca8a04;
  color: var(--cm-text);
}
.sip-messages-row.sip-call-color-6,
.sip-diagram-row.sip-call-color-6 {
  background-color: rgba(79, 70, 229, 0.14) !important;
  box-shadow: inset 4px 0 0 #4f46e5;
  color: var(--cm-text);
}
.sip-messages-row.sip-call-color-7,
.sip-diagram-row.sip-call-color-7 {
  background-color: rgba(100, 116, 139, 0.16) !important;
  box-shadow: inset 4px 0 0 #64748b;
  color: var(--cm-text);
}

.sip-messages-row[class*="sip-call-color-"]:hover:not(.sip-row-bye-first),
.sip-diagram-row[class*="sip-call-color-"]:hover:not(.sip-row-bye-first) {
  filter: brightness(0.98);
}

.sip-leg-section[class*="sip-call-color-"] {
  border-left: 4px solid transparent;
  padding-left: 0.5rem;
  margin-left: -0.25rem;
}

.sip-leg-section.sip-call-color-0 { border-left-color: #3b82f6; }
.sip-leg-section.sip-call-color-1 { border-left-color: #059669; }
.sip-leg-section.sip-call-color-2 { border-left-color: #d97706; }
.sip-leg-section.sip-call-color-3 { border-left-color: #7c3aed; }
.sip-leg-section.sip-call-color-4 { border-left-color: #db2777; }
.sip-leg-section.sip-call-color-5 { border-left-color: #0891b2; }
.sip-leg-section.sip-call-color-6 { border-left-color: #65a30d; }
.sip-leg-section.sip-call-color-7 { border-left-color: var(--cm-text-muted); }

.col-start {
  line-height: 1.25;
  white-space: normal !important;
}

.start-date {
  display: block;
  font-size: 0.72rem;
  color: var(--cm-text-muted);
  font-variant-numeric: tabular-nums;
}

.start-time {
  display: block;
  font-family: var(--cm-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.anomaly-long_pdd { box-shadow: inset 0 -2px 0 #f59e0b; }
.anomaly-high_loss { box-shadow: inset 0 -2px 0 #ef4444; }
.anomaly-many_invites { box-shadow: inset 0 -2px 0 #8b5cf6; }
.anomaly-auth_failure { box-shadow: inset 0 -2px 0 #dc2626; }
.anomaly-codec_mismatch { box-shadow: inset 0 -2px 0 #ea580c; }
.anomaly-hold { box-shadow: inset 0 -2px 0 #0ea5e9; }
.anomaly-transfer { box-shadow: inset 0 -2px 0 #6366f1; }

.party-number {
  display: block;
  font-family: var(--cm-mono);
  font-size: 0.8125rem;
}

.party-name {
  display: block;
  font-size: 0.72rem;
  color: var(--cm-text-muted);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.alert-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}

.alert-originator_cancel {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fdba74;
}

.alert-failed_sip {
  background: #fee2e2;
  color: #991b1b;
}

.alert-poor_mos {
  background: #fef3c7;
  color: #92400e;
}

.alert-not_connected {
  background: #e2e8f0;
  color: #475569;
}

.alert-attended_transfer {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
}

.alert-mvno_ipv6,
.alert-telenet {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.alert-ext_org {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
}

.dtmf-cell {
  font-family: var(--cm-mono);
  letter-spacing: 0.08em;
}

/* —— SIP operator (CRDC) bar —— */
.sip-operator-bar {
  margin: 0.35rem 0 0.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.84rem;
}

.sip-operator-bar.hidden {
  display: none;
}

.sip-operator-party {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.sip-operator-party-label {
  font-weight: 600;
  color: var(--cm-text);
}

.sip-operator-party-number {
  font-family: var(--cm-mono, ui-monospace, monospace);
  font-size: 0.8rem;
  color: var(--cm-text-muted);
}

.sip-operator-result {
  color: var(--cm-text);
}

.sip-operator-result.is-error {
  color: #b91c1c;
}

.sip-operator-result.is-muted {
  color: var(--cm-text-muted);
}

.sip-operator-source {
  font-size: 0.75rem;
  color: var(--cm-text-muted);
}

/* —— SIP invite banner —— */
.sip-invite-banner {
  margin: 0.5rem 0 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--cm-primary-soft);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  font-size: 0.875rem;
  color: var(--cm-text);
}

.sip-invite-banner.hidden {
  display: none;
}

.sip-invite-banner-title {
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.sip-invite-banner-meta {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--cm-text-muted);
}

/* —— Help modal —— */
.help-content h3 {
  margin: 1rem 0 0.35rem;
  font-size: 0.9rem;
}

.help-content h3:first-child {
  margin-top: 0;
}

.help-content p,
.help-content ul {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--cm-text);
}

.help-content ul {
  padding-left: 1.2rem;
}

.help-content kbd {
  font-family: var(--cm-mono);
  font-size: 0.78rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--cm-border);
  border-radius: 4px;
  background: var(--cm-surface-2);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.assistant-card {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 8rem);
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
}

.app-page-assistant .app-scroll {
  display: flex;
  flex-direction: column;
}

.app-page-assistant .app-main {
  flex: 1;
  min-height: 0;
  max-width: none;
  padding: 1.5rem 1.25rem;
}

.app-page-assistant .assistant-card {
  flex: 1;
  min-height: 0;
}

.assistant-thread {
  flex: 1;
  overflow-y: auto;
  overflow-anchor: none;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.assistant-msg {
  max-width: 92%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--cm-radius);
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.45;
}

.assistant-msg-user {
  align-self: flex-end;
  background: var(--cm-primary-soft);
  color: var(--cm-text);
}

.assistant-msg-bot {
  align-self: flex-start;
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  color: var(--cm-text);
  max-width: 100%;
  width: 100%;
}

.assistant-typing {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.28rem;
  width: auto;
  max-width: 28rem;
  padding: 0.75rem 0.95rem;
  white-space: normal;
}

.assistant-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.assistant-typing-status {
  font-size: inherit;
  color: var(--cm-text-muted);
  line-height: 1.35;
}

.assistant-typing-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--cm-text-muted);
  animation: assistant-typing-bounce 1.15s infinite ease-in-out;
}

.assistant-typing-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.assistant-typing-dot:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes assistant-typing-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-0.28rem);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-typing-dot {
    animation: none;
    opacity: 0.65;
  }
}

.assistant-itglue {
  margin-top: 0.65rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--cm-border);
  white-space: normal;
}

.assistant-itglue-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.assistant-itglue-org > summary.assistant-itglue-title {
  margin-bottom: 0;
  font-weight: 700;
}

.assistant-itglue-more {
  margin-top: 0.35rem;
  color: var(--cm-text-muted);
}

.assistant-fold {
  border: 1px solid var(--cm-border);
  border-radius: 8px;
  margin: 0.3rem 0;
  padding: 0.2rem 0.55rem 0.35rem;
  background: var(--cm-surface);
  color: var(--cm-text);
}

.assistant-fold > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: inherit;
  padding: 0.2rem 0;
  color: var(--cm-text);
}

.assistant-fold-line {
  font-size: inherit;
  margin: 0.15rem 0;
  color: var(--cm-text);
}

.assistant-fold-item {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--cm-border);
}

.assistant-fold-item:last-child {
  border-bottom: 0;
  padding-bottom: 0.15rem;
}

.assistant-fold-meta {
  margin: 0.1rem 0 0;
  color: var(--cm-text-muted);
  line-height: 1.4;
}

.assistant-tree {
  margin: 0.15rem 0 0.2rem 0.2rem;
  padding-left: 1rem;
  font-size: inherit;
}

.assistant-tree ul {
  margin: 0.1rem 0 0.1rem 0.75rem;
  padding-left: 0.75rem;
}

.assistant-msg-bot strong {
  font-weight: 700;
}

.assistant-msg-bot a {
  color: var(--cm-primary, #1d4ed8);
  word-break: break-all;
}

.assistant-msg-bot .assistant-ticket-title a {
  word-break: normal;
}

.assistant-group-actions {
  display: block;
  margin: 0.15rem 0 0.55rem;
  font-size: inherit;
}

.assistant-group-actions a {
  word-break: normal;
}

.assistant-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.assistant-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--cm-border);
}

.assistant-threads {
  width: 14rem;
  flex-shrink: 0;
  border-right: 1px solid var(--cm-border);
  padding: 0.75rem 0.6rem;
  overflow-y: auto;
  background: var(--cm-surface-2);
}

.assistant-threads-label {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cm-text-muted);
}

.assistant-thread-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.assistant-thread-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.82rem;
  color: var(--cm-text);
  cursor: pointer;
}

.assistant-thread-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-thread-item:hover,
.assistant-thread-item.is-active {
  background: var(--cm-surface);
  box-shadow: inset 0 0 0 1px var(--cm-border);
}

.assistant-thread-delete {
  flex-shrink: 0;
  color: #94a3b8;
  font-size: 1.05rem;
  line-height: 1;
}

.assistant-thread-delete:hover {
  color: #94a3b8;
}

.assistant-chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.assistant-company {
  margin: 0.35rem 0 0.9rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--cm-border);
  white-space: normal;
}

.assistant-company:last-child {
  border-bottom: 0;
}

.assistant-company-title {
  font-weight: 700;
  font-size: inherit;
  margin: 0 0 0.2rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
}

.assistant-group-domain {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.assistant-impersonate-wrap {
  margin: 0;
}

.impersonate-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  padding: 0.28rem 0.95rem 0.28rem 0.7rem;
  border-radius: 999px;
  background: #bfa771;
  color: #fff !important;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  line-height: 1.2;
  word-break: normal;
}

.impersonate-btn:hover {
  background: #b3965f;
  color: #fff !important;
}

.impersonate-btn-icon.svg-inline--fa {
  width: 0.875em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  overflow: visible;
}

.assistant-vm {
  margin: 0.35rem 0 0.2rem;
}

.assistant-section-label {
  font-weight: 700;
  margin: 0.4rem 0 0.2rem;
}

.assistant-ticket {
  margin: 0 0 0.85rem;
}

.assistant-ticket:last-child {
  margin-bottom: 0.2rem;
}

@media (max-width: 800px) {
  .assistant-layout {
    flex-direction: column;
  }
  .assistant-threads {
    width: auto;
    max-height: 8rem;
    border-right: 0;
    border-bottom: 1px solid var(--cm-border);
  }
}

.assistant-compose {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem 1rem;
  border-top: 1px solid var(--cm-border);
}

.assistant-compose textarea {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 2.6rem;
  max-height: 8rem;
  resize: vertical;
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--cm-border-strong);
  border-radius: var(--cm-radius-sm);
}

.logs-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
}

.logs-tab {
  border: 1px solid var(--cm-border);
  background: var(--cm-surface-2);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--cm-text);
}

.logs-tab.is-active {
  background: var(--cm-surface);
  box-shadow: inset 0 0 0 1px var(--cm-border-strong);
  font-weight: 600;
  color: var(--cm-text);
}

.logs-app-pre {
  margin: 0;
  max-height: min(70vh, 40rem);
  overflow: auto;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--cm-border);
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.logs-sip-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.45rem;
}

.logs-sip-presets-label {
  font-size: 0.72rem;
  color: var(--cm-text-muted);
  margin-right: 0.15rem;
}

.logs-sip-preset {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  min-height: 36px;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--cm-border);
  background: var(--cm-surface);
  color: var(--cm-text-muted);
  cursor: pointer;
}

.logs-sip-preset:hover,
.logs-sip-preset.is-active {
  border-color: color-mix(in srgb, var(--cm-primary) 50%, var(--cm-border));
  color: var(--cm-primary);
  background: color-mix(in srgb, var(--cm-primary) 12%, var(--cm-surface));
}

.logs-sip-preset.logs-sip-dir-in.is-active {
  border-color: rgba(103, 232, 249, 0.55);
  color: #67e8f9;
  background: rgba(103, 232, 249, 0.12);
}

.logs-sip-preset.logs-sip-dir-out.is-active {
  border-color: rgba(253, 186, 116, 0.55);
  color: #fdba74;
  background: rgba(253, 186, 116, 0.12);
}

.logs-sip-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.logs-sip-toolbar input[type="search"] {
  flex: 1;
  min-width: 10rem;
  min-height: 44px;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--cm-border);
  background: var(--cm-bg);
  color: var(--cm-text);
}

.logs-sip-toolbar #logsSipExt {
  width: 5.5rem;
  flex: 0 0 auto;
  min-height: 44px;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--cm-border);
  background: var(--cm-bg);
  color: var(--cm-text);
}

.logs-sip-meta {
  font-size: 0.72rem;
  color: var(--cm-text-muted);
  white-space: nowrap;
}

#logsSipPause.is-paused {
  border-color: rgba(253, 224, 71, 0.55);
  color: #ca8a04;
  background: rgba(253, 224, 71, 0.12);
}

.logs-sip-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  background: #070a10;
  color: #c8d0e0;
  min-height: 16rem;
}

.logs-sip-empty { color: #64748b; }

/* SIP trace syntax (dark console) */
.logs-sip-pre .sip-dir-in { color: #67e8f9; font-weight: 700; }
.logs-sip-pre .sip-dir-out { color: #fdba74; font-weight: 700; }
.logs-sip-pre .sip-req { color: #93c5fd; font-weight: 700; }
.logs-sip-pre .sip-resp-ok { color: #86efac; font-weight: 700; }
.logs-sip-pre .sip-resp-provisional { color: #fde047; font-weight: 700; }
.logs-sip-pre .sip-resp-err { color: #f87171; font-weight: 700; }
.logs-sip-pre .sip-hdr { color: #c4b5fd; }
.logs-sip-pre .sip-kw { color: #7dd3fc; font-weight: 600; }
.logs-sip-pre .sip-code-ok { color: #4ade80; font-weight: 700; }
.logs-sip-pre .sip-code-err { color: #f87171; font-weight: 700; }
.logs-sip-pre .sip-uri { color: #a5b4fc; }
.logs-sip-pre .sip-ext { color: #fbbf24; font-weight: 600; }

/* Runtime log syntax */
.logs-sip-pre .log-ts { color: #64748b; }
.logs-sip-pre .log-info { color: #93c5fd; font-weight: 600; }
.logs-sip-pre .log-debug { color: #64748b; }
.logs-sip-pre .log-warning { color: #fde047; font-weight: 600; }
.logs-sip-pre .log-error { color: #f87171; font-weight: 700; }
.logs-sip-pre .log-logger { color: #a78bfa; }
.logs-sip-pre .log-kw { color: #7dd3fc; font-weight: 600; }
.logs-sip-pre .log-state { color: #4ade80; font-weight: 600; }
.logs-sip-pre .log-code-err { color: #f87171; font-weight: 700; }
.logs-sip-pre .log-uri { color: #a5b4fc; }
.logs-sip-pre .log-ext { color: #fbbf24; font-weight: 600; }

@media (max-width: 700px) {
  .logs-sip-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .logs-sip-toolbar input[type="search"],
  .logs-sip-toolbar #logsSipExt {
    width: 100%;
  }
  .logs-sip-meta {
    white-space: normal;
  }
}

.logs-filter {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.logs-filter input {
  flex: 1;
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--cm-border-strong);
  border-radius: var(--cm-radius-sm);
}

.logs-gateway-filter {
  flex-wrap: wrap;
  align-items: flex-end;
}

.logs-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 9rem;
  flex: 1 1 8rem;
  color: var(--cm-text);
  font-size: 0.82rem;
}

.logs-filter-field select,
.logs-filter-field input {
  font: inherit;
  font-size: 1rem;
  min-height: 2.75rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--cm-border-strong);
  border-radius: var(--cm-radius-sm);
  background: var(--cm-surface);
  color: var(--cm-text);
}

.logs-status {
  font-size: 0.85rem;
  color: var(--cm-muted, #64748b);
  margin: 0 0 0.5rem;
}

.logs-table-wrap {
  overflow-x: auto;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.logs-table th,
.logs-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--cm-border);
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.logs-table th {
  font-weight: 600;
  white-space: nowrap;
}

.logs-table td.logs-id {
  font-family: var(--cm-mono);
  font-size: 0.75rem;
  white-space: nowrap;
}

.logs-table td.logs-detail {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 12rem;
}

.logs-table th {
  font-weight: 600;
  white-space: nowrap;
}

.logs-table tbody tr.logs-req-0 td {
  background-color: rgba(59, 130, 246, 0.14);
  box-shadow: inset 4px 0 0 #3b82f6;
}
.logs-table tbody tr.logs-req-1 td {
  background-color: rgba(5, 150, 105, 0.14);
  box-shadow: inset 4px 0 0 #059669;
}
.logs-table tbody tr.logs-req-2 td {
  background-color: rgba(217, 119, 6, 0.15);
  box-shadow: inset 4px 0 0 #d97706;
}
.logs-table tbody tr.logs-req-3 td {
  background-color: rgba(124, 58, 237, 0.14);
  box-shadow: inset 4px 0 0 #7c3aed;
}
.logs-table tbody tr.logs-req-4 td {
  background-color: rgba(219, 39, 119, 0.14);
  box-shadow: inset 4px 0 0 #db2777;
}
.logs-table tbody tr.logs-req-5 td {
  background-color: rgba(8, 145, 178, 0.14);
  box-shadow: inset 4px 0 0 #0891b2;
}
.logs-table tbody tr.logs-req-6 td {
  background-color: rgba(101, 163, 13, 0.15);
  box-shadow: inset 4px 0 0 #65a30d;
}
.logs-table tbody tr.logs-req-7 td {
  background-color: rgba(71, 85, 105, 0.12);
  box-shadow: inset 4px 0 0 #475569;
}

.mobile-only {
  display: none;
}

@media (max-width: 800px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: inline;
  }

  .app-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 0.75rem;
    padding: 0.65rem max(0.75rem, env(safe-area-inset-right)) 0.7rem max(0.75rem, env(safe-area-inset-left));
  }

  .app-brand-logo {
    height: 22px;
    width: auto;
  }

  .app-brand-title {
    font-size: 0.8rem;
    margin-left: 1.65rem;
  }

  .app-nav-topright,
  .app-account {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
    gap: 0.15rem;
  }

  .app-nav-stack {
    flex: 1 1 100%;
    min-width: 0;
  }

  .app-nav {
    flex: 0 1 auto;
    min-width: 0;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .app-nav::-webkit-scrollbar {
    display: none;
  }

  .app-nav-link,
  .app-logout-btn {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .app-main {
    padding: 0.75rem max(0.7rem, env(safe-area-inset-right)) 1rem max(0.7rem, env(safe-area-inset-left));
    gap: 0.75rem;
  }

  .app-footer {
    padding: 0.75rem max(0.7rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(0.7rem, env(safe-area-inset-left));
    font-size: 0.72rem;
  }

  .card-header,
  .card-body {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .card-header {
    padding-top: 0.85rem;
  }

  .card-title {
    font-size: 1.05rem;
  }

  .btn,
  .search-mode-tab,
  .ms-signin-btn {
    min-height: 2.75rem;
  }

  input,
  select,
  textarea,
  .filter-input,
  .history-text-input,
  .group-combobox-input,
  .phone-field-input,
  .domain-field-input,
  #search {
    font-size: 16px;
  }

  .domain-field {
    font-size: 1rem;
  }

  .group-combobox-input,
  .phone-field-input {
    max-width: none;
  }

  .toolbar-primary {
    width: 100%;
  }

  .toolbar-primary .btn {
    flex: 1 1 auto;
  }

  .history-controls-main {
    --history-input-offset: 0.35rem;
  }

  .history-controls-main > .history-group-combobox,
  .history-from-stack,
  .history-field-date,
  .history-checkbox,
  .history-load-btn {
    width: 100%;
    max-width: none;
    flex: 1 1 100%;
  }

  .history-from-stack .history-range-presets {
    flex-wrap: wrap;
  }

  .history-checkbox,
  .history-controls-main > .history-load-btn {
    margin-top: 0.15rem;
    margin-left: 0;
  }

  .history-controls-main > .history-load-btn {
    margin-left: 0;
    width: 100%;
  }

  .filter-bar {
    padding: 0.65rem 0.85rem;
  }

  .filter-field,
  .filter-field-grow {
    min-width: 0;
    flex: 1 1 100%;
  }

  .filter-quality-group,
  #clearFiltersBtn {
    width: 100%;
  }

  #clearFiltersBtn {
    justify-content: center;
  }

  .card-table-panel .table-wrap,
  .card-table-panel .table-wrap.table-wrap-fit {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #callsTable.data-table {
    table-layout: auto;
    min-width: 32rem;
  }

  #callsTable [data-col-key="callerCodec"],
  #callsTable [data-col-key="calledCodec"],
  #callsTable [data-col-key="callerDomain"],
  #callsTable [data-col-key="calledDomain"],
  #callsTable [data-col-key="callerAgent"],
  #callsTable [data-col-key="calledAgent"],
  #callsTable [data-col-key="dtmfDigits"] {
    display: none;
  }

  .modal {
    padding: 0;
    align-items: stretch;
  }

  .modal-panel,
  .modal-panel-wide {
    max-width: none;
    width: 100%;
    max-height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
    padding: 0.85rem max(0.85rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(0.85rem, env(safe-area-inset-left));
  }

  .chart-view-bar,
  .chart-grid,
  .stream-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-box canvas,
  .stream-graph-img {
    max-width: 100%;
    height: auto;
  }

  .sip-messages-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sip-messages-head,
  .sip-messages-row {
    min-width: 42rem;
  }

  .login-main {
    padding: 1.5rem 1rem max(1.25rem, env(safe-area-inset-bottom));
  }

  .login-card {
    padding: 1.5rem 1.15rem 1.25rem;
  }

  .app-page-assistant .app-main {
    padding: 0.55rem max(0.55rem, env(safe-area-inset-right)) 0.55rem max(0.55rem, env(safe-area-inset-left));
  }

  .assistant-card {
    min-height: 0;
  }

  .assistant-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .assistant-layout {
    flex-direction: column;
  }

  .assistant-threads {
    width: auto;
    max-height: 7.5rem;
    border-right: 0;
    border-bottom: 1px solid var(--cm-border);
  }

  .assistant-compose {
    flex-wrap: wrap;
    padding: 0.65rem 0.75rem max(0.75rem, env(safe-area-inset-bottom));
  }

  .assistant-compose textarea {
    flex: 1 1 100%;
    min-width: 0;
  }

  .assistant-compose .btn {
    width: 100%;
  }

  .assistant-msg {
    max-width: 100%;
  }

  .hosts-toolbar {
    flex-wrap: wrap;
  }

  .hosts-status {
    margin-left: 0;
    width: 100%;
  }

  .hosts-table .hosts-ip,
  .hosts-table .hosts-name {
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  .settings-form fieldset.settings-stack {
    padding-bottom: 0.65rem;
  }

  .settings-checks label {
    min-height: 2.5rem;
  }

  .nav-order-item {
    min-height: 2.5rem;
  }

  .logs-filter {
    flex-wrap: wrap;
  }

  .logs-filter input {
    flex: 1 1 100%;
    min-width: 0;
  }

  .logs-filter .btn {
    width: 100%;
  }

  .logs-filter-field {
    flex: 1 1 100%;
    min-width: 0;
  }
}





.tasks-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 0.9fr) minmax(20rem, 1.2fr) minmax(14rem, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.tasks-list-header,
.task-form-actions,
.task-form-row,
.task-company-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.task-item {
  border: 1px solid var(--cm-border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--cm-bg);
}

.task-item strong {
  font-size: 0.95rem;
}

.task-item span {
  color: var(--cm-text-muted);
  font-size: 0.8rem;
}

.task-item.is-active {
  border-color: var(--cm-primary);
  box-shadow: 0 0 0 2px var(--cm-primary-soft);
}

.task-item.is-done strong {
  text-decoration: line-through;
  color: var(--cm-text-muted);
}

.task-empty {
  color: var(--cm-text-muted);
  padding: 0.5rem 0;
}

.task-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 600;
  font-size: 0.85rem;
  user-select: none;
}

.task-form input,
.task-form textarea,
.task-form select,
.task-scratchpad {
  font: inherit;
  font-weight: 400;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--cm-border);
  border-radius: 8px;
  background: var(--cm-surface);
  color: var(--cm-text);
  user-select: text;
}

.task-form select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2364748b' d='M1.2 1.2 L6 6 L10.8 1.2' stroke='%2364748b' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 0.7rem 0.45rem;
}

.task-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.task-company-label {
  position: relative;
}

.task-combobox {
  position: relative;
  display: block;
  width: 100%;
}

.task-combobox input {
  width: 100%;
  box-sizing: border-box;
}

.task-company-options {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.25rem);
  margin: 0;
  max-width: none;
  z-index: 40;
}

.group-option {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.2rem 0.5rem;
}

.group-option-name {
  display: inline;
  font-weight: 600;
  color: var(--cm-text);
}

.group-option-domain {
  display: inline;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--cm-text-muted);
  margin-top: 0;
}

.task-domain {
  font-size: 0.8rem;
  color: var(--cm-text-muted);
}

.task-scratchpad {
  width: 100%;
  min-height: 12rem;
  resize: vertical;
}

@media (max-width: 1100px) {
  .tasks-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .task-form-row {
    grid-template-columns: 1fr;
  }

  .settings-form fieldset {
    gap: 0.35rem 0.75rem;
  }

  .settings-checks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-order-list {
    flex-wrap: nowrap;
  }

  .settings-form {
    max-width: none;
  }

  .connector-actions {
    width: 100%;
    align-items: stretch;
  }

  .task-status-add {
    width: 100%;
    max-width: 100%;
  }

  .task-status-add input {
    flex: 1 1 auto;
    min-width: 0;
  }
}

.confirm-modal-panel {
  max-width: 26rem;
}

.confirm-modal-message {
  margin: 0.75rem 0 1.1rem;
  color: var(--cm-text);
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

html[data-theme="dark"] .modal-panel {
  background: var(--cm-surface);
  color: var(--cm-text);
}

.tasks-board-wrap {
  margin-bottom: 1rem;
}

.tasks-board-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
}

.task-status-add {
  display: flex;
  gap: 0.4rem;
}

.task-status-add input {
  font: inherit;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--cm-border);
  border-radius: 8px;
  background: var(--cm-surface);
  color: var(--cm-text);
}

.task-board {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  user-select: none;
}

.task-column {
  background: var(--cm-bg);
  border: 1px solid var(--cm-border);
  border-radius: 12px;
  padding: 0.55rem;
  min-height: 12rem;
  min-width: 14rem;
  flex: 1 1 14rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.task-column.is-drop {
  border-color: var(--cm-primary);
  box-shadow: 0 0 0 2px var(--cm-primary-soft);
}

.task-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  cursor: pointer;
}

.task-column-head h3 {
  margin: 0;
  font-size: 0.88rem;
}

.task-column-remove {
  border: 0;
  background: transparent;
  color: var(--cm-text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.task-column-cards {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.task-card {
  position: relative;
  text-align: left;
  font: inherit;
  border: 1px solid var(--cm-border);
  background: var(--cm-surface);
  border-radius: 10px;
  padding: 0.55rem 1.6rem 0.55rem 0.65rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.task-card span {
  color: var(--cm-text-muted);
  font-size: 0.78rem;
}

.task-card.is-active {
  border-color: var(--cm-primary);
}

.task-card-x {
  position: absolute;
  top: 0.2rem;
  right: 0.25rem;
  border: 0;
  background: transparent;
  color: var(--cm-text-muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0.15rem 0.3rem;
}

.task-column-add {
  font: inherit;
  border: 1px dashed var(--cm-border);
  background: transparent;
  color: var(--cm-text-muted);
  border-radius: 8px;
  padding: 0.4rem;
  cursor: pointer;
}

.task-column-add:hover {
  color: var(--cm-text);
  border-color: var(--cm-text-muted);
}

.task-ticket-meta {
  margin: -0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--cm-text-muted);
}

.tasks-layout {
  grid-template-columns: minmax(22rem, 1.4fr) minmax(14rem, 0.8fr);
}

@media (max-width: 1100px) {
  .task-board {
    flex-direction: column;
  }

  .task-column {
    max-width: none;
  }
}

.tasks-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: start;
  gap: 1rem;
  width: 100%;
}

.tasks-editor-card,
.tasks-notes-card {
  max-width: none;
}

.task-form {
  gap: 0.55rem;
}

.task-form textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.task-scratchpad {
  min-height: 8rem;
}

.task-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.task-link-btns,
.task-form-save {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn-impersonate,
.btn-telsy,
.btn-hubspot,
.btn-freshdesk {
  color: #fff;
  border: 0;
  font-weight: 600;
  text-decoration: none;
}

.btn-impersonate {
  background: #f49913;
}

.btn-impersonate:hover {
  background: #d9840c;
  color: #fff;
}

.btn-telsy {
  background: #254d81;
}

.btn-telsy:hover {
  background: #1b3a62;
  color: #fff;
}

.btn-hubspot {
  background: #ff7a59;
}

.btn-hubspot:hover {
  background: #e06645;
  color: #fff;
}

.btn-freshdesk {
  background: #25c16f;
}

.btn-freshdesk:hover {
  background: #1ea35c;
  color: #fff;
}

.task-due-label {
  position: relative;
}

.task-due-field {
  display: flex;
  align-items: stretch;
  gap: 0.3rem;
}

.task-due-field input {
  flex: 1;
  min-width: 0;
}

.task-due-cal {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.35rem);
  left: 0;
  box-sizing: border-box;
  width: 18.5rem;
  max-width: calc(100vw - 2rem);
  overflow: hidden;
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: 12px;
  box-shadow: var(--cm-shadow-lg);
  padding: 0.7rem 0.65rem 0.55rem;
}

.task-due-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

.task-due-cal-head button {
  border: 0;
  background: var(--cm-surface-2);
  cursor: pointer;
  font-size: 1.05rem;
  color: var(--cm-text);
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border-radius: 8px;
}

.task-due-cal-head button:hover {
  background: var(--cm-hover);
}

.task-due-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  width: 100%;
  gap: 0.12rem;
  text-align: center;
  font-size: 0.75rem;
}

.task-due-dow {
  color: var(--cm-text-muted);
  font-weight: 600;
  padding: 0.2rem 0 0.35rem;
  min-width: 0;
  overflow: hidden;
}

.task-due-day {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 0.32rem 0;
  margin: 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  color: var(--cm-text);
  font-size: 0.78rem;
  line-height: 1.2;
}

.task-due-day.is-weekend {
  color: var(--cm-text-muted);
}

.task-due-day.is-today:not(.is-selected) {
  box-shadow: inset 0 0 0 1px var(--cm-primary);
}

.task-due-day:hover {
  background: var(--cm-primary-soft);
}

.task-due-day.is-selected {
  background: var(--cm-primary);
  color: var(--cm-on-primary);
}

.task-due-cal-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--cm-border);
}

.task-due-cal-foot button {
  border: 0;
  background: transparent;
  color: var(--cm-primary);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0.15rem;
}

.task-form input:focus,
.task-form textarea:focus,
.task-form select:focus {
  outline: none;
  border-color: var(--cm-primary);
  box-shadow: 0 0 0 3px var(--cm-primary-soft);
}

.task-drop-line {
  height: 3px;
  background: var(--cm-accent);
  border-radius: 99px;
  margin: 0.15rem 0;
}

.task-col-drop-line {
  width: 4px;
  flex: 0 0 4px;
  align-self: stretch;
  background: var(--cm-accent);
  border-radius: 2px;
}

.task-card.is-dragging {
  opacity: 0.45;
}

@media (max-width: 900px) {
  .tasks-detail {
    grid-template-columns: 1fr;
  }
}

html[data-theme="dark"] .btn-filter-quality.active {
  border-color: #d97706;
  background: #3a2a12;
  color: #fbbf24;
}

html[data-theme="dark"] .btn-filter-sip-failure.active {
  border-color: #f87171;
  background: #3f1d1d;
  color: #fecaca;
}

html[data-theme="dark"] .analysis-result,
html[data-theme="dark"] .sip-call-story,
html[data-theme="dark"] .sip-codec-diff,
html[data-theme="dark"] .sip-glossary,
html[data-theme="dark"] .sip-packet-context-pass {
  background: var(--cm-surface-2);
  border-color: var(--cm-border);
  color: var(--cm-text);
}

html[data-theme="dark"] .analysis-overall {
  background: var(--cm-surface);
  color: var(--cm-text);
}

html[data-theme="dark"] .analysis-streams .stream-card {
  background: var(--cm-surface);
}

html[data-theme="dark"] .analysis-streams .stream-card p,
html[data-theme="dark"] .stream-dir {
  color: var(--cm-text);
}

html[data-theme="dark"] .analysis-badge {
  background: var(--cm-hover);
  color: var(--cm-text);
}

html[data-theme="dark"] .sip-glossary summary,
html[data-theme="dark"] .sip-glossary-list dt,
html[data-theme="dark"] .sip-codec-diff-title,
html[data-theme="dark"] .analysis-result h4 {
  color: var(--cm-text);
}

html[data-theme="dark"] .sip-glossary-list dd,
html[data-theme="dark"] .analysis-samples {
  color: var(--cm-text-muted);
}

html[data-theme="dark"] .sip-call-story.scenario-completed {
  background: #163024;
  border-color: #166534;
}

html[data-theme="dark"] .sip-call-story.scenario-failed,
html[data-theme="dark"] .sip-codec-diff.verdict-no_overlap {
  background: #3a1c1c;
  border-color: #7f1d1d;
}

html[data-theme="dark"] .sip-codec-diff.verdict-overlap_exists,
html[data-theme="dark"] .sip-call-story.scenario-partial {
  background: #3a2e14;
  border-color: #854d0e;
}

html[data-theme="dark"] .start-date,
html[data-theme="dark"] .start-time {
  color: var(--cm-text);
}

html[data-theme="dark"] .heatmap-cell {
  background: var(--cm-border);
}

html[data-theme="dark"] .heatmap-cell[data-count="0"] {
  background: var(--cm-hover);
}

html[data-theme="dark"] .sip-messages-row.sip-row-vm-neutral,
html[data-theme="dark"] .sip-diagram-row.sip-row-vm-neutral {
  background-color: #243056 !important;
  color: var(--cm-text);
}

html[data-theme="dark"] .sip-messages-row.sip-row-vm-setup,
html[data-theme="dark"] .sip-diagram-row.sip-row-vm-setup,
html[data-theme="dark"] .sip-messages-row.sip-row-vm-update,
html[data-theme="dark"] .sip-diagram-row.sip-row-vm-update {
  background-color: #1e3a5f !important;
  color: var(--cm-text);
}

html[data-theme="dark"] .sip-messages-row.sip-row-vm-cancel,
html[data-theme="dark"] .sip-diagram-row.sip-row-vm-cancel,
html[data-theme="dark"] .sip-messages-row.sip-row-vm-terminated,
html[data-theme="dark"] .sip-diagram-row.sip-row-vm-terminated,
html[data-theme="dark"] .sip-messages-row.sip-row-vm-rtp,
html[data-theme="dark"] .sip-diagram-row.sip-row-vm-rtp {
  background-color: #3f1d2a !important;
  color: var(--cm-text);
}

html[data-theme="dark"] .sip-messages-row.sip-row-vm-sip,
html[data-theme="dark"] .sip-diagram-row.sip-row-vm-sip {
  background-color: #2d2448 !important;
  color: var(--cm-text);
}

html[data-theme="dark"] .sip-unavailable {
  background: #3a2e14;
  border-color: #854d0e;
  color: #fde68a;
}

html[data-theme="dark"] .sip-retry-btn {
  background: var(--cm-primary-soft);
  border-color: var(--cm-primary);
  color: var(--cm-primary);
}

html[data-theme="dark"] .sip-codec-diff-title {
  color: var(--cm-text);
}

html[data-theme="dark"] .sip-reason-sub {
  color: var(--cm-danger);
}

html[data-theme="dark"] .hour-option:hover,
html[data-theme="dark"] .hour-option.is-active {
  background: var(--cm-primary-soft);
}

html[data-theme="dark"] .sip-msg-kind {
  background: var(--cm-hover);
  color: var(--cm-text);
}

html[data-theme="dark"] .sip-msg-kind.request {
  background: #1e3a5f;
  color: #bfdbfe;
}

html[data-theme="dark"] .sip-msg-kind.response {
  background: #3a2e14;
  color: #fde68a;
}

html[data-theme="dark"] .sip-operator-result.is-error {
  color: var(--cm-danger);
}

html[data-theme="dark"] .sip-packet-context.severity-error {
  background: var(--cm-danger-soft);
  border-color: var(--cm-danger);
  color: var(--cm-text);
}

html[data-theme="dark"] .sip-packet-context.severity-warning {
  background: #3a2e14;
  border-color: #854d0e;
  color: var(--cm-text);
}

html[data-theme="dark"] .modal-close:hover {
  color: var(--cm-text);
}

.settings-form fieldset.settings-stack {
  flex-direction: column;
  align-items: stretch;
}

.settings-form fieldset.settings-stack > .settings-hint,
.settings-form fieldset.settings-stack > .settings-checks,
.settings-form fieldset.settings-stack > .nav-order-list,
.settings-form fieldset.settings-stack > .connector-list {
  width: 100%;
  flex: 1 1 100%;
}

.settings-hint {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: var(--cm-text-muted);
  white-space: normal;
}

.settings-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 1rem;
}

.settings-checks label {
  white-space: nowrap;
}

.connector-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.connector-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  color: var(--cm-text);
}

.connector-copy {
  flex: 1 1 12rem;
  min-width: 0;
}

.connector-name {
  font-weight: 650;
  color: var(--cm-text);
}

.connector-hint,
.connector-auth {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--cm-text-muted);
}

.connector-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.connector-actions .btn {
  min-height: 44px;
}

.connector-soon {
  font-size: 0.78rem;
  color: var(--cm-text-muted);
}

.nav-order-list {
  list-style: none;
  margin: 0;
  padding: 0.15rem 0 0.25rem;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.45rem;
  overflow-x: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 2.6rem;
}

.nav-order-item {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--cm-border);
  border-radius: 8px;
  background: var(--cm-surface);
  color: var(--cm-text);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 0.85rem;
}

.nav-order-item.is-pinned {
  cursor: default;
  opacity: 0.85;
  box-shadow: none;
}

.app-page-home .app-main.home-main,
.app-page-home .app-footer {
  max-width: 1100px;
}

.home-hero {
  padding: 0.35rem 0.15rem 0.15rem;
}

.home-hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.home-hero-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.home-edit-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.home-edit-tools[hidden] {
  display: none !important;
}

.home-cols-label {
  font-size: 0.85rem;
  color: var(--cm-text-muted);
}

.home-cols-switch {
  display: inline-flex;
  border: 1px solid var(--cm-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--cm-surface);
}

.home-cols-btn {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--cm-text);
  font: inherit;
  cursor: pointer;
}

.home-cols-btn + .home-cols-btn {
  border-left: 1px solid var(--cm-border);
}

.home-cols-btn.is-on {
  background: var(--cm-primary-soft);
  color: var(--cm-text);
}

.home-revert-btn {
  min-height: 44px;
}

.home-edit-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--cm-border);
  background: var(--cm-surface);
  color: var(--cm-text);
  cursor: pointer;
}

.home-edit-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-edit-btn[aria-pressed="true"] {
  background: var(--cm-primary-soft);
  border-color: var(--cm-primary);
}

.home-edit-hint {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--cm-text-muted);
}

.app-page-home.home-wide .app-main.home-main,
.app-page-home.home-wide .app-footer {
  max-width: 1680px;
}

.home-widgets {
  display: flex;
  align-items: stretch;
  gap: 1rem;
}

/* Orphan cards (not yet in a column) must not paint as a flat 5-wide row. */
.home-widgets > [data-home-card] {
  display: none !important;
}

.home-widget-col {
  flex: 1 1 0;
  min-width: 0;
  min-height: 12rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.app-user:empty {
  display: none;
}

.home-drop-line {
  flex: 0 0 4px;
  height: 4px;
  margin: -0.35rem 0;
  border-radius: 999px;
  background: var(--cm-primary);
  pointer-events: none;
}

.home-widget-park {
  display: none !important;
}

.home-widget-col.is-drop,
.home-editing [data-home-card].is-drop {
  outline: 2px dashed var(--cm-primary);
  outline-offset: 2px;
}

.home-editing [data-home-card] {
  position: relative;
  cursor: grab;
}

.home-editing [data-home-card].is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.home-quicklinks-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.home-quicklink-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  background: var(--cm-surface-2);
}

.home-quicklink-row.is-off .home-quicklink-open {
  opacity: 0.55;
  cursor: default;
}

.home-quicklink-open {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0 0.55rem 0.7rem;
  color: var(--cm-text);
  text-decoration: none;
}

.home-quicklink-open:hover .home-quicklink-label {
  color: var(--cm-primary);
  text-decoration: underline;
}

.home-quicklink-favicon {
  position: relative;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: var(--cm-primary-soft);
  color: var(--cm-text-muted);
  font-size: 0.8rem;
}

.home-quicklink-favicon img {
  position: absolute;
  inset: 1px;
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 4px;
}

.home-quicklink-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.home-quicklink-action {
  flex: 0 0 auto;
  min-height: 44px;
  margin-right: 0.3rem;
}

.home-quicklinks-off {
  margin: 0.65rem 0 0.85rem;
  padding: 0 0.55rem 0.55rem;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  background: var(--cm-surface);
  color: var(--cm-text);
}

.home-quicklinks-off-summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--cm-text-muted);
  font-weight: 600;
  user-select: none;
}

.home-quicklinks-off[hidden] {
  display: none;
}

.home-quicklinks-form {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--cm-border);
}

.home-quicklinks-form input {
  width: 100%;
  min-height: 44px;
  font-size: 16px;
}

.home-quicklinks-error {
  margin: 0;
  color: var(--cm-danger);
  font-size: 0.9rem;
  font-weight: 400;
}

.home-quicklinks-add {
  min-height: 44px;
  justify-self: start;
}

@media (max-width: 600px) {
  .home-quicklink-row {
    flex-wrap: wrap;
    padding-bottom: 0.35rem;
  }

  .home-quicklink-open {
    flex-basis: calc(100% - 0.5rem);
    padding-right: 0.7rem;
  }

  .home-quicklink-action {
    margin-left: auto;
  }

  .home-quicklinks-add {
    width: 100%;
  }
}

.home-card-remove {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 4;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 1rem;
  opacity: 0;
  pointer-events: none;
}

.home-editing [data-home-card]:hover .home-card-remove,
.home-editing [data-home-card].is-remove-linger .home-card-remove,
.home-card-remove:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.home-add-wrap {
  position: relative;
  width: 100%;
}

.home-editing .home-widget-col > .home-add-wrap {
  margin-top: auto;
}

.home-add-wrap[hidden] {
  display: none !important;
}

.home-add-card {
  width: 100%;
  min-height: 8.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem 1.1rem;
  font: inherit;
  font-size: 1rem;
  color: var(--cm-text);
  background: transparent;
  border: 1.5px dashed var(--cm-border);
  border-radius: 12px;
  box-shadow: none;
  cursor: pointer;
}

.home-add-card:hover {
  color: var(--cm-text);
  border-color: var(--cm-text-muted);
  background: transparent;
}

.home-add-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 0.35rem);
  z-index: 5;
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  min-width: min(16rem, 100%);
  border-radius: 10px;
  background: var(--cm-surface);
  color: var(--cm-text);
  border: 1px solid var(--cm-border);
  box-shadow: var(--cm-shadow);
}

.home-add-menu button {
  display: block;
  width: 100%;
  min-height: 44px;
  text-align: left;
  font: inherit;
  color: var(--cm-text);
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
}

.home-add-menu button:hover {
  background: var(--cm-hover);
}

.home-hello {
  margin: 0;
  font-size: clamp(1.65rem, 3.4vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--cm-text);
}

.home-date {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
  color: var(--cm-text-muted);
}

.home-lead {
  margin: 0.2rem 0 0;
  font-size: 0.95rem;
  color: var(--cm-text-muted);
}

.home-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1rem;
  align-items: start;
}

.home-columns.is-single {
  grid-template-columns: 1fr;
}

.home-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.home-activity .card-body,
.home-columns .card-body,
.home-widgets .card-body {
  padding: 0.85rem 1.25rem 1.15rem;
  color: var(--cm-text);
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.85rem;
  min-height: 4.25rem;
}

.home-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.8rem;
  min-height: 4.25rem;
  border-radius: 10px;
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  color: var(--cm-text);
}

.home-stat-n {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.home-stat-label {
  font-size: 0.8rem;
  color: var(--cm-text-muted);
}

.home-stat.is-overdue .home-stat-n,
.home-stat.is-overdue .home-stat-label {
  color: var(--cm-danger);
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.home-action {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  min-height: 44px;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--cm-text);
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
}

.home-action:hover {
  background: var(--cm-hover);
}

.home-action-title {
  font-weight: 650;
}

.home-action-hint {
  font-size: 0.8rem;
  color: var(--cm-text-muted);
}

.home-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.home-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.home-card-foot {
  justify-content: flex-end;
  padding: 0 1.25rem 1.1rem;
}

.home-card-foot .btn {
  min-height: 44px;
  text-decoration: none;
}

.home-card-head .btn {
  min-height: 44px;
  text-decoration: none;
}

#home-tickets-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.15rem;
}

.home-mock-pill {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  vertical-align: middle;
  color: var(--cm-text-muted);
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
}

.home-task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.home-empty {
  margin: 0;
  color: var(--cm-text-muted);
}

.home-task-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  min-height: 44px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--cm-text);
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
}

a.home-task-link:hover {
  background: var(--cm-hover);
}

.home-task-subject {
  font-weight: 600;
}

.home-task-meta {
  font-size: 0.85rem;
  color: var(--cm-text-muted);
}

.home-task-meta.is-overdue {
  color: var(--cm-danger);
}

.home-task-meta.is-today {
  color: var(--cm-primary);
  font-weight: 600;
}

.home-cal-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.home-cal-today {
  margin: 0;
  min-height: 1.35em;
  font-weight: 600;
  color: var(--cm-text);
}

.home-cal {
  min-height: 15.5rem;
  padding: 0.55rem 0.4rem 0.7rem;
  border-radius: 12px;
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  overflow: visible;
}

.home-cal-card {
  overflow: visible;
}

.home-cal-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.home-cal-table th,
.home-cal-table td {
  position: relative;
  text-align: center;
  padding: 0.38rem 0.1rem;
  font-size: 0.78rem;
  color: var(--cm-text);
}

.home-cal-table th {
  color: var(--cm-text-muted);
  font-weight: 600;
}

.home-cal-table td.is-pad {
  color: transparent;
}

.home-cal-table td.is-today {
  font-weight: 700;
  background: var(--cm-primary-soft);
  border-radius: 8px;
  color: var(--cm-text);
}

.home-cal-table td.has-task,
.home-cal-table td.has-tip {
  cursor: default;
}

.home-cal-table td.is-oncall {
  background: color-mix(in srgb, var(--home-oncall) 38%, var(--cm-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--home-oncall) 55%, transparent);
}

.home-cal-table td.is-holiday {
  background: color-mix(in srgb, var(--home-holiday, #7c3aed) 48%, var(--cm-surface));
}

.home-cal-table td.is-holiday.is-oncall {
  box-shadow: inset 0 0 0 2px var(--home-oncall);
}

.home-cal-table td.is-today.is-oncall {
  background: color-mix(in srgb, var(--home-oncall) 38%, var(--cm-primary-soft));
}

.home-cal-table td.is-today.is-holiday {
  background: color-mix(in srgb, var(--home-holiday, #7c3aed) 48%, var(--cm-primary-soft));
}

.home-cal-table td.has-task::after {
  content: "";
  display: block;
  width: 0.35rem;
  height: 0.35rem;
  margin: 0.15rem auto 0;
  border-radius: 50%;
  background: var(--cm-accent);
}

.home-cal-tip {
  display: none;
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  min-width: 9rem;
  max-width: 16rem;
  margin: 0;
  padding: 0.4rem 0.65rem;
  list-style: none;
  text-align: left;
  background: var(--cm-surface);
  color: var(--cm-text);
  border: 1px solid var(--cm-border);
  border-radius: 8px;
  box-shadow: var(--cm-shadow);
}

.home-cal-table tr:nth-child(-n+2) .home-cal-tip {
  bottom: auto;
  top: calc(100% + 6px);
}

.home-cal-table td.has-tip:hover .home-cal-tip,
.home-cal-table td.has-tip:focus-within .home-cal-tip {
  display: block;
}

.home-cal-tip li {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cm-text);
  line-height: 1.35;
}

.home-cal-tip li + li {
  margin-top: 0.2rem;
}

.home-agenda {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px dashed var(--cm-border);
  background: var(--cm-surface);
}

.home-agenda-label {
  margin: 0 0 0.25rem;
  font-weight: 650;
  color: var(--cm-text);
}

.home-team-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.home-team-chip {
  min-height: 44px;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--cm-border);
  background: var(--cm-surface);
  color: var(--cm-text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.home-team-chip.is-active {
  border-color: var(--cm-primary);
  background: var(--cm-primary-soft);
  color: var(--cm-text);
}

.home-team-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.home-team-member {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
}

.home-team-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.home-team-name {
  font-weight: 650;
  color: var(--cm-text);
}

.home-team-role {
  font-size: 0.8rem;
  color: var(--cm-text-muted);
}

.home-team-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.25rem;
  margin-left: auto;
}

.home-team-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: var(--cm-text);
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  text-decoration: none;
}

.home-team-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-team-icon:hover {
  background: var(--cm-hover);
}

.home-team-icon.is-off {
  opacity: 0.4;
  pointer-events: none;
}

.home-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 3px solid var(--cm-presence-unknown);
  background: var(--cm-surface-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.home-avatar-ini {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cm-text-muted);
}

.home-avatar.presence-available {
  border-color: var(--cm-presence-available);
}

.home-avatar.presence-busy {
  border-color: var(--cm-presence-busy);
}

.home-avatar.presence-meeting {
  border-color: var(--cm-presence-meeting);
}

.home-avatar.presence-away {
  border-color: var(--cm-presence-away);
}

.home-avatar.presence-ooo {
  border-color: var(--cm-presence-ooo);
}

.home-avatar.presence-ringing {
  border-color: var(--cm-presence-ringing);
  animation: home-presence-ring 1.6s ease-in-out infinite;
}

@keyframes home-presence-ring {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.home-task-panel {
  max-width: 640px;
}

button.home-task-link {
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
}

.logs-access-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.logs-access-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  color: var(--cm-text);
}

.logs-access-copy {
  flex: 1 1 12rem;
  min-width: 0;
}

.logs-access-name {
  font-weight: 650;
}

.logs-access-meta {
  font-size: 0.85rem;
  color: var(--cm-text-muted);
}

.logs-access-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1 1 16rem;
  justify-content: flex-end;
}

.logs-access-actions .btn {
  flex: 0 0 auto;
}

@media (max-width: 800px) {
  .home-columns,
  .home-actions,
  .home-stats,
  .settings-form {
    grid-template-columns: 1fr;
  }

  .home-widgets {
    flex-direction: column;
  }

  .home-widget-col {
    width: 100%;
    flex: 1 1 auto;
  }

  .home-card-actions {
    width: 100%;
  }

  .home-card-actions .btn {
    flex: 1 1 auto;
  }
}


.nav-order-item.is-drop {
  border-color: var(--cm-primary);
}

.nav-order-drop {
  flex: 0 0 4px;
  align-self: stretch;
  background: var(--cm-accent);
  border-radius: 2px;
  list-style: none;
}

.task-column-rename {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  width: 100%;
  min-width: 0;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--cm-primary);
  border-radius: 6px;
  background: var(--cm-surface);
  color: var(--cm-text);
}

.hub-tour {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 4000;
  overflow: hidden;
  pointer-events: none;
}

.hub-tour.is-on {
  display: block;
}

html.hub-tour-active,
html.hub-tour-active body {
  overflow: hidden !important;
  overscroll-behavior: none;
  height: 100%;
}

html.hub-tour-active .app-scroll {
  overflow: hidden !important;
}

html.hub-tour-active .app-shell {
  pointer-events: none;
}

html.hub-tour-active .hub-tour-panel,
html.hub-tour-active .hub-tour-panel * {
  pointer-events: auto;
}

.hub-tour-hole {
  position: fixed;
  border-radius: 12px;
  border: 1px solid var(--cm-border);
  box-shadow:
    0 0 0 1px var(--cm-surface),
    0 0 0 3px color-mix(in srgb, var(--cm-accent) 42%, var(--cm-surface)),
    0 0 0 999vmax var(--cm-overlay);
  pointer-events: none;
}

.hub-tour-panel {
  position: fixed;
  z-index: 4001;
  pointer-events: auto;
  max-width: 380px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: 1rem 1.05rem 0.9rem;
  border-radius: 14px;
  background: var(--cm-surface);
  color: var(--cm-text);
  border: 1px solid var(--cm-border-strong);
  box-shadow:
    var(--cm-shadow-lg),
    0 16px 36px rgba(15, 23, 42, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.7);
}

html[data-theme="dark"] .hub-tour-hole {
  border-color: var(--cm-border-strong);
  box-shadow:
    0 0 0 1px var(--cm-surface),
    0 0 0 3px color-mix(in srgb, var(--cm-accent) 50%, var(--cm-bg)),
    0 0 0 999vmax var(--cm-overlay);
}

html[data-theme="dark"] .hub-tour-panel {
  border-color: var(--cm-border-strong);
  box-shadow:
    var(--cm-shadow-lg),
    0 18px 40px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(232, 238, 246, 0.08);
}

.hub-tour-panel.is-sheet {
  max-width: none;
  max-height: min(46vh, calc(100vh - 24px));
}

.hub-tour-step {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cm-text-muted);
}

.hub-tour-title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--cm-text);
}

.hub-tour-body {
  margin: 0 0 0.9rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--cm-text);
}

.hub-tour-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.hub-tour-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.hub-tour-skip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.hub-tour-skip,
.hub-tour-skip-end,
.hub-tour-nav .btn {
  min-height: 44px;
}

@media (max-width: 480px) {
  .hub-tour-panel {
    font-size: 1rem;
  }

  .hub-tour-title {
    font-size: 1.12rem;
  }

  .hub-tour-body {
    font-size: 1rem;
  }
}

.requests-layout {
  display: grid;
  grid-template-columns: minmax(280px, 22rem) minmax(0, 1fr);
  gap: 1.15rem;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.requests-compose-card,
.requests-list-card {
  min-width: 0;
}

.request-form,
.request-lock-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.request-form > label,
.request-lock-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--cm-text);
}

.request-form input:not([type="radio"]),
.request-form textarea,
.request-vote-comment,
.request-lock-form input {
  width: 100%;
  min-height: 44px;
  font: inherit;
  font-weight: 400;
  font-size: 1rem;
  color: var(--cm-text);
  background: var(--cm-bg);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  padding: 0.55rem 0.75rem;
}

.request-form textarea {
  min-height: 6.5rem;
  resize: vertical;
  line-height: 1.45;
}

.request-form .btn-primary {
  min-height: 44px;
  width: 100%;
}

.request-audience {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.request-audience legend {
  padding: 0;
  margin: 0 0 0.45rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--cm-text);
}

.request-audience-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.request-choice {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  margin: 0;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  background: var(--cm-bg);
  color: var(--cm-text);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.request-choice input {
  width: auto;
  min-width: 1rem;
  min-height: 1rem;
  margin: 0;
  accent-color: var(--cm-primary);
  flex: 0 0 auto;
}

.request-choice:has(input:checked) {
  border-color: var(--cm-primary);
  background: var(--cm-primary-soft);
  box-shadow: inset 0 0 0 1px var(--cm-primary);
}

.requests-list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.request-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  padding: 0.2rem;
  border: 1px solid var(--cm-border);
  border-radius: 999px;
  background: var(--cm-bg);
}

.request-tab {
  min-height: 40px;
  border-radius: 999px;
  background: transparent;
  color: var(--cm-text-muted);
  border-color: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.request-tab .app-nav-edit-dot {
  background: var(--cm-notice);
}

.request-tab.is-active {
  background: var(--cm-primary-soft);
  color: var(--cm-text);
  border-color: transparent;
}

.request-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.request-empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--cm-text-muted);
}

.request-item {
  padding: 0.65rem 0.8rem 0.7rem;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  background: var(--cm-bg);
  color: var(--cm-text);
  overflow: visible;
}

.bug-comment {
  border-top: 1px solid var(--cm-border);
  color: var(--cm-text-muted);
  margin: .8rem 0 0;
  padding-top: .8rem;
  white-space: pre-wrap;
}

.bug-report-card {
  padding: 0.55rem 0.7rem 0.65rem;
}

.bug-report-card h3 {
  font-size: 1rem;
  margin: 0;
}

.bug-report-card .request-meta,
.bug-report-card .request-body {
  margin: 0.4rem 0 0;
}

.bug-comment-form {
  align-items: stretch;
}

.bug-comment-form textarea {
  flex: 1 1 20rem;
  min-height: 4.5rem;
  resize: vertical;
}

.bug-dev-person {
  color: var(--cm-accent);
  font-weight: 700;
}

.bug-nav-icon {
  font-size: .9em;
  margin-right: .3rem;
}

.bug-target-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--cm-surface);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2364748b' d='M1.2 1.2 L6 6 L10.8 1.2' stroke='%2364748b' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-position: right 0.7rem center;
  background-repeat: no-repeat;
  background-size: 0.7rem 0.45rem;
  cursor: pointer;
  font: inherit;
  font-weight: 400;
  border: 1px solid var(--cm-border);
  border-radius: 8px;
  color: var(--cm-text);
  min-height: 2.45rem;
  padding: 0.5rem 2rem 0.5rem 0.65rem;
}

.request-item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}

.request-heading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
}

.request-heading h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  color: var(--cm-text);
}

.request-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0.2rem 0 0.35rem;
  color: var(--cm-text-muted);
  font-size: 0.8rem;
}

.request-edited {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: var(--cm-text-muted);
}

.request-edited.is-notice {
  color: #ea580c;
  font-weight: 650;
}

html[data-theme="dark"] .request-edited.is-notice {
  color: #fb923c;
}

.request-locked-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--cm-accent);
  color: var(--cm-accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.request-counts {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  position: relative;
}

.request-counts.has-voters {
  cursor: pointer;
}

.request-counts.has-voters:hover,
.request-counts.has-voters:focus-within,
.request-counts.has-voters.is-open {
  z-index: 6;
}

.request-voters-tip {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 8;
  min-width: 16.5rem;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.55rem 0.7rem;
  background: var(--cm-surface);
  color: var(--cm-text);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  box-shadow: var(--cm-shadow-lg);
}

.request-counts.has-voters:hover .request-voters-tip,
.request-counts.has-voters:focus-within .request-voters-tip,
.request-counts.has-voters.is-open .request-voters-tip {
  display: block;
}

.request-voter-vote {
  display: inline-flex;
  margin-left: auto;
  color: var(--cm-text-muted);
}

.request-voter-vote .request-thumb-icon {
  width: 1.05rem;
  height: 1.05rem;
}

.request-voter-comment {
  font-size: 0.8rem;
  color: var(--cm-text-muted);
}

.request-thumb-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.request-thumb-icon.is-down {
  transform: rotate(180deg);
}

.request-counts .request-thumb-icon {
  width: 0.9rem;
  height: 0.9rem;
}

.request-vote-btn {
  width: 2.5rem;
  padding: 0.35rem;
}

.request-edit {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.35rem 0 0;
}

.request-edit-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.request-edit-title-row input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.request-saved {
  flex: 0 0 9.5rem;
  margin: 0;
  min-height: 1.2em;
  opacity: 0;
  font-size: 0.85rem;
  font-weight: 650;
  color: #059669;
  pointer-events: none;
  white-space: nowrap;
}

.request-saved.is-visible {
  opacity: 1;
}

html[data-theme="dark"] .request-saved {
  color: #34d399;
}

.request-edit input,
.request-edit textarea,
.request-edit select {
  width: 100%;
  min-height: 36px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--cm-text);
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  padding: 0.35rem 0.55rem;
}

.request-edit textarea {
  min-height: 4rem;
  resize: vertical;
}

.request-edit .btn {
  min-height: 36px;
  align-self: flex-start;
}

.request-body {
  margin: 0 0 0.4rem;
  color: var(--cm-text);
  white-space: pre-wrap;
}

.request-admin-note {
  margin: 0 0 0.4rem;
  font-weight: 650;
  color: var(--cm-danger);
}

.request-lock-note {
  margin: 0 0 0.4rem;
  padding: 0.4rem 0.55rem;
  border-radius: var(--cm-radius);
  background: var(--cm-surface);
  color: var(--cm-text);
  border: 1px solid var(--cm-border);
}

.request-actions,
.request-admin-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0.35rem 0 0;
}

.request-actions .btn,
.request-admin-bar .btn {
  min-height: 36px;
}

.request-vote-btn.is-active {
  background: var(--cm-primary-soft);
  border-color: var(--cm-primary);
  color: var(--cm-text);
}

.request-vote-comment,
.request-admin-input {
  flex: 1 1 10rem;
  min-width: 8rem;
  min-height: 36px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--cm-text);
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  padding: 0.35rem 0.55rem;
}

.changelogs-layout.is-readonly {
  grid-template-columns: 1fr;
}

.changelog-entry {
  padding: 0.85rem 1rem;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  background: var(--cm-surface);
  color: var(--cm-text);
  min-width: 0;
}

.changelog-entry-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--cm-text);
}

.changelog-chip {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
  background: var(--cm-primary-soft);
  color: var(--cm-text);
}

.changelog-meta {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--cm-text-muted);
}

.changelog-entry-body {
  margin: 0;
  white-space: pre-wrap;
  color: var(--cm-text);
}

.changelog-entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.changelog-entry input,
.changelog-entry textarea {
  width: 100%;
  margin-bottom: 0.5rem;
  min-height: 44px;
  font: inherit;
  font-size: 1rem;
  color: var(--cm-text);
  background: var(--cm-bg);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  padding: 0.55rem 0.75rem;
}

.oncall-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 1rem;
  align-items: start;
}

.oncall-year-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.oncall-years {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
}

.oncall-year-btn {
  min-height: 44px;
  min-width: 72px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--cm-text-muted);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.oncall-year-btn.is-active {
  background: var(--cm-primary);
  color: var(--cm-on-primary);
}

.oncall-year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  min-height: 62rem;
}

.oncall-year-body {
  position: relative;
}

.oncall-year-loading {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: var(--cm-overlay);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cm-text);
  border-radius: 12px;
}

.oncall-year-loading.hidden {
  display: none;
}

.oncall-year-spinner {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--cm-border);
  border-top-color: var(--cm-primary);
  border-radius: 50%;
  animation: cm-spin 0.7s linear infinite;
}

.oncall-month {
  padding: 0.7rem 0.65rem 0.8rem;
  border-radius: 14px;
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
}

.oncall-month-title {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--cm-text);
}

.oncall-month-grid {
  display: grid;
  grid-template-columns: 1.45rem repeat(7, minmax(0, 1fr));
  gap: 0.18rem;
}

.oncall-weeknum {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--cm-text-muted);
  line-height: 1;
  text-align: center;
}

.oncall-dow {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--cm-text-muted);
}

.oncall-day {
  aspect-ratio: 1;
  min-height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--cm-text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}

.oncall-day.is-pad {
  visibility: hidden;
  pointer-events: none;
}

.oncall-day.is-assigned {
  background: color-mix(in srgb, var(--oncall-fill) 38%, var(--cm-surface));
  color: var(--cm-text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--oncall-fill) 55%, transparent);
}

.oncall-day.is-today {
  box-shadow: inset 0 0 0 2px var(--cm-accent);
}

.oncall-day.is-week {
  outline: 2px solid var(--cm-primary);
  outline-offset: 0;
}

.oncall-day.is-changed {
  box-shadow: inset 0 0 0 2px #ea580c;
}

.oncall-day.is-today.is-changed,
.oncall-day.is-assigned.is-changed {
  box-shadow: inset 0 0 0 2px #ea580c;
}

.oncall-day.is-holiday {
  background: color-mix(in srgb, var(--oncall-holiday, #7c3aed) 48%, var(--cm-surface));
  color: var(--cm-text);
}

.oncall-day.is-holiday.is-assigned {
  box-shadow: inset 0 0 0 2px var(--oncall-fill);
}

.oncall-picker {
  margin-top: 1rem;
  padding: 0.85rem;
  border-radius: 14px;
  border: 1px dashed var(--cm-border);
  background: var(--cm-surface);
}

.oncall-picker-label {
  margin: 0 0 0.65rem;
  font-weight: 650;
  color: var(--cm-text);
}

.oncall-roster {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.oncall-roster-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}

.oncall-roster-row .oncall-roster-btn {
  flex: 1;
  min-width: 0;
}

.oncall-color-picker {
  position: relative;
  flex: 0 0 44px;
}

.oncall-color-btn {
  width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--cm-border);
  cursor: pointer;
  padding: 0;
}

.oncall-color-panel {
  position: absolute;
  z-index: 8;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  display: grid;
  grid-template-columns: repeat(5, 28px);
  gap: 0.3rem;
  padding: 0.4rem;
  background: var(--cm-surface);
  color: var(--cm-text);
  border: 1px solid var(--cm-border);
  border-radius: 10px;
  box-shadow: var(--cm-shadow-lg);
}

.oncall-color-panel[hidden] {
  display: none;
}

.oncall-color-choice {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--cm-border);
  padding: 0;
  cursor: pointer;
}

.oncall-color-choice.is-current {
  outline: 2px solid var(--cm-text);
  outline-offset: 1px;
}

.oncall-roster-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--cm-border);
  border-radius: 12px;
  background: var(--cm-surface-2);
  color: var(--cm-text);
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  border-left: 5px solid var(--oncall-fill, var(--cm-border));
}

.oncall-roster-btn.is-active {
  background: var(--cm-primary-soft);
  border-color: var(--cm-primary);
}

.oncall-rand-panel {
  max-width: 28rem;
}

.oncall-rand-panel .oncall-roster {
  max-height: min(50vh, 24rem);
  overflow-y: auto;
  margin: 0.65rem 0 0;
}

.oncall-rand-panel .modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.oncall-rand-panel .modal-actions .btn {
  min-height: 44px;
}

.oncall-year-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: flex-end;
}

.oncall-day.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.oncall-day.is-day {
  outline: 2px dashed var(--cm-primary);
  outline-offset: 0;
}

.oncall-history-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.oncall-history-label {
  font-weight: 650;
  color: var(--cm-text);
}

.oncall-history-select {
  width: 100%;
  min-height: 44px;
  font: inherit;
  font-size: 1rem;
  color: var(--cm-text);
  background: var(--cm-surface-2);
  border: 1px solid var(--cm-border);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
}

@media (max-width: 800px) {
  .oncall-year-actions {
    width: 100%;
    justify-content: stretch;
  }

  .oncall-year-actions .btn {
    width: 100%;
  }
}

.oncall-legend,
.oncall-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.oncall-legend-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 0.5rem;
  row-gap: 0.15rem;
  align-items: center;
}

.oncall-legend-item .oncall-color-picker {
  grid-row: 1 / span 2;
}

.oncall-legend-person {
  min-width: 0;
  grid-column: 2;
}

.oncall-legend-person .home-team-copy,
.oncall-legend-person .home-team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.oncall-legend-days {
  grid-column: 2;
  margin-left: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cm-text-muted);
  white-space: nowrap;
}

.oncall-history-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--cm-border);
}

.oncall-history-copy {
  margin: 0;
  color: var(--cm-text);
  font-size: 0.85rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.oncall-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.oncall-history-actions .btn {
  min-height: 44px;
}

.oncall-history-details {
  color: var(--cm-text);
}

.oncall-history-weeks {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0 0 0 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--cm-text-muted);
}

.oncall-tip-holiday {
  margin: 0 0 0.4rem;
  font-weight: 700;
  color: var(--cm-text);
}

.oncall-tip {
  position: fixed;
  z-index: 40;
  min-width: 220px;
  max-width: 280px;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: var(--cm-surface);
  color: var(--cm-text);
  border: 1px solid var(--cm-border);
  box-shadow: var(--cm-shadow-lg);
}

.oncall-tip-date {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cm-text-muted);
}

@media (max-width: 1100px) {
  .oncall-year-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 92rem;
  }
}

@media (max-width: 800px) {
  .requests-layout {
    grid-template-columns: 1fr;
  }

  .request-audience-opts {
    grid-template-columns: 1fr;
  }

  .oncall-layout {
    grid-template-columns: 1fr;
  }

  .oncall-year-grid {
    grid-template-columns: 1fr;
    min-height: 168rem;
  }

  .oncall-day {
    min-height: 40px;
    font-size: 0.9rem;
  }
}


