:root {
  color-scheme: dark;
  --color-page-bg: #08090a;
  --color-surface: #0c0d0e;
  --color-card: #0e0f10;
  --color-card-raised: #111214;
  --color-nav-bg: #090a0b;
  --color-nav-active: #232323;
  --color-nav-hover: #18191b;
  --color-header-bg: #0c0d0e;
  --color-text: #f5f5f5;
  --color-text-muted: #a3a3a3;
  --color-text-subtle: #737373;
  --color-border: #25272a;
  --color-separator: #1b1d20;
  --color-input-bg: #121315;
  --color-input-border: #303236;
  --color-table-head: #151618;
  --color-table-hover: #181a1d;
  --color-focus: rgba(87, 84, 250, 0.35);
  --color-accent: #c83f46;
  --color-accent-hover: #de555d;
  --color-accent-contrast: #ffffff;
  --color-button-primary: #5754fa;
  --color-button-primary-hover: #6865ff;
  --color-button-primary-active: #4542d9;
  --color-button-primary-disabled: #55547d;
  --color-info: #8aa7d8;
  --color-info-soft: #16202d;
  --color-success: #65b98b;
  --color-success-soft: #14251c;
  --color-warning: #d6a24d;
  --color-warning-soft: #2a2112;
  --color-risk: #df7d4c;
  --color-risk-soft: #2c1710;
  --color-error: #e0666d;
  --color-error-soft: #2f1417;
  --admin-status-active: #77c69a;
  --admin-status-active-bg: rgba(119, 198, 154, .14);
  --admin-status-active-border: rgba(119, 198, 154, .34);
  --admin-status-inactive: #e58a91;
  --admin-status-inactive-bg: rgba(229, 138, 145, .14);
  --admin-status-inactive-border: rgba(229, 138, 145, .34);
  --chart-indigo: #5754fa;
  --chart-purple: #b143ed;
  --chart-magenta: #e140a1;
  --chart-amber: #f5ad35;
  --chart-coral: #f44549;
  --color-chart-created: var(--chart-indigo);
  --color-chart-resolved: #65b98b;
  --color-chart-closed: var(--chart-purple);
  --color-chart-escalated: var(--chart-magenta);
  --color-chart-base: #6f7682;
  --color-chart-base-soft: #2a2d31;
  --color-tooltip-bg: #f5f5f5;
  --color-tooltip-text: #08090a;
  --color-loading: #737373;
  --color-empty: #737373;
  --radius: 8px;
  --shadow-card: none;
}

[data-theme="light"] {
  color-scheme: light;
  --color-page-bg: #f4f5f7;
  --color-surface: #f8f9fb;
  --color-card: #ffffff;
  --color-card-raised: #ffffff;
  --color-nav-bg: #171719;
  --color-nav-active: #2b2c30;
  --color-nav-hover: #242529;
  --color-header-bg: #f8f9fb;
  --color-text: #151619;
  --color-text-muted: #5f6672;
  --color-text-subtle: #7b8190;
  --color-border: #d7dbe2;
  --color-separator: #e5e7ec;
  --color-input-bg: #ffffff;
  --color-input-border: #cbd1dc;
  --color-table-head: #f0f2f5;
  --color-table-hover: #f6f7f9;
  --color-focus: rgba(87, 84, 250, 0.35);
  --color-accent: #b4232a;
  --color-accent-hover: #9f1f26;
  --color-accent-contrast: #ffffff;
  --color-button-primary: #5754fa;
  --color-button-primary-hover: #6865ff;
  --color-button-primary-active: #4542d9;
  --color-button-primary-disabled: #8b89d7;
  --color-info: #315f9c;
  --color-info-soft: #e8eef7;
  --color-success: #25724d;
  --color-success-soft: #e7f3ed;
  --color-warning: #8d640f;
  --color-warning-soft: #fff3d6;
  --color-risk: #a34818;
  --color-risk-soft: #ffeadc;
  --color-error: #b4232a;
  --color-error-soft: #fde8e8;
  --admin-status-active: #28744e;
  --admin-status-active-bg: rgba(40, 116, 78, .10);
  --admin-status-active-border: rgba(40, 116, 78, .34);
  --admin-status-inactive: #b4232a;
  --admin-status-inactive-bg: rgba(180, 35, 42, .09);
  --admin-status-inactive-border: rgba(180, 35, 42, .32);
  --chart-indigo: #5754fa;
  --chart-purple: #b143ed;
  --chart-magenta: #e140a1;
  --chart-amber: #f5ad35;
  --chart-coral: #f44549;
  --color-chart-created: var(--chart-indigo);
  --color-chart-resolved: #25724d;
  --color-chart-closed: var(--chart-purple);
  --color-chart-escalated: var(--chart-magenta);
  --color-chart-base: #69707d;
  --color-chart-base-soft: #e1e5eb;
  --color-tooltip-bg: #151619;
  --color-tooltip-text: #ffffff;
  --color-loading: #7b8190;
  --color-empty: #7b8190;
}

[data-theme="dark"] {
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --color-page-bg: #f4f5f7;
    --color-surface: #f8f9fb;
    --color-card: #ffffff;
    --color-card-raised: #ffffff;
    --color-header-bg: #f8f9fb;
    --color-text: #151619;
    --color-text-muted: #5f6672;
    --color-text-subtle: #7b8190;
    --color-border: #d7dbe2;
    --color-separator: #e5e7ec;
    --color-input-bg: #ffffff;
    --color-input-border: #cbd1dc;
    --color-table-head: #f0f2f5;
    --color-table-hover: #f6f7f9;
    --color-focus: rgba(87, 84, 250, 0.35);
    --color-accent: #b4232a;
    --color-accent-hover: #9f1f26;
    --color-info: #315f9c;
    --color-info-soft: #e8eef7;
    --color-success: #25724d;
    --color-success-soft: #e7f3ed;
    --color-warning: #8d640f;
    --color-warning-soft: #fff3d6;
    --color-risk: #a34818;
    --color-risk-soft: #ffeadc;
    --color-error: #b4232a;
    --color-error-soft: #fde8e8;
    --admin-status-active: #28744e;
    --admin-status-active-bg: rgba(40, 116, 78, .10);
    --admin-status-active-border: rgba(40, 116, 78, .34);
    --admin-status-inactive: #b4232a;
    --admin-status-inactive-bg: rgba(180, 35, 42, .09);
    --admin-status-inactive-border: rgba(180, 35, 42, .32);
    --chart-indigo: #5754fa;
    --chart-purple: #b143ed;
    --chart-magenta: #e140a1;
    --chart-amber: #f5ad35;
    --chart-coral: #f44549;
    --color-chart-created: var(--chart-indigo);
    --color-chart-resolved: #25724d;
    --color-chart-closed: var(--chart-purple);
    --color-chart-escalated: var(--chart-magenta);
    --color-chart-base: #69707d;
    --color-chart-base-soft: #e1e5eb;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--color-page-bg);
  color: var(--color-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.42;
}
button, input, select { font: inherit; }
button, .action-link {
  min-height: 38px;
  border-radius: 6px;
}
button {
  border: 1px solid var(--color-button-primary);
  background: var(--color-button-primary);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  padding: 8px 12px;
}
button:hover {
  border-color: var(--color-button-primary-hover);
  background: var(--color-button-primary-hover);
  color: #ffffff;
}
button:active {
  border-color: var(--color-button-primary-active);
  background: var(--color-button-primary-active);
}
.ghost-button {
  background: var(--color-input-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.ghost-button:hover, .action-link:hover, .chat-session-card:not(.is-active):hover {
  background: var(--color-nav-hover);
  color: #ffffff;
  border-color: var(--color-nav-hover);
}
[data-theme="light"] .ghost-button:hover,
[data-theme="light"] .action-link:hover,
[data-theme="light"] .chat-session-card:not(.is-active):hover {
  background: #242529;
  color: #ffffff;
  border-color: #242529;
}
.ghost-button:hover svg,
.action-link:hover svg,
.chat-session-card:hover svg { color: #ffffff; }
button:disabled {
  cursor: not-allowed;
  border-color: var(--color-button-primary-disabled);
  background: var(--color-button-primary-disabled);
  color: rgba(255, 255, 255, .82);
  opacity: 1;
}
button:disabled:hover {
  border-color: var(--color-button-primary-disabled);
  background: var(--color-button-primary-disabled);
  color: rgba(255, 255, 255, .82);
}
.ghost-button:disabled:hover {
  background: var(--color-input-bg);
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
button.is-busy::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 6px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: k27-spin .7s linear infinite;
  vertical-align: -1px;
}
@keyframes k27-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  button.is-busy::before { animation: none; }
}
a { color: var(--color-info); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 20;
  background: var(--color-card);
  color: var(--color-text);
  padding: 8px 12px;
}
.skip-link:focus { top: 12px; }
.app-shell {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--color-nav-bg);
  border-right: 1px solid var(--color-border);
  color: #f5f5f5;
  padding: 14px 12px;
}
.mobile-topbar { display: grid; gap: 12px; }
.brand {
  display: grid;
  gap: 4px;
  align-items: start;
  min-height: 58px;
  color: #f5f5f5;
  font-weight: 800;
}
.brand-logo {
  display: block;
  width: 132px;
  max-width: 100%;
  height: 42px;
  object-fit: contain;
  object-position: left center;
}
.brand-name {
  color: #d4d4d4;
  font-size: 12px;
  font-weight: 700;
}
.nav-toggle { display: none; }
.sidebar-nav {
  display: grid;
  gap: 4px;
  margin-top: 18px;
}
.nav-group {
  margin: 16px 8px 6px;
  color: #a3a3a3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 6px;
  color: #d4d4d4;
  text-decoration: none;
}
.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}
.sidebar-nav a:hover, .sidebar-nav a:focus-visible {
  background: var(--color-nav-hover);
  color: #ffffff;
}
.sidebar-nav a[aria-current="page"] {
  background: var(--color-nav-active);
  color: #ffffff;
}
.main-content {
  min-width: 0;
  background: var(--color-surface);
  padding: 18px 24px 28px;
}
.page-header {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: start;
  border-bottom: 1px solid var(--color-separator);
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.eyebrow {
  color: var(--color-text-subtle);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  margin: 0 0 3px;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 22px; line-height: 1.15; margin-bottom: 0; }
h2 { font-size: 20px; margin-bottom: 4px; }
h3 { font-size: 15px; margin-bottom: 0; }
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  max-width: 100%;
}
.updated, .user-chip, .language-control {
  color: var(--color-text-muted);
  font-size: 12px;
}
.language-control {
  display: flex;
  align-items: center;
  gap: 6px;
}
.language-control select { min-height: 34px; }
.filter-shell {
  margin-bottom: 14px;
}
.filters-active-count {
  display: inline-flex;
  margin-left: 6px;
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 800;
}
.filter-shell .ghost-button.has-active-filter {
  border-color: var(--color-accent);
  color: var(--color-text);
}
.summary-scope-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  min-height: 24px;
}
.summary-period {
  color: var(--color-text-muted);
  font-size: 12px;
}
.summary-scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 700;
}
.summary-scope-chip:hover { background: var(--color-nav-active); }
.filters-active-count {
  display: inline-flex;
  margin-left: 6px;
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 800;
}
.filter-shell .ghost-button.has-active-filter {
  border-color: var(--color-accent);
  color: var(--color-text);
}
.summary-scope-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  min-height: 24px;
}
.summary-period {
  color: var(--color-text-muted);
  font-size: 12px;
}
.summary-scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 55%, var(--color-border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 700;
}
.summary-scope-chip:hover { background: color-mix(in srgb, var(--color-accent) 20%, transparent); }
.filters-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
}
label {
  display: grid;
  gap: 4px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
}
input, select {
  min-height: 36px;
  width: 100%;
  border: 1px solid var(--color-input-border);
  border-radius: 6px;
  background: var(--color-input-bg);
  color: var(--color-text);
  padding: 7px 9px;
}
.search-field { grid-column: span 2; }
.filter-actions, .toolbar, .pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pager {
  justify-content: space-between;
  margin-top: 18px;
  padding: 0 0 20px;
  min-width: 0;
}
.pager .panel-state {
  margin: 0;
  min-width: 0;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}
.pagination-controls .ghost-button {
  background: var(--color-button-primary);
  border-color: var(--color-button-primary);
  color: #ffffff;
}
.pagination-controls .ghost-button:hover:not(:disabled) {
  background: var(--color-button-primary-hover);
  border-color: var(--color-button-primary-hover);
  color: #ffffff;
}
.pagination-controls .ghost-button:active:not(:disabled) {
  background: var(--color-button-primary-active);
  border-color: var(--color-button-primary-active);
  color: #ffffff;
}
.pagination-controls .ghost-button:disabled,
.pagination-controls .ghost-button:disabled:hover {
  background: var(--color-input-bg);
  border-color: var(--color-border);
  color: #c9c9c9;
  opacity: 1;
  cursor: not-allowed;
}
.view-panel { display: none; }
.view-panel.active { display: block; }
.admin-filter-row {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
}
.admin-filter-row label { min-width: min(100%, 220px); }
.admin-franchise-detail {
  display: grid;
  gap: 16px;
  max-width: 980px;
}
.admin-franchise-detail ul { margin: 0; padding-left: 20px; }
.admin-modal-panel { width: min(460px, calc(100vw - 32px)); }
.admin-franchise-form, .admin-detail-form { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-franchise-form .admin-notes { grid-column: 1 / -1; }
.admin-detail-form label:has(textarea) { grid-column: 1 / -1; }
.admin-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-detail-head h3 { margin: 0 auto 0 0; font-size: 21px; }
.admin-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.admin-metric {
  display: grid;
  gap: 5px;
  min-width: 0;
  min-height: 84px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: var(--color-card);
  text-align: left;
}
.admin-metric-link { color: var(--color-text); cursor: pointer; }
.admin-metric-link:hover { border-color: var(--color-button-primary); background: var(--color-surface-active); }
.admin-metric .metric-value { color: var(--color-text); font-size: 25px; font-weight: 800; }
.admin-tabs { display: flex; gap: 5px; border-bottom: 1px solid var(--color-border); }
.admin-tabs button { color: var(--color-text-muted); border: 0; border-bottom: 2px solid transparent; background: transparent; border-radius: 0; padding: 8px 10px; }
.admin-tabs button:hover, .admin-tabs button.is-active { color: var(--color-text); border-bottom-color: var(--color-button-primary); background: transparent; }
.admin-general-section, .admin-stores-section { display: grid; gap: 12px; }
.admin-general-section h4, .admin-stores-section h4 { margin: 0; font-size: 15px; }
.admin-stores-table-wrap { padding-right: 16px; overflow-x: auto; }
.admin-stores-table { min-width: 620px; table-layout: fixed; }
.admin-stores-table th:nth-child(1), .admin-stores-table td:nth-child(1) { width: 19%; }
.admin-stores-table th:nth-child(2), .admin-stores-table td:nth-child(2) { width: 31%; }
.admin-stores-table th:nth-child(3), .admin-stores-table td:nth-child(3) { width: 16%; }
.admin-stores-table th:nth-child(4), .admin-stores-table td:nth-child(4) { width: 12%; }
.admin-stores-table th:nth-child(5), .admin-stores-table td:nth-child(5) { width: 108px; padding-right: 16px; white-space: nowrap; }
.admin-stores-table th:nth-child(6), .admin-stores-table td:nth-child(6), .admin-stores-table th:nth-child(7), .admin-stores-table td:nth-child(7) { text-align: center; }
.admin-table-wrap {
  min-width: 0;
  max-width: 100%;
  padding: 0 16px 2px 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
.admin-table {
  width: 100%;
  table-layout: fixed;
}
.admin-table th,
.admin-table td {
  min-width: 0;
  overflow-wrap: anywhere;
  vertical-align: middle;
}
.admin-table th:last-child,
.admin-table td:last-child {
  padding-right: 20px;
  white-space: nowrap;
}
.admin-table--kiosks { min-width: 1080px; }
.admin-table--kiosks th:nth-child(1), .admin-table--kiosks td:nth-child(1) { width: 145px; }
.admin-table--kiosks th:nth-child(2), .admin-table--kiosks td:nth-child(2) { width: 115px; }
.admin-table--kiosks th:nth-child(3), .admin-table--kiosks td:nth-child(3) { width: 195px; }
.admin-table--kiosks th:nth-child(4), .admin-table--kiosks td:nth-child(4) { width: 130px; }
.admin-table--kiosks th:nth-child(5), .admin-table--kiosks td:nth-child(5) { width: 150px; }
.admin-table--kiosks th:nth-child(6), .admin-table--kiosks td:nth-child(6) { width: 105px; }
.admin-table--kiosks th:nth-child(7), .admin-table--kiosks td:nth-child(7) { width: 125px; text-align: center; }
.admin-table--kiosks th:nth-child(8), .admin-table--kiosks td:nth-child(8) { width: 100px; }
.admin-table--kiosk-incidents { min-width: 930px; }
.admin-table--kiosk-incidents th:nth-child(1), .admin-table--kiosk-incidents td:nth-child(1) { width: 125px; }
.admin-table--kiosk-incidents th:nth-child(2), .admin-table--kiosk-incidents td:nth-child(2) { width: 80px; }
.admin-table--kiosk-incidents th:nth-child(3), .admin-table--kiosk-incidents td:nth-child(3) { width: 130px; }
.admin-table--kiosk-incidents th:nth-child(4), .admin-table--kiosk-incidents td:nth-child(4) { width: 140px; }
.admin-table--kiosk-incidents th:nth-child(5), .admin-table--kiosk-incidents td:nth-child(5) { width: 160px; white-space: nowrap; }
.admin-table--kiosk-incidents th:nth-child(6), .admin-table--kiosk-incidents td:nth-child(6) { width: 165px; }
.admin-table--kiosk-incidents th:nth-child(7), .admin-table--kiosk-incidents td:nth-child(7) { width: 100px; }
.admin-table--activity { min-width: 850px; }
.admin-table--activity th:nth-child(1), .admin-table--activity td:nth-child(1) { width: 175px; white-space: nowrap; }
.admin-table--activity th:nth-child(2), .admin-table--activity td:nth-child(2) { width: 135px; }
.admin-table--activity th:nth-child(3), .admin-table--activity td:nth-child(3) { width: 155px; }
.admin-table--activity th:nth-child(4), .admin-table--activity td:nth-child(4) { width: 145px; }
.admin-table--activity td:nth-child(5) { white-space: normal; overflow-wrap: anywhere; }
.admin-table--users { min-width: 720px; }
.admin-table--users th:nth-child(1), .admin-table--users td:nth-child(1) { width: 170px; }
.admin-table--users th:nth-child(2), .admin-table--users td:nth-child(2) { width: 140px; }
.admin-table--users th:nth-child(3), .admin-table--users td:nth-child(3) { width: 110px; }
.admin-table--users th:nth-child(4), .admin-table--users td:nth-child(4) { width: 180px; }
.admin-table--users th:nth-child(5), .admin-table--users td:nth-child(5) { width: 150px; white-space: nowrap; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.view-heading {
  margin-bottom: 12px;
}
.view-heading.split, .panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.view-heading p {
  color: var(--color-text-muted);
  margin-bottom: 0;
}
.panel, .kpi {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(128px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.kpi {
  padding: 12px;
  min-height: 92px;
}
.kpi .label {
  display: block;
  color: var(--color-text-muted);
  font-size: 12px;
}
.kpi strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  margin: 8px 0 5px;
}
.kpi .hint {
  color: var(--color-text-subtle);
  font-size: 12px;
}
.summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.summary-grid.lower {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.panel {
  padding: 14px;
}
.svg-chart, .heatmap-chart {
  min-height: 178px;
  width: 100%;
  min-width: 0;
}
.svg-chart svg {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 150px;
}
.svg-chart.small,
.svg-chart.small svg { min-height: 126px; }
.svg-chart.executive { min-height: 210px; }
.svg-chart.executive svg { min-height: 184px; }
.svg-chart.executive.compact,
.svg-chart.executive.compact svg { min-height: 150px; }
.svg-chart.executive.donut,
.svg-chart.executive.donut svg { min-height: 132px; }
.chart-tooltip {
  position: fixed;
  z-index: 40;
  max-width: 220px;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-tooltip-bg);
  color: var(--color-tooltip-text);
  font-size: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
  pointer-events: none;
}
.chart-grid { stroke: var(--color-border); stroke-width: .8; opacity: .55; }
.chart-axis { stroke: var(--color-text-subtle); stroke-width: .8; opacity: .7; }
.chart-label { fill: var(--color-text-muted); font-size: 11px; }
.chart-line-created { fill: none; stroke: var(--color-accent); stroke-width: 2; }
.chart-line-resolved { fill: none; stroke: var(--color-success); stroke-width: 2; }
.chart-line-closed { fill: none; stroke: var(--color-chart-closed); stroke-width: 2; }
.chart-line-escalated { fill: none; stroke: var(--color-chart-escalated); stroke-width: 2; }
.chart-point-created { fill: var(--color-accent); }
.chart-point-resolved { fill: var(--color-success); }
.chart-point-closed { fill: var(--color-chart-closed); }
.chart-point-escalated { fill: var(--color-chart-escalated); }
.chart-bar-created { fill: var(--chart-indigo); }
.chart-bar-resolved { fill: var(--color-chart-resolved); }
.chart-bar-closed { fill: var(--chart-purple); }
.chart-bar-escalated { fill: var(--chart-magenta); }
.chart-segment-met { fill: var(--color-success); }
.chart-segment-at_risk { fill: #f5ad35; }
.chart-segment-breached { fill: #f44549; }
.chart-segment-pending { fill: #6b7280; }
.chart-segment-no_policy { fill: #6b7280; }
.chart-slice-0 { fill: var(--chart-indigo); }
.chart-slice-1 { fill: var(--chart-purple); }
.chart-slice-2 { fill: var(--chart-magenta); }
.chart-slice-3 { fill: var(--color-chart-base); }
.chart-slice-4 { fill: var(--color-border); }
.chart-slice-p1 { fill: var(--chart-coral); }
.chart-slice-p2 { fill: var(--chart-amber); }
.chart-slice-p3 { fill: var(--chart-indigo); }
.chart-bar-primary { fill: var(--chart-indigo); }
.chart-bar-secondary { fill: var(--color-chart-base); }
.chart-bar-tertiary { fill: var(--color-chart-base-soft); }
.chart-bar-muted { fill: var(--color-text-subtle); }
.chart-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--color-text-muted);
  font-size: 11px;
  margin-top: 6px;
}
.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 5px;
}
.chart-data-trigger {
  min-height: 26px;
  padding: 4px 8px;
  margin-top: auto;
  font-size: 11px;
  justify-self: start;
}
.sla-grid {
  display: grid;
  gap: 10px;
}
.sla-card {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 10px;
  background: var(--color-card-raised);
}
.sla-title-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.sla-percent { font-size: 20px; font-weight: 800; color: var(--color-text); }
.sla-meta {
  color: var(--color-text-muted);
  font-size: 12px;
  margin-bottom: 8px;
}
.segment-bar {
  display: flex;
  min-height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
}
.segment { min-width: 2px; }
.seg-met { background: var(--color-success); }
.seg-at_risk { background: #f5ad35; }
.seg-breached { background: #f44549; }
.seg-pending { background: #6b7280; }
.seg-no_policy { background: #6b7280; }
.mini-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--color-text-muted);
}
.bar-list {
  display: grid;
  gap: 8px;
}
.metric-row {
  display: grid;
  grid-template-columns: minmax(100px, 150px) 1fr auto;
  gap: 8px;
  align-items: center;
}
.metric-label {
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}
.metric-track {
  height: 8px;
  border-radius: 999px;
  background: var(--color-input-bg);
  overflow: hidden;
}
.metric-fill {
  height: 100%;
  min-width: 2px;
  background: var(--color-accent);
}
.compact-list, .data-grid {
  display: grid;
  gap: 8px;
}
.data-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.columns-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
}
.inline-check {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 6px;
}
.inline-check input { width: auto; min-height: auto; }
.item-card {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-card-raised);
  padding: 10px;
}
.item-card strong { display: block; margin-bottom: 4px; }
.item-card p { margin-bottom: 4px; color: var(--color-text-muted); }
.strong-line {
  display: block;
  color: var(--color-text);
  font-weight: 800;
}
.muted, .preview-line {
  display: block;
  color: var(--color-text-muted);
  font-size: 12px;
}
.preview-line {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px;
}
.incident-detail-view, .chat-inbox, .chat-thread, .chat-context {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
  padding: 12px;
  min-width: 0;
}
.incident-detail-view {
  margin-top: 0;
  padding: 14px;
}
.drawer-head, .chat-thread-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.drawer-head {
  align-items: flex-start;
  border-bottom: 1px solid var(--color-separator);
  padding-bottom: 12px;
}
.drawer-head h2 {
  margin: 0 0 4px;
  font-size: 24px;
}
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.detail-actions button[aria-pressed="true"], .incident-tabs [aria-selected="true"] {
  background: var(--color-button-primary);
  border-color: var(--color-button-primary);
  color: #ffffff;
}
.incident-tabs { display:flex; flex-wrap:wrap; gap:8px; min-width:0; }
#incident-details-content[hidden], #detail-resource[hidden] { display:none !important; }
.detail-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.detail-section {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-card-raised);
  padding: 12px;
}
.detail-section h3 {
  margin-bottom: 10px;
  color: var(--color-text);
}
.detail-resource {
  border-top: 1px solid var(--color-separator);
  padding-top: 10px;
}
.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.timeline-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
}
.timeline-item {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-card-raised);
  padding: 8px 10px;
}
.customer-history .timeline-item {
  display: grid;
  grid-template-columns: minmax(175px, 1.1fr) minmax(150px, 1fr) minmax(110px, .7fr) minmax(100px, .7fr);
  gap: 8px 16px;
  align-items: baseline;
}
.customer-history .timeline-date,
.customer-history .timeline-action,
.customer-history .timeline-actor,
.customer-history .timeline-status { min-width: 0; }
.timeline-item summary {
  cursor: pointer;
  display: grid;
  gap: 2px;
}
.timeline-item p {
  margin: 7px 0 0;
  color: var(--color-text-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.field-grid {
  display: grid;
  grid-template-columns: minmax(130px, 180px) 1fr;
  gap: 6px 12px;
  margin: 0;
}
.field-grid dt {
  color: var(--color-text-subtle);
  font-size: 12px;
}
.field-grid dd {
  margin: 0;
  color: var(--color-text);
  overflow-wrap: anywhere;
}
.field-grid.compact {
  grid-template-columns: minmax(108px, 140px) 1fr;
  gap: 5px 10px;
  margin: 8px 0 10px;
}
.field-grid.compact dt,
.field-grid.compact dd { font-size: 12px; }
.chat-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr) minmax(240px, 300px);
  gap: 12px;
}
.chat-filters, .chat-session-list, .message-list, .context-grid {
  display: grid;
  gap: 8px;
}
.chat-filters { margin-bottom: 10px; }
.chat-session-card {
  width: 100%;
  min-height: 0;
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--color-border);
  background: var(--color-card-raised);
  color: var(--color-text);
  padding: 10px;
}
.chat-session-card.is-active {
  border-color: var(--color-button-primary);
  background: var(--color-nav-active);
}
.chat-session-card.is-active:hover { border-color: var(--color-button-primary-hover); }
.chat-ticket-badge {
  justify-self: start;
  margin-bottom: 2px;
}
.badge-ticket {
  color: #e1e0ff;
  border-color: rgba(87, 84, 250, .72);
  background: rgba(87, 84, 250, .18);
}
[data-theme="light"] .badge-ticket {
  color: #3935b8;
  border-color: rgba(87, 84, 250, .52);
  background: rgba(87, 84, 250, .11);
}
.chat-session-card:focus-visible {
  outline: 2px solid var(--color-button-primary);
  outline-offset: 2px;
}
.action-reason {
  min-height: 18px;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 12px;
}
.action-reason:empty { display: none; }
.message {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--color-card-raised);
}
.message-user { border-left: 3px solid var(--color-info); }
.message-assistant { border-left: 3px solid var(--color-success); }
.message-operator { border-left: 3px solid var(--color-accent); }
.message.internal { border-left-color: var(--color-warning); }
.message p { margin-bottom: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-meta {
  display: block;
  color: var(--color-text-subtle);
  font-size: 11px;
  margin-bottom: 4px;
}
.composer {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
}
textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--color-input-border);
  border-radius: 6px;
  background: var(--color-input-bg);
  color: var(--color-text);
  padding: 8px;
}
.action-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  text-decoration: none;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
}
table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}
caption {
  text-align: left;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
}
th, td {
  border-bottom: 1px solid var(--color-separator);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
th {
  background: var(--color-table-head);
  color: var(--color-text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
tbody tr:hover { background: var(--color-table-hover); }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  border: 1px solid var(--color-border);
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.badge-p1, .badge-breached { background: var(--color-error-soft); color: var(--color-error); }
.badge-p2, .badge-at_risk { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-p3, .badge-pending { background: var(--color-info-soft); color: var(--color-info); }
.badge-p4 { background: var(--surface-active); color: var(--text-secondary); border-color: var(--border); }
.badge-met { background: var(--color-success-soft); color: var(--color-success); }
.badge-neutral, .badge-no_policy { color: var(--color-text-muted); background: var(--color-input-bg); }
.admin-status {
  gap: 5px;
  border-color: var(--color-border);
  color: var(--color-text-muted);
  background: var(--color-input-bg);
}
.admin-status::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}
.admin-status--active {
  color: var(--admin-status-active);
  border-color: var(--admin-status-active-border);
  background: var(--admin-status-active-bg);
}
.admin-status--inactive {
  color: var(--admin-status-inactive);
  border-color: var(--admin-status-inactive-border);
  background: var(--admin-status-inactive-bg);
}
.panel-state {
  margin: 8px 0 0;
  color: var(--color-text-muted);
}
.panel-state.error { color: var(--color-error); }
.empty { color: var(--color-empty); }
.loading { color: var(--color-loading); }
.reports-kpi-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(105px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.report-kpi {
  min-height: 92px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--chart-indigo);
  border-radius: 6px;
  background: var(--color-card);
}
.report-kpi:nth-child(4),
.report-kpi:nth-child(5) {
  border-left-color: var(--chart-amber);
}
.report-kpi:nth-child(7) {
  border-left-color: var(--chart-magenta);
}
.report-kpi span {
  display: block;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.report-kpi strong {
  display: block;
  margin-top: 8px;
  color: var(--color-text);
  font-size: 24px;
  line-height: 1;
}
.report-kpi small {
  display: block;
  margin-top: 6px;
  color: var(--color-text-subtle);
}
.reports-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.chart-card {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-height: 0;
  min-width: 0;
  padding: 14px 16px 16px;
  overflow: clip;
}
.chart-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chart-body > .svg-chart,
.chart-body > .heatmap-chart,
.chart-body > .bar-list {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.chart-body > .svg-chart,
.chart-body > .svg-chart svg {
  height: 100%;
  min-height: 0;
  max-height: 100%;
}
.chart-data-footer {
  flex: 0 0 auto;
  box-sizing: border-box;
  min-height: 42px;
  display: flex;
  align-items: end;
  margin-top: auto;
  padding-top: 8px;
}
.chart-data-footer .chart-data-trigger { margin-top: 0; }
.chart-card-head {
  flex: 0 0 auto;
  display: flex;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.chart-card-head h3 {
  font-size: 14px;
  letter-spacing: .01em;
}
.chart-main {
  grid-column: span 8;
  height: 300px;
}
.chart-side {
  grid-column: span 4;
  height: 300px;
}
.chart-quarter {
  grid-column: span 4;
  height: 230px;
}
.chart-mini {
  grid-column: span 2;
  height: 230px;
}
.chart-third {
  grid-column: span 4;
  height: 190px;
}
.chart-heatmap {
  grid-column: span 6;
  height: 240px;
}
.chart-heatmap .chart-card-head {
  min-height: 20px;
  margin-bottom: 5px;
}
.chart-heatmap .chart-legend {
  gap: 6px;
  margin: 0 0 5px;
  font-size: 10.5px;
}
.chart-priority {
  grid-column: span 3;
  height: 240px;
}
.chart-closure {
  grid-column: span 3;
  height: 240px;
}
.supplemental {
  height: 230px;
}
.compact-bars {
  gap: 6px;
}
.compact-bars .metric-row {
  grid-template-columns: minmax(84px, 130px) 1fr auto;
}
.compact-bars .metric-track {
  height: 7px;
}
.chart-card.chart-list-card {
  height: auto;
  min-height: 180px;
  max-height: none;
  overflow: visible;
}
.chart-list-card .chart-body {
  display: block;
  flex: 1 1 auto;
  max-height: 20rem;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: var(--color-text-muted) var(--color-input-bg);
  overscroll-behavior-y: contain;
}
.chart-list-card .chart-body > .readable-bars {
  height: auto;
  max-height: none;
  overflow: visible;
}
.readable-bars {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}
.readable-bars .metric-row {
  grid-template-columns: minmax(0, 45%) minmax(0, 1fr) minmax(2.5ch, auto);
  min-height: 28px;
  gap: 10px;
}
.readable-bars .metric-label {
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
}
.readable-bars .metric-value {
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.readable-bars .metric-fill {
  display: block;
  min-width: 0;
  background: var(--chart-indigo);
}
.readable-bars .metric-row:not(:first-child) .metric-fill { background: var(--color-text-muted); }
.readable-bars .metric-track { min-width: 0; height: 8px; }
.chart-list-card .chart-body:focus-visible { outline: 2px solid var(--chart-indigo); outline-offset: 2px; }
.chart-list-card .stacked-category-chart { max-height: none; overflow: visible; }
.chart-list-card .stacked-row { min-height: 28px; }
.chart-list-card .stacked-label { white-space: normal; overflow-wrap: anywhere; overflow: visible; }
.chart-card.chart-donut-card { height: auto; min-height: 230px; }
.chart-donut-card .chart-body { flex: 1 0 auto; overflow: visible; }
.chart-body > .donut-content {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  gap: 10px;
  height: auto;
  overflow: visible;
}
.chart-body > .donut-content > svg { flex: 0 0 108px; width: 108px; height: 118px; max-height: none; }
.chart-body > .svg-chart.executive.donut.donut-content { min-height: 0; flex: 0 0 auto; }
.chart-body > .svg-chart.executive.donut.donut-content > svg { min-height: 0; max-height: 118px; }
.donut-legend { flex: 1 1 108px; display: grid; gap: 8px; min-width: 0; }
.donut-legend-row { display: grid; grid-template-columns: 8px minmax(0, 1fr); align-items: center; column-gap: 6px; font-size: 12px; }
.donut-legend-row > svg { width: 8px; height: 8px; }
.chart-body > .donut-content .donut-legend-row > svg { min-height: 8px; max-height: 8px; width: 8px; height: 8px; }
.donut-legend-label { white-space: normal; overflow-wrap: anywhere; }
.donut-legend-value { grid-column: 2; font-variant-numeric: tabular-nums; color: var(--color-text-muted); }
.badge-p4 { white-space: normal; overflow-wrap: anywhere; }
.chart-body > .svg-chart:not(.readable-bars):not(.donut-content) { display: flex; flex-direction: column; }
.chart-body > .svg-chart:not(.readable-bars):not(.donut-content) > svg { flex: 1 1 auto; height: 0; min-height: 0; max-width: 100%; }
.chart-body > .svg-chart > .chart-legend { flex: 0 0 auto; }
.compact-table {
  min-width: 0;
  font-size: 12px;
}
.compact-table td {
  padding: 4px 6px;
}
.stacked-category-chart {
  display: grid;
  gap: 5px;
  max-height: 148px;
  min-width: 0;
  overflow: hidden;
}
.stacked-row {
  display: grid;
  grid-template-columns: minmax(110px, 130px) minmax(0, 1fr) 34px;
  gap: 7px;
  align-items: center;
  min-height: 20px;
}
.stacked-label {
  color: var(--color-text-muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stacked-track {
  display: flex;
  height: 10px;
  min-width: 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
}
.stacked-segment {
  min-width: 0;
  height: 100%;
}
.stacked-value {
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}
.stack-pending { background: #b143ed; }
.stack-fixed { background: #5754fa; }
.stack-0 { background: #e140a1; }
.stack-1 { background: #f5ad35; }
.stack-2 { background: #6b7280; }
.stack-3 { background: var(--color-chart-base); }
.note {
  color: var(--color-text-subtle);
  font-size: 12px;
  margin: 12px 0 0;
}
.evidence-viewer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .72);
}
.chart-data-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .72);
}
.chart-data-panel {
  position: relative;
  width: min(720px, calc(100vw - 32px));
  max-height: 75vh;
  overflow: hidden;
  display: grid;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
  padding: 14px;
}
.chart-data-panel.wide {
  width: min(900px, calc(100vw - 32px));
}
.chart-data-panel h2 {
  margin: 0;
  padding-right: 36px;
  font-size: 18px;
}
.modal-x {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 30px;
  width: 30px;
  padding: 0;
}
.chart-data-table-wrap {
  max-height: calc(75vh - 104px);
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 6px;
}
.chart-data-table-wrap table {
  min-width: 0;
  width: 100%;
}
.chart-data-table-wrap th,
.chart-data-table-wrap td {
  padding: 6px 8px;
}
body.modal-open {
  overflow: hidden;
}
.login-page {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background-color: #000;
  background-image: url("/static/images/ari-login-k27-background.png");
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  color: #f5f5f5;
}
.login-shell {
  display: grid;
  min-height: 100dvh;
  align-items: center;
  padding: clamp(92px, 12vh, 144px) clamp(32px, 15vw, 288px) clamp(42px, 9vh, 96px);
}
.login-card {
  width: min(100%, 410px);
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}
.login-logo {
  display: block;
  width: 132px;
  height: 42px;
  margin-bottom: 28px;
  object-fit: contain;
}
.login-product {
  margin: 0 0 30px;
  color: #f5f5f5;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
}
.login-product span { color: #a3a3a3; font-size: 13px; font-weight: 500; }
.login-card h1 { margin: 0 0 8px; color: #f5f5f5; font-size: 26px; font-weight: 650; line-height: 1.2; }
.login-description { margin: 0 0 30px; color: #a3a3a3; font-size: 14px; line-height: 1.5; }
.login-card form { display: grid; gap: 9px; }
.login-card label { color: #d4d4d4; font-size: 12px; font-weight: 600; }
.login-card input {
  min-height: 42px;
  border: 1px solid rgba(245, 245, 245, .16);
  border-radius: 6px;
  background: rgba(8, 9, 10, .72);
  color: #f5f5f5;
  padding: 0 12px;
}
.login-card input:hover { border-color: rgba(245, 245, 245, .30); }
.login-card input:focus-visible { border-color: #6865ff; box-shadow: 0 0 0 3px rgba(87, 84, 250, .35); }
.login-card .btn { min-height: 42px; margin-top: 14px; justify-content: center; color: #fff; }
.login-card .btn:disabled { cursor: not-allowed; opacity: .65; }
.login-error { margin: 5px 0 0; color: #f44549; font-size: 13px; }
.login-controls {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #a3a3a3;
}
.login-language-label { font-size: 12px; }
.login-controls select,
.login-theme-toggle {
  min-height: 32px;
  border: 1px solid rgba(245, 245, 245, .16);
  border-radius: 6px;
  background: rgba(8, 9, 10, .72);
  color: #f5f5f5;
}
.login-controls select { padding: 0 26px 0 9px; font-size: 12px; }
.login-theme-toggle { width: 32px; padding: 0; font-size: 16px; }
.login-controls select:hover,
.login-theme-toggle:hover { border-color: rgba(245, 245, 245, .36); background: #1b1d20; color: #fff; }
.login-controls select:focus-visible,
.login-theme-toggle:focus-visible { outline: 3px solid rgba(87, 84, 250, .35); outline-offset: 2px; }
.viewer-panel {
  width: min(960px, 100%);
  max-height: min(780px, 92vh);
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
  padding: 14px;
}
.viewer-body {
  display: grid;
  place-items: center;
  min-height: 160px;
}
.viewer-media {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}
@media (max-width: 1180px) {
  .page-header {
    grid-template-columns: 1fr;
  }
  .header-actions { justify-content: flex-start; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .reports-kpi-strip { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .filters-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .data-grid, .summary-grid.lower { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-main, .chart-side, .chart-quarter, .chart-mini, .chart-third, .chart-heatmap, .chart-priority, .chart-closure { grid-column: span 1; }
  .chat-workspace { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
  .chat-context { grid-column: 1 / -1; }
  .columns-panel { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
}
@media (max-width: 820px) {
  .login-shell { padding-left: clamp(28px, 9vw, 84px); padding-right: 28px; }
  .login-card { width: min(100%, 400px); }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    height: auto;
    z-index: 10;
  }
  .mobile-topbar {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .brand { min-height: 48px; }
  .brand-logo { width: 118px; height: 36px; }
  .nav-toggle { display: inline-flex; align-items: center; }
  .sidebar-nav[hidden] { display: none; }
  .sidebar-nav { margin-top: 10px; }
  .main-content { padding: 14px; }
  .pager {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .pagination-controls { width: 100%; }
  .summary-grid, .summary-grid.lower, .reports-grid, .data-grid, .detail-section-grid {
    grid-template-columns: 1fr;
  }
  .reports-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-grid { grid-template-columns: 1fr; }
  .stacked-category-chart { overflow-x: auto; overflow-y: hidden; }
  .chart-data-modal { padding: 10px; }
  .chart-data-panel { width: 100%; max-height: 88vh; }
  .chat-workspace { grid-template-columns: 1fr; }
  .chat-thread-head { display: grid; grid-template-columns: 1fr; }
  .columns-panel { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .filters-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .admin-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-stores-table-wrap { padding-right: 12px; }
}
@media (max-width: 480px) {
  .login-page { background-position: 68% center; }
  .login-shell { place-items: center; padding: 96px 16px 36px; }
  .login-card { width: min(100%, calc(100vw - 32px)); }
  .login-logo { margin-bottom: 24px; }
  .login-product { margin-bottom: 26px; }
  .login-controls { top: 14px; right: 16px; }
  .login-language-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  body { font-size: 13px; }
  .header-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .header-actions > * { min-width: 0; }
  .filters-grid, .kpi-grid { grid-template-columns: 1fr; }
  .admin-franchise-form, .admin-detail-form, .admin-metric-grid { grid-template-columns: 1fr; }
  .reports-kpi-strip { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .mini-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Customer views share the operational components; only their column geometry differs. */
[data-dashboard="customer"] .view-panel,
[data-dashboard="customer"] .detail-section,
[data-dashboard="customer"] .chat-workspace > *,
[data-dashboard="customer"] .table-wrap { min-width: 0; max-width: 100%; }
[data-dashboard="customer"] .table-wrap { overflow-x: auto; }
[data-dashboard="customer"] .table-wrap table { table-layout: auto; width: 100%; }
[data-dashboard="customer"] .table-wrap th,
[data-dashboard="customer"] .table-wrap td { overflow-wrap: normal; word-break: normal; }
[data-dashboard="customer"] .table-wrap th { white-space: nowrap; }
[data-dashboard="customer"] .table-wrap td:last-child,
[data-dashboard="customer"] .table-wrap th:last-child { width: 104px; min-width: 104px; padding-right: 24px; }
[data-dashboard="customer"] .badge { white-space: nowrap; }
#customer-incidents-table { min-width: 1180px; }
#customer-incidents-table th:nth-child(4),
#customer-incidents-table td:nth-child(4) { min-width: 185px; }
#customer-incidents-table td:nth-child(8),
#customer-incidents-table td:nth-child(9) { min-width: 130px; }
#customer-stores-table { min-width: 960px; }
#customer-stores-table th:nth-child(5),
#customer-stores-table td:nth-child(5) { width: 100px; min-width: 100px; }
#customer-stores-table th:nth-child(6),
#customer-stores-table td:nth-child(6) { width: 85px; min-width: 85px; text-align: center; }
#customer-stores-table th:nth-child(7),
#customer-stores-table td:nth-child(7) { width: 150px; min-width: 150px; text-align: center; white-space: nowrap; }
[data-dashboard="customer"] .admin-table--kiosks { min-width: 960px; }
[data-dashboard="customer"] .admin-table--kiosks td:nth-child(7) { text-align: center; min-width: 150px; }
[data-dashboard="customer"] .admin-table--kiosk-incidents { min-width: 850px; }
[data-dashboard="customer"] .detail-section-grid { margin: 12px 0; }
[data-dashboard="customer"] .field-grid { margin: 0; }
[data-dashboard="customer"] .message-author { display: block; }
#customer-chat-back { display: none; }
@media (max-width: 820px) {
  .customer-history .timeline-item { grid-template-columns: 1fr; gap: 4px; }
  #customer-chat-back { display: inline-flex; }
  [data-dashboard="customer"] .admin-detail-head { flex-wrap: wrap; }
  [data-dashboard="customer"] .field-grid { grid-template-columns: minmax(90px, .8fr) minmax(0, 1.2fr); }
}

#customer-stores-table th:nth-child(1), #customer-stores-table td:nth-child(1) { width: 110px; }
#customer-stores-table th:nth-child(2), #customer-stores-table td:nth-child(2) { width: auto; min-width: 150px; }
#customer-stores-table th:nth-child(3), #customer-stores-table td:nth-child(3) { width: auto; min-width: 135px; }
#customer-stores-table th:nth-child(4), #customer-stores-table td:nth-child(4) { width: auto; min-width: 110px; }

[data-dashboard="customer"] .context-grid { display: grid; gap: 10px; }
[data-dashboard="customer"] .context-item { display: grid; grid-template-columns: minmax(90px, 130px) minmax(0, 1fr); gap: 12px; align-items: start; }
[data-dashboard="customer"] .context-label { color: var(--color-text-subtle); font-size: 12px; }
[data-dashboard="customer"] .chart-axis, [data-dashboard="customer"] .chart-gridline { stroke: var(--color-border); stroke-width: 1; }
[data-dashboard="customer"] .chart-gridline { opacity: .7; }
[data-dashboard="customer"] .chart-axis-label { fill: var(--color-text-subtle); font-size: 11px; }
[data-dashboard="customer"] .chart-series-created { fill: var(--color-button-primary); }
[data-dashboard="customer"] .chart-series-resolved { fill: var(--color-success); }
[data-dashboard="customer"] .chart-series-closed { fill: var(--color-warning); }
[data-dashboard="customer"] .chart-series-escalated { fill: var(--color-error); }
[data-dashboard="customer"] .chart-legend-item { display: inline-flex; align-items: center; margin-right: 14px; }
@media (max-width: 480px) { [data-dashboard="customer"] .context-item { grid-template-columns: 1fr; gap: 2px; } }

/* Customer trend geometry shares operational colors and controls. */
[data-dashboard="customer"] .trend-panel { display: flex; flex-direction: column; height: 390px; min-height: 0; }
[data-dashboard="customer"] .trend-panel .panel-head { flex: 0 0 auto; margin-bottom: 8px; }
#customer-trend { position: relative; min-height: 0; width: 100%; flex: 1 1 auto; display: flex; flex-direction: column; }
#customer-trend > .customer-trend-svg { display: block; width: 100%; height: 0; flex: 1 1 auto; min-height: 0; overflow: visible; }
#customer-trend .customer-trend-legend { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 10px; min-height: 22px; }
#customer-trend .chart-legend-item { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 600; }
#customer-trend .chart-legend-swatch { display: block; flex: 0 0 28px; width: 28px; height: 10px; min-height: 0; }
#customer-trend .chart-legend-swatch line, #customer-trend .customer-trend-line { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
#customer-trend .chart-series-created { stroke: var(--color-chart-created); fill: var(--color-chart-created); }
#customer-trend .chart-series-resolved { stroke: var(--color-chart-resolved); fill: var(--color-chart-resolved); }
#customer-trend .chart-series-closed { stroke: var(--color-chart-closed); fill: var(--color-chart-closed); }
#customer-trend .chart-series-escalated { stroke: var(--color-chart-escalated); fill: var(--color-chart-escalated); }
#customer-trend .customer-trend-line { fill: none; stroke-linejoin: round; stroke-linecap: round; }
#customer-trend .customer-trend-plot { stroke: var(--color-border); fill: none; }
#customer-trend .customer-trend-hit { cursor: crosshair; }
#customer-trend .customer-trend-hit:focus { outline: none; stroke: var(--color-text); stroke-width: 2; }
#customer-trend .customer-chart-tooltip { position: absolute; top: 38px; right: 8px; max-width: calc(100% - 16px); z-index: 2; pointer-events: none; }
#customer-trend .customer-tooltip-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding-top: 5px; }
#customer-trend .customer-tooltip-dot { width: 9px; height: 9px; border-radius: 50%; }
#customer-trend .customer-tooltip-dot.chart-series-created { background: var(--color-chart-created); }
#customer-trend .customer-tooltip-dot.chart-series-resolved { background: var(--color-chart-resolved); }
#customer-trend .customer-tooltip-dot.chart-series-closed { background: var(--color-chart-closed); }
#customer-trend .customer-tooltip-dot.chart-series-escalated { background: var(--color-chart-escalated); }
[data-dashboard="customer"] .customer-report-trigger { white-space: normal; flex-shrink: 0; }
[data-dashboard="customer"] .channel-badge { display: inline-flex; align-items: center; width: fit-content; }
[data-dashboard="customer"] .chat-card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
[data-dashboard="customer"] .chat-meta-item { display: inline-flex; margin-right: 12px; margin-bottom: 4px; }
/* The dialog is a sibling of the shell, so its scope is its own ID. */
#customer-report-modal .customer-report-panel { width: min(780px, 100%); max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; display: flex; flex-direction: column; }
#customer-report-modal .customer-report-head { display: flex; align-items: flex-start; gap: 16px; padding: 20px 24px 8px; }
#customer-report-modal .customer-report-head h2 { margin: 0 0 6px; font-size: 21px; }
#customer-report-modal .customer-report-head p { margin: 0; color: var(--color-text-subtle); }
#customer-report-modal .customer-report-head button { margin-left: auto; padding: 6px 12px; }
#customer-report-modal .customer-report-preferences { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 4px 24px 12px; border-bottom: 1px solid var(--color-border); }
#customer-report-modal .customer-report-preferences label { display: flex; align-items: center; gap: 8px; }
#customer-report-form { display: flex; flex-direction: column; min-height: 0; }
#customer-report-modal .customer-report-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; padding: 18px 24px; min-height: 0; overflow-y: auto; }
#customer-report-modal label { display: grid; gap: 6px; min-width: 0; }
#customer-report-modal .report-wide { grid-column: 1 / -1; }
#customer-report-modal input, #customer-report-modal select, #customer-report-modal textarea { width: 100%; min-width: 0; max-width: 100%; }
#customer-report-modal output:not(.field-hint) { min-height: 38px; display: flex; align-items: center; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-surface); overflow-wrap: anywhere; }
#customer-report-modal output[hidden], #customer-report-modal select[hidden] { display: none; }
#customer-report-modal textarea { min-height: 88px; resize: vertical; font: inherit; font-weight: 400; }
#customer-report-modal .field-hint { margin: 0; color: var(--color-text-subtle); font-size: 12px; }
#customer-report-counter { text-align: right; }
#customer-report-modal .report-evidence h3 { margin: 0 0 5px; font-size: 13px; }
#customer-report-modal .customer-report-footer { padding: 10px 24px 18px; border-top: 1px solid var(--color-border); }
#customer-report-modal .customer-report-footer .panel-state:empty { display: none; }
#customer-report-modal .form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
#customer-report-modal button:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 820px) {
  [data-dashboard="customer"] .sidebar-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; }
  [data-dashboard="customer"] .sidebar-nav .nav-group { display: none; }
  [data-dashboard="customer"] .sidebar-nav a { justify-content: center; padding: 10px 3px; }
  [data-dashboard="customer"] .sidebar-nav[hidden] { display: none; }
}
@media (max-width: 500px) {
  #customer-trend .customer-trend-legend { gap: 4px 12px; }
  #customer-trend .chart-legend-item { font-size: 11px; }
  [data-dashboard="customer"] .view-heading.split { flex-wrap: wrap; gap: 8px; }
  #customer-report-modal { padding: 8px; }
  #customer-report-modal .customer-report-panel { max-height: calc(100dvh - 16px); }
  #customer-report-modal .customer-report-head { padding: 14px 14px 6px; }
  #customer-report-modal .customer-report-preferences { padding: 4px 14px 10px; }
  #customer-report-modal .customer-report-fields { padding: 14px; gap: 12px; grid-template-columns: minmax(0,1fr); }
  #customer-report-modal .customer-report-footer { padding: 10px 14px 14px; }
  #customer-report-modal .form-actions { display: grid; grid-template-columns: auto minmax(0,1fr); }
  #customer-report-modal .form-actions button { white-space: normal; }
}

@media (max-width: 1100px) { [data-dashboard="customer"] .trend-panel { height: 330px; } }
@media (max-width: 500px) { [data-dashboard="customer"] .trend-panel { height: 300px; } }

#customer-report-modal .customer-report-preferences label:last-child { margin-left: auto; }
#customer-report-modal .customer-report-preferences #customer-report-channel { min-height: 28px; padding: 4px 8px; }

/* Customer messaging is enabled only by the scoped conversation capability. */
.customer-chat-composer { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border); }
.customer-chat-composer textarea { width: 100%; min-width: 0; font: inherit; font-weight: 400; resize: vertical; }
.customer-chat-composer button { justify-self: end; }
.customer-chat-composer p { margin: 0; color: var(--color-text-subtle); }
/* Formal chat identifiers and customer messages may contain long unbroken text. */
[data-dashboard="customer"] .chat-session-card,
[data-dashboard="customer"] .chat-session-card > *,
[data-dashboard="customer"] .chat-thread-head > *,
[data-dashboard="customer"] .context-item > *,
[data-dashboard="customer"] .message { min-width: 0; overflow-wrap: anywhere; }
[data-dashboard="customer"] .chat-session-card,
[data-dashboard="customer"] .message-list { grid-template-columns: minmax(0, 1fr); }
#customer-chat-thread-title { overflow-wrap: anywhere; }
@media (max-width: 820px) {
  [data-dashboard="customer"] .chat-thread-head { grid-template-columns: minmax(0, 1fr); }
}
/* Customer conversation uses the existing panels with an independently scrolling transcript. */
.customer-chat-workspace { height: var(--customer-chat-height, 65dvh); min-height: 0; grid-template-columns: minmax(160px,24%) minmax(0,1fr) minmax(160px,22%); grid-template-rows: minmax(0,1fr); }
.customer-chat-workspace > .chat-context { grid-column: auto; }
.customer-chat-workspace > .chat-thread { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
#customer-chat-thread { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
#customer-chat-thread .chat-thread-head { flex: 0 0 auto; max-height: 28%; overflow: auto; }
#customer-chat-messages { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 8px; }
.customer-chat-workspace .chat-inbox, .customer-chat-workspace .chat-context { overflow: auto; min-height: 0; }
.customer-chat-composer { flex: 0 0 auto; min-height: 0; margin: 0; padding: 8px; background: var(--color-card); grid-template-columns: minmax(0,1fr) auto; align-items: center; }
#customer-chat-input-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.customer-chat-composer textarea { grid-column: 1/-1; height: 64px; min-height: 48px; max-height: 96px; resize: none; }
#customer-chat-send-state { grid-column: 1/-1; font-size: 12px; max-height: 40px; overflow: auto; }
#customer-chat-send-state:empty { display: none; }
#customer-chat-attachments { min-width: 0; }
#customer-chat-files { max-height: 80px; overflow: auto; }
.customer-file-selection { display: flex; gap: 8px; align-items: center; min-width: 0; }
.customer-file-selection > :first-child { overflow-wrap: anywhere; min-width: 0; }
.customer-file-selection button { flex-shrink: 0; }
.customer-attachment-link { display: block; margin-top: 6px; overflow-wrap: anywhere; }
@media (max-width: 820px) {
 .customer-chat-workspace { grid-template-columns: minmax(0,1fr); }
 .customer-chat-workspace.is-selected { position: fixed; left: 0; right: 0; top: var(--customer-chat-top,0px); height: var(--customer-chat-height,100dvh); z-index: 50; display: grid; grid-template-columns: minmax(0,1fr); padding: 6px; gap: 0; background: var(--color-bg); }
 .customer-chat-workspace.is-selected > .chat-inbox, .customer-chat-workspace.is-selected > .chat-context { display: none; }
 .customer-chat-workspace.is-selected .chat-thread-head { max-height: 25%; padding: 4px; }
 .customer-chat-workspace.is-selected #customer-chat-thread-title { font-size: 14px; margin: 2px 0; }
 .customer-chat-workspace.is-selected #customer-chat-thread-meta { font-size: 11px; margin: 2px 0; }
 .customer-chat-workspace.is-selected #customer-chat-back { display: inline-flex; }
}

.customer-chat-workspace .chat-session-card.is-active { background: var(--color-info-soft); color: var(--color-text); }
[data-dashboard="customer"] .customer-chat-workspace .context-item { grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); gap: 8px; }
#customer-chat-mobile-context { display: none; }
@media (max-width: 820px) {
 #customer-chat-mobile-context { display: block; grid-column: 1/-1; }
 #customer-chat-mobile-context summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
 #customer-chat-mobile-context summary:focus-visible { outline: 2px solid var(--color-button-primary); }
 .customer-chat-workspace.is-selected #customer-chat-back { justify-self: start; }
}

/* Customer evidence reuses the operational modal, card and button tokens. */
.customer-linked-conversation > button { margin-top: 16px; }
#customer-evidence-viewer .customer-evidence-panel {
  width: min(1100px, 100%); height: min(850px, calc(100dvh - 48px));
  max-height: calc(100dvh - 48px); grid-template-rows: auto minmax(0, 1fr) auto;
}
.customer-evidence-head { min-width: 0; }
.customer-evidence-head h2 { overflow-wrap: anywhere; }
.customer-evidence-media { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.customer-evidence-media .viewer-media { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.customer-evidence-controls { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; }
#customer-evidence-download { margin-left: auto; }
@media (max-width: 600px) {
  #customer-evidence-viewer { padding: 8px; }
  #customer-evidence-viewer .customer-evidence-panel { height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); padding: 12px; }
}

#customer-chat-thread .chat-thread-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; }
#customer-chat-thread-title { grid-column: 2; grid-row: 1; margin: 0; }
#customer-chat-thread-meta { grid-column: 2; grid-row: 2; margin: 0; min-width: 0; }
#customer-chat-back { grid-column: 1; grid-row: 1 / 3; align-self: start; }
.customer-chat-brand, .customer-chat-tagline { display: block; }
.customer-chat-brand { font-weight: 600; }
.customer-chat-tagline { margin-top: 4px; color: var(--color-text-subtle); }
@media (max-width: 820px) {
 .customer-chat-workspace.is-selected #customer-chat-thread-title { font-size: 18px; }
 .customer-chat-workspace.is-selected #customer-chat-thread-meta { font-size: 12px; }
}

/* Operational forms use the existing cards, fields, buttons and color tokens. */
.pilot-dialog { display:block; max-height:calc(100dvh - 32px); overflow:auto; color:var(--color-text); }
.pilot-dialog::backdrop { background:rgba(0,0,0,.72); }
.pilot-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin:16px 0; }
.pilot-fields label { display:grid; gap:6px; min-width:0; }
.pilot-fields input,.pilot-fields textarea,.pilot-fields select { width:100%; min-width:0; }
.pilot-fields label:has(textarea),.pilot-full { grid-column:1/-1; }
.pilot-fields input[type=checkbox],.pilot-check input { width:auto; }
.pilot-check { display:flex; align-items:center; gap:10px; margin:8px 0; }
.pilot-body { white-space:pre-wrap; overflow-wrap:anywhere; }
.pilot-evidence img { display:block; max-width:100%; max-height:65dvh; object-fit:contain; margin:auto; }
.pilot-alert-list { display:grid; gap:8px; }
.pilot-pulse { animation:pilot-pulse 600ms ease-out 2; }
@keyframes pilot-pulse { 50% { box-shadow:0 0 0 5px rgba(109,80,255,.25); } }
@media(prefers-reduced-motion:reduce){.pilot-pulse{animation:none;}}
@media(max-width:700px){.pilot-fields{grid-template-columns:1fr}.pilot-dialog{width:calc(100vw - 24px);max-height:calc(100dvh - 24px)}.pilot-fields fieldset{min-width:0}}

#detail-resource { scroll-margin-top: 16px; }
#operation-alerts { display:inline-flex; align-items:center; gap:8px; }
.pilot-bell-icon { width:18px; height:18px; flex:none; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
@media(max-width:820px){#detail-resource {scroll-margin-top:100px;}}
#detail-resource .chip-row .badge { max-width:100%; white-space:normal; overflow-wrap:anywhere; }
[data-dashboard="acrec"] .admin-franchise-detail { width:100%; min-width:0; grid-template-columns:minmax(0,1fr); }
[data-dashboard="acrec"] .admin-tabs { flex-wrap:wrap; }
.pilot-access-table { min-width:920px; }

/* Only mail opens a side panel; incident tabs remain in the main workspace. */
body.operation-panel-open { overflow:hidden; }
.operation-side-panel { position:fixed; inset:0 0 0 auto; margin:0; width:min(1020px,88vw); max-width:100vw; height:100dvh; max-height:100dvh; padding:0; border:0; border-left:1px solid var(--color-border); border-radius:0; color:var(--color-text); background:var(--color-surface); overflow:hidden; box-shadow:-12px 0 48px #0005; }
.operation-side-panel[open] { display:flex; flex-direction:column; }
.operation-side-panel::backdrop { background:rgba(0,0,0,.58); }
.operation-panel-header { flex:none; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px 16px; padding:20px 24px 14px; border-bottom:1px solid var(--color-border); }
.operation-panel-header h2 { margin:0; align-self:center; font-size:20px; overflow-wrap:anywhere; }
.operation-panel-header .chip-row { grid-column:1/-1; gap:8px; }
.operation-panel-header .badge { white-space:normal; }
.operation-mail-tabs { display:flex; flex:none; gap:8px; flex-wrap:wrap; padding:10px 24px; border-bottom:1px solid var(--color-border); }
.operation-mail-tabs button { min-width:0; }
.operation-mail-tabs [aria-selected=true] { background:var(--color-button-primary); color:#fff; border-color:var(--color-button-primary); }
.operation-mail-refresh { grid-column:1/-1; display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; font-size:12px; }
.operation-mail-refresh [role=status] { flex-basis:100%; margin:0; }
.operation-mail-refresh [role=status]:empty { display:none; }
.mail-quoted { border-top:1px solid var(--color-border); padding-top:8px; margin-top:10px; }
.mail-quoted summary { cursor:pointer; color:var(--color-text); font-size:13px; }
.pilot-evidence img,.pilot-evidence video { max-width:100%; max-height:60dvh; object-fit:contain; display:block; margin:0 auto 12px; }
.operation-panel-body { flex:1 1 0; min-height:0; min-width:0; padding:20px 24px; overflow:auto; overscroll-behavior:contain; overflow-wrap:anywhere; }
.operation-panel-footer { flex:none; padding:12px 24px max(16px,env(safe-area-inset-bottom)); border-top:1px solid var(--color-border); background:var(--color-card); }
.operation-panel-footer .modal-actions { display:flex; justify-content:flex-end; gap:8px; flex-wrap:wrap; margin:8px 0 0; }
.operation-panel-footer [role=status]:empty { display:none; }
.operation-side-panel [hidden] { display:none !important; }
.operation-side-panel .pilot-fields { margin-top:0; }
.operation-side-panel .pilot-fields fieldset { min-width:0; border:1px solid var(--color-border); border-radius:var(--radius); padding:10px 12px; }
.operation-side-panel .pilot-check,.operation-side-panel label:has(input[type=checkbox]) { display:flex; align-items:center; gap:10px; margin:6px 0; }
.operation-side-panel input[type=checkbox],.pilot-dialog input[type=checkbox] { appearance:auto; width:17px; height:17px; min-width:17px; min-height:17px; flex:0 0 17px; padding:0; margin:0; }
.operation-side-panel label:has(input[type=checkbox]) > input { order:-1; }
.operation-side-panel .pilot-check span { flex:1; min-width:0; overflow-wrap:anywhere; }
.operation-side-panel .pilot-check button { flex:none; }
.operation-side-panel .field-grid { grid-template-columns:minmax(100px,1fr) minmax(0,2fr); }
.operation-side-panel .field-grid dd { min-width:0; overflow-wrap:anywhere; }
.operation-side-panel .resource-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.operation-evidence-preview { display:block; width:100%; background:var(--color-card); border:1px solid var(--color-border); padding:8px; margin:8px 0; }
.operation-evidence-thumbnail { display:block; width:100%; height:132px; object-fit:contain; }
.operation-side-panel .timeline-list { display:grid; gap:12px; }
.operation-side-panel .timeline-item .strong-line,.operation-side-panel .timeline-item .muted { display:block; margin:6px 0; }
@media(max-width:700px){
 .operation-side-panel { width:100vw; border:0; }
 .operation-panel-header { padding:12px 16px; gap:8px; }
 .operation-panel-header h2 { font-size:18px; }
 .operation-mail-tabs { padding:8px 16px; gap:6px; }
 .operation-panel-body { padding:16px; }
 .operation-panel-footer { padding:10px 16px max(12px,env(safe-area-inset-bottom)); }
 .operation-panel-footer .modal-actions { display:grid; grid-template-columns:1fr 1fr; }
 .operation-panel-footer #l2-send { grid-column:1/-1; }
 .operation-side-panel .resource-grid { grid-template-columns:minmax(0,1fr); }
 .operation-side-panel .field-grid { grid-template-columns:minmax(0,1fr); gap:4px; }
 .operation-side-panel .field-grid dd { margin-bottom:8px; }
}

.operation-side-panel input,.operation-side-panel textarea,.operation-side-panel select { font:inherit; }

/* Operation review: readable access tables and a bounded conversation workspace. */
[data-dashboard="acrec"] #panel-chats .chat-workspace { height:calc(100dvh - 224px); min-height:470px; position:relative; }
[data-dashboard="acrec"] #panel-chats .chat-thread { min-height:0; display:flex; flex-direction:column; overflow:hidden; }
#chat-thread-body { min-height:0; flex:1; display:flex; flex-direction:column; overflow:hidden; }
#chat-thread-body[hidden] { display:none; }
#chat-thread-body .chat-thread-head { flex:none; flex-wrap:wrap; max-height:180px; overflow:auto; }
#chat-thread-body .chat-thread-head p { margin:4px 0; }
#chat-action-reason { flex:none; margin:0 0 5px; }
#chat-action-reason:empty { display:none; }
#chat-messages { flex:1; min-height:0; max-height:none; overflow:auto; overscroll-behavior:contain; }
#operator-composer { flex:none; margin:0; padding-top:8px; border-top:1px solid var(--color-border); background:var(--color-card); }
#operator-composer textarea { min-height:64px; max-height:120px; font:inherit; }
#operator-composer.is-internal { border-top:2px solid var(--color-warning); }
#operator-internal { width:17px; height:17px; padding:0; flex:none; }
#operation-context-toggle { display:none; }
[data-dashboard="acrec"] #panel-chats .chat-inbox,[data-dashboard="acrec"] #panel-chats .chat-context { min-height:0; overflow:auto; }
#detail-resource > button { margin-top:16px; }
.detail-actions { margin:16px 0; gap:12px; }
.pilot-access-table,.admin-table--users,.admin-table--activity { table-layout:auto; width:100%; }
.pilot-access-table { min-width:1120px; }
.pilot-access-table th,.pilot-access-table td { padding:12px; overflow-wrap:break-word; }
.pilot-access-table td:last-child { min-width:290px; white-space:normal; }
.pilot-access-table td:last-child button { margin:4px 6px 4px 0; }
.admin-stores-section,.admin-table-wrap { min-width:0; width:100%; }
.admin-table--activity td:last-child { min-width:230px; }
.admin-table--activity details p { white-space:normal; }
.pilot-fields label[hidden],.pilot-fields p[hidden] { display:none; }
.account-dialog { width:min(680px,calc(100vw - 24px)); }
.account-dialog .field-grid { margin-top:20px; }
.account-setup { max-width:680px; margin:40px auto; padding:24px; background:var(--color-card); color:var(--color-text); }
@media(max-width:820px){
 [data-dashboard="acrec"] #panel-chats .chat-workspace { height:auto; min-height:0; grid-template-columns:minmax(0,1fr); }
 [data-dashboard="acrec"] #panel-chats.operation-chat-selected .chat-workspace { height:calc(100dvh - 180px); min-height:490px; }
 #panel-chats.operation-chat-selected .chat-inbox { display:none; }
 [data-dashboard="acrec"] #panel-chats .chat-context { display:none; }
 [data-dashboard="acrec"] #panel-chats.operation-context-open .chat-context { display:block; position:absolute; inset:110px 8px 170px; z-index:5; background:var(--color-card); box-shadow:0 0 0 2px var(--color-border); }
 #operation-context-toggle { display:block; }
 #operator-composer textarea { min-height:50px; max-height:90px; }
 #chat-thread-body .chat-thread-head { max-height:180px; margin-bottom:6px; }
 .pilot-access-table { min-width:100%; }
 .pilot-access-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
 .pilot-access-table tbody,.pilot-access-table tr { display:block; }
 .pilot-access-table tr { padding:12px; border-bottom:1px solid var(--color-border); }
 .pilot-access-table td { display:block; border:0; padding:4px 0; min-width:0 !important; white-space:normal; }
 .pilot-access-table td::before { content:attr(data-label); display:block; color:var(--color-text-muted); font-size:12px; }
 .account-setup { margin:0; padding:16px; }
}

[data-dashboard="acrec"] #panel-chats .chat-workspace { height:var(--operation-chat-height,calc(100dvh - 224px)); min-height:0; grid-template-rows:minmax(0,1fr); }
#chat-detail-state:empty,#operator-state:empty { display:none; }
#operator-state { max-height:32px; overflow:auto; }
@media(max-width:820px){
 [data-dashboard="acrec"] #panel-chats.operation-chat-selected .chat-workspace { position:fixed; left:0; right:0; top:var(--operation-chat-top,86px); height:var(--operation-chat-height,calc(100dvh - 86px)); min-height:0; z-index:50; padding:6px; background:var(--color-bg); }
 #chat-thread-body .chat-thread-head { grid-template-columns:auto minmax(0,1fr); max-height:35%; gap:6px; padding:4px; }
 #chat-thread-meta,#chat-thread-body .chat-thread-head .chat-actions { grid-column:1/-1; }
 #chat-thread-title { margin:0; font-size:16px; }
 #chat-action-reason { max-height:32px; overflow:auto; font-size:11px; }
 #operator-composer { gap:5px; }
 #operator-composer textarea { height:54px; }
}

@media(max-width:820px){
 .app-shell[data-dashboard="acrec"] { grid-template-rows:auto minmax(0,1fr); }
 #chat-thread-body .chat-thread-head > div { grid-column:1/-1; }
 #chat-back { grid-column:1; grid-row:1; }
 #operation-context-toggle { grid-column:2; grid-row:1; }
}

/* Native dialogs must stay viewport-anchored even when opened after page scroll. */
dialog.pilot-dialog { position:fixed; inset:0; margin:auto; }
.pilot-fields label:has(input[type="checkbox"]) { display:flex; align-items:center; gap:8px; }

#admin-franchise-detail { max-width:none; }
.pilot-access-table { min-width:1050px; table-layout:fixed; }
.pilot-access-table th:nth-child(1) { width:13%; }
.pilot-access-table th:nth-child(2) { width:20%; }
.pilot-access-table th:nth-child(3) { width:14%; }
.pilot-access-table th:nth-child(4) { width:13%; }
.pilot-access-table th:nth-child(5) { width:8%; }
.pilot-access-table th:nth-child(6) { width:9%; }
.pilot-access-table th:nth-child(7) { width:23%; }
.pilot-access-table td:last-child { min-width:0; }
.pilot-access-table td:last-child button { max-width:100%; white-space:normal; overflow-wrap:break-word; }
@media(max-width:820px){ .pilot-access-table { min-width:100%; } }
