:root {
  /* Semantic theme tokens: Light */
  --bg-app: #F3F7FB;
  --bg-surface: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-soft: #EAF1F7;
  --sidebar-bg: #082B43;
  --sidebar-bg-secondary: #0D3855;
  --sidebar-hover: #144B6D;
  --sidebar-active: #176693;
  --sidebar-active-line: #27C2E6;
  --header-bg: #F8FAFC;
  --table-header-bg: #E8F1F9;
  --table-row-hover: #F4F8FC;
  --text-primary: #102A43;
  --text-secondary: #5F7387;
  --text-muted: #8293A3;
  --text-on-dark: #F7FAFC;
  --text-on-dark-secondary: #B9CBD8;
  --border-default: #D9E4ED;
  --border-strong: #BFCEDB;
  --primary: #248DD1;
  --primary-hover: #1777B3;
  --primary-soft: #E4F2FB;
  --accent-cyan: #24C0E5;
  --success: #28B779;
  --success-soft: #E4F7EF;
  --warning: #E7A329;
  --warning-soft: #FFF4D9;
  --danger: #D94848;
  --danger-soft: #FDE8E8;
  --info: #4B8FD8;
  --info-soft: #EAF3FC;
  --table-bg: #FFFFFF;
  --table-header-text: #4D6578;
  --table-row-border: #E5EDF4;
  --table-row-selected: #E8F4FB;
  --table-cell-muted: #6D8091;
  --status-alarm-bg: #FDE7E7;
  --status-alarm-text: #C73737;
  --status-alarm-border: #EB5A5A;
  --text-on-primary: #FFFFFF;
  --sidebar-brand-text: #FFFFFF;
  --bg-overlay: rgba(9, 21, 33, 0.48);
  --bg-surface-translucent: rgba(255, 255, 255, 0.96);
  --bg-surface-subtle: rgba(255, 255, 255, 0.82);
  --focus-ring: rgba(36, 141, 209, 0.24);
  --scrollbar-thumb: rgba(36, 141, 209, 0.48);
  --shadow-color: rgba(16, 42, 67, 0.12);
  --shadow-color-soft: rgba(16, 42, 67, 0.08);
  --inactive-soft: rgba(130, 147, 163, 0.14);
  --chart-grid: rgba(95, 115, 135, 0.18);
  --tooltip-bg: #102A43;
  --tooltip-text: #F7FAFC;
  --primary-accessible-text: #12689E;
  --primary-action-bg: var(--primary-hover);
  --primary-action-hover: #12689E;
  --success-accessible-text: #167A50;
  --warning-accessible-text: #855B0A;
  --danger-accessible-text: #B52D2D;
  --info-accessible-text: #265F9B;
  --status-alarm-contrast-text: #B52D2D;
  --table-muted-contrast: var(--text-secondary);
  --placeholder-text: var(--text-secondary);
  /* Shared AI orb tokens: same visual reference used on the main site. */
  --ai-orb-halo-white: rgba(255, 255, 255, 0.34);
  --ai-orb-halo-ice: rgba(225, 253, 255, 0.28);
  --ai-orb-halo-cyan: rgba(116, 245, 255, 0.16);
  --ai-orb-halo-silver: rgba(210, 232, 238, 0.16);
  --ai-orb-surface-core: rgba(255, 255, 255, 0.96);
  --ai-orb-surface-mid: rgba(232, 251, 255, 0.84);
  --ai-orb-surface-soft: rgba(182, 235, 244, 0.26);
  --ai-orb-surface-white: rgba(255, 255, 255, 0.34);
  --ai-orb-surface-ice: rgba(214, 248, 255, 0.28);
  --ai-orb-surface-cyan: rgba(116, 245, 255, 0.16);
  --ai-orb-surface-silver: rgba(226, 238, 241, 0.22);
  --ai-orb-form-a: rgba(255, 255, 255, 0.64);
  --ai-orb-form-b: rgba(232, 251, 255, 0.54);
  --ai-orb-form-c: rgba(210, 249, 255, 0.48);
  --ai-orb-form-d: rgba(255, 255, 255, 0.50);
  --ai-orb-form-e: rgba(180, 247, 255, 0.34);
  --ai-orb-form-f: rgba(245, 252, 255, 0.44);
  --ai-orb-form-g: rgba(255, 255, 255, 0.34);
  --ai-orb-idle-core: rgba(255, 255, 255, 0.98);
  --ai-orb-idle-mid: rgba(232, 251, 255, 0.82);
  --ai-orb-idle-soft: rgba(116, 245, 255, 0.22);
  --ai-orb-thinking-core: rgba(93, 184, 238, 0.98);
  --ai-orb-thinking-mid: rgba(56, 169, 235, 0.84);
  --ai-orb-thinking-soft: rgba(44, 198, 232, 0.28);
  --ai-orb-alarm-core: rgba(240, 182, 75, 0.98);
  --ai-orb-alarm-mid: rgba(231, 163, 41, 0.84);
  --ai-orb-alarm-soft: rgba(240, 182, 75, 0.28);
  --ai-orb-shadow-white: rgba(255, 255, 255, 0.54);
  --ai-orb-shadow-cyan: rgba(116, 245, 255, 0.32);
  --bg: var(--bg-app);
  --panel: var(--header-bg);
  --surface: var(--bg-surface-subtle);
  --surface-strong: var(--bg-surface);
  --surface-soft: var(--bg-soft);
  --line: var(--border-default);
  --line-strong: var(--border-strong);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --brand: var(--primary);
  --brand-deep: var(--primary-hover);
  --sidebar-gradient-start: var(--sidebar-bg);
  --sidebar-gradient-end: var(--sidebar-bg-secondary);
  --accent: var(--warning);
  --gray: var(--text-muted);
  --status-ok: var(--success);
  --status-ok-soft: var(--success-soft);
  --status-warning: var(--warning);
  --status-warning-soft: var(--warning-soft);
  --status-critical: var(--danger);
  --status-critical-soft: var(--danger-soft);
  --status-neutral: var(--info);
  --status-neutral-soft: var(--info-soft);
  --status-offline: var(--text-muted);
  --status-offline-soft: var(--inactive-soft);
  --shadow: 0 24px 60px var(--shadow-color);
  --shadow-soft: 0 18px 40px var(--shadow-color-soft);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --scrollbar-radius: 999px;
  --scrollbar-track-radius: 999px;
  --sidebar-width: 286px;
  --sidebar-width-collapsed: 92px;
  --main-panel-padding: 26px;
  /* Reserva vertical (topbar + toolbar + respiro) descontada de 100vh pra
     .table-screen (a área da tabela) e pro .editor-drawer (o painel de
     edição que abre ao lado). Os dois precisam ler a MESMA variável -
     antes cada um tinha seu próprio número mágico e foram divergindo aos
     poucos, deixando o painel de edição visivelmente mais alto que a
     tabela. */
  --table-chrome-reserve: 178px;
  --editor-drawer-top-offset: 72px;
}

:root[data-theme="dark"] {
  /* Semantic theme tokens: Dark */
  --bg-app: #091521;
  --bg-surface: #102230;
  --bg-elevated: #142B3B;
  --bg-soft: #0D1D2A;
  --sidebar-bg: #061D2B;
  --sidebar-bg-secondary: #0A2B3E;
  --sidebar-hover: #123B52;
  --sidebar-active: #155C80;
  --sidebar-active-line: #28C2E6;
  --header-bg: #0E202D;
  --table-header-bg: #173141;
  --table-row-hover: #183444;
  --text-primary: #F3F8FC;
  --text-secondary: #B4C4D1;
  --text-muted: #8295A5;
  --text-on-dark: #FFFFFF;
  --text-on-dark-secondary: #B6C8D5;
  --border-default: #294556;
  --border-strong: #3B5B6D;
  --primary: #38A9EB;
  --primary-hover: #5DB8EE;
  --primary-soft: rgba(56, 169, 235, 0.16);
  --accent-cyan: #2CC6E8;
  --success: #38C98A;
  --success-soft: rgba(56, 201, 138, 0.15);
  --warning: #F0B64B;
  --warning-soft: rgba(240, 182, 75, 0.16);
  --danger: #F05A5A;
  --danger-soft: rgba(240, 90, 90, 0.16);
  --info: #5AA7ED;
  --info-soft: rgba(90, 167, 237, 0.15);
  --table-bg: #102432;
  --table-header-text: #B8C8D4;
  --table-row-border: #294454;
  --table-row-selected: #173D51;
  --table-cell-muted: #91A4B2;
  --status-alarm-bg: rgba(229, 72, 72, 0.19);
  --status-alarm-text: #FF8B8B;
  --status-alarm-border: #E65353;
  --text-on-primary: #061D2B;
  --bg-overlay: rgba(3, 10, 16, 0.7);
  --bg-surface-translucent: rgba(16, 34, 48, 0.96);
  --bg-surface-subtle: rgba(20, 43, 59, 0.9);
  --focus-ring: rgba(56, 169, 235, 0.3);
  --scrollbar-thumb: rgba(56, 169, 235, 0.5);
  --shadow-color: rgba(0, 0, 0, 0.34);
  --shadow-color-soft: rgba(0, 0, 0, 0.24);
  --inactive-soft: rgba(130, 149, 165, 0.15);
  --chart-grid: rgba(180, 196, 209, 0.18);
  --tooltip-bg: #061D2B;
  --tooltip-text: #FFFFFF;
  --primary-accessible-text: var(--primary-hover);
  --primary-action-bg: var(--primary);
  --primary-action-hover: var(--primary-hover);
  --success-accessible-text: var(--success);
  --warning-accessible-text: var(--warning);
  --danger-accessible-text: #FF7A7A;
  --info-accessible-text: var(--info);
  --status-alarm-contrast-text: var(--status-alarm-text);
  --table-muted-contrast: var(--table-cell-muted);
  --placeholder-text: var(--text-secondary);
}

/*
 * Light surfaces use a solid brand-red entity across nucleus, forms,
 * gradients, halo and shadows. Dark keeps the luminous pearl palette.
 * Os valores efetivos vem do marca.css, que redefine este mesmo seletor.
 */
:root:not([data-theme="dark"]) {
  --ai-orb-halo-white: rgba(233, 67, 58, 0.34);
  --ai-orb-halo-ice: rgba(237, 101, 94, 0.30);
  --ai-orb-halo-cyan: rgba(232, 54, 44, 0.22);
  --ai-orb-halo-silver: rgba(240, 130, 125, 0.18);
  --ai-orb-surface-core: rgba(209, 45, 36, 0.98);
  --ai-orb-surface-mid: rgba(233, 67, 58, 0.90);
  --ai-orb-surface-soft: rgba(237, 101, 94, 0.40);
  --ai-orb-surface-white: rgba(233, 67, 58, 0.48);
  --ai-orb-surface-ice: rgba(237, 101, 94, 0.42);
  --ai-orb-surface-cyan: rgba(232, 54, 44, 0.32);
  --ai-orb-surface-silver: rgba(240, 130, 125, 0.26);
  --ai-orb-form-a: rgba(209, 45, 36, 0.78);
  --ai-orb-form-b: rgba(233, 67, 58, 0.70);
  --ai-orb-form-c: rgba(237, 101, 94, 0.62);
  --ai-orb-form-d: rgba(232, 54, 44, 0.68);
  --ai-orb-form-e: rgba(240, 130, 125, 0.44);
  --ai-orb-form-f: rgba(235, 80, 72, 0.56);
  --ai-orb-form-g: rgba(232, 54, 44, 0.48);
  --ai-orb-idle-core: rgba(209, 45, 36, 0.99);
  --ai-orb-idle-mid: rgba(233, 67, 58, 0.94);
  --ai-orb-idle-soft: rgba(232, 54, 44, 0.42);
  --ai-orb-shadow-white: rgba(209, 45, 36, 0.44);
  --ai-orb-shadow-cyan: rgba(232, 54, 44, 0.36);
}

/*
 * Mirrors the .main-panel padding breakpoints (see rules at ~7213/7437/8367) so any
 * layout that reads var(--main-panel-padding) — like the full-screen dashboard edit
 * mode — automatically tracks the same horizontal padding as the normal view at every
 * screen size, instead of duplicating hardcoded pixel values that can drift out of sync.
 */
@media (max-width: 1180px) {
  :root { --main-panel-padding: 22px; }
}

@media (max-width: 840px) {
  :root { --main-panel-padding: 16px; }
}

@media (max-width: 640px) {
  :root { --main-panel-padding: 12px; }
}

* {
  box-sizing: border-box;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(21, 19, 19, 0.16), transparent 28%),
    radial-gradient(circle at right 10%, rgba(241, 162, 8, 0.18), transparent 24%),
    linear-gradient(180deg, #FAFAFA 0%, #F3F3F3 100%);
  color: var(--text);
  min-height: 100vh;
  scrollbar-width: auto;
  scrollbar-color: transparent transparent;
}

body.primary-loading {
  overflow: hidden;
}

body.primary-loading .app-shell {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.primary-loading .dashboard-loading-screen {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.dashboard-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(237, 102, 95, 0.16), transparent 30%),
    radial-gradient(circle at right 14%, rgba(43, 40, 40, 0.1), transparent 24%),
    linear-gradient(180deg, rgba(250, 250, 250, 0.96), rgba(243, 243, 243, 0.98));
  backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.34s ease, visibility 0.34s ease;
}

.app-shell {
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.dashboard-loading-screen.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.dashboard-loading-panel {
  position: relative;
  width: min(560px, 100%);
  padding: 28px 28px 24px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 28px 72px rgba(43, 40, 40, 0.16);
  overflow: hidden;
  display: grid;
  gap: 22px;
}

.dashboard-loading-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.dashboard-loading-mark {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top, rgba(237, 102, 95, 0.14), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 241, 241, 0.92));
  border: 1px solid rgba(237, 102, 95, 0.14);
  flex: 0 0 auto;
}

.dashboard-loading-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
}

.dashboard-loading-logo--dark {
  display: none;
}

.dashboard-loading-copy {
  display: grid;
  gap: 8px;
}

.dashboard-loading-copy .eyebrow {
  margin: 0;
}

.dashboard-loading-copy h1 {
  margin: 0;
  font-size: clamp(1.56rem, 2.8vw, 2.08rem);
  line-height: 1.04;
  color: #2B2828;
  letter-spacing: -0.02em;
}

.dashboard-loading-copy p:last-child {
  margin: 0;
  color: rgba(43, 40, 40, 0.72);
  font-size: 0.96rem;
  line-height: 1.5;
}

.dashboard-loading-bars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  min-height: 126px;
}

.dashboard-loading-bar {
  border-radius: 999px 999px 20px 20px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.2)),
    linear-gradient(180deg, rgba(43, 40, 40, 0.9), rgba(237, 102, 95, 0.72));
  background-size: 220px 100%, 100% 100%;
  animation: dashboardLoadingBars 1.26s ease-in-out infinite alternate, skeletonShimmer 1.3s linear infinite;
  transform-origin: bottom center;
}

.dashboard-loading-bar.bar-1 { height: 52%; animation-delay: 0s, 0s; }
.dashboard-loading-bar.bar-2 { height: 82%; animation-delay: 0.08s, 0.08s; }
.dashboard-loading-bar.bar-3 { height: 66%; animation-delay: 0.16s, 0.16s; }
.dashboard-loading-bar.bar-4 { height: 92%; animation-delay: 0.24s, 0.24s; }

.dashboard-loading-sheen {
  position: absolute;
  inset: auto 0 0;
  height: 80px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.32));
  pointer-events: none;
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  align-items: start;
}

.sidebar {
  background:
    radial-gradient(circle at 20% 0%, rgba(21, 19, 19, 0.78), transparent 38%),
    linear-gradient(180deg, var(--sidebar-gradient-start) 0%, var(--sidebar-gradient-end) 100%);
  color: #f5fff9;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
  max-height: 100vh;
  overflow-y: hidden;
  overflow-x: hidden;
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  z-index: 30;
  transform: translateX(0);
  transition: transform 0.3s ease;
  scrollbar-gutter: stable;
}

body:hover,
body:focus-within {
  scrollbar-color: rgba(118, 162, 170, 0.38) transparent;
}

body::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

body::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: var(--scrollbar-radius);
  border: 3px solid transparent;
  background-clip: padding-box;
}

body::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
  background: transparent;
  border-radius: var(--scrollbar-track-radius);
}

body:hover::-webkit-scrollbar-thumb,
body:focus-within::-webkit-scrollbar-thumb,
.sidebar:hover::-webkit-scrollbar-thumb,
.sidebar:focus-within::-webkit-scrollbar-thumb {
  background: rgba(118, 162, 170, 0.38);
}

.brand,
.profile-card,
.nav-item,
.section-card,
.surface-card,
.trend-card,
.hero-card,
.table-card,
.editor-shell {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 4px 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.brand-button {
  width: 100%;
  text-align: center;
  color: inherit;
  cursor: pointer;
}

.brand h1 {
  margin: 0;
  color: var(--sidebar-brand-text);
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 1.08rem;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 0;
  background: none;
  overflow: visible;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: none;
  border: 0;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f1a208, #ffe4a8);
  color: #173229;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.96rem;
  letter-spacing: 0.08em;
  overflow: hidden;
  flex: 0 0 auto;
}

.avatar.has-image {
  background: transparent;
  color: transparent;
}

.avatar-large {
  width: 108px;
  height: 108px;
  font-size: 1.7rem;
}

.avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar .eyebrow {
  color: rgba(245, 255, 249, 0.56);
}

.hero-card h3,
.trend-card h3,
.surface-card h3,
.section-card h3,
.topbar h2,
.editor-header h3 {
  margin: 0;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  color: inherit;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  min-height: 60px;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.profile-card:hover,
.profile-card:focus-visible {
  background: transparent;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: none;
}

.profile-card-docked {
  margin-top: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.profile-copy {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.sidebar-system-status {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  width: 100%;
  min-width: 0;
  margin-top: 5px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.sidebar-system-status #floatingMonitorIndicator {
  position: static;
  display: block;
  width: 7px;
  height: 7px;
  border: 0;
  border-radius: 999px;
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
}

.sidebar-system-status #floatingMonitorIndicator > span {
  display: none;
}

.sidebar-system-status #floatingMonitorIndicator.is-ok {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.sidebar-system-status #floatingMonitorIndicator.is-warning {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
}

.sidebar-system-status #floatingMonitorIndicator.is-critical {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.sidebar-system-status-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.sidebar-system-status-copy > span,
.sidebar-system-status-copy > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-system-status-copy > span {
  color: var(--text-on-dark);
  font-size: 0.67rem;
  line-height: 1.25;
}

.sidebar-system-status-copy > small {
  color: var(--text-on-dark-secondary);
  font-size: 0.64rem;
  line-height: 1.25;
}

.sidebar-system-status #refreshStatus {
  display: none !important;
}

.profile-copy strong {
  font-size: 1rem;
  font-weight: 700;
}

.profile-copy strong,
.table-title h3,
.table-title p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card-arrow {
  flex: 0 0 auto;
  font-size: 1.12rem;
  line-height: 1;
  color: rgba(245, 255, 249, 0.62);
}

.sidebar-profile-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  flex: 0 0 auto;
  position: relative;
}

.sidebar-profile-row::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 0;
  height: 1px;
  border-radius: 999px;
  background: transparent;
  box-shadow: 0 -12px 26px rgba(88, 82, 82, 0.16);
  pointer-events: none;
}

.collapsed-profile-menu {
  position: absolute;
  left: calc(100% + 12px);
  bottom: 0;
  width: 224px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(24, 23, 23, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 22px 50px rgba(11, 11, 11, 0.34);
  display: grid;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transform-origin: bottom left;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  z-index: 1600;
}

.collapsed-profile-menu.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.collapsed-profile-menu-button {
  width: 100%;
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: #FBFAFA;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.collapsed-profile-menu-button:hover,
.collapsed-profile-menu-button:focus-visible {
  background: rgba(237, 102, 95, 0.18);
  transform: translateY(-1px);
}

.collapsed-profile-menu-button.is-logout {
  background: rgba(199, 74, 69, 0.12);
  color: #ffb5af;
}

.collapsed-profile-menu-button.is-logout:hover,
.collapsed-profile-menu-button.is-logout:focus-visible {
  background: rgba(199, 74, 69, 0.22);
}

.collapsed-profile-menu-icon {
  width: 18px;
  min-width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.98rem;
  line-height: 1;
}

.sidebar-logout-button {
  width: 60px;
  min-width: 60px;
  height: 60px;
  border-radius: 16px;
  background: transparent;
  color: rgba(245, 255, 249, 0.82);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-logout-button:hover,
.sidebar-logout-button:focus-visible {
  background: transparent;
  color: #FCFBFB;
  transform: translateY(-1px);
  box-shadow: none;
}

.sidebar-logout-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logout-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
}

.sidebar-toggle {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 14px;
  cursor: pointer;
  flex: 0 0 auto;
}

.sidebar-toggle-mobile {
  display: none;
}

.sidebar-edge-toggle {
  position: fixed;
  top: 45px;
  left: var(--sidebar-width);
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  z-index: 1600;
  box-shadow: 0 1px 4px var(--shadow-color-soft, rgba(43, 40, 40, 0.16));
  transition: left 0.3s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-toggle.sidebar-edge-toggle {
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 999px;
}

.sidebar-edge-toggle:hover {
  box-shadow: 0 2px 8px var(--shadow-color-soft, rgba(43, 40, 40, 0.24));
}

.sidebar-edge-toggle svg {
  width: 13px;
  height: 13px;
  display: block;
  fill: currentColor;
  transition: transform 0.3s ease;
}

body.sidebar-collapsed .sidebar-edge-toggle svg {
  transform: rotate(180deg);
}

@media (min-width: 1181px) {
  body.sidebar-collapsed .sidebar-edge-toggle {
    left: var(--sidebar-width-collapsed);
  }
}

@media (max-width: 1180px) {
  body.sidebar-collapsed .sidebar-edge-toggle {
    /* Sidebar slides fully off-canvas on mobile; keep the arrow reachable to reopen it. */
    left: 14px;
  }
}

.sidebar-footer p {
  color: rgba(245, 255, 249, 0.72);
  margin: 0;
  font-size: 0.92rem;
}

.sidebar-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.client-branding {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0;
  margin: 4px 0 14px;
  flex: 0 0 auto;
  overflow: hidden;
}

.client-branding[hidden] {
  display: none !important;
}

.client-branding-image {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 168px;
  object-fit: contain;
  object-position: center;
  background: transparent;
}

.client-switcher {
  display: block;
  width: 100%;
  min-width: 0;
  margin-bottom: 12px;
  position: relative;
}

.client-switcher label {
  font-size: 0.82rem;
  color: rgba(245, 255, 249, 0.72);
}

.client-switcher select {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.client-dropdown-trigger {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 13px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.045)),
    linear-gradient(135deg, rgba(7, 6, 6, 0.34), rgba(21, 19, 19, 0.42));
  color: #f5fff9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px 7px 14px;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.client-dropdown-trigger:hover,
.client-dropdown-trigger:focus-visible,
.client-dropdown-trigger.is-open {
  border-color: rgba(152, 199, 207, 0.24);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.055)),
    linear-gradient(135deg, rgba(7, 6, 6, 0.52), rgba(21, 19, 19, 0.58));
  box-shadow: 0 0 0 3px rgba(152, 199, 207, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  outline: none;
}

.client-dropdown-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 760;
  line-height: 1.15;
}

.client-dropdown-arrow {
  flex: 0 0 auto;
  color: rgba(245, 255, 249, 0.66);
  font-size: 1rem;
  line-height: 1;
  opacity: 0.68;
  transform: rotate(90deg);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.client-dropdown-trigger.is-open .client-dropdown-arrow {
  opacity: 0.92;
  transform: rotate(-90deg);
}

.client-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 35;
  display: grid;
  gap: 4px;
  max-height: min(320px, calc(100vh - 220px));
  overflow-y: auto;
  padding: 8px;
  border: 1px solid rgba(152, 199, 207, 0.16);
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(21, 19, 19, 0.94), transparent 54%),
    linear-gradient(180deg, rgba(7, 6, 6, 0.98), rgba(21, 19, 19, 0.97));
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #f5fff9;
}

.client-dropdown-menu[hidden] {
  display: none !important;
}

.client-dropdown-option {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(245, 255, 249, 0.78);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 720;
  line-height: 1.15;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.client-dropdown-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-dropdown-option:hover,
.client-dropdown-option:focus-visible {
  background: rgba(255, 255, 255, 0.075);
  color: #ffffff;
  outline: none;
}

.client-dropdown-option.is-active {
  background: linear-gradient(135deg, rgba(7, 6, 6, 0.82), rgba(21, 19, 19, 0.92));
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(152, 199, 207, 0.14);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 6px;
  margin-right: -6px;
  scrollbar-width: auto;
  scrollbar-color: transparent transparent;
}

.sidebar-nav:hover,
.sidebar-nav:focus-within {
  scrollbar-color: rgba(118, 162, 170, 0.38) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 12px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: var(--scrollbar-radius);
  border: 3px solid transparent;
  background-clip: padding-box;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
  border-radius: var(--scrollbar-track-radius);
}

.sidebar-nav:hover::-webkit-scrollbar-thumb,
.sidebar-nav:focus-within::-webkit-scrollbar-thumb {
  background: rgba(118, 162, 170, 0.38);
}

.nav-group {
  display: grid;
  gap: 4px;
  width: 100%;
}

.nav-group[hidden] {
  display: none !important;
}

.nav-group-toggle {
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(245, 255, 249, 0.54);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 12px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.2;
  text-transform: uppercase;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.nav-group-toggle:hover,
.nav-group-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.055);
  color: rgba(245, 255, 249, 0.78);
  outline: none;
}

.nav-group-toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(152, 199, 207, 0.1);
}

.nav-group-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: rgba(245, 255, 249, 0.62);
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.55;
  transform: rotate(90deg);
  transform-origin: center;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.nav-group.is-collapsed .nav-group-arrow {
  opacity: 0.42;
  transform: rotate(0deg);
}

.nav-group-items {
  display: grid;
  gap: 5px;
  width: 100%;
}

.nav-group.is-collapsed .nav-group-items {
  display: none;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 13px;
  padding: 7px 13px;
  background: transparent;
  color: rgba(245, 255, 249, 0.8);
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0;
  min-height: 44px;
  user-select: none;
  transform-origin: center;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.nav-item.is-dragging {
  opacity: 0.96;
  cursor: grabbing;
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 16px 28px rgba(21, 20, 20, 0.28);
  background: linear-gradient(135deg, rgba(7, 6, 6, 0.98), rgba(21, 19, 19, 0.88));
  color: #ffffff;
  z-index: 2;
}

.nav-item[data-menu-drag] {
  cursor: grab;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.nav-item.is-drag-armed {
  box-shadow: inset 0 0 0 1px rgba(152, 199, 207, 0.18), 0 10px 18px rgba(7, 6, 6, 0.18);
  transform: translateY(-1px);
}

.nav-item.is-drag-over {
  box-shadow: inset 0 0 0 1px rgba(152, 199, 207, 0.22);
  transform: translateY(-1px);
}

.nav-item.active,
.nav-item:hover {
  background: linear-gradient(135deg, rgba(7, 6, 6, 0.92), rgba(21, 19, 19, 0.84));
  color: #ffffff;
}

.nav-item[data-section="serviceMonitor"],
.nav-item[data-section="alarms"] {
  min-height: 54px;
  padding: 8px 13px;
}

.nav-item-label {
  font-weight: 700;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 20px;
}

.nav-item-icon {
  width: 20px;
  min-width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.08rem;
  line-height: 1;
  opacity: 0.92;
}

.nav-item-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
}

.nav-item-meta {
  font-size: 0.76rem;
  color: rgba(245, 255, 249, 0.66);
  min-height: 1em;
  line-height: 1.2;
  display: flex;
  align-items: center;
  margin-top: 4px;
}

.nav-item[data-section="serviceMonitor"] .nav-item-meta,
.nav-item[data-section="alarms"] .nav-item-meta {
  margin-top: 8px;
  padding-right: 12px;
}

.nav-item-meta.is-ok {
  color: #79e4aa;
}

#serviceMonitorNavMeta.is-contrast {
  color: #ffffff;
}

.nav-item-meta.is-warning {
  color: #ffd479;
}

.nav-item-meta.is-critical {
  color: #ff8c8c;
}

.nav-item-meta:empty {
  display: none;
  margin-top: 0;
}

/* Status central de sucesso/erro para criar e excluir - essas duas ações
   costumam fechar o editor/modal na hora (diferente de editar, que fica
   aberto), então o flash no editor (.editor-shell.is-success/.is-error) ou o
   destaque no botão (.is-save-success/.is-save-error) somem antes de dar
   tempo de ver. Esse aviso fica fixo no centro da tela, funciona mesmo sem
   nenhum editor aberto, e some sozinho. */
.center-status-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 220;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-radius: 18px;
  background: rgba(34, 31, 31, 0.94);
  color: #fff;
  box-shadow: 0 24px 60px rgba(20, 18, 18, 0.35);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  font-size: 0.92rem;
  font-weight: 600;
  max-width: min(420px, calc(100vw - 32px));
}

.center-status-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.center-status-toast.success {
  background: var(--success);
}

.center-status-toast.error {
  background: var(--danger);
  animation: profileSettingsShake 0.46s ease;
}

.center-status-toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  flex: none;
  font-size: 1rem;
  font-weight: 800;
}

.center-status-toast-message {
  line-height: 1.35;
}

.profile-reload-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 18, 18, 0.58);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.profile-reload-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.profile-reload-dialog {
  position: relative;
  width: min(100%, 380px);
  padding: 22px 18px 18px;
  border-radius: 20px;
  background: #ffffff;
  color: #282424;
  box-shadow: 0 28px 70px rgba(20, 18, 18, 0.28);
}

.profile-reload-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.profile-reload-copy {
  display: grid;
  gap: 10px;
}

.profile-reload-copy .eyebrow {
  margin-bottom: 0;
  color: #776D6D;
}

.profile-reload-copy h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
  color: #282424;
}

.profile-reload-copy p:last-child {
  margin: 0;
  color: #3B3636;
  line-height: 1.5;
}

.profile-reload-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-start;
}

.invite-result-dialog {
  width: min(100%, 520px);
}

.invite-result-copy {
  gap: 12px;
}

.invite-result-summary,
.invite-result-details {
  display: grid;
  gap: 10px;
}

.invite-result-summary {
  padding: 14px;
  border-radius: 16px;
  background: rgba(43, 40, 40, 0.06);
  color: #332F2F;
}

.invite-result-summary.is-success {
  background: rgba(28, 152, 92, 0.12);
  color: #125032;
}

.invite-result-summary.is-error {
  background: rgba(201, 48, 44, 0.12);
  color: #7f1d1d;
}

.invite-result-summary.is-partial {
  background: rgba(196, 121, 14, 0.14);
  color: #7a4b08;
}

.invite-result-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.72);
}

.invite-result-detail-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(43, 40, 40, 0.12);
  background: #FCFBFB;
  color: #332F2F;
}

.invite-result-detail-card.is-error {
  border-color: rgba(201, 48, 44, 0.18);
  background: rgba(255, 240, 240, 0.86);
}

.invite-result-detail-card strong,
.invite-result-detail-card span {
  display: block;
}

.invite-result-detail-card span + span,
.invite-result-detail-card strong + span {
  margin-top: 4px;
}

.invite-result-reason {
  color: #8a2f2f;
}

.invite-result-help {
  color: #776D6D;
}

.invite-result-actions {
  gap: 10px;
  flex-wrap: wrap;
}

.payload-disclosure {
  border: 1px solid rgba(62, 58, 58, 0.12);
  border-radius: 14px;
  background: rgba(247, 247, 247, 0.72);
  overflow: hidden;
  min-width: 260px;
}

.payload-disclosure summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  font-weight: 700;
  color: #2B2828;
}

.payload-disclosure summary::-webkit-details-marker {
  display: none;
}

.payload-summary-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.payload-summary-title::before {
  content: "+";
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgba(88, 82, 82, 0.12);
  color: #585252;
  font-size: 0.95rem;
  line-height: 1;
}

.payload-disclosure[open] .payload-summary-title::before {
  content: "−";
}

.payload-summary-meta {
  font-size: 0.74rem;
  color: #675F5F;
  font-weight: 600;
}

.payload-body {
  padding: 0 12px 12px;
}

.payload-group {
  display: grid;
  gap: 10px;
}

.payload-entry {
  border-left: 2px solid rgba(88, 82, 82, 0.14);
  padding-left: 12px;
  display: grid;
  gap: 4px;
}

.cell-disclosure {
  margin-top: 8px;
  border: 1px solid rgba(43, 40, 40, 0.1);
  border-radius: 12px;
  background: rgba(250, 250, 250, 0.9);
  overflow: hidden;
}

.cell-disclosure summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
}

.cell-disclosure summary::-webkit-details-marker {
  display: none;
}

.cell-disclosure-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #454040;
}

.cell-disclosure-title::before {
  content: "+";
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgba(88, 82, 82, 0.12);
  color: #585252;
  font-size: 0.86rem;
  line-height: 1;
}

.cell-disclosure[open] .cell-disclosure-title::before {
  content: "−";
}

.cell-disclosure-meta {
  font-size: 0.7rem;
  color: #7F7575;
  font-weight: 700;
  text-align: right;
}

.cell-disclosure-body {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.cell-disclosure-entry {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(88, 82, 82, 0.08);
}

.cell-disclosure-entry-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #2B2828;
  line-height: 1.25;
}

.cell-disclosure-entry-meta {
  font-size: 0.72rem;
  color: #675F5F;
  line-height: 1.25;
}

.cell-disclosure-entry-subtle {
  font-size: 0.68rem;
  color: #968E8E;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Variante clicável de .cell-disclosure-entry (ex.: membro de um Grupo que
   leva direto pro contato) - o elemento vira <button>, então reseta os
   estilos nativos de botão e mantém exatamente o mesmo visual do item
   estático, só acrescentando affordance de clique. */
.cell-disclosure-entry-clickable {
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.cell-disclosure-entry-clickable:hover,
.cell-disclosure-entry-clickable:focus-visible {
  border-color: rgba(88, 82, 82, 0.32);
  background: rgba(245, 244, 244, 0.95);
  transform: translateX(2px);
}

.cell-disclosure-entry-clickable:focus-visible {
  outline: 2px solid var(--brand-deep, #ED665F);
  outline-offset: 1px;
}

.payload-label-row {
  display: flex;
  align-items: center;
  min-height: 18px;
}

.payload-label {
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: #6C6363;
}

.payload-value {
  display: grid;
  gap: 8px;
}

.payload-primitive {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #282424;
}

.sidebar-footer {
  margin-top: auto;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  gap: 8px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ED665F;
  box-shadow: 0 0 0 6px rgba(237, 102, 95, 0.12);
}

.main-panel {
  padding: var(--main-panel-padding);
  min-width: 0;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.3s ease;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 18px;
}

.topbar-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  padding-left: 26px;
}

.topbar-side {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 44px;
}

.system-health-indicator {
  position: relative;
  min-height: 52px;
  min-width: min(320px, 100%);
  padding: 10px 16px 10px 14px;
  border-radius: 18px;
  border: 1px solid rgba(237, 102, 95, 0.14);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
}

.system-health-glow {
  position: absolute;
  inset: auto auto -18px -12px;
  width: 110px;
  height: 110px;
  border-radius: 999px;
  background: rgba(237, 102, 95, 0.12);
  filter: blur(18px);
  z-index: 0;
  transition: background 0.2s ease;
}

.system-health-copy,
.system-health-dot {
  position: relative;
  z-index: 1;
}

.system-health-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #A9A2A2;
  box-shadow: 0 0 0 8px rgba(169, 162, 162, 0.14), 0 0 20px rgba(169, 162, 162, 0.26);
  flex: 0 0 auto;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.system-health-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  text-align: left;
}

.system-health-copy strong {
  font-size: 0.86rem;
  line-height: 1.15;
  color: #2B2828;
}

.system-health-copy span {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.system-health-indicator.is-ok .system-health-dot {
  background: #16a34a;
  box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.16), 0 0 24px rgba(34, 197, 94, 0.3);
}

.system-health-indicator.is-ok .system-health-glow {
  background: rgba(34, 197, 94, 0.16);
}

.system-health-indicator.is-warning .system-health-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.16), 0 0 24px rgba(245, 158, 11, 0.28);
}

.system-health-indicator.is-warning .system-health-glow {
  background: rgba(245, 158, 11, 0.16);
}

.system-health-indicator.is-critical .system-health-dot {
  background: #dc2626;
  box-shadow: 0 0 0 8px rgba(220, 38, 38, 0.16), 0 0 24px rgba(220, 38, 38, 0.28);
}

.system-health-indicator.is-critical .system-health-glow {
  background: rgba(220, 38, 38, 0.16);
}

.system-health-indicator.is-loading {
  cursor: progress;
}

.system-health-indicator.is-loading .system-health-dot {
  background: #AAA2A2;
  box-shadow: 0 0 0 8px rgba(170, 162, 162, 0.12), 0 0 20px rgba(170, 162, 162, 0.18);
}

@media (max-width: 1180px) {
  body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-collapsed .main-panel {
    margin-left: 0;
  }
}

@media (min-width: 1181px) {
  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-width-collapsed);
    padding: 18px 12px;
    transform: translateX(0);
    gap: 14px;
    overflow-x: visible;
    overflow-y: visible;
    z-index: 1500;
  }

  body.sidebar-collapsed .main-panel {
    margin-left: var(--sidebar-width-collapsed);
  }

  body.sidebar-collapsed .brand {
    justify-content: center;
    padding: 6px 0;
    background: transparent;
    border-color: transparent;
  }

  body.sidebar-collapsed .brand h1,
  body.sidebar-collapsed .client-branding,
  body.sidebar-collapsed .client-switcher,
  body.sidebar-collapsed .nav-item-meta,
  body.sidebar-collapsed .profile-copy,
  body.sidebar-collapsed .profile-card-arrow,
  body.sidebar-collapsed .sidebar-logout-button,
  body.sidebar-collapsed .menu-prefs-panel {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-main {
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
  }

  body.sidebar-collapsed .sidebar-nav {
    align-items: center;
    flex: 1 1 auto;
    min-height: 0;
    padding-right: 0;
    margin-right: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
  }

  body.sidebar-collapsed .sidebar-nav::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  body.sidebar-collapsed .sidebar-nav .nav-group {
    width: 100%;
    display: grid;
    justify-items: center;
    gap: 10px;
  }

  body.sidebar-collapsed .sidebar-nav .nav-group-toggle {
    display: none;
  }

  body.sidebar-collapsed .sidebar-nav .nav-group-items {
    display: grid;
    justify-items: center;
    gap: 8px;
    width: 100%;
  }

  body.sidebar-collapsed .sidebar-nav .nav-group.is-collapsed .nav-group-items {
    display: none;
  }

  body.sidebar-collapsed .sidebar-nav .nav-item,
  body.sidebar-collapsed .sidebar-nav .menu-prefs-toggle {
    width: 64px;
    min-height: 64px !important;
    padding: 10px 4px !important;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    align-self: center;
    overflow: hidden;
  }

  body.sidebar-collapsed .sidebar-nav .nav-item-label,
  body.sidebar-collapsed .sidebar-nav .menu-prefs-toggle {
    font-size: 0;
    line-height: 0;
    gap: 0;
    justify-content: center;
  }

  body.sidebar-collapsed .sidebar-nav .nav-item-icon {
    width: 22px;
    min-width: 22px;
    font-size: 1.1rem;
    line-height: 1;
    margin: 0;
  }

  body.sidebar-collapsed .sidebar-nav .menu-prefs-toggle {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-nav .nav-item,
  body.sidebar-collapsed .profile-card.profile-card-docked {
    position: relative;
    overflow: visible;
  }

  body.sidebar-collapsed .sidebar-nav .nav-item::after,
  body.sidebar-collapsed .profile-card.profile-card-docked::after {
    content: attr(data-collapsed-label);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-6px);
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(24, 23, 23, 0.94);
    color: #FCFBFB;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    box-shadow: 0 14px 28px rgba(19, 18, 18, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 50;
  }

  body.sidebar-collapsed .sidebar-nav .nav-item::before,
  body.sidebar-collapsed .profile-card.profile-card-docked::before {
    content: "";
    position: absolute;
    left: calc(100% + 6px);
    top: 50%;
    transform: translateY(-50%) translateX(-6px);
    border-width: 7px;
    border-style: solid;
    border-color: transparent rgba(24, 23, 23, 0.94) transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 49;
  }

  body.sidebar-collapsed .sidebar-nav .nav-item:hover::after,
  body.sidebar-collapsed .sidebar-nav .nav-item:hover::before,
  body.sidebar-collapsed .sidebar-nav .nav-item:focus-visible::after,
  body.sidebar-collapsed .sidebar-nav .nav-item:focus-visible::before,
  body.sidebar-collapsed .profile-card.profile-card-docked:hover::after,
  body.sidebar-collapsed .profile-card.profile-card-docked:hover::before,
  body.sidebar-collapsed .profile-card.profile-card-docked:focus-visible::after,
  body.sidebar-collapsed .profile-card.profile-card-docked:focus-visible::before {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }

  body.sidebar-collapsed .sidebar-profile-row {
    justify-content: center;
    margin-top: 8px;
    flex: 0 0 auto;
    overflow: visible;
    z-index: 1600;
  }

  body.sidebar-collapsed .profile-card.profile-card-docked {
    width: 64px;
    min-width: 64px;
    min-height: 64px;
    padding: 0;
    justify-content: center;
    border-radius: 18px;
    flex: 0 0 auto;
  }

  body.sidebar-collapsed .profile-card.profile-card-docked .avatar {
    width: 42px;
    height: 42px;
  }
}

body.sidebar-collapsed .sidebar-nav .nav-item::before,
body.sidebar-collapsed .sidebar-nav .nav-item::after,
body.sidebar-collapsed .profile-card.profile-card-docked::before,
body.sidebar-collapsed .profile-card.profile-card-docked::after {
  display: none !important;
}

.collapsed-sidebar-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  transform: translateY(-50%);
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(24, 23, 23, 0.96);
  color: #FCFBFB;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  box-shadow: 0 14px 28px rgba(19, 18, 18, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 120;
}

.collapsed-sidebar-tooltip::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-width: 7px;
  border-style: solid;
  border-color: transparent rgba(24, 23, 23, 0.96) transparent transparent;
}

.collapsed-sidebar-tooltip.is-visible {
  opacity: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ghost-button,
.primary-button,
.icon-button,
.filter-chip,
.sort-button {
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.ghost-button,
.primary-button {
  padding: 12px 16px;
  border-radius: 14px;
  cursor: pointer;
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

.primary-button {
  background: linear-gradient(135deg, #ED665F 0%, #585252 100%);
  color: #ffffff;
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.filter-chip:hover,
.sort-button:hover {
  transform: translateY(-1px);
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-button span {
  font-size: 1.1rem;
  line-height: 1;
}

.icon-button-strong {
  background: rgba(245, 244, 244, 0.92);
  border-color: rgba(237, 102, 95, 0.22);
  color: var(--brand-deep);
}

.icon-button.is-loading {
  position: relative;
  pointer-events: none;
  color: transparent;
}

.ghost-button.is-loading,
.primary-button.is-loading {
  position: relative;
  pointer-events: none;
  color: transparent;
}

.icon-button.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(23, 50, 41, 0.22);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}

.ghost-button.is-loading::after,
.primary-button.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(23, 50, 41, 0.22);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}

.refresh-status {
  min-height: 22px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  color: rgba(245, 255, 249, 0.76);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.refresh-status.show {
  opacity: 1;
  transform: translateY(0);
}

.refresh-status.success {
  color: #000000;
  background: rgba(245, 244, 244, 0.92);
  border-color: rgba(237, 102, 95, 0.22);
}

.refresh-status.error {
  color: #ffd6d3;
  background: rgba(199, 74, 69, 0.1);
  border-color: rgba(199, 74, 69, 0.2);
}

#refreshStatus:not(.show) {
  display: none;
}

#refreshStatus:not(.show) + #lastRefresh {
  margin-top: -4px;
}

#lastRefresh {
  line-height: 1.2;
}

.floating-refresh-badge {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 45;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(88, 82, 82, 0.92);
  color: #f5fff9;
  border: 1px solid rgba(250, 214, 212, 0.18);
  box-shadow: var(--shadow-soft);
  font-size: 0.82rem;
  line-height: 1.35;
  max-width: min(320px, calc(100vw - 24px));
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.floating-refresh-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.floating-refresh-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.floating-refresh-copy strong {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(245, 244, 244, 0.82);
}

.floating-monitor-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex: 0 0 auto;
  position: relative;
  cursor: help;
}

.floating-monitor-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #AAA2A2;
  box-shadow: 0 0 0 5px rgba(170, 162, 162, 0.14);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.floating-monitor-indicator.is-ok .floating-monitor-indicator-dot {
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.18);
}

.floating-monitor-indicator.is-warning .floating-monitor-indicator-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.18);
}

.floating-monitor-indicator.is-critical .floating-monitor-indicator-dot {
  background: #ef4444;
  box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.18);
}

.floating-monitor-indicator.is-loading .floating-monitor-indicator-dot {
  background: #AAA2A2;
  box-shadow: 0 0 0 5px rgba(170, 162, 162, 0.14);
}

.floating-monitor-indicator .info-tooltip-text {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: 220px;
  max-width: min(220px, calc(100vw - 48px));
  padding: 10px 12px;
  border-radius: 14px;
  background: #173229;
  color: #f5fff9;
  font-size: 0.78rem;
  line-height: 1.4;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  white-space: normal;
  overflow-wrap: break-word;
  z-index: 30;
}

.floating-monitor-indicator:hover .info-tooltip-text,
.floating-monitor-indicator:focus-within .info-tooltip-text {
  opacity: 1;
  transform: translateY(0);
}

.floating-refresh-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-refresh-status {
  min-height: 1.1em;
  font-size: 0.74rem;
  color: rgba(245, 244, 244, 0.84);
}

.floating-refresh-status.show {
  color: rgba(245, 255, 249, 0.92);
}

.floating-refresh-status.success {
  color: #000000;
}

.floating-refresh-status.error {
  color: #ffd6d3;
}

.floating-refresh-button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 255, 249, 0.88);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.floating-refresh-button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 80;
  display: grid;
  gap: 12px;
  width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 18px 38px rgba(43, 40, 40, 0.18);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-success {
  background: rgba(250, 249, 249, 0.96);
  color: #2B2828;
  border-color: rgba(237, 102, 95, 0.2);
}

.toast-error {
  background: rgba(76, 17, 16, 0.92);
  color: #fff3f2;
  border-color: rgba(255, 214, 211, 0.18);
}

.toast-indicator {
  width: 11px;
  height: 11px;
  margin-top: 4px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08);
}

.toast-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.toast-copy strong {
  font-size: 0.84rem;
  line-height: 1.1;
}

.toast-copy span {
  font-size: 0.8rem;
  line-height: 1.45;
}

body.editor-active .floating-refresh-badge {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
}

.workspace-shell {
  position: relative;
  min-width: 0;
}

.content-column {
  min-width: 0;
}

.editor-drawer {
  position: fixed;
  top: var(--editor-drawer-top-offset);
  right: 14px;
  /* Mesma reserva vertical usada por .table-screen (ver --table-chrome-reserve
     em :root), pra o painel de edição sempre ficar exatamente do mesmo
     tamanho que a tabela ao lado, em qualquer largura de tela. */
  bottom: calc(var(--table-chrome-reserve) - var(--editor-drawer-top-offset));
  width: min(660px, calc(100vw - 28px));
  opacity: 0;
  pointer-events: none;
  transform: translateX(26px);
  transition: transform 0.28s ease, opacity 0.2s ease;
  z-index: 35;
}

.editor-drawer.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.editor-shell {
  position: relative;
  height: 100%;
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
  padding: 14px 16px 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  max-height: none;
  min-height: 0;
  overflow: hidden;
}

.editor-header,
.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-header {
  justify-content: flex-end;
  min-height: 36px;
}

.editor-header-copy {
  display: none;
}

.editor-body,
.editor-multiselect {
  display: grid;
  align-content: start;
  align-items: start;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.18s ease;
}

.editor-body {
  gap: 12px;
  min-width: 0;
  padding-bottom: 4px;
  padding-right: 6px;
}

.editor-body > * {
  min-width: 0;
  align-self: start;
}

.editor-drawer[data-section="assets"] .editor-body {
  max-height: calc(100vh - 210px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.editor-drawer[data-section="assets"] .point-history-access-card,
.editor-drawer[data-section="rules"] .editor-note,
.editor-drawer[data-section="rules"] .selected-tags,
.editor-drawer[data-section="rules"] .editor-inline-actions,
.editor-drawer[data-section="rules"] .editor-grid,
.editor-drawer[data-section="routes"] .editor-note,
.editor-drawer[data-section="routes"] .selected-tags,
.editor-drawer[data-section="routes"] .editor-inline-actions,
.editor-drawer[data-section="routes"] .editor-grid {
  align-self: start;
}

.editor-body:hover,
.editor-body:focus-within,
.editor-multiselect:hover,
.editor-multiselect:focus-within {
  scrollbar-color: rgba(237, 102, 95, 0.45) transparent;
}

.editor-body::-webkit-scrollbar,
.editor-multiselect::-webkit-scrollbar {
  width: 14px;
}

.editor-body::-webkit-scrollbar-thumb,
.editor-multiselect::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: var(--scrollbar-radius);
  border: 4px solid transparent;
  background-clip: padding-box;
}

.editor-body::-webkit-scrollbar-track,
.editor-multiselect::-webkit-scrollbar-track {
  background: transparent;
  border-radius: var(--scrollbar-track-radius);
}

.editor-body:hover::-webkit-scrollbar-thumb,
.editor-body:focus-within::-webkit-scrollbar-thumb,
.editor-multiselect:hover::-webkit-scrollbar-thumb,
.editor-multiselect:focus-within::-webkit-scrollbar-thumb {
  background: rgba(237, 102, 95, 0.45);
  border-radius: var(--scrollbar-radius);
  border: 4px solid transparent;
  background-clip: padding-box;
}

.editor-footer {
  display: grid;
  gap: 12px;
  background: rgba(255, 255, 255, 0.96);
  padding-top: 10px;
  border-top: 1px solid rgba(237, 102, 95, 0.14);
}

.editor-status {
  color: var(--muted);
  font-size: 0.88rem;
}

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

.editor-status.success {
  color: #000000;
}

.editor-drawer.is-alarm-ack .editor-header-copy {
  display: grid;
  gap: 0;
}

.editor-drawer.is-alarm-ack .editor-header {
  justify-content: space-between;
  align-items: flex-start;
  min-height: 0;
  padding-bottom: 0;
}

.editor-drawer.is-alarm-ack .editor-body {
  gap: 0;
  padding-bottom: 0;
}

.editor-drawer.is-alarm-ack .editor-status,
.editor-drawer.is-alarm-ack .editor-delete-button {
  display: none !important;
}

.editor-drawer.is-alarm-ack .editor-footer {
  gap: 0;
  padding-top: 6px;
}

.editor-drawer.is-alarm-ack .editor-field {
  gap: 0;
}

.editor-grid-alarm-ack {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.editor-drawer.is-alarm-ack .editor-textarea {
  min-height: 92px;
}

.editor-inline-delete {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.editor-inline-delete .ghost-button {
  width: 100%;
  max-width: none;
}

.editor-alarm-subtitle {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  color: #7e8b86;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

@media (min-width: 769px) {
  .editor-drawer.is-alarm-ack .editor-shell {
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto auto;
    gap: 6px;
  }

  .editor-drawer.is-alarm-ack .editor-body {
    align-content: start;
    overflow-y: visible;
  }

  .editor-drawer.is-alarm-ack .editor-grid-alarm-ack,
  .editor-drawer.is-alarm-ack .editor-field {
    align-content: start;
  }

  .editor-drawer.is-alarm-ack .editor-textarea {
    min-height: 74px;
  }

  .editor-drawer.is-alarm-ack .editor-footer {
    padding-top: 4px;
  }
}

.editor-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.editor-create-flow {
  display: grid;
  gap: 12px;
  align-content: start;
}

.editor-create-flow .editor-note {
  margin: 0;
}

.editor-grid-scrollable {
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.editor-grid-scrollable [data-field-wrapper="name"],
.editor-grid-scrollable [data-field-wrapper="company"],
.editor-grid-scrollable [data-field-wrapper="role"],
.editor-grid-scrollable [data-field-wrapper="email"],
.editor-grid-scrollable [data-field-wrapper="active"],
.editor-grid-scrollable [data-field-wrapper="validation_status"] {
  min-width: 0;
}

.editor-grid-scrollable [data-field-wrapper="phone"],
.editor-grid-scrollable [data-field-wrapper="validation_code"],
.editor-grid-scrollable [data-field-wrapper="date_birth"] {
  grid-column: 1 / -1;
}

.editor-field {
  display: grid;
  gap: 8px;
}

.editor-field.is-hidden {
  display: none;
}

.editor-field label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.editor-help {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.copy-template-field {
  margin-bottom: 4px;
}

.editor-field.is-readonly label {
  color: #7e8b86;
}

.editor-field.is-mixed label::after {
  content: " • Diversos";
  color: #ac6b00;
}

.editor-note {
  display: inline-flex;
  align-self: start;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(245, 244, 244, 0.92);
  color: var(--brand-deep);
  border: 1px solid rgba(237, 102, 95, 0.2);
  font-size: 0.88rem;
  line-height: 1.45;
  width: fit-content;
  max-width: 100%;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.selected-tag {
  display: inline-flex;
  align-items: center;
  max-width: min(100%, 280px);
  width: fit-content;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.editor-inline-actions {
  display: flex;
  justify-content: flex-start;
}

.editor-multiselect {
  gap: 8px;
  max-height: 180px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.multi-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

/* Linha de uma opção do multiselect "Grupos de Contato" - checkbox + nome +
   nível à esquerda, ícone de editar grupo à direita (só aparece pra quem
   pode gerenciar grupos; nas outras multiselects do sistema, ex.: contatos
   de um grupo, essa linha extra não é usada). */
.multi-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.multi-option-level {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.multi-option-edit {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
}

.multi-option-edit span {
  font-size: 0.86rem;
}

.multiselect-quick-create {
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

/* Modal de criar/editar grupo (reaproveita a base .filter-modal/.delete-confirm-*) */
.group-editor-card {
  gap: 12px;
}

.group-editor-actions {
  align-items: center;
}

.group-editor-actions-spacer {
  flex: 1;
}

/* Coluna "Grupo de Contato" na tabela de Contatos - chips compactos com o
   nome de cada grupo (mostrados direto na célula, sem precisar de clique),
   mais um chip "+N" quando o contato pertence a mais grupos do que o limite
   visível, pra não estourar a altura da linha. Usa tokens de cor (não fixo)
   pra já nascer correto no modo escuro, sem precisar de override separado. */
.contact-group-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.contact-group-chip {
  display: inline-flex;
  align-items: center;
  max-width: 160px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-group-chip-overflow {
  max-width: none;
  color: var(--muted);
  font-weight: 700;
  cursor: default;
}

.code-action-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.phone-parts-field {
  display: grid;
  grid-template-columns: 92px 92px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}

.phone-parts-field .editor-input {
  min-width: 0;
}

.panel-section {
  display: none;
}

.panel-section.is-active {
  display: block;
}

.dashboard-manager-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.dashboard-manager-shell.is-editing {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "aside editbar"
    "aside main";
  gap: 0;
  background: var(--bg);
  overflow: hidden;
}

.dashboard-manager-sidebar-placeholder {
  display: none;
}

.dashboard-manager-shell.is-editing .dashboard-manager-sidebar-placeholder {
  grid-area: aside;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--sidebar-width);
  padding: 24px;
  background: linear-gradient(180deg, #2B2828 0%, #585252 100%);
  color: rgba(245, 255, 249, 0.6);
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.5;
}

body.sidebar-collapsed .dashboard-manager-shell.is-editing .dashboard-manager-sidebar-placeholder {
  width: var(--sidebar-width-collapsed);
  padding: 24px 8px;
  font-size: 0;
}

.dashboard-manager-main {
  min-width: 0;
}

.dashboard-manager-shell.is-editing .dashboard-manager-main {
  grid-area: main;
  min-width: 0;
  overflow-y: auto;
  padding: var(--main-panel-padding);
  padding-bottom: 96px;
}

.dashboard-manager-editbar {
  display: none;
}

.dashboard-manager-shell.is-editing .dashboard-manager-editbar {
  grid-area: editbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px var(--main-panel-padding);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.dashboard-manager-editbar-title h2 {
  margin: 4px 0 0;
}

.dashboard-manager-editbar-title .eyebrow {
  margin: 0;
}

.dashboard-manager-editbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

body.dashboard-manager-editing {
  overflow: hidden;
}

body.dashboard-manager-editing .sidebar,
body.dashboard-manager-editing .topbar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.32s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-manager-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 54;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(43, 40, 40, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: #2B2828;
  box-shadow: 0 18px 40px rgba(43, 40, 40, 0.16);
  backdrop-filter: blur(16px);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.dashboard-manager-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 48px rgba(43, 40, 40, 0.18);
}

.dashboard-manager-shell.is-editing .dashboard-manager-toggle {
  display: none;
}

.dashboard-manager-toggle.is-active {
  background: linear-gradient(135deg, #2B2828, #585252);
  color: #ffffff;
}

.dashboard-manager-toggle-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(237, 102, 95, 0.16);
  font-size: 0.94rem;
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.24s ease;
}

.dashboard-manager-toggle.is-active .dashboard-manager-toggle-icon {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg) scale(1.1);
}

.dashboard-manager-toggle:active {
  transform: scale(0.94);
}

.dashboard-manager-editbar-title-input {
  margin: 4px 0 0;
  font-size: 1.3rem;
  font-weight: 800;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 4px 8px;
  margin-left: -9px;
  max-width: 100%;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.dashboard-manager-editbar-title-input:hover {
  background: rgba(237, 102, 95, 0.08);
  border-color: rgba(237, 102, 95, 0.18);
}

.dashboard-manager-editbar-title-input:focus {
  outline: none;
  background: rgba(237, 102, 95, 0.12);
  border-color: rgba(237, 102, 95, 0.4);
}

/* Modal central de alerta pra falhas de criar/excluir dashboard (limite
   de privado/compartilhado atingido, etc.) - reaproveita a família
   .filter-modal/.logout-confirm-dialog/.logout-confirm-card já usada em
   #logoutConfirmModal e #tourConfirmModal. Dois ajustes escopados só
   aqui, sem tocar as regras compartilhadas:
   - z-index acima do #globalAiLauncher (145): .filter-modal base é 135,
     e o launcher de IA (canto inferior direito, sempre fixo) pode cobrir
     visualmente e bloquear clique no botão "Entendi" se aparecer nesse
     canto - mesmo conflito pré-existente já corrigido pro tourConfirmModal.
   - .filter-modal-card sem fundo/borda: no dark mode, style.css dá um
     background diferente do .filter-modal-dialog em que ele fica dentro
     (ver comentário igual em tour.css), criando uma caixa mais escura
     colada no texto - bug real que também afeta o #logoutConfirmModal de
     produção sem ninguém notar, mas só neutralizo aqui, escopado.
   Seletor por ID (não classe): a definição real de `.filter-modal`
   (z-index:135) fica bem mais abaixo neste mesmo arquivo, e com empate de
   especificidade (classe vs. classe) quem vence é a ordem no arquivo, não
   a intenção - um seletor de ID (maior especificidade) garante que este
   bloco vence independente de onde `.filter-modal` for definido depois. */
#dashboardWorkspaceAlertModal {
  z-index: 9001;
}
#dashboardWorkspaceAlertModal .filter-modal-card {
  background: transparent;
  border-color: transparent;
}

.dashboard-workspaces-menu {
  position: fixed;
  top: 78px;
  right: 24px;
  z-index: 1600;
  width: 400px;
  max-width: calc(100vw - 32px);
  max-height: min(560px, calc(100vh - 110px));
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  padding: 16px;
  border-radius: 22px;
  background: rgba(24, 23, 23, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 22px 50px rgba(11, 11, 11, 0.4);
  display: grid;
  gap: 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  filter: blur(5px);
  transform: translateY(-28px) scale(0.82) rotateX(-8deg);
  transform-origin: top right;
  perspective: 900px;
  transition:
    opacity 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.24s ease,
    visibility 0.38s;
}

.dashboard-workspaces-menu * {
  box-sizing: border-box;
}

.dashboard-workspaces-menu.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  filter: blur(0);
  transform: translateY(0) scale(1) rotateX(0deg);
}

.dashboard-manager-shell.is-editing .dashboard-workspaces-menu {
  display: none;
}

.dashboard-workspaces-menu-head {
  padding: 2px 6px 6px;
  color: #FBFAFA;
}

.dashboard-workspaces-menu-head .eyebrow {
  margin: 0;
  color: rgba(251, 250, 250, 0.6);
}

.dashboard-workspaces-menu-head h3 {
  margin: 4px 0 0;
  font-size: 1.05rem;
}

.dashboard-workspaces-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

@keyframes dashboardWorkspaceRowIn {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.92);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dashboard-workspaces-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  transition: background 0.18s ease, transform 0.18s ease;
}

/* A animação de entrada só toca na lista marcada como "abrindo agora"
   (ver renderDashboardWorkspacesMenu({ animate: true }) em main.js) - do
   contrário, qualquer re-render por interação (criar, editar, excluir,
   trocar privado/compartilhado) recria os elementos via innerHTML e o
   navegador tocaria a animação inteira de novo a cada clique. */
.dashboard-workspaces-list.is-animating-in .dashboard-workspaces-row {
  animation: dashboardWorkspaceRowIn 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--stagger-index, 0) * 40ms);
}

.dashboard-workspaces-row:hover {
  background: rgba(237, 102, 95, 0.14);
  transform: translateX(2px);
}

.dashboard-workspaces-row.is-active {
  background: rgba(237, 102, 95, 0.24);
  box-shadow: inset 0 0 0 1px rgba(237, 102, 95, 0.4);
}

.dashboard-workspaces-row-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #FBFAFA;
  padding: 10px 2px;
  text-align: left;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.dashboard-workspaces-row-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-workspaces-row-active-marker {
  flex: 0 0 auto;
  color: #ED665F;
  font-size: 0.7rem;
}

.dashboard-workspaces-visibility-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.dashboard-workspaces-visibility-badge.is-shared {
  background: rgba(237, 102, 95, 0.18);
  color: #F2918C;
}

.dashboard-workspaces-visibility-badge.is-private {
  background: rgba(241, 162, 8, 0.18);
  color: #f1c04a;
}

.dashboard-workspaces-row-action,
.dashboard-workspaces-row-action-spacer {
  width: 34px;
  height: 34px;
  min-width: 34px;
  justify-self: center;
}

.dashboard-workspaces-row-action {
  border-radius: 11px;
  border: 1px solid transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.14s ease;
}

.dashboard-workspaces-row-action:hover {
  transform: translateY(-1px);
}

.dashboard-workspaces-row-action.is-edit {
  background: rgba(237, 102, 95, 0.16);
  border-color: rgba(237, 102, 95, 0.3);
  color: #F2918C;
}

.dashboard-workspaces-row-action.is-edit:hover {
  background: rgba(237, 102, 95, 0.3);
  color: #ffffff;
}

.dashboard-workspaces-row-action.is-delete {
  background: rgba(199, 74, 69, 0.16);
  border-color: rgba(199, 74, 69, 0.32);
  color: #ff8f87;
}

.dashboard-workspaces-row-action.is-delete:hover {
  background: rgba(199, 74, 69, 0.3);
  color: #ffffff;
}

.dashboard-workspaces-row-action.is-confirming {
  background: #c74a45;
  border-color: #c74a45;
  color: #ffffff;
  animation: dashboardWorkspaceConfirmPulse 1.1s ease-in-out infinite;
}

@keyframes dashboardWorkspaceConfirmPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(199, 74, 69, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(199, 74, 69, 0); }
}

.dashboard-workspaces-row-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.dashboard-workspaces-empty {
  padding: 12px 8px;
  color: rgba(251, 250, 250, 0.6);
  font-size: 0.85rem;
}

.dashboard-workspaces-list.is-animating-in .dashboard-workspaces-empty {
  animation: dashboardWorkspaceRowIn 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.dashboard-workspaces-create {
  width: 100%;
  border: 1px dashed rgba(237, 102, 95, 0.35);
  background: rgba(237, 102, 95, 0.06);
  color: #FBFAFA;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.dashboard-workspaces-create svg {
  color: #ED665F;
}

.dashboard-workspaces-create:hover {
  background: rgba(237, 102, 95, 0.16);
  border-color: rgba(237, 102, 95, 0.55);
}

.dashboard-workspaces-create:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dashboard-workspaces-list.is-animating-in .dashboard-workspaces-create {
  animation: dashboardWorkspaceRowIn 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--stagger-index, 0) * 40ms);
}

.dashboard-workspaces-create-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  min-width: 0;
}

.dashboard-workspaces-list.is-animating-in .dashboard-workspaces-create-form {
  animation: dashboardWorkspaceRowIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.dashboard-workspaces-create-form input[type="text"] {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: #FBFAFA;
  padding: 11px 12px;
  font: inherit;
}

.dashboard-workspaces-create-form input[type="text"]:focus {
  outline: none;
  border-color: rgba(237, 102, 95, 0.55);
  background: rgba(255, 255, 255, 0.1);
}

.dashboard-workspaces-visibility-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  min-width: 0;
}

.dashboard-workspaces-visibility-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(251, 250, 250, 0.7);
  padding: 9px 8px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.14s ease;
}

.dashboard-workspaces-visibility-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-workspaces-visibility-option:hover {
  transform: translateY(-1px);
}

.dashboard-workspaces-visibility-option.is-shared-option.is-selected {
  background: linear-gradient(135deg, #ED665F 0%, #585252 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(237, 102, 95, 0.3);
}

.dashboard-workspaces-visibility-option.is-private-option.is-selected {
  background: linear-gradient(135deg, #f1c04a 0%, #a8720b 100%);
  border-color: transparent;
  color: #241a04;
  box-shadow: 0 8px 18px rgba(241, 162, 8, 0.32);
}

.dashboard-workspaces-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dashboard-workspaces-create-form-cancel,
.dashboard-workspaces-create-form-submit {
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.18s ease;
}

.dashboard-workspaces-create-form-cancel:hover,
.dashboard-workspaces-create-form-submit:hover {
  transform: translateY(-1px);
}

.dashboard-workspaces-create-form-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #FBFAFA;
}

.dashboard-workspaces-create-form-submit {
  background: linear-gradient(135deg, #ED665F 0%, #585252 100%);
  color: #ffffff;
}

.dashboard-workspaces-create-form-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 480px) {
  .dashboard-workspaces-menu {
    width: calc(100vw - 24px);
  }
}

.dashboard-library-fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 65;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  line-height: 1;
  background: linear-gradient(135deg, #2B2828, #585252);
  color: #fff;
  box-shadow: 0 18px 40px rgba(43, 40, 40, 0.28);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-library-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 48px rgba(43, 40, 40, 0.32);
}

.dashboard-manager-shell.is-editing .dashboard-library-fab {
  display: inline-flex;
}

.dashboard-manager-panel {
  display: none;
  min-width: 0;
}

.dashboard-manager-shell.is-editing .dashboard-manager-panel {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}

.dashboard-library-sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(17, 16, 16, 0.42);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.dashboard-manager-panel.is-open .dashboard-library-sheet-scrim {
  opacity: 1;
  pointer-events: auto;
}

.dashboard-library-sheet-handle {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: rgba(43, 40, 40, 0.16);
  margin: 10px auto 0;
}

.dashboard-manager-panel-shell {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%);
  display: flex;
  flex-direction: column;
  width: min(920px, 92vw);
  max-height: 78vh;
  min-height: 0;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(43, 40, 40, 0.08);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 24px 60px rgba(43, 40, 40, 0.12);
  backdrop-filter: blur(18px);
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.dashboard-manager-panel.is-open .dashboard-manager-panel-shell {
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.dashboard-manager-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(43, 40, 40, 0.08);
}

.dashboard-manager-panel-header h3,
.dashboard-manager-panel-header p {
  margin: 0;
}

.dashboard-manager-panel-body {
  display: grid;
  gap: 18px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 20px;
}

.dashboard-manager-panel-actions {
  display: grid;
  gap: 10px;
}

.dashboard-manager-panel-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.dashboard-manager-panel-section {
  display: grid;
  gap: 12px;
}

.dashboard-manager-panel-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #2B2828;
}

.dashboard-manager-panel-section-head span {
  font-size: 0.82rem;
  color: var(--muted);
}

.dashboard-manager-pill-grid,
.dashboard-manager-library-grid {
  display: grid;
  gap: 10px;
}

.dashboard-manager-library-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-manager-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(43, 40, 40, 0.06);
  border: 1px solid rgba(43, 40, 40, 0.08);
}

.dashboard-manager-pill.is-active {
  background: linear-gradient(180deg, rgba(237, 102, 95, 0.12), rgba(237, 102, 95, 0.06));
}

.dashboard-manager-pill span {
  font-weight: 600;
  color: #2B2828;
}

.dashboard-manager-pill-action {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: 0 0 auto;
}

.dashboard-library-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(43, 40, 40, 0.08);
  box-shadow: var(--shadow-soft);
  cursor: grab;
  min-height: 150px;
}

.dashboard-library-card:active {
  cursor: grabbing;
}

.dashboard-library-card h4,
.dashboard-library-card p {
  margin: 0;
}

.dashboard-manager-empty-mini {
  padding: 14px;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(43, 40, 40, 0.04);
  border: 1px dashed rgba(43, 40, 40, 0.12);
}

.dashboard-canvas-empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
}

.dashboard-canvas-empty[hidden] {
  display: none;
}

.dashboard-canvas-empty p {
  margin: 0;
  max-width: 480px;
}

.dashboard-canvas {
  display: grid;
  gap: 18px;
  align-items: start;
}

.dashboard-canvas-group {
  display: grid;
  gap: 12px;
}

.dashboard-canvas-group[hidden] {
  display: none;
}



.dashboard-canvas-group-head {
  display: grid;
  gap: 4px;
  padding: 0 4px;
}

.dashboard-canvas-group-head h3,
.dashboard-canvas-group-head p {
  margin: 0;
}

.dashboard-canvas-grid {
  display: grid;
  gap: 18px;
  align-items: start;
}

.dashboard-canvas-grid-large {
  grid-template-columns: repeat(20, minmax(0, 1fr));
  grid-auto-rows: 76px;
}

.dashboard-canvas-grid-small {
  grid-template-columns: repeat(20, minmax(0, 1fr));
  grid-auto-rows: 76px;
}

.dashboard-card {
  position: relative;
  min-width: 0;
  align-self: stretch;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card[hidden] {
  display: none !important;
}

.dashboard-card-summary .hero-card,
.dashboard-card-samples .trend-card {
  min-height: 340px;
}

.dashboard-card-metric .dashboard-kpi-card {
  min-height: 150px;
}

.dashboard-kpi-card {
  position: relative;
  height: 100%;
  padding: 20px 20px 20px 24px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(43, 40, 40, 0.08);
  border-left: 3px solid var(--status-neutral);
  box-shadow: var(--shadow);
  display: grid;
  align-content: start;
  gap: 10px;
  transition: border-color 0.2s ease;
}

.dashboard-kpi-card[data-dashboard-metric-tone="ok"] { border-left-color: var(--status-ok); }
.dashboard-kpi-card[data-dashboard-metric-tone="warning"] { border-left-color: var(--status-warning); }
.dashboard-kpi-card[data-dashboard-metric-tone="critical"] { border-left-color: var(--status-critical); }
.dashboard-kpi-card[data-dashboard-metric-tone="offline"] { border-left-color: var(--status-offline); }

.dashboard-kpi-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  margin-bottom: 2px;
  background: var(--status-neutral-soft);
  color: var(--status-neutral);
}

.dashboard-kpi-icon svg {
  width: 19px;
  height: 19px;
}

.dashboard-kpi-card[data-dashboard-metric-tone="ok"] .dashboard-kpi-icon { background: var(--status-ok-soft); color: var(--status-ok); }
.dashboard-kpi-card[data-dashboard-metric-tone="warning"] .dashboard-kpi-icon { background: var(--status-warning-soft); color: var(--status-warning); }
.dashboard-kpi-card[data-dashboard-metric-tone="critical"] .dashboard-kpi-icon { background: var(--status-critical-soft); color: var(--status-critical); }
.dashboard-kpi-card[data-dashboard-metric-tone="offline"] .dashboard-kpi-icon { background: var(--status-offline-soft); color: var(--status-offline); }

.dashboard-kpi-card .eyebrow,
.dashboard-kpi-card h3,
.dashboard-kpi-card p {
  margin: 0;
}

.dashboard-kpi-card .eyebrow {
  display: none;
}

.dashboard-kpi-card h3 {
  font-size: 1rem;
  color: #2B2828;
}

.dashboard-kpi-value {
  display: block;
  font-size: clamp(2rem, 2.6vw, 2.7rem);
  line-height: 1;
  font-weight: 800;
  color: #2B2828;
  letter-spacing: -0.04em;
  transition: color 0.2s ease;
}

.dashboard-kpi-card[data-dashboard-metric-tone="ok"] .dashboard-kpi-value { color: var(--status-ok); }
.dashboard-kpi-card[data-dashboard-metric-tone="warning"] .dashboard-kpi-value { color: var(--status-warning); }
.dashboard-kpi-card[data-dashboard-metric-tone="critical"] .dashboard-kpi-value { color: var(--status-critical); }

.dashboard-kpi-meta {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.dashboard-kpi-fill {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(43, 40, 40, 0.08);
  overflow: hidden;
  margin-top: 2px;
}

.dashboard-kpi-fill span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--status-neutral);
  transition: width 0.4s ease, background 0.2s ease;
}

.dashboard-kpi-card[data-dashboard-metric-tone="ok"] .dashboard-kpi-fill span { background: var(--status-ok); }
.dashboard-kpi-card[data-dashboard-metric-tone="warning"] .dashboard-kpi-fill span { background: var(--status-warning); }
.dashboard-kpi-card[data-dashboard-metric-tone="critical"] .dashboard-kpi-fill span { background: var(--status-critical); }


.dashboard-card-samples .trend-card,
.dashboard-card-summary .hero-card,
.dashboard-card-metric .dashboard-kpi-card {
  height: 100%;
  overflow: hidden;
}

.dashboard-card-editor-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: none;
  align-items: center;
  gap: 8px;
}


.dashboard-metric-card-action {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
}

.dashboard-metric-card-action-trigger {
  position: relative;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.dashboard-metric-card-action-corner {
  position: absolute;
  inset: 0;
  border-top-right-radius: calc(var(--radius-xl) - 2px);
  background:
    linear-gradient(135deg, rgba(237, 102, 95, 0.26) 0%, rgba(237, 102, 95, 0.18) 18%, rgba(237, 102, 95, 0.04) 54%, rgba(237, 102, 95, 0) 70%),
    linear-gradient(180deg, rgba(43, 40, 40, 0.1), rgba(43, 40, 40, 0));
  clip-path: polygon(100% 0, 100% 100%, 0 0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.dashboard-metric-card-action-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #585252;
  font-size: 0.84rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 24px rgba(43, 40, 40, 0.08);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.dashboard-metric-card-action-trigger:hover .dashboard-metric-card-action-corner,
.dashboard-metric-card-action-trigger.is-active .dashboard-metric-card-action-corner {
  opacity: 1;
}

.dashboard-metric-card-action-trigger:hover .dashboard-metric-card-action-icon,
.dashboard-metric-card-action-trigger.is-active .dashboard-metric-card-action-icon {
  transform: translate(-1px, 1px);
  background: rgba(255, 255, 255, 0.96);
  color: #2B2828;
}

.dashboard-metric-card-popover {
  position: absolute;
  top: 14px;
  right: 14px;
  width: min(240px, calc(100vw - 52px));
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(43, 40, 40, 0.08);
  box-shadow: 0 20px 44px rgba(21, 20, 20, 0.18);
  backdrop-filter: blur(14px);
  display: grid;
  gap: 12px;
  transform: translateY(-6px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.dashboard-metric-card-popover.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.dashboard-metric-card-popover p {
  margin: 0;
  color: #544E4E;
  font-size: 0.88rem;
  line-height: 1.45;
}

.dashboard-metric-card-popover strong {
  color: #2B2828;
}

.dashboard-metric-card-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dashboard-metric-card-popover-actions .ghost-button,
.dashboard-metric-card-popover-actions .primary-button {
  min-width: 0;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.78rem;
}

.dashboard-manager-shell.is-editing .dashboard-card-editor-tools {
  display: inline-flex;
}

.dashboard-card-tool {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(43, 40, 40, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: #2B2828;
  box-shadow: 0 10px 24px rgba(43, 40, 40, 0.12);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.dashboard-card-tool-handle {
  cursor: grab;
}

.dashboard-card-tool-mobile-resize {
  display: none;
}

.dashboard-card-tool-handle:active {
  cursor: grabbing;
}

.dashboard-manager-shell.is-editing .dashboard-card:hover {
  transform: translateY(-2px);
}

.dashboard-card.is-drop-target-before::before,
.dashboard-card.is-drop-target-after::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2B2828, #ED665F);
  z-index: 5;
}

.dashboard-card.is-drop-target-before::before {
  top: -8px;
}

.dashboard-card.is-drop-target-after::after {
  bottom: -8px;
}

.dashboard-card.is-resizable-card {
  min-height: 0;
}

.dashboard-widget-card-shell {
  height: 100%;
  min-height: max(168px, calc(var(--dashboard-card-row-span, 2) * 76px + (var(--dashboard-card-row-span, 2) - 1) * 18px - 20px));
  padding: 22px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(43, 40, 40, 0.08);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.dashboard-widget-card-shell > [data-dashboard-watchlist-body],
.dashboard-widget-card-shell > [data-dashboard-alarms-body],
.dashboard-widget-card-shell > [data-dashboard-machine-body],
.dashboard-widget-card-shell > [data-dashboard-surgical-rooms-body],
.dashboard-widget-card-shell > [data-dashboard-space-ranking-body],
.dashboard-widget-card-shell > [data-dashboard-room-history-body],
.dashboard-widget-card-shell > [data-dashboard-alarm-heatmap-body],
.dashboard-widget-card-shell > [data-dashboard-setpoint-deviation-body] {
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding-right: 6px;
}

/* Os 3 cards de gráfico novos têm um elemento irmão ao lado do gráfico (toolbar de
   dias no mapa de alarmes, rodapé de "ambiente sem setpoint" no desvio, aviso de
   clima indisponível na tendência) - com flex column, só o próprio container do
   gráfico cresce/encolhe pra preencher o espaço restante, então ele acompanha o
   tamanho do card de verdade em vez de vazar (100% do body inteiro, sem descontar
   os irmãos) ou ficar cortado. */
.dashboard-widget-card-shell > [data-dashboard-room-history-body],
.dashboard-widget-card-shell > [data-dashboard-alarm-heatmap-body],
.dashboard-widget-card-shell > [data-dashboard-setpoint-deviation-body] {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

[data-dashboard-room-history-body] > .room-history-plotly,
[data-dashboard-alarm-heatmap-body] > .alarm-heatmap-plotly,
[data-dashboard-setpoint-deviation-body] > .setpoint-deviation-chart-shell {
  flex: 1 1 auto;
  min-height: 0;
}

.dashboard-widget-card-heading {
  min-width: 0;
}

.dashboard-widget-card-heading-with-legend {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: wrap;
}

/* No modo de edição, a fileira de botões do card (engrenagem/remover/arrastar)
   flutua por cima do canto superior direito (.dashboard-card-editor-tools,
   position:absolute) - sem esse respiro a legenda encosta embaixo dos botões. */
.dashboard-manager-shell.is-editing .dashboard-widget-card-heading-with-legend {
  padding-right: 148px;
}

.room-history-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding-top: 4px;
}

.room-history-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: #5A5454;
  white-space: nowrap;
}

.room-history-legend-swatch {
  width: 10px;
  height: 3px;
  border-radius: 2px;
  flex: none;
}

.dashboard-widget-card-heading h3,
.dashboard-widget-card-heading p {
  margin: 0;
}

.dashboard-widget-card-context-inline {
  color: #2B2828;
  font-size: 1rem;
  font-weight: 700;
}

.dashboard-widget-card-context {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 3px;
}

.dashboard-widget-card-context:empty {
  display: none;
}

.widget-empty-state {
  display: grid;
  gap: 10px;
  align-content: center;
  min-height: 180px;
  padding: 20px;
  border-radius: 20px;
  border: 1px dashed rgba(43, 40, 40, 0.12);
  background: linear-gradient(180deg, rgba(250, 250, 250, 0.96), rgba(246, 246, 246, 0.94));
  color: var(--muted);
}

.widget-empty-state strong {
  color: #2B2828;
  font-size: 1rem;
}

.widget-empty-config-button {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* Widget "Ranking de Ambientes" — GET /spaces/ranking (api/space_ranking.py). Visual
   espelhando o vocabulário já usado em Salas Cirúrgicas (tokens de tema, tons
   ok/warning/critical, cantos arredondados, pill badges) — ver .surgical-rooms-* acima.
   Tokens de tema de propósito: conteúdo novo, sem vizinho legado hardcoded. */
.space-ranking-widget-shell {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.space-ranking-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.space-ranking-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text);
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, transform 100ms ease;
}

.space-ranking-chip:hover {
  border-color: color-mix(in srgb, var(--brand-deep, var(--primary)) 45%, var(--line));
  background: color-mix(in srgb, var(--brand-deep, var(--primary)) 10%, var(--panel));
}

.space-ranking-chip:active {
  transform: scale(0.97);
}

.space-ranking-chip:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand-deep, var(--primary)) 55%, transparent);
  outline-offset: 2px;
}

.space-ranking-chip.is-static {
  cursor: default;
  opacity: 0.72;
}

.space-ranking-chip.is-static:hover {
  border-color: var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}

.space-ranking-chip-icon {
  font-size: 0.92rem;
  line-height: 1;
}

.space-ranking-list-shell {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  padding-right: 2px;
}

.space-ranking-plotly {
  width: 100%;
  height: 100%;
  min-height: 220px;
}

.room-history-plotly,
.alarm-heatmap-plotly {
  width: 100%;
  height: 100%;
  min-height: 240px;
}

.setpoint-deviation-chart-shell {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.space-ranking-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.space-ranking-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
}

.space-ranking-item.is-rank-1 {
  border-color: color-mix(in srgb, var(--brand-deep, var(--primary)) 38%, var(--line));
  background: color-mix(in srgb, var(--brand-deep, var(--primary)) 6%, var(--panel));
}

.space-ranking-position {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.space-ranking-item.is-rank-1 .space-ranking-position {
  color: var(--brand-deep, var(--primary));
  font-weight: 800;
}

.space-ranking-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
}

.space-ranking-value {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  font-size: 0.85rem;
}

.space-ranking-value.tone-ok {
  color: var(--status-ok);
}

.space-ranking-value.tone-warning {
  color: var(--status-warning);
}

.space-ranking-value.tone-critical {
  color: var(--status-critical);
}

.space-ranking-footnote {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.dashboard-widget-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #8A8181;
}

.watchlist-widget-table-shell {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(43, 40, 40, 0.08);
  background: rgba(252, 251, 251, 0.84);
}

.watchlist-widget-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
  table-layout: fixed;
}

.watchlist-widget-table th,
.watchlist-widget-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(43, 40, 40, 0.06);
  vertical-align: middle;
  font-size: 0.88rem;
}

.watchlist-widget-table th {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  color: #645D5D;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  z-index: 1;
  padding-top: 7px;
  padding-bottom: 7px;
}

.watchlist-point-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.watchlist-point-cell strong,
.watchlist-point-cell span {
  display: block;
}

.watchlist-point-cell span {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 3px;
}


.watchlist-value-cell {
  font-weight: 700;
  color: #2B2828;
}

.watchlist-value-with-trend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dashboard-trend-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.dashboard-trend-arrow svg {
  width: 100%;
  height: 100%;
}

.dashboard-trend-arrow.is-up,
.dashboard-trend-arrow.is-down { color: var(--brand-deep); }
.dashboard-trend-arrow.is-stable { color: var(--gray); }

.alarm-feed-table-shell {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(43, 40, 40, 0.08);
  background: rgba(252, 251, 251, 0.84);
}

.alarm-feed-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
  table-layout: fixed;
}

.alarm-feed-table th,
.alarm-feed-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(43, 40, 40, 0.06);
  vertical-align: middle;
  font-size: 0.83rem;
}

.alarm-feed-table th {
  position: sticky;
  top: 0;
  background: rgba(252, 251, 251, 0.96);
  color: #645D5D;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  z-index: 1;
  padding-top: 7px;
  padding-bottom: 7px;
}

.alarm-feed-alarm-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.alarm-feed-alarm-cell strong,
.alarm-feed-alarm-cell span {
  display: block;
}

.dashboard-row-state-bar {
  flex: 0 0 auto;
  width: 3px;
  height: 30px;
  border-radius: 999px;
  background: var(--status-offline);
}

.dashboard-row-state-bar.tone-ok { background: var(--status-ok); }
.dashboard-row-state-bar.tone-warning { background: var(--status-warning); }
.dashboard-row-state-bar.tone-critical { background: var(--status-critical); }
.dashboard-row-state-bar.tone-neutral { background: var(--status-neutral); }

.watchlist-point-type-icon {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.alarm-feed-alarm-cell strong {
  color: #2B2828;
  line-height: 1.15;
}

.alarm-feed-alarm-cell span {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 2px;
}


.dashboard-surgical-config-shell {
  gap: 18px;
}

.dashboard-surgical-config-section {
  display: grid;
  gap: 12px;
}

.dashboard-surgical-config-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-surgical-config-head strong {
  color: #2B2828;
}

.dashboard-surgical-config-head span {
  color: var(--muted);
  font-size: 0.8rem;
}

.dashboard-surgical-config-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.dashboard-surgical-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #2B2828;
  font-size: 0.82rem;
}

.dashboard-surgical-space-list,
.dashboard-surgical-selected-list,
.dashboard-surgical-column-list,
.dashboard-surgical-mapping-list {
  display: grid;
  gap: 10px;
}

.dashboard-surgical-space-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-surgical-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-surgical-column-item,
.dashboard-surgical-mapping-card {
  align-items: start;
}

.dashboard-surgical-column-grid,
.dashboard-surgical-mapping-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-surgical-mapping-head {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 12px;
  align-items: center;
}

.surgical-rooms-name-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.surgical-rooms-name-copy strong,
.surgical-rooms-name-copy span,
.surgical-rooms-metric-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.surgical-rooms-name-copy span {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

.surgical-rooms-skeleton-line {
  display: block;
  width: 74px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(43, 40, 40, 0.08), rgba(43, 40, 40, 0.14), rgba(43, 40, 40, 0.08));
  background-size: 160px 100%;
  animation: skeletonShimmer 1.2s linear infinite;
}

.surgical-rooms-skeleton-line.is-wide {
  width: 150px;
}

.surgical-rooms-skeleton-line.is-short {
  width: 56px;
}

.surgical-rooms-widget-shell {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.surgical-rooms-table-shell {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
}

.surgical-rooms-table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.surgical-rooms-table th,
.surgical-rooms-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(43, 40, 40, 0.06);
  vertical-align: middle;
  font-size: 0.84rem;
}

.surgical-rooms-table th:first-child,
.surgical-rooms-table td:first-child {
  text-align: left;
}

.surgical-rooms-table th:not(:first-child),
.surgical-rooms-table td:not(:first-child) {
  text-align: center;
}

.surgical-rooms-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: 7px;
  padding-bottom: 7px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  color: color-mix(in srgb, var(--text) 54%, var(--muted));
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.surgical-rooms-table tbody tr:last-child td {
  border-bottom: 0;
}

.surgical-rooms-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  text-align: left;
}

.surgical-rooms-name-cell strong {
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.2;
  font-weight: 600;
}

.surgical-rooms-state-bar {
  width: 3px;
  min-width: 3px;
  height: 30px;
  align-self: center;
  border-radius: 999px;
  border: 0;
  background: var(--gray);
  opacity: 0.92;
  display: inline-block;
}

.surgical-rooms-state-bar[tabindex="0"] {
  cursor: help;
}

.surgical-rooms-state-bar:focus-visible {
  outline: 2px solid rgba(237, 102, 95, 0.42);
  outline-offset: 3px;
}

.surgical-rooms-state-bar.is-mock {
  background:
    repeating-linear-gradient(
      180deg,
      rgba(234, 88, 12, 0.92) 0 4px,
      rgba(234, 88, 12, 0.32) 4px 8px
    );
  opacity: 1;
}

.surgical-rooms-metric {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 24px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.surgical-rooms-metric.is-performance {
  gap: 7px;
}

.surgical-rooms-metric-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.surgical-rooms-metric-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: center;
}

.surgical-rooms-metric-button:focus-visible {
  outline: 2px solid rgba(237, 102, 95, 0.42);
  outline-offset: 4px;
  border-radius: 10px;
}

.surgical-rooms-inline-mock {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid rgba(234, 88, 12, 0.18);
  background: rgba(234, 88, 12, 0.1);
  color: #ea580c;
  font-size: 0.56rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.surgical-rooms-performance-bar {
  width: 34px;
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 68%, transparent);
  overflow: hidden;
  flex: 0 0 auto;
}

.surgical-rooms-performance-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
}

.surgical-rooms-mini-popover {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 140;
  width: clamp(380px, 34vw, 420px);
  min-height: 240px;
  max-width: calc(100vw - 24px);
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 96%, transparent);
  box-shadow: var(--shadow-soft);
  color: var(--text);
}

.surgical-rooms-mini-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.surgical-rooms-mini-popover-heading {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.surgical-rooms-mini-popover-head strong {
  font-size: 0.79rem;
  line-height: 1.25;
}

.surgical-rooms-mini-popover-explanation {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.surgical-rooms-mini-popover-head span,
.surgical-rooms-mini-popover-summary-item small,
.surgical-rooms-mini-popover-empty {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.surgical-rooms-popover-close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: color-mix(in srgb, #b42318 68%, var(--muted));
  cursor: pointer;
  flex: 0 0 auto;
  transition: background-color 140ms ease, color 140ms ease;
}

.surgical-rooms-popover-close-button svg {
  width: 15px;
  height: 15px;
  display: block;
}

.surgical-rooms-popover-close-button:hover {
  background: color-mix(in srgb, #b42318 10%, transparent);
  color: color-mix(in srgb, #b42318 82%, var(--text));
}

.surgical-rooms-popover-close-button:focus-visible {
  outline: 2px solid rgba(237, 102, 95, 0.42);
  outline-offset: 2px;
  background: color-mix(in srgb, #b42318 10%, transparent);
  color: color-mix(in srgb, #b42318 82%, var(--text));
}

.surgical-rooms-mini-popover-period-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
}

.surgical-rooms-mini-popover-period-option {
  min-width: 0;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.surgical-rooms-mini-popover-period-option.is-active {
  background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 72%, transparent);
}

.surgical-rooms-mini-popover-period-option:focus-visible {
  outline: 2px solid rgba(237, 102, 95, 0.42);
  outline-offset: 1px;
}

.surgical-rooms-mini-popover-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 10px;
}

.surgical-rooms-mini-popover-summary-item {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.surgical-rooms-mini-popover-summary-item.is-wide {
  grid-column: 1 / -1;
}

.surgical-rooms-mini-popover-summary-item strong {
  font-size: 0.76rem;
  line-height: 1.35;
  font-weight: 700;
}

.surgical-rooms-mini-popover-summary-stats .surgical-rooms-mini-popover-summary-item:not(.is-wide) {
  text-align: left;
}

:root[data-theme="dark"] .surgical-rooms-mini-popover .surgical-rooms-mini-popover-head span,
:root[data-theme="dark"] .surgical-rooms-mini-popover .surgical-rooms-mini-popover-explanation,
:root[data-theme="dark"] .surgical-rooms-mini-popover .surgical-rooms-mini-popover-summary-item small,
:root[data-theme="dark"] .surgical-rooms-mini-popover .surgical-rooms-mini-popover-summary-item strong,
:root[data-theme="dark"] .surgical-rooms-mini-popover .surgical-rooms-mini-popover-empty {
  color: var(--text-primary) !important;
}

.surgical-rooms-mini-chart {
  width: 100%;
  height: 172px;
  border-radius: 12px;
  overflow: visible;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
}

.surgical-rooms-mini-chart svg {
  width: 100%;
  height: 100%;
  display: block;
}

.surgical-rooms-mini-chart-grid {
  fill: none;
  stroke: color-mix(in srgb, var(--line) 80%, transparent);
  stroke-width: 1;
}

.surgical-rooms-mini-chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.surgical-rooms-metric small,
.surgical-rooms-legend-item strong {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.surgical-rooms-trend-mock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #ea580c;
  font-weight: 700;
}

.surgical-rooms-trend-mock.tone-up { color: var(--status-ok); }
.surgical-rooms-trend-mock.tone-down { color: var(--status-critical); }
.surgical-rooms-trend-mock.tone-stable { color: var(--gray); }

.surgical-rooms-trend-mock small {
  color: currentColor;
  font-size: 0.78rem;
  font-weight: 800;
}

.surgical-rooms-trend-mock em,
.surgical-rooms-legend-item-mock em {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid rgba(234, 88, 12, 0.22);
  background: rgba(234, 88, 12, 0.12);
  color: #ea580c;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.surgical-rooms-pressure {
  font-variant-numeric: tabular-nums;
  color: #2B2828;
}

.surgical-rooms-status,
.surgical-rooms-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.surgical-rooms-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  flex: 0 0 auto;
}

.surgical-rooms-status-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.surgical-rooms-status-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 4px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: center;
  transition: background-color 140ms ease;
}

.surgical-rooms-status-button:hover {
  background: color-mix(in srgb, var(--panel) 82%, transparent);
}

.surgical-rooms-status-button:focus-visible {
  outline: 2px solid rgba(237, 102, 95, 0.42);
  outline-offset: 4px;
  border-radius: 10px;
}

.surgical-rooms-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 18;
  width: min(320px, calc(100vw - 48px));
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
  box-shadow: var(--shadow-soft);
  color: var(--text);
}

.surgical-rooms-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.surgical-rooms-popover-heading {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.surgical-rooms-popover-head strong {
  font-size: 0.8rem;
  line-height: 1.2;
}

.surgical-rooms-popover-head span,
.surgical-rooms-popover-empty,
.surgical-rooms-popover-item span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.surgical-rooms-popover-list {
  display: grid;
  gap: 10px;
  max-height: 240px;
  overflow: auto;
  padding-right: 4px;
}

.surgical-rooms-popover-item {
  display: grid;
  gap: 3px;
  padding-top: 10px;
  border-top: 1px solid rgba(43, 40, 40, 0.08);
}

.surgical-rooms-popover-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.surgical-rooms-popover-item strong {
  font-size: 0.76rem;
  line-height: 1.25;
  color: var(--text);
}

.surgical-rooms-popover-item.is-fallback strong {
  color: #dc2626;
}

.surgical-rooms-legend-item-mock {
  color: var(--muted);
}

.surgical-rooms-legend-item-mock strong {
  color: #ea580c;
}

.surgical-rooms-legend-item-mock span {
  color: inherit;
}

.surgical-rooms-legend-item-trend.tone-up strong { color: var(--status-ok); }
.surgical-rooms-legend-item-trend.tone-down strong { color: var(--status-critical); }
.surgical-rooms-legend-item-trend.tone-stable strong { color: var(--gray); }

.surgical-rooms-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.72rem;
}

.surgical-rooms-legend-group {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.surgical-rooms-legend-copy {
  color: var(--muted);
}

.surgical-rooms-status.tone-ok,
.surgical-rooms-legend-item.tone-ok,
.surgical-rooms-pressure.tone-ok,
.surgical-rooms-metric.tone-ok {
  color: #16a34a;
}

.surgical-rooms-status.tone-warning,
.surgical-rooms-legend-item.tone-warning,
.surgical-rooms-pressure.tone-warning,
.surgical-rooms-metric.tone-warning {
  color: #d97706;
}

.surgical-rooms-status.tone-critical,
.surgical-rooms-legend-item.tone-critical,
.surgical-rooms-pressure.tone-critical,
.surgical-rooms-metric.tone-critical {
  color: #dc2626;
}

.surgical-rooms-status.tone-offline,
.surgical-rooms-legend-item.tone-offline,
.surgical-rooms-pressure.tone-offline,
.surgical-rooms-metric.tone-offline {
  color: var(--gray);
}

.surgical-rooms-state-bar.tone-ok {
  background: #16a34a;
}

.surgical-rooms-state-bar.tone-warning {
  background: #d97706;
}

.surgical-rooms-state-bar.tone-mock {
  background: #ea580c;
}

.surgical-rooms-state-bar.tone-critical {
  background: #dc2626;
}

.surgical-rooms-state-bar.tone-offline {
  background: var(--gray);
}

.surgical-rooms-metric.tone-neutral {
  color: var(--text);
}

.surgical-rooms-sort-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.surgical-rooms-table th:first-child .surgical-rooms-sort-button {
  justify-content: flex-start;
}

.surgical-rooms-sort-button small {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
}

.surgical-rooms-sort-button.is-active small {
  color: var(--text);
}

.surgical-rooms-header-info-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  color: var(--muted);
}

.surgical-rooms-sort-button.dashboard-hover-card-trigger:hover .surgical-rooms-header-info-icon,
.surgical-rooms-sort-button.dashboard-hover-card-trigger:focus-visible .surgical-rooms-header-info-icon {
  color: var(--brand-deep);
}

.surgical-rooms-sort-button:focus-visible {
  outline: 2px solid rgba(237, 102, 95, 0.42);
  outline-offset: 3px;
  border-radius: 8px;
}

.surgical-rooms-table td.is-numeric {
  text-align: center;
}

.surgical-rooms-table td.is-numeric .surgical-rooms-metric {
  justify-content: center;
}

.surgical-rooms-metric-text {
  font-weight: 600;
}

.watchlist-widget-single {
  display: grid;
  gap: 12px;
  min-height: 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(43, 40, 40, 0.08);
  background: rgba(252, 251, 251, 0.84);
  align-content: start;
}

.watchlist-widget-single-head {
  display: grid;
  gap: 8px;
}

.watchlist-widget-single-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.watchlist-widget-single-metrics span {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7A7171;
  margin-bottom: 4px;
}

.watchlist-widget-single-metrics strong {
  display: block;
  font-size: 0.86rem;
  color: #2B2828;
}

.widget-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 5px rgba(43, 40, 40, 0.06);
}

.widget-status-dot.normal {
  background: #16a34a;
}

.widget-status-dot.candidate {
  background: #f59e0b;
}

.widget-status-dot.alarm {
  background: #dc2626;
}

.widget-status-dot.inactive {
  background: #AAA2A2;
}

.machine-monitor-shell {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  min-height: 0;
}

.machine-monitor-shell,
.machine-monitor-copy,
.machine-monitor-metrics-grid {
  min-height: 0;
}

.machine-monitor-visual-card {
  display: grid;
  gap: 12px;
  justify-items: center;
  align-content: start;
}

.machine-monitor-visual {
  width: min(100%, 180px);
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(160deg, #F4F3F3 0%, #FBDDDB 54%, #FBFAFA 100%);
  border: 1px solid rgba(237, 102, 95, 0.16);
  display: grid;
  place-items: center;
  padding: 18px;
}

.machine-monitor-image {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  display: block;
}

.machine-monitor-image-placeholder {
  color: #585252;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.machine-monitor-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(43, 40, 40, 0.82);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.machine-monitor-badge.normal {
  background: rgba(22, 163, 74, 0.92);
}

.machine-monitor-badge.alarm {
  background: rgba(220, 38, 38, 0.92);
}

.machine-monitor-badge.inactive {
  background: rgba(124, 115, 115, 0.92);
}

.machine-monitor-copy {
  display: grid;
  gap: 0;
  min-width: 0;
}

.machine-monitor-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.machine-monitor-metric-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(252, 251, 251, 0.92);
  border: 1px solid rgba(43, 40, 40, 0.08);
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
}

.machine-monitor-metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.machine-monitor-metric-head-stack {
  align-items: flex-start;
}

.dashboard-mobile-resize-dialog {
  width: min(420px, calc(100vw - 28px));
  max-height: min(72vh, 420px);
}

.dashboard-mobile-resize-body {
  overflow: auto;
}

.dashboard-mobile-resize-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-mobile-resize-option {
  min-height: 78px;
  border-radius: 18px;
  border: 1px solid rgba(43, 40, 40, 0.1);
  background: rgba(255, 255, 255, 0.96);
  color: #2B2828;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  font: inherit;
  box-shadow: 0 14px 28px rgba(43, 40, 40, 0.08);
}

.dashboard-mobile-resize-option-label {
  font-size: 1rem;
  font-weight: 800;
}

.dashboard-mobile-resize-option-meta {
  font-size: 0.76rem;
  font-weight: 700;
  color: #7A7171;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-mobile-resize-option.is-active {
  background: rgba(237, 102, 95, 0.14);
  border-color: rgba(237, 102, 95, 0.34);
  color: #585252;
}

.dashboard-mobile-picker {
  display: grid;
  gap: 8px;
}

.dashboard-mobile-picker > span {
  font-size: 0.82rem;
  font-weight: 700;
  color: #5C5454;
}

.dashboard-mobile-picker-trigger {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(43, 40, 40, 0.12);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.94);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #2B2828;
  font: inherit;
  text-align: left;
}

.dashboard-mobile-picker.is-disabled .dashboard-mobile-picker-trigger {
  opacity: 0.58;
}

.dashboard-mobile-picker-sheet {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  border-radius: 16px;
  background: rgba(248, 248, 248, 0.96);
  border: 1px solid rgba(43, 40, 40, 0.08);
}

.dashboard-mobile-picker-option {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(43, 40, 40, 0.08);
  border-radius: 12px;
  background: #fff;
  color: #2B2828;
  font: inherit;
  text-align: left;
}

.dashboard-mobile-picker-option.is-selected {
  background: rgba(237, 102, 95, 0.12);
  border-color: rgba(237, 102, 95, 0.26);
}

.machine-monitor-metric-values {
  display: grid;
  gap: 3px;
}

.machine-monitor-metric-values strong {
  color: #2B2828;
  font-size: 1.16rem;
  line-height: 1.1;
}

.machine-monitor-metric-values span,
.machine-monitor-metric-copy {
  color: var(--muted);
  font-size: 0.84rem;
  margin: 0;
}


.watchlist-inline-state {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
  box-shadow: 0 0 0 4px rgba(43, 40, 40, 0.06);
}

.watchlist-inline-state.normal { background: #16a34a; }
.watchlist-inline-state.candidate { background: #f59e0b; }
.watchlist-inline-state.alarm { background: #dc2626; }
.watchlist-inline-state.inactive { background: #AAA2A2; }

.watchlist-widget-table-shell {
  border-radius: 16px;
}

.watchlist-widget-table th,
.watchlist-widget-table td {
  padding: 8px 9px;
  font-size: 0.77rem;
}

.watchlist-point-cell.compact {
  gap: 9px;
}

.watchlist-point-cell.compact strong {
  font-size: 0.84rem;
  line-height: 1.1;
}


.watchlist-value-cell.compact {
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.watchlist-widget-single.compact {
  gap: 8px;
  padding: 10px;
}

.watchlist-widget-single-head.compact {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.watchlist-widget-single-metrics.compact {
  grid-template-columns: minmax(0, 1fr);
}

.watchlist-widget-single-metrics.compact strong {
  font-size: 1rem;
}

.machine-monitor-shell.compact {
  min-height: 0;
  height: auto;
  grid-template-columns: minmax(116px, 138px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

[data-dashboard-card^="machineMonitor"] {
  align-self: stretch;
}

[data-dashboard-card^="machineMonitor"] .dashboard-widget-card-shell {
  height: 100%;
  min-height: max(168px, calc(var(--dashboard-card-row-span, 2) * 76px + (var(--dashboard-card-row-span, 2) - 1) * 18px - 20px));
  padding: 16px;
  gap: 10px;
  align-content: start;
  grid-template-rows: minmax(0, 1fr);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(251, 251, 251, 0.96));
  border: 1px solid rgba(43, 40, 40, 0.08);
  box-shadow: var(--shadow);
  overflow: hidden;
}

[data-dashboard-card^="machineMonitor"] .dashboard-widget-card-heading {
  display: none;
}

[data-dashboard-card^="machineMonitor"] [data-dashboard-machine-body] {
  min-height: 0;
  height: 100%;
  display: grid;
  align-content: start;
  overflow: auto;
  padding-right: 6px;
  position: relative;
  z-index: 2;
}

.machine-monitor-panel {
  min-height: 0;
  height: auto;
  display: grid;
  grid-template-rows: auto auto;
  gap: 8px;
  align-content: start;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
}

.machine-monitor-panel-head {
  display: grid;
  gap: 4px;
}

.machine-monitor-panel-head .eyebrow,
.machine-monitor-panel-head h3 {
  margin: 0;
}

.machine-monitor-panel-head h3 {
  font-size: 1.06rem;
  line-height: 1.08;
  color: #2B2828;
}

.machine-monitor-visual-card.compact {
  gap: 8px;
  justify-items: center;
  align-content: start;
  align-self: start;
  padding: 0;
}

.machine-monitor-visual.compact {
  width: min(100%, 126px);
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  padding: 12px;
}

.machine-monitor-badge.compact {
  padding: 7px 10px;
  font-size: 0.76rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.machine-monitor-badge-icon {
  font-size: 1rem;
  line-height: 1;
}

.machine-monitor-copy.compact {
  min-height: 0;
  height: auto;
  align-content: start;
  align-self: start;
  min-width: 0;
}

.machine-monitor-copy.compact .dashboard-hover-tooltip {
  left: 0;
}

.machine-monitor-metrics-grid.compact {
  min-height: 0;
  height: auto;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: minmax(0, auto);
  gap: 6px;
  align-content: start;
}

.machine-monitor-metric-card-compact {
  padding: 11px 12px;
  border-radius: 16px;
  gap: 4px;
  min-height: 0;
  align-content: start;
}

.machine-monitor-metric-minihead {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.machine-monitor-metric-icon {
  font-size: 1.08rem;
  line-height: 1;
}

.machine-monitor-metric-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7A7171;
  min-width: 0;
  flex: 1 1 auto;
}

.machine-monitor-state-chip {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 4px rgba(43, 40, 40, 0.06);
}

.machine-monitor-state-chip.normal { background: #16a34a; }
.machine-monitor-state-chip.candidate { background: #f59e0b; }
.machine-monitor-state-chip.alarm { background: #dc2626; }
.machine-monitor-state-chip.inactive { background: #AAA2A2; }

.machine-monitor-metric-values.compact {
  gap: 2px;
}

.machine-monitor-metric-values.compact strong {
  font-size: 1rem;
  line-height: 1.02;
}

.machine-monitor-metric-card-state .machine-monitor-metric-values.compact strong {
  font-size: 0.92rem;
}

.machine-monitor-metric-card-state {
  grid-column: auto;
}

.machine-monitor-metric-card-tone-normal {
  border-color: rgba(22, 163, 74, 0.18);
}

.machine-monitor-metric-card-tone-candidate {
  border-color: rgba(245, 158, 11, 0.22);
}

.machine-monitor-metric-card-tone-alarm {
  border-color: rgba(220, 38, 38, 0.18);
}

.machine-monitor-metric-card-tone-inactive {
  border-color: rgba(170, 162, 162, 0.18);
}


.dashboard-hover-card-trigger,
.dashboard-hover-row-trigger {
  position: relative;
}

.dashboard-hover-tooltip {
  position: absolute;
  left: 14px;
  top: calc(100% + 8px);
  min-width: 180px;
  max-width: min(280px, calc(100vw - 48px));
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(24, 22, 22, 0.96);
  border: 1px solid rgba(196, 122, 118, 0.28);
  box-shadow: 0 18px 38px rgba(43, 40, 40, 0.24);
  color: #FBFBFB;
  font-size: 0.75rem;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 30;
}

.dashboard-hover-tooltip::before {
  content: "";
  position: absolute;
  left: 18px;
  bottom: 100%;
  width: 10px;
  height: 10px;
  background: rgba(24, 22, 22, 0.96);
  border-left: 1px solid rgba(196, 122, 118, 0.28);
  border-top: 1px solid rgba(196, 122, 118, 0.28);
  transform: translateY(6px) rotate(45deg);
}

.dashboard-hover-tooltip-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 2px;
  padding-left: 8px;
  margin-left: -4px;
  border-left: 3px solid rgba(251, 251, 251, 0.3);
  border-bottom: 1px solid rgba(196, 122, 118, 0.22);
}

.dashboard-hover-tooltip-head strong {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
}

.dashboard-hover-tooltip-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-hover-tooltip-label {
  color: #D9ABA9;
  flex: 1 1 auto;
  min-width: 0;
}

.dashboard-hover-tooltip-value {
  font-weight: 700;
  color: #FBFBFB;
  text-align: right;
  white-space: nowrap;
  margin-left: auto;
}

.dashboard-hover-tooltip-icon {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: #CF837F;
}

.dashboard-hover-tooltip-icon-emoji {
  font-size: 0.95rem;
  line-height: 1;
  width: auto;
  height: auto;
}

.dashboard-hover-tooltip-head.tone-ok { border-left-color: var(--status-ok); }
.dashboard-hover-tooltip-head.tone-warning { border-left-color: var(--status-warning); }
.dashboard-hover-tooltip-head.tone-critical { border-left-color: var(--status-critical); }
.dashboard-hover-tooltip-head.tone-neutral { border-left-color: #F28D87; }
.dashboard-hover-tooltip-head.tone-offline { border-left-color: var(--status-offline); }

.dashboard-hover-tooltip-row.tone-ok .dashboard-hover-tooltip-icon,
.dashboard-hover-tooltip-row.tone-ok .dashboard-hover-tooltip-value { color: #4ade80; }
.dashboard-hover-tooltip-row.tone-warning .dashboard-hover-tooltip-icon,
.dashboard-hover-tooltip-row.tone-warning .dashboard-hover-tooltip-value { color: #fbbf24; }
.dashboard-hover-tooltip-row.tone-critical .dashboard-hover-tooltip-icon,
.dashboard-hover-tooltip-row.tone-critical .dashboard-hover-tooltip-value { color: #f87171; }
.dashboard-hover-tooltip-row.tone-neutral .dashboard-hover-tooltip-icon,
.dashboard-hover-tooltip-row.tone-neutral .dashboard-hover-tooltip-value { color: #F28D87; }
.dashboard-hover-tooltip-row.tone-offline .dashboard-hover-tooltip-icon,
.dashboard-hover-tooltip-row.tone-offline .dashboard-hover-tooltip-value { color: #AAA2A2; }

.dashboard-hover-card-trigger:hover > .dashboard-hover-tooltip,
.dashboard-hover-card-trigger:focus-within > .dashboard-hover-tooltip,
.dashboard-hover-row-trigger:hover .dashboard-hover-tooltip,
.dashboard-hover-row-trigger:focus-within .dashboard-hover-tooltip {
  opacity: 1;
  transform: translateY(0) scale(1);
}

[data-dashboard-card^="machineMonitor"] .dashboard-hover-tooltip,
[data-dashboard-card^="watchlist"] .dashboard-hover-tooltip,
[data-dashboard-card="alarmFeed"] .dashboard-hover-tooltip,
[data-dashboard-card="surgicalRooms"] .dashboard-hover-tooltip {
  display: none !important;
}

.dashboard-global-hover-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  min-width: 210px;
  max-width: min(320px, calc(100vw - 24px));
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(24, 22, 22, 0.98);
  border: 1px solid rgba(196, 122, 118, 0.28);
  box-shadow: 0 18px 38px rgba(43, 40, 40, 0.24);
  color: #FBFBFB;
  font-size: 0.75rem;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 10000;
}

.dashboard-global-hover-tooltip::before {
  content: "";
  position: absolute;
  left: 16px;
  top: -6px;
  width: 10px;
  height: 10px;
  background: rgba(24, 22, 22, 0.98);
  border-left: 1px solid rgba(196, 122, 118, 0.28);
  border-top: 1px solid rgba(196, 122, 118, 0.28);
  transform: rotate(45deg);
}

.dashboard-global-hover-tooltip.is-flipped::before {
  top: auto;
  bottom: -6px;
  border-left: 0;
  border-top: 0;
  border-right: 1px solid rgba(196, 122, 118, 0.28);
  border-bottom: 1px solid rgba(196, 122, 118, 0.28);
}

.dashboard-global-hover-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.dashboard-hover-row-tooltip-cell {
  display: none;
}

.dashboard-widget-config-modal {
  z-index: 260;
}

.dashboard-widget-config-modal .filter-modal-dialog {
  width: min(860px, calc(100vw - 32px));
}

.dashboard-widget-config-shell {
  display: grid;
  gap: 18px;
}

.dashboard-widget-config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.dashboard-widget-config-grid.single-column {
  grid-template-columns: minmax(0, 1fr);
}

.dashboard-widget-config-grid-watchlist {
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.3fr) auto;
}

.dashboard-widget-config-action {
  display: grid;
}

.dashboard-widget-config-action .primary-button {
  min-height: 48px;
  white-space: nowrap;
}

.dashboard-widget-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.dashboard-widget-field span {
  font-size: 0.82rem;
  font-weight: 700;
  color: #5C5454;
}

.dashboard-widget-field select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(43, 40, 40, 0.12);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.94);
}

.dashboard-widget-selection-list {
  display: grid;
  gap: 10px;
}

.dashboard-widget-checkbox-search {
  margin-bottom: 8px;
}

.dashboard-widget-checkbox-empty {
  padding: 14px 6px;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.dashboard-widget-checkbox-list {
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 4px 4px 0;
  border-top: 1px solid var(--border-default);
}

.dashboard-widget-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s ease;
}

.dashboard-widget-checkbox-row:hover {
  background: var(--table-row-hover, var(--inactive-soft));
}

/* Checkbox custom (não o quadrado nativo do SO) - mesmo desenho usado nos dois
   temas, só trocando as cores via variáveis: quadrado com cantos arredondados,
   marca de "check" desenhada em CSS puro (clip-path, sem imagem/ícone externo)
   que aparece com uma pequena animação de escala ao marcar. */
.dashboard-widget-checkbox-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 19px;
  height: 19px;
  flex: none;
  margin: 0;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.dashboard-widget-checkbox-row input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  background: #ffffff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0);
  transition: transform 0.12s ease-in-out;
}

.dashboard-widget-checkbox-row input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.dashboard-widget-checkbox-row input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.dashboard-widget-checkbox-row input[type="checkbox"]:hover {
  border-color: var(--primary);
}

.dashboard-widget-checkbox-row input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.dashboard-widget-checkbox-row-all {
  font-weight: 700;
  padding-bottom: 10px;
}

.dashboard-widget-selection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(43, 40, 40, 0.08);
}

.dashboard-widget-selection-copy {
  min-width: 0;
}

.dashboard-widget-selection-item strong,
.dashboard-widget-selection-item span {
  display: block;
}

.dashboard-widget-selection-item span {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 3px;
}

.dashboard-widget-image-upload-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.dashboard-widget-image-preview {
  min-height: 160px;
  border-radius: 18px;
  border: 1px dashed rgba(43, 40, 40, 0.14);
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  padding: 16px;
}

.dashboard-widget-image-preview img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  display: block;
}

.dashboard-widget-config-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dashboard-widget-config-status {
  min-height: 20px;
  color: #7B7272;
  font-size: 0.84rem;
}

.dashboard-widget-config-status.error {
  color: #b42318;
  font-weight: 700;
}

.dashboard-widget-config-footer .primary-button {
  min-width: 148px;
}

.dashboard-widget-config-modal .filter-modal-dialog.dashboard-widget-save-success {
  animation: dashboardWidgetSavePulse 0.42s ease;
}

@keyframes dashboardWidgetSavePulse {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 18px 44px rgba(43, 40, 40, 0.18);
  }
  45% {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 22px 52px rgba(22, 163, 74, 0.22);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 18px 44px rgba(43, 40, 40, 0.18);
  }
}

.dashboard-widget-image-actions {
  display: grid;
  gap: 12px;
  align-content: start;
}

.dashboard-widget-image-copy {
  display: grid;
  gap: 4px;
}

.dashboard-widget-image-copy strong {
  color: #2B2828;
}

.dashboard-widget-image-copy span {
  color: var(--muted);
  font-size: 0.84rem;
}

.dashboard-widget-image-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-card-tool[data-dashboard-card-config] {
  color: #585252;
}

.dashboard-card-tool[data-dashboard-card-config].is-active {
  background: rgba(237, 102, 95, 0.18);
  border-color: rgba(237, 102, 95, 0.32);
}
.dashboard-card-samples .mini-chart {
  --chart-bar-width: minmax(10px, 1fr);
  --chart-bar-gap: clamp(6px, 1vw, 10px);
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding-top: 10px;
  grid-auto-flow: row;
  grid-auto-columns: auto;
  grid-template-columns: repeat(var(--chart-columns, 1), minmax(0, 1fr));
  justify-content: stretch;
  overflow: hidden;
}

.dashboard-card-samples .chart-bar-wrap {
  width: 100%;
  min-width: 0;
}

.dashboard-card-samples .chart-bar-hitbox {
  width: 100%;
  min-width: 0;
}

.dashboard-card-samples .chart-bar {
  width: min(100%, 28px);
}

.dashboard-card-samples .chart-label {
  width: 100%;
  text-align: center;
}

.hero-grid,
.content-grid,
.profile-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(0, 1.28fr);
  gap: 18px;
  margin-bottom: 22px;
}

.profile-grid {
  grid-template-columns: minmax(380px, 1.14fr) minmax(300px, 0.86fr);
  align-items: start;
}

.hero-card,
.trend-card,
.surface-card,
.section-card,
.table-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
  padding: 20px;
}

.hero-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  background:
    linear-gradient(135deg, #2B2828, #585252),
    var(--surface-strong);
  color: #ffffff;
  min-height: 198px;
  padding: 22px 20px 20px;
  text-align: center;
}

.hero-card .eyebrow,
.hero-card #heroClientMeta,
.hero-card .hero-stat-label {
  color: rgba(250, 250, 250, 0.8);
}

.hero-copy {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  flex: 0 1 auto;
  align-self: center;
  align-content: center;
  justify-items: center;
  justify-self: center;
  text-align: center;
  min-width: 0;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 10px 0 0;
  gap: 16px;
}

.hero-copy p,
.hero-copy h3,
.hero-copy span {
  max-width: 390px;
  margin: 0;
}

.hero-copy p,
.hero-copy h3,
.hero-copy span,
.hero-stat-stack strong {
  color: #ffffff;
}

.hero-copy h3 {
  font-size: clamp(3.2rem, 5.2vw, 4.4rem);
  line-height: 0.94;
  letter-spacing: -0.03em;
  text-shadow: 0 8px 24px rgba(17, 16, 16, 0.18);
}

.hero-copy .eyebrow {
  margin-bottom: 0;
  font-size: 1.08rem;
  letter-spacing: 0.16em;
  font-weight: 700;
}

#heroClientMeta {
  display: none;
}

.hero-stat-stack {
  display: none;
  flex: 0 0 auto;
  align-self: center;
  align-content: center;
  justify-items: center;
  justify-self: center;
  text-align: center;
  gap: 14px;
  min-width: 164px;
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
}

.hero-stat-stack > div {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 100%;
}

.hero-stat-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 2px;
  border-radius: 10px;
  background: rgba(250, 250, 250, 0.14);
  color: rgba(250, 250, 250, 0.92);
}

.hero-stat-icon svg {
  width: 18px;
  height: 18px;
}

.hero-stat-item.has-alarms .hero-stat-icon {
  background: rgba(220, 38, 38, 0.22);
  color: #ff8a80;
}

.hero-stat-item.has-alarms strong {
  color: #ff8a80;
}

.hero-stat-label,
.metric-label {
  display: block;
  font-size: 0.84rem;
  margin-bottom: 6px;
}

.metric-label {
  color: var(--muted);
}

.hero-stat-stack strong {
  font-size: 1.64rem;
}

.trend-card {
  min-height: 340px;
  padding: 22px 24px 22px;
}

.trend-card .card-heading {
  margin-bottom: 10px;
}

.kpi-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 22px;
}

.service-monitor-screen {
  display: grid;
  gap: 12px;
}

.service-monitor-overview {
  display: grid;
  gap: 10px;
}

.topbar-actions.is-service-monitor {
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 0;
}

.service-monitor-status-card {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  padding: 12px 14px;
  background:
    linear-gradient(135deg, rgba(43, 40, 40, 0.98), rgba(88, 82, 82, 0.94)),
    var(--surface);
  color: #FBFBFB;
}

.service-monitor-status-card-topbar {
  width: min(100%, 260px);
}

.service-monitor-status-card .eyebrow,
.service-monitor-status-card .service-monitor-note,
.service-monitor-status-card .service-monitor-meta-line {
  color: rgba(245, 244, 244, 0.82);
}

.service-monitor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.service-monitor-copy,
.service-monitor-summary {
  display: grid;
  gap: 4px;
}

.service-monitor-summary {
  align-content: start;
  justify-items: start;
}

.service-monitor-copy-hero {
  min-height: 100%;
  place-content: center;
  text-align: center;
}

.service-monitor-copy-hero h3 {
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.service-monitor-copy h3,
.service-monitor-copy p,
.service-monitor-summary h3,
.service-monitor-summary p {
  margin: 0;
}

.service-monitor-summary h3 {
  font-size: 1.26rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

.service-monitor-meta-line {
  font-size: 0.82rem;
  line-height: 1.4;
}

.service-monitor-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.service-monitor-host-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.service-monitor-host-card,
.service-monitor-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.service-monitor-host-card {
  display: grid;
  gap: 4px;
  min-height: 108px;
  padding: 12px 14px;
}

.service-monitor-host-card strong {
  font-size: 1.26rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

.service-monitor-host-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.service-monitor-host-note {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.service-monitor-overview-loading,
.service-monitor-loading-grid {
  pointer-events: none;
}

.service-monitor-loading-card {
  overflow: hidden;
}

.service-monitor-loading-head,
.service-monitor-loading-copy,
.service-monitor-loading-details {
  display: grid;
  gap: 10px;
}

.danger-button {
  background: linear-gradient(135deg, #c74a45, #db6a64);
  border-color: rgba(199, 74, 69, 0.34);
}

.danger-outline {
  border-color: rgba(199, 74, 69, 0.22);
  color: #9f3834;
  background: rgba(199, 74, 69, 0.06);
}

.delete-confirm-card,
.delete-confirm-copy,
.delete-confirm-impact {
  display: grid;
  gap: 12px;
}

.delete-confirm-copy p,
.delete-confirm-impact p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.delete-confirm-impact {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(43, 40, 40, 0.04);
  border: 1px solid rgba(43, 40, 40, 0.08);
}

.delete-confirm-impact[hidden] {
  display: none !important;
}

.service-monitor-error {
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(199, 74, 69, 0.2);
  background: rgba(199, 74, 69, 0.08);
  color: #8c2f2a;
  font-size: 0.88rem;
  line-height: 1.45;
}

.service-monitor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.service-monitor-card {
  display: grid;
  gap: 10px;
}

.service-monitor-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.service-monitor-card-title {
  display: grid;
  gap: 8px;
}

.service-monitor-card-title h4,
.service-monitor-card-title p {
  margin: 0;
}

.service-monitor-card-title h4 {
  font-size: 1rem;
  line-height: 1.2;
}

.service-monitor-card-title p {
  font-size: 0.82rem;
  color: var(--muted);
}

.service-monitor-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #A9A2A2;
  box-shadow: 0 0 0 8px rgba(169, 162, 162, 0.12);
  flex: 0 0 auto;
}

.service-monitor-dot.is-ok {
  background: #22c55e;
  box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.14);
}

.service-monitor-dot.is-warning {
  background: #f59e0b;
  box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.14);
}

.service-monitor-dot.is-critical {
  background: #ef4444;
  box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.14);
}

.service-monitor-status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.service-monitor-status-pill.is-ok {
  color: #106b31;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.2);
}

.service-monitor-status-pill.is-warning {
  color: #9a6700;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.2);
}

.service-monitor-status-pill.is-critical {
  color: #9f2020;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.2);
}

.service-monitor-details {
  display: grid;
  gap: 9px;
}

.service-monitor-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 0.86rem;
}

.service-monitor-row span:first-child {
  color: var(--muted);
}

.service-monitor-row strong {
  font-size: 0.88rem;
  text-align: right;
}

.service-monitor-note {
  font-size: 0.82rem;
  line-height: 1.45;
}

.kpi-card {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 8px;
  border-radius: 20px;
  min-height: 126px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.kpi-card strong {
  font-size: 1.72rem;
  line-height: 1;
}

.kpi-card-loading {
  display: grid;
  gap: 12px;
}

.table-screen {
  min-width: 0;
  min-height: 0;
  height: calc(100vh - var(--table-chrome-reserve));
  max-height: calc(100vh - var(--table-chrome-reserve));
  display: grid;
}

.table-card {
  display: grid;
  gap: 12px;
  position: relative;
  isolation: isolate;
  overflow: visible;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  height: 100%;
}

.table-card-loading,
.table-toolbar-loading,
.table-loading-shell,
.table-loading-grid,
.table-loading-row {
  display: grid;
}

.table-loading-shell {
  gap: 18px;
}

.table-loading-grid {
  gap: 12px;
}

.table-loading-row {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.table-title p,
.table-title h3 {
  margin: 0;
}

.table-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  position: relative;
  z-index: 20;
  overflow: visible;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar-right {
  justify-content: flex-end;
  position: relative;
  z-index: 60;
  overflow: visible;
}

.column-picker {
  position: relative;
  z-index: 70;
}
.column-picker-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  max-height: 280px;
  overflow: auto;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  display: none;
  z-index: 120;
}

.column-picker-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.column-picker-panel-head strong {
  font-size: 0.9rem;
  color: var(--text);
}

.column-picker-close {
  width: 30px;
  height: 30px;
  padding: 0;
  flex: 0 0 auto;
}

.column-picker-panel-body {
  display: grid;
  gap: 10px;
}

.toolbar-extras {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.date-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
}

.date-filter input {
  border: 0;
  background: transparent;
  color: var(--text);
}

.column-picker.is-open .column-picker-panel {
  display: grid;
  gap: 10px;
}

.column-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.92rem;
}

.column-option-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.column-option-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.column-move-button {
  width: 32px;
  height: 32px;
  padding: 0;
}

.filter-chip-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.table-filter-summary {
  color: var(--muted);
  font-size: 0.84rem;
  min-width: 0;
}

.filter-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  cursor: pointer;
}

.filter-chip.is-active {
  background: #F5F4F4;
  border-color: #ED665F;
  color: #ED665F;
}

.filter-chip[disabled] {
  opacity: 0.56;
  cursor: default;
  transform: none;
}

.table-search {
  min-width: min(100%, 260px);
  flex: 1 1 240px;
  position: relative;
}

.table-search input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

.table-search::before {
  content: "⌕";
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--muted);
}

.table-meta {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.table-shell,
.table-container {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.table-wrapper {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: inherit;
  overflow: hidden;
  background: inherit;
}

.table-scroll {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: rgba(237, 102, 95, 0.45) transparent;
  background: inherit;
  border-radius: inherit;
  transition: scrollbar-color 0.18s ease;
  -webkit-overflow-scrolling: touch;
}

.table-scroll.has-horizontal-scroll {
  overflow-x: auto;
}

.table-scroll:hover,
.table-scroll:focus-within {
  scrollbar-color: rgba(237, 102, 95, 0.45) transparent;
}

.table-scroll::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: var(--scrollbar-radius);
  border: 3px solid transparent;
  background-clip: padding-box;
}

.table-scroll::-webkit-scrollbar-track {
  background: transparent;
  border-radius: var(--scrollbar-track-radius);
}

.table-scroll:hover::-webkit-scrollbar-thumb,
.table-scroll:focus-within::-webkit-scrollbar-thumb {
  background: rgba(237, 102, 95, 0.45);
}

thead th[data-column-drag] {
  cursor: grab;
  user-select: none;
}

thead th[data-column-drag].is-dragging {
  opacity: 0.72;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
  margin: 0;
  table-layout: fixed;
}

th,
td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  background: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}

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

tbody tr.is-selected td {
  background: rgba(245, 244, 244, 0.92);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #F5F4F4;
  box-shadow: inset 0 -1px 0 var(--line);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  overflow: visible;
  background-clip: padding-box;
}

thead th:first-child {
  border-top-left-radius: 22px;
}

thead th:last-child {
  border-top-right-radius: 22px;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  font-weight: 700;
  text-transform: inherit;
  letter-spacing: inherit;
  position: relative;
}

.info-tooltip {
  display: inline-flex;
  align-items: center;
  position: relative;
  margin-left: 6px;
  z-index: 20;
}

.info-badge {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(237, 102, 95, 0.22);
  background: rgba(245, 244, 244, 0.92);
  color: var(--brand-deep);
  display: inline-grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: help;
}

.info-tooltip-text {
  position: absolute;
  left: 0;
  top: calc(100% + 18px);
  bottom: auto;
  width: 220px;
  max-width: min(220px, calc(100vw - 48px));
  padding: 10px 12px;
  border-radius: 14px;
  background: #173229;
  color: #f5fff9;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.78rem;
  line-height: 1.4;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 30;
  white-space: normal;
  overflow-wrap: break-word;
}

.info-tooltip:hover .info-tooltip-text,
.info-tooltip:focus-within .info-tooltip-text {
  opacity: 1;
  transform: translateY(0);
}

thead th:last-child .info-tooltip-text,
thead th:nth-last-child(2) .info-tooltip-text {
  left: auto;
  right: 0;
}

.sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  color: rgba(98, 125, 115, 0.8);
}

.sort-button[data-sort-dir="asc"] .sort-icon,
.sort-button[data-sort-dir="desc"] .sort-icon {
  color: var(--brand-deep);
}

.row-check,
.head-check {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.cell-title {
  display: block;
  font-weight: 700;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.muted {
  color: var(--muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.pill.normal,
.pill.active,
.pill.ack,
.pill.sent,
.pill.closed {
  background: rgba(245, 244, 244, 0.92);
  color: var(--brand-deep);
}

.pill.inactive,
.pill.disabled {
  background: rgba(127, 141, 135, 0.14);
  color: #5d6a65;
}

.pill.open,
.pill.error,
.pill.alarm {
  background: rgba(199, 74, 69, 0.12);
  color: var(--danger);
}

.pill.candidate,
.pill.pending {
  background: rgba(241, 162, 8, 0.15);
  color: #8a6000;
}

.required-marker {
  color: var(--danger);
  font-weight: 800;
  margin-left: 4px;
}

.editor-field.is-invalid label {
  color: var(--danger);
}

.editor-field.is-invalid .editor-input,
.editor-field.is-invalid .editor-select,
.editor-field.is-invalid .editor-textarea,
.editor-field.is-invalid .editor-multiselect,
.editor-field.is-invalid .phone-parts-field {
  border-color: rgba(199, 74, 69, 0.72);
  box-shadow: 0 0 0 3px rgba(199, 74, 69, 0.12);
}

.editor-field-error {
  display: block;
  margin-top: 6px;
  color: var(--danger);
  font-size: 0.78rem;
}

.mini-chart {
  --chart-bar-width: clamp(20px, 2vw, 24px);
  --chart-bar-gap: clamp(12px, 1.45vw, 16px);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--chart-bar-width);
  align-items: end;
  column-gap: var(--chart-bar-gap);
  justify-content: center;
  min-height: 262px;
  padding: 18px 0 0;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.chart-loading {
  display: grid;
  gap: 18px;
  min-height: 238px;
  align-content: center;
}

.chart-loading-bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--chart-bar-width, 24px);
  align-items: end;
  justify-content: center;
  gap: var(--chart-bar-gap, 16px);
  min-height: 194px;
}

.chart-loading-bar {
  border-radius: 16px 16px 0 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.18)),
    linear-gradient(180deg, #3D3939 0%, #CB453E 100%);
  background-size: 240px 100%, 100% 100%;
  animation: skeletonShimmer 1.2s linear infinite;
}

.chart-loading-bar.bar-1 { height: 42%; }
.chart-loading-bar.bar-2 { height: 68%; }
.chart-loading-bar.bar-3 { height: 54%; }
.chart-loading-bar.bar-4 { height: 82%; }
.chart-loading-bar.bar-5 { height: 60%; }
.chart-loading-bar.bar-6 { height: 48%; }

.chart-bar-wrap {
  width: var(--chart-bar-width);
  min-width: var(--chart-bar-width);
  display: grid;
  justify-items: center;
  align-items: end;
  align-self: stretch;
  grid-template-rows: minmax(210px, 1fr) auto;
  row-gap: 0;
  position: relative;
}

.chart-bar-hitbox {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 210px;
  padding-top: 54px;
  outline: none;
}

.chart-bar {
  width: 100%;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(180deg, #3C3737 0%, #CA463F 100%);
  height: max(16px, var(--bar-height, 16px));
  min-height: 16px;
  box-shadow: 0 12px 24px rgba(66, 60, 60, 0.16);
  transition: filter 0.18s ease, box-shadow 0.18s ease;
}

.chart-bar-hitbox:hover .chart-bar,
.chart-bar-hitbox:focus-visible .chart-bar {
  filter: saturate(1.03) brightness(1.04);
  box-shadow: 0 16px 28px rgba(63, 59, 59, 0.22);
}

.chart-tooltip {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, 8px);
  min-width: max-content;
  max-width: 176px;
  padding: 10px 13px;
  border-radius: 14px;
  background: rgba(50, 47, 47, 0.98);
  color: #FCFBFB;
  box-shadow: 0 14px 30px rgba(43, 40, 40, 0.24);
  border: 1px solid rgba(250, 214, 212, 0.08);
  display: grid;
  gap: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 4;
  text-align: center;
}

.chart-tooltip strong {
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
}

.chart-tooltip span {
  font-size: 0.8rem;
  color: rgba(245, 244, 244, 0.78);
}

.chart-bar-hitbox:hover .chart-tooltip,
.chart-bar-hitbox:focus-visible .chart-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.chart-helper {
  margin: 14px 0 0;
  font-size: 0.77rem;
  line-height: 1.55;
  color: rgba(127, 117, 117, 0.95);
  max-width: 39ch;
  text-align: left;
}

.chart-label {
  display: none;
}

.chart-label.is-muted {
  display: none;
}

.menu-prefs-toggle {
  width: 100%;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  padding: 10px 16px;
}

.sidebar-nav .menu-prefs-toggle {
  width: 100%;
  margin-top: 0;
}

.sidebar-nav > .menu-prefs-panel {
  width: 100%;
  margin-top: 8px;
  margin-bottom: 0;
}

.menu-prefs-panel {
  display: none;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.menu-prefs-panel.is-open {
  display: grid;
}

.menu-pref-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(245, 255, 249, 0.86);
  font-size: 0.9rem;
}

.profile-panel {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  min-width: 0;
}

.profile-main-card,
.profile-side-card {
  min-width: 0;
}

.profile-panel > div:last-child {
  min-width: 0;
}

.profile-panel h4,
.profile-panel p {
  overflow-wrap: anywhere;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-list div {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.detail-list dd {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.todo-list {
  display: grid;
  gap: 14px;
}

.profile-forms {
  margin-bottom: 14px;
  gap: 12px;
}

.profile-settings-card {
  gap: 14px;
}

.profile-settings-dialog {
  width: min(640px, calc(100vw - 28px));
}

.profile-settings-option {
  gap: 12px;
}

.profile-settings-option-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-toggle,
.settings-select-field {
  display: grid;
  gap: 8px;
}

.settings-toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 10px;
  font-weight: 600;
}

.settings-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

.settings-select-field span {
  font-size: 0.84rem;
  color: var(--muted);
}

.profile-settings-option-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--brand-deep);
}

.profile-settings-option-icon svg {
  width: 100%;
  height: 100%;
}

.work-hours-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.settings-time-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.84rem;
  color: var(--muted);
}

/* Seletor de horário customizado, substitui o <input type="time"> nativo (e a
   tentativa anterior com dois <select> nativos, que abriam uma lista enorme
   e sem estilo do próprio navegador). Botão compacto mostrando "HH:MM" que
   abre um painel próprio, pequeno e rolável, com o mesmo visual do resto do
   site - nunca "explode" a tela. */
.time-picker {
  position: relative;
}

.time-picker-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 108px;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-default, var(--line));
  background: var(--bg-elevated, #fff);
  color: var(--text-primary, var(--text));
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.time-picker-trigger:hover {
  border-color: var(--brand-deep, #ED665F);
}

.time-picker-trigger:focus-visible {
  outline: none;
  border-color: var(--brand-deep, #ED665F);
  box-shadow: 0 0 0 3px rgba(237, 102, 95, 0.18);
}

.time-picker.is-open .time-picker-trigger {
  border-color: var(--brand-deep, #ED665F);
  box-shadow: 0 0 0 3px rgba(237, 102, 95, 0.18);
}

.time-picker-icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}

.time-picker-value {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.time-picker-chevron {
  width: 13px;
  height: 13px;
  flex: none;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.time-picker.is-open .time-picker-chevron {
  transform: rotate(180deg);
}

.time-picker-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 150;
  width: 148px;
  padding: 6px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px) scale(0.97);
  transform-origin: top left;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.time-picker.is-open .time-picker-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.time-picker-list {
  max-height: 216px;
  overflow-y: auto;
  display: grid;
  gap: 2px;
}

.time-picker-option {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.time-picker-option:hover,
.time-picker-option:focus-visible {
  background: rgba(237, 102, 95, 0.14);
  outline: none;
}

.time-picker-option.is-selected {
  background: var(--primary);
  color: var(--text-on-primary);
  font-weight: 700;
}

.time-picker-option-clear {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  margin-bottom: 4px;
  padding-bottom: 10px;
  font-style: italic;
}

.work-days-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.work-day-toggle {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.work-day-toggle:hover {
  border-color: var(--brand-deep);
  color: var(--brand-deep);
}

.work-day-toggle.is-active {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: #fff;
}

.settings-toggle.tone-warning:has(input:checked) {
  color: var(--status-warning);
}

.settings-toggle.tone-brand:has(input:checked) {
  color: var(--status-ok);
}

.todo-item {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
}

.inline-form {
  display: grid;
  gap: 10px;
}

.form-helper {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

.collapsible-card {
  gap: 0;
  overflow: hidden;
}

.collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
  cursor: pointer;
}

.collapse-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(245, 244, 244, 0.92);
  color: var(--brand-deep);
  font-weight: 800;
  transition: transform 0.2s ease;
}

.collapse-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.24s ease, padding-top 0.24s ease;
  padding-top: 0;
}

.collapse-body > * {
  overflow: hidden;
}

.collapsible-card.is-open .collapse-body {
  grid-template-rows: 1fr;
  padding-top: 12px;
}

.collapsible-card.is-open .collapse-body > * {
  overflow: visible;
  padding: 3px;
  margin: -3px;
}

.collapsible-card.is-open .collapse-icon {
  transform: rotate(45deg);
}

.todo-item.is-success {
  animation: successPulse 0.7s ease;
  border-color: rgba(237, 102, 95, 0.35);
  box-shadow: 0 0 0 3px rgba(237, 102, 95, 0.08);
}

.text-input,
.editor-input,
.editor-select,
.editor-textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
}

.editor-textarea {
  min-height: 110px;
  resize: vertical;
}

.editor-input:disabled,
.editor-select:disabled,
.editor-textarea:disabled {
  background: rgba(127, 141, 135, 0.14);
  border-color: rgba(127, 141, 135, 0.24);
  color: #6f7d77;
  cursor: not-allowed;
}

.editor-input.is-mixed,
.editor-select.is-mixed,
.editor-textarea.is-mixed {
  border-color: rgba(241, 162, 8, 0.28);
  background: rgba(241, 162, 8, 0.08);
}

.editor-shell.is-success {
  animation: drawerSuccessPulse 0.82s ease;
  box-shadow:
    0 0 0 3px rgba(237, 102, 95, 0.14),
    var(--shadow);
}

/* Par do .is-success acima, para falha ao salvar - mesmo princípio (pulso no
   editor inteiro), padronizado em todas as tabelas/seções e também no card
   "Grupos associados" do editor de Regras. */
.editor-shell.is-error {
  animation: drawerErrorPulse 0.5s ease;
  box-shadow:
    0 0 0 3px rgba(217, 72, 72, 0.16),
    var(--shadow);
}

.avatar-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 16, 16, 0.64);
  backdrop-filter: blur(16px);
}

.avatar-editor-modal.is-open {
  display: flex;
}

.filter-modal {
  position: fixed;
  inset: 0;
  z-index: 135;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 16, 16, 0.48);
  backdrop-filter: blur(14px);
}

.filter-modal.is-open {
  display: flex;
}

.filter-modal-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: min(88vh, 760px);
  background: rgba(252, 251, 251, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 28px;
  box-shadow: 0 30px 70px rgba(21, 20, 20, 0.24);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  padding: 22px;
  overflow: hidden;
}

.filter-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.filter-modal-header h3 {
  margin: 0;
}

.filter-modal-body {
  overflow: auto;
}

.filter-modal-card {
  display: grid;
  gap: 18px;
}

.filter-modal-group {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.filter-modal-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filter-modal-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.filter-date-field {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.filter-date-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  padding: 11px 12px;
}

.filter-modal-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.filter-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-settings-apply-row {
  align-items: center;
}

.profile-settings-apply-row .refresh-status {
  margin: 0;
}

#profileSettingsApply {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.profile-settings-apply-check {
  display: none;
  align-items: center;
  width: 18px;
  height: 18px;
  flex: none;
}

.profile-settings-apply-check svg {
  width: 100%;
  height: 100%;
}

#profileSettingsApply.is-save-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

/* Esse botão já tem seu próprio ícone dedicado (.profile-settings-apply-check,
   um <span> real) + troca de texto para "Salvo!" via JS - sem isso aqui, o
   ::after genérico (usado pelos outros botões do site) desenharia um "✓"
   por cima, se sobrepondo ao ícone e ao texto que já existem. */
#profileSettingsApply.is-save-success::after {
  content: none;
}

#profileSettingsApply.is-save-success .profile-settings-apply-check {
  display: inline-flex;
  animation: profileSettingsCheckIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#profileSettingsApply.is-save-error {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  animation: profileSettingsShake 0.46s ease;
}

@keyframes profileSettingsCheckIn {
  from {
    transform: scale(0.3);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes profileSettingsShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.avatar-editor-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: min(92vh, 920px);
  background: rgba(252, 251, 251, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 30px;
  box-shadow: 0 30px 70px rgba(21, 20, 20, 0.24);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 20px;
  overflow: hidden;
}

.avatar-editor-header,
.avatar-editor-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-editor-header {
  justify-content: space-between;
}

.avatar-editor-actions {
  justify-content: flex-end;
  padding-top: 4px;
}

.avatar-editor-actions .ghost-button,
.avatar-editor-actions .primary-button {
  min-width: 120px;
  padding: 10px 16px;
}

.avatar-editor-header h3 {
  margin: 0;
}

.avatar-editor-content {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 240px);
  gap: 16px;
  align-items: stretch;
  overflow: hidden;
}

.avatar-editor-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 28px;
  padding: 18px;
  background:
    radial-gradient(circle at top, rgba(237, 102, 95, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 241, 241, 0.96));
  border: 1px solid rgba(237, 102, 95, 0.16);
  overflow: hidden;
}

.avatar-editor-canvas {
  display: block;
  width: min(100%, 500px, calc(100vh - 360px));
  max-width: 100%;
  max-height: min(100%, calc(100vh - 360px));
  height: auto;
  aspect-ratio: 1;
  border-radius: 24px;
  background:
    linear-gradient(45deg, rgba(237, 102, 95, 0.08) 25%, transparent 25%) -12px 0 / 24px 24px,
    linear-gradient(-45deg, rgba(237, 102, 95, 0.08) 25%, transparent 25%) -12px 0 / 24px 24px,
    linear-gradient(45deg, transparent 75%, rgba(237, 102, 95, 0.08) 75%) -12px 0 / 24px 24px,
    linear-gradient(-45deg, transparent 75%, rgba(237, 102, 95, 0.08) 75%) -12px 0 / 24px 24px,
    #F8F8F8;
  cursor: grab;
  touch-action: none;
}

.avatar-editor-canvas.is-dragging {
  cursor: grabbing;
}

.avatar-editor-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.avatar-editor-preview-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  min-width: 0;
}

.avatar-editor-preview-label {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.avatar-editor-preview {
  display: block;
  width: min(100%, 156px);
  aspect-ratio: 1;
  border-radius: 999px;
  background: #F5F4F4;
}

.avatar-editor-preview[data-crop-shape="square"] {
  aspect-ratio: 1;
  border-radius: 24px;
}

.avatar-editor-preview[data-crop-shape="rect"] {
  aspect-ratio: 1.7 / 1;
  border-radius: 20px;
}

.avatar-editor-shape {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  color: var(--text);
}

.avatar-editor-shape-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.avatar-shape-button {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(43, 40, 40, 0.12);
  background: rgba(248, 248, 248, 0.92);
  color: #2B2828;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.avatar-shape-button:hover,
.avatar-shape-button:focus-visible {
  border-color: rgba(237, 102, 95, 0.42);
  background: rgba(249, 226, 225, 0.96);
}

.avatar-shape-button.is-active {
  background: linear-gradient(135deg, rgba(88, 82, 82, 0.92), rgba(237, 102, 95, 0.42));
  border-color: rgba(88, 82, 82, 0.5);
  color: #ffffff;
}

.avatar-shape-icon {
  display: inline-block;
  border: 2px solid currentColor;
  background: transparent;
}

.avatar-shape-icon-circle {
  width: 16px;
  height: 16px;
  border-radius: 999px;
}

.avatar-shape-icon-square {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.avatar-shape-icon-rect {
  width: 20px;
  height: 12px;
  border-radius: 4px;
}

.avatar-editor-zoom {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  color: var(--text);
}

.avatar-editor-zoom span {
  font-weight: 700;
}

.avatar-editor-zoom input {
  width: 100%;
}

.avatar-editor-help {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 28ch;
}

.password-field {
  position: relative;
}

.password-input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
  margin: 0 auto;
}

.login-page {
  display: grid;
  place-items: center;
}

.login-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  gap: 20px;
}

.login-copy h2,
.login-copy p {
  margin: 0;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-button {
  justify-self: start;
}

.login-helper-links {
  display: flex;
  justify-content: flex-start;
}

.login-helper-link {
  color: #2B2828;
  font-size: 0.92rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(43, 40, 40, 0.18);
}

.login-helper-link:hover {
  border-bottom-color: rgba(43, 40, 40, 0.52);
}

.finance-card {
  background:
    radial-gradient(circle at top right, rgba(237, 102, 95, 0.12), transparent 35%),
    linear-gradient(135deg, rgba(241, 162, 8, 0.08), rgba(237, 102, 95, 0.08)),
    #ffffff;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 0.94rem;
}

.empty-state span {
  max-width: 54ch;
  line-height: 1.45;
}

.empty-state-actions {
  display: flex;
  justify-content: center;
}

.loading-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 244, 244, 0.94));
  border: 1px solid rgba(237, 102, 95, 0.14);
  box-shadow: 0 16px 36px rgba(43, 40, 40, 0.08);
  color: #2B2828;
  font-size: 0.92rem;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(43, 40, 40, 0.12);
  border-top-color: #ED665F;
  animation: spin 0.8s linear infinite;
}

.table-inline-state {
  display: grid;
  gap: 10px;
  align-items: center;
}

.table-inline-state .loading-state {
  width: fit-content;
}

.table-inline-state.is-error {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(199, 74, 69, 0.18);
  background: rgba(255, 245, 244, 0.96);
  color: #742f2b;
}

.table-inline-state.is-error strong,
.table-inline-state.is-error span {
  display: block;
}

.table-inline-state.is-error span {
  margin-top: 4px;
}

.skeleton-line {
  display: block;
  width: 100%;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.42)),
    rgba(237, 102, 95, 0.18);
  background-size: 240px 100%;
  animation: skeletonShimmer 1.2s linear infinite;
}

.skeleton-title {
  max-width: 280px;
  height: 1.18em;
}

.skeleton-copy {
  max-width: 320px;
  height: 0.95em;
}

.skeleton-label {
  max-width: 120px;
  height: 0.76rem;
}

.skeleton-value {
  max-width: 120px;
  height: 1.6rem;
}

.skeleton-pill {
  width: 92px;
  height: 34px;
}

.skeleton-search {
  width: min(280px, 100%);
  height: 42px;
}

.skeleton-meta {
  width: 160px;
  height: 18px;
}

.skeleton-cell {
  min-height: 18px;
}

@keyframes skeletonShimmer {
  0% {
    background-position: 240px 0;
  }
  100% {
    background-position: -240px 0;
  }
}

@keyframes dashboardLoadingBars {
  0% {
    transform: scaleY(0.9);
    filter: saturate(0.96);
  }
  100% {
    transform: scaleY(1.04);
    filter: saturate(1.06);
  }
}

.table-scroll {
  overscroll-behavior: contain;
}

html {
  font-size: 14px;
}

body {
  line-height: 1.45;
}

img,
svg,
canvas,
video {
  max-width: 100%;
  height: auto;
}

.sidebar {
  width: var(--sidebar-width);
  padding: 16px 14px;
  gap: 14px;
}

.main-panel {
  margin-left: var(--sidebar-width);
  padding: var(--main-panel-padding);
}

.topbar,
.hero-grid,
.content-grid,
.profile-grid,
.kpi-grid,
.monitor-summary-grid,
.service-monitor-grid,
.service-monitor-host-grid {
  gap: 14px;
}

.topbar {
  margin-bottom: 18px;
}

.table-card,
.service-monitor-card,
.service-monitor-host-card,
.metric-card,
.finance-card,
.editor-shell,
.filter-modal-dialog,
.avatar-editor-shell {
  border-radius: 18px;
}

.table-card {
  gap: 12px;
  padding: 14px;
}

.table-toolbar,
.toolbar-left,
.toolbar-right,
.toolbar-extras,
.filter-chip-group {
  gap: 8px;
}

.table-shell,
.table-container {
  border-radius: 18px;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  height: 100%;
}

.table-search {
  min-width: min(100%, 220px);
}

.table-search input,
.editor-field input,
.editor-field select,
.editor-field textarea,
.filter-date-field input,
.date-filter input {
  padding-top: 10px;
  padding-bottom: 10px;
}

.table-search input {
  padding-left: 40px;
}

.filter-chip,
.ghost-button,
.primary-button,
.secondary-button,
.icon-button {
  min-height: 36px;
}

th,
td {
  padding: 8px 8px;
}

.editor-drawer {
  right: 12px;
  width: min(680px, calc(100vw - 24px));
}

.editor-shell {
  padding: 14px 16px 16px;
  gap: 10px;
  max-height: calc(100vh - 20px);
}

.filter-modal,
.avatar-editor-modal,
.profile-reload-modal {
  padding: 18px;
}

.filter-modal-dialog,
.avatar-editor-shell,
.profile-reload-panel {
  padding: 18px;
}

.sidebar-footer {
  padding: 12px;
}

.sidebar-nav .nav-item {
  min-height: 38px;
}

.client-dropdown-trigger {
  min-height: 42px;
}

@media (max-width: 1180px) {
  :root {
    --table-chrome-reserve: 164px;
  }

  .sidebar {
    width: min(286px, 82vw);
  }

  .main-panel {
    margin-left: 0;
    padding: 22px;
  }
}

@media (max-width: 900px) {
  :root {
    --table-chrome-reserve: 152px;
  }

  .service-monitor-host-grid,
  .service-monitor-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions.is-service-monitor {
    justify-content: stretch;
  }

  .topbar-actions.is-service-monitor .service-monitor-status-card-topbar {
    width: 100%;
  }

  .table-toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar-right {
    justify-content: flex-start;
  }

  .table-inline-state.is-error {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  :root {
    --table-chrome-reserve: 138px;
  }

  html {
    font-size: 13px;
  }

  .main-panel {
    padding: 16px;
  }

  .table-card {
    padding: 14px;
  }

  .table-shell,
  .table-container {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  table {
    min-width: 620px;
  }

  th,
  td {
    white-space: normal;
    min-width: 96px;
    word-break: break-word;
  }

}


.report-page[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-summary-grid.report-summary-grid-executive,
.report-page[data-export-mode="pdf"] .report-reference-page .report-summary-grid.report-summary-grid-executive,
body[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-summary-grid.report-summary-grid-executive,
body[data-export-mode="pdf"] .report-reference-page .report-summary-grid.report-summary-grid-executive {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.report-page[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-executive-card,
.report-page[data-export-mode="pdf"] .report-reference-page .report-executive-card,
body[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-executive-card,
body[data-export-mode="pdf"] .report-reference-page .report-executive-card {
  grid-template-columns: 36px minmax(0, 1fr) !important;
  gap: 8px !important;
  padding: 10px !important;
  border-radius: 16px !important;
  min-width: 0 !important;
}

.report-page[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-executive-card-icon,
.report-page[data-export-mode="pdf"] .report-reference-page .report-executive-card-icon,
body[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-executive-card-icon,
body[data-export-mode="pdf"] .report-reference-page .report-executive-card-icon {
  width: 36px !important;
  height: 36px !important;
}

.report-page[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-executive-card-icon svg,
.report-page[data-export-mode="pdf"] .report-reference-page .report-executive-card-icon svg,
body[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-executive-card-icon svg,
body[data-export-mode="pdf"] .report-reference-page .report-executive-card-icon svg {
  width: 16px !important;
  height: 16px !important;
}

.report-page[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-executive-card-copy span,
.report-page[data-export-mode="pdf"] .report-reference-page .report-executive-card-copy span,
body[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-executive-card-copy span,
body[data-export-mode="pdf"] .report-reference-page .report-executive-card-copy span {
  font-size: 9px !important;
  line-height: 1.25 !important;
}

.report-page[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-executive-card-copy strong,
.report-page[data-export-mode="pdf"] .report-reference-page .report-executive-card-copy strong,
body[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-executive-card-copy strong,
body[data-export-mode="pdf"] .report-reference-page .report-executive-card-copy strong {
  margin-top: 2px !important;
  font-size: 14px !important;
  line-height: 1.05 !important;
}

.report-page[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-executive-card-copy small,
.report-page[data-export-mode="pdf"] .report-reference-page .report-executive-card-copy small,
body[data-export-mode="pdf"] .report-top-summary > .history-report-section .report-executive-card-copy small,
body[data-export-mode="pdf"] .report-reference-page .report-executive-card-copy small {
  margin-top: 2px !important;
  font-size: 8.5px !important;
  line-height: 1.2 !important;
}

@media (max-width: 1440px) {
  .editor-drawer.is-open {
    width: min(620px, calc(100vw - 40px));
  }
}

@media (max-width: 1260px) {
  :root {
    --editor-drawer-top-offset: 84px;
  }

  .editor-drawer {
    right: 20px;
    width: min(600px, calc(100vw - 40px));
  }

  .editor-drawer.is-open {
    width: min(600px, calc(100vw - 40px));
  }
}

@media (max-width: 1180px) {
  .sidebar {
    width: min(320px, 86vw);
    max-width: 86vw;
    box-shadow: 0 24px 48px rgba(6, 18, 15, 0.28);
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-card {
    min-height: 118px;
  }

  .hero-grid,
  .content-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-toggle-mobile {
    display: none;
  }

  .sidebar-toggle:not(.sidebar-toggle-mobile) {
    display: inline-grid;
    place-items: center;
  }

  .main-panel {
    margin-left: 0;
    position: relative;
  }

  body:not(.sidebar-collapsed) .main-panel::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(12, 25, 22, 0.38);
    backdrop-filter: blur(2px);
    z-index: 20;
  }
}

@media (max-width: 840px) {
  .dashboard-loading-panel {
    padding: 24px 22px 20px;
    gap: 18px;
  }

  .dashboard-loading-brand {
    align-items: flex-start;
  }

  .dashboard-loading-mark {
    width: 76px;
    height: 76px;
  }

  .dashboard-loading-logo {
    width: 62px;
    height: 62px;
  }

  .main-panel {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 18px;
  }

  .topbar-title {
    align-items: center;
  }

  .topbar-side {
    width: 100%;
    justify-content: flex-start;
  }

  .system-health-indicator {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .service-monitor-overview,
  .service-monitor-summary-row,
  .service-monitor-grid,
  .service-monitor-host-grid {
    grid-template-columns: 1fr;
  }

  .table-toolbar,
  .editor-actions {
    display: flex;
    flex-wrap: wrap;
  }

  .toolbar-right {
    justify-content: flex-start;
  }

  .toolbar-left,
  .toolbar-right,
  .toolbar-extras {
    width: 100%;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .hero-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-stat-stack {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-card,
  .trend-card,
  .surface-card,
  .section-card,
  .table-card {
    padding: 18px;
    border-radius: 22px;
  }

  .trend-card {
    min-height: 300px;
  }

  .mini-chart {
    --chart-bar-width: 18px;
    --chart-bar-gap: 12px;
    min-height: 228px;
    padding-inline: 0;
  }

  .chart-bar-hitbox {
    min-height: 194px;
    padding-top: 38px;
  }

  .toast-stack {
    top: auto;
    bottom: 84px;
  }

  .table-shell {
    min-height: clamp(320px, 62vh, 760px);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .profile-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .code-action-field {
    grid-template-columns: 1fr;
  }

  .editor-grid-scrollable {
    grid-template-columns: 1fr;
  }

  .editor-grid-scrollable [data-field-wrapper="phone"],
  .editor-grid-scrollable [data-field-wrapper="validation_code"],
  .editor-grid-scrollable [data-field-wrapper="date_birth"] {
    grid-column: auto;
  }

  .phone-parts-field {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .editor-drawer {
    right: 10px;
    left: 10px;
    width: auto;
    top: auto;
    bottom: 10px;
  }

  .editor-shell {
    max-height: min(70vh, 680px);
    height: auto;
  }

  .editor-drawer[data-section="assets"] .editor-body {
    max-height: calc(min(70vh, 680px) - 230px);
  }

  .avatar-editor-dialog {
    width: min(840px, 100%);
    max-height: min(92vh, 860px);
    padding: 18px;
    border-radius: 24px;
  }

  .filter-date-grid {
    grid-template-columns: 1fr;
  }

  .avatar-editor-content {
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .avatar-editor-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .avatar-editor-help {
    grid-column: 1 / -1;
  }
}

@media (min-width: 769px) {
  .table-toolbar,
  .toolbar-left,
  .toolbar-right {
    overflow: visible;
  }

  .toolbar-right {
    width: auto;
    min-width: max-content;
    flex: 0 1 auto;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
  }

  .column-picker-desktop-shell {
    display: inline-flex !important;
    align-items: center;
    flex: 0 0 auto !important;
    min-width: max-content;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .column-picker-trigger-desktop {
    display: inline-flex !important;
    width: auto !important;
    min-width: max-content;
    white-space: nowrap;
    flex: 0 0 auto !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

}

@media (max-width: 768px) {
  body:not(.sidebar-collapsed) {
    overflow: hidden;
  }

  .table-screen {
    width: 100%;
    min-width: 0;
  }

  .table-card {
    width: 100%;
    min-width: 0;
  }

  .table-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.82fr) minmax(0, 1.6fr) 32px;
    gap: 4px;
    align-items: center;
  }

  .toolbar-left,
  .toolbar-right {
    display: contents;
  }

  .toolbar-left > [data-open-filters],
  .toolbar-right > .filter-chip-group,
  .toolbar-right > .column-picker-desktop-shell,
  .toolbar-right > [data-local-refresh],
  .toolbar-left > .table-filter-summary,
  .toolbar-left > .table-search,
  .toolbar-left > .toolbar-extras {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .toolbar-left > [data-open-filters] {
    grid-column: 2;
    grid-row: 1;
  }

  .toolbar-right > .filter-chip-group {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .toolbar-right > .column-picker-desktop-shell {
    grid-column: 4;
    grid-row: 1;
    display: inline-flex !important;
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .toolbar-left > .table-filter-summary {
    grid-column: 1 / 3;
    grid-row: 2;
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.84);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.66rem;
  }

  .toolbar-left > .table-search {
    grid-column: 4 / 6;
    grid-row: 2;
  }

  .toolbar-right > [data-local-refresh] {
    grid-column: 6;
    grid-row: 2;
    min-height: 32px;
    width: 32px;
    min-width: 32px;
    padding: 0;
  }

  .toolbar-left > .toolbar-extras {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .toolbar-right > .table-meta {
    display: none;
  }

  .toolbar-left > [data-open-filters],
  .toolbar-right > .filter-chip-group,
  .toolbar-right > .column-picker-desktop-shell {
    align-self: stretch;
    justify-self: stretch;
  }

  .toolbar-right > .filter-chip-group .ghost-button,
  .toolbar-right > .column-picker-desktop-shell .ghost-button,
  .toolbar-left > [data-open-filters],
  .toolbar-right > [data-local-refresh] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .toolbar-right > .filter-chip-group .ghost-button,
  .toolbar-right > .column-picker-desktop-shell .ghost-button,
  .toolbar-left > [data-open-filters] {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 32px;
    padding: 4px 5px;
    font-size: 0.62rem;
    line-height: 1;
    white-space: nowrap;
  }

  .table-shell,
  .table-container,
  .table-wrapper,
  .table-scroll {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .table-scroll {
    overflow-x: auto;
    overflow-y: auto;
  }

  .sidebar {
    height: 100dvh;
    max-height: 100dvh;
    overflow-x: hidden;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .brand,
  .profile-card,
  .client-switcher,
  .sidebar-footer {
    flex: 0 0 auto;
  }

  .sidebar-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    touch-action: pan-y;
    padding-right: 4px;
    margin-right: -4px;
  }

  .nav-item[data-menu-drag] {
    touch-action: pan-y;
  }

  .sidebar-footer {
    margin-top: 12px;
    margin-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .mobile-filters {
    display: grid;
    gap: 10px;
    width: 100%;
    align-items: start;
  }

  .mobile-filters > * {
    min-width: 0;
    max-width: 100%;
  }

  .mobile-table-search,
  .mobile-table-search input {
    width: 100%;
    min-width: 0;
  }

  .mobile-filters-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .mobile-filters-bar > .ghost-button,
  .mobile-filters-bar > .column-picker {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
  }

  .mobile-filters-bar > .icon-button {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    min-width: 40px;
    align-self: stretch;
  }

  .mobile-filters-bar .ghost-button,
  .mobile-filters-bar .column-picker .ghost-button {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 40px !important;
    padding: 10px 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    line-height: 1.1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .mobile-filters-bar .icon-button span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  .mobile-filters-bar .column-picker {
    position: relative;
    z-index: 70;
  }

  .mobile-filters-bar .column-picker-panel {
    left: auto;
    right: 0;
    width: min(240px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
  }

  .mobile-toolbar-extras:empty,
  .mobile-action-row:empty,
  .mobile-chip-group:empty {
    display: none;
  }

  .mobile-toolbar-extras,
  .mobile-action-row,
  .mobile-chip-group,
  .mobile-filters-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  .mobile-action-row {
    justify-content: flex-start;
  }

  .mobile-toolbar-extras > *,
  .mobile-chip-group > *,
  .mobile-filters-meta > * {
    min-width: 0;
    max-width: 100%;
  }

  .mobile-filters-meta {
    justify-content: space-between;
    align-items: flex-start;
    row-gap: 6px;
  }

  .mobile-filters-meta .table-filter-summary,
  .mobile-filters-meta .table-meta {
    min-width: 0;
    max-width: 100%;
  }

  .floating-refresh-badge {
    right: max(8px, env(safe-area-inset-right));
    left: auto;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: fit-content;
    max-width: calc(100vw - 16px - env(safe-area-inset-right));
    padding: 8px 9px;
    gap: 6px;
    font-size: 0.76rem;
    line-height: 1.28;
    justify-content: flex-start;
  }

  .floating-refresh-badge.is-mobile-collapsed {
    padding: 0 !important;
    gap: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }

  .floating-refresh-badge.is-mobile-collapsed .floating-refresh-copy {
    display: none !important;
  }

  .floating-refresh-badge.is-mobile-collapsed .floating-refresh-button {
    width: auto !important;
    min-width: 0 !important;
    height: 28px !important;
    padding: 0 10px !important;
    border-radius: 999px !important;
    background: rgba(88, 82, 82, 0.94) !important;
    border: 1px solid rgba(250, 214, 212, 0.18) !important;
    box-shadow: var(--shadow-soft) !important;
    font-size: 0.72rem !important;
    line-height: 1 !important;
  }

  .floating-refresh-badge.is-mobile-expanded {
    padding: 8px 9px !important;
    gap: 6px !important;
    background: rgba(88, 82, 82, 0.92) !important;
    border: 1px solid rgba(250, 214, 212, 0.18) !important;
    box-shadow: var(--shadow-soft) !important;
    backdrop-filter: blur(10px) !important;
  }

  .floating-refresh-badge.is-mobile-expanded .floating-refresh-copy {
    display: grid !important;
  }

  .floating-refresh-copy {
    gap: 1px;
    width: fit-content;
    flex: 0 1 auto;
  }

  .floating-refresh-head {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: fit-content;
  }

  .floating-refresh-copy span {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .floating-refresh-copy strong {
    font-size: 0.68rem;
  }

  .floating-refresh-status {
    font-size: 0.7rem;
    line-height: 1.32;
  }

  .floating-refresh-button {
    width: 30px;
    height: 30px;
  }

  .editor-drawer {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    padding: 0 !important;
    transform: none !important;
    background: rgba(17, 16, 16, 0.42) !important;
    backdrop-filter: blur(10px) !important;
    z-index: 135 !important;
  }

  .editor-drawer.is-open {
    transform: none;
  }

  .editor-shell {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: min(94vw, 560px) !important;
    max-width: 94vw !important;
    max-height: min(82vh, calc(100dvh - 24px - env(safe-area-inset-bottom))) !important;
    height: auto !important;
    border-radius: 22px !important;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom)) !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    gap: 12px !important;
    overflow: hidden !important;
  }

  .editor-header {
    justify-content: space-between;
    align-items: flex-start;
    min-height: 0;
    padding-bottom: 2px;
  }

  .editor-header-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .editor-header-copy .eyebrow {
    margin: 0;
    font-size: 0.72rem;
  }

  .editor-header-copy h3 {
    margin: 0;
    font-size: 1.12rem;
    line-height: 1.2;
    color: #2B2828;
  }

  .editor-body {
    gap: 14px;
    padding-right: 2px;
    padding-bottom: 2px;
  }

  .editor-note {
    padding: 10px 12px;
    border-radius: 13px;
    font-size: 0.84rem;
    line-height: 1.45;
  }

  .editor-inline-actions {
    width: 100%;
  }

  .editor-inline-actions .ghost-button {
    min-width: 0;
    max-width: 100%;
  }

  .editor-grid,
  .editor-grid-scrollable {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .editor-field {
    gap: 7px;
  }

  .editor-field label {
    font-size: 0.76rem;
    line-height: 1.3;
  }

  .editor-input,
  .editor-select,
  .editor-textarea,
  .editor-multiselect,
  .phone-parts-field {
    width: 100%;
    min-width: 0;
  }

  .editor-input,
  .editor-select,
  .editor-textarea,
  .editor-multiselect {
    border-radius: 14px;
  }

  .editor-textarea {
    min-height: 96px;
  }

  .editor-footer {
    gap: 10px;
    padding-top: 12px;
    position: relative;
    background: rgba(255, 255, 255, 0.96);
  }

  .editor-status {
    font-size: 0.82rem;
    line-height: 1.4;
  }

  .editor-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .editor-footer .editor-actions {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: space-between !important;
  }

  .editor-actions .ghost-button,
  .editor-actions .primary-button {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    min-height: 42px;
    padding: 10px 12px;
  }

  .editor-drawer[data-section="assets"] .editor-body {
    max-height: calc(min(82vh, calc(100dvh - 24px - env(safe-area-inset-bottom))) - 228px);
  }

  .toolbar-left,
  .toolbar-right,
  .toolbar-extras,
  .filter-chip-group,
  .topbar-actions,
  .editor-actions,
  .mobile-filters,
  .mobile-filters-bar,
  .mobile-toolbar-extras,
  .mobile-action-row,
  .mobile-chip-group,
  .mobile-filters-meta,
  .mobile-table-list,
  .mobile-row-grid {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .toolbar-left,
  .toolbar-right,
  .toolbar-extras,
  .filter-chip-group,
  .topbar-actions {
    align-items: center;
    flex-wrap: wrap;
  }

  .editor-actions {
    align-items: center;
  }

  .filter-chip,
  .ghost-button,
  .primary-button {
    width: auto;
    min-width: 90px;
    max-width: 160px;
    padding: 10px 16px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
  }

  .toolbar-left .ghost-button,
  .toolbar-left .primary-button,
  .toolbar-right .ghost-button,
  .toolbar-right .primary-button,
  .toolbar-extras .ghost-button,
  .toolbar-extras .primary-button,
  .topbar-actions .ghost-button,
  .topbar-actions .primary-button,
  .filter-chip-group .filter-chip,
  .mobile-filters-bar .ghost-button,
  .mobile-toolbar-extras .ghost-button,
  .mobile-action-row .ghost-button,
  .mobile-action-row .primary-button,
  .mobile-chip-group .ghost-button,
  .mobile-chip-group .filter-chip {
    flex: 0 1 auto;
  }

  .table-card,
  .table-toolbar,
  .table-search,
  .table-search input,
  .mobile-table-card,
  .mobile-filters,
  .mobile-row-card,
  .mobile-row-title,
  .mobile-data-value,
  .mobile-summary-pair,
  .mobile-data-pair,
  .editor-shell,
  .editor-body,
  .editor-grid,
  .editor-field,
  .filter-modal-dialog,
  .avatar-editor-dialog,
  .service-monitor-card,
  .service-monitor-host-card,
  .service-monitor-status-card,
  .trend-card,
  .hero-card,
  .surface-card,
  .section-card,
  .mini-chart {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .table-screen,
  .table-card,
  .table-shell,
  .table-container,
  .table-wrapper {
    min-height: 0;
    height: auto;
    max-height: none;
  }

  .table-scroll {
    min-height: 240px;
    overflow-x: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }

  .table-screen,
  .table-shell,
  .table-container,
  .table-wrapper,
  .table-scroll,
  table {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .dashboard-loading-screen {
    padding: 16px;
  }

  .dashboard-loading-panel {
    padding: 22px 18px 18px;
    border-radius: 24px;
  }

  .dashboard-loading-brand {
    flex-direction: column;
    gap: 14px;
  }

  .dashboard-loading-copy {
    gap: 6px;
  }

  .dashboard-loading-copy h1 {
    font-size: clamp(1.42rem, 7vw, 1.82rem);
  }

  .dashboard-loading-copy p:last-child {
    font-size: 0.9rem;
  }

  .sidebar {
    width: min(320px, 92vw);
    max-width: 92vw;
    padding: 16px 14px;
  }

  .brand,
  .profile-card,
  .sidebar-footer {
    padding: 12px;
  }

  .profile-card {
    min-height: 56px;
  }

  .sidebar-profile-row {
    gap: 8px;
  }

  .sidebar-logout-button {
    width: 56px;
    min-width: 56px;
    height: 56px;
    border-radius: 14px;
  }

  .main-panel {
    padding: 12px;
  }

  .topbar-title {
    gap: 10px;
  }

  .service-monitor-status-card,
  .service-monitor-host-card,
  .service-monitor-card {
    padding: 14px;
    border-radius: 18px;
  }

  .service-monitor-status-card {
    min-height: 0;
  }

  .service-monitor-host-card {
    min-height: 108px;
    padding: 14px;
  }

  .hero-copy h3 {
    font-size: clamp(1.6rem, 8vw, 2.2rem);
  }

  .hero-stat-stack {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: center;
    gap: 12px 14px;
  }

  .kpi-card {
    min-height: 104px;
    padding: 13px 14px;
    gap: 6px;
  }

  .kpi-card:nth-child(5) {
    grid-column: 1 / -1;
    width: min(100%, calc(50% - 7px));
    justify-self: center;
  }

  .kpi-card strong {
    font-size: 1.56rem;
  }

  .hero-grid,
  .content-grid,
  .profile-grid {
    gap: 14px;
    margin-bottom: 16px;
  }

  .table-card,
  .hero-card,
  .trend-card,
  .surface-card,
  .section-card {
    padding: 16px;
    border-radius: 18px;
  }

  .filter-chip-group,
  .toolbar-left,
  .toolbar-right,
  .toolbar-extras {
    gap: 8px;
  }

  .filter-chip,
  .ghost-button,
  .primary-button {
    width: auto;
    min-width: 90px;
    max-width: 160px;
    justify-content: center;
  }

  .table-search {
    min-width: 100%;
    flex-basis: 100%;
  }

  .column-picker,
  .column-picker-panel {
    width: 100%;
  }

  .column-picker-panel {
    left: 0;
    right: auto;
    max-width: 100%;
  }

  table {
    min-width: 620px;
  }

  th,
  td {
    padding: 9px 8px;
  }

  .mini-chart {
    --chart-bar-width: 16px;
    --chart-bar-gap: 10px;
    min-height: 184px;
  }

  .chart-bar-hitbox {
    min-height: 152px;
    padding-top: 28px;
  }

  .chart-tooltip {
    max-width: 148px;
    padding: 8px 10px;
  }

  .chart-helper {
    font-size: 0.74rem;
    margin-top: 10px;
  }

  .toast-stack {
    right: 12px;
    width: calc(100vw - 24px);
  }

  .editor-shell {
    width: min(95vw, 520px);
    max-height: min(78vh, calc(100dvh - 20px - env(safe-area-inset-bottom)));
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  .editor-header-copy h3 {
    font-size: 1.04rem;
  }

  .editor-body {
    gap: 12px;
  }

  .editor-actions {
    gap: 8px;
  }

  .editor-actions .ghost-button,
  .editor-actions .primary-button {
    min-height: 40px;
    padding: 10px;
  }

  .editor-drawer[data-section="assets"] .editor-body {
    max-height: calc(min(78vh, calc(100dvh - 20px - env(safe-area-inset-bottom))) - 220px);
  }

  .avatar-editor-modal {
    padding: 0;
    align-items: flex-end;
  }

  .filter-modal {
    padding: 0;
    align-items: flex-end;
  }

  .filter-modal-dialog {
    width: 100%;
    max-height: 88vh;
    border-radius: 24px 24px 0 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }

  .avatar-editor-dialog {
    width: 100%;
    max-height: 88vh;
    border-radius: 24px 24px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  }

  .avatar-editor-stage {
    padding: 12px;
    border-radius: 22px;
  }

  .avatar-editor-canvas {
    width: 100%;
    max-height: min(100%, calc(100vh - 390px));
    border-radius: 20px;
  }

  .avatar-editor-sidebar {
    grid-template-columns: 1fr;
  }

  .avatar-editor-preview {
    width: 128px;
  }

  .avatar-editor-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
  }

  .avatar-editor-actions .ghost-button,
  .avatar-editor-actions .primary-button {
    width: auto;
    min-width: 116px;
    padding: 10px 14px;
  }

  .phone-parts-field {
    grid-template-columns: 1fr;
  }

  .login-shell {
    padding: 16px;
  }

  .login-card {
    padding: 22px 18px;
    border-radius: 22px;
  }

  .floating-refresh-badge {
    width: fit-content;
    max-width: calc(100vw - 16px - env(safe-area-inset-right));
    padding: 7px 8px;
    gap: 6px;
  }

  .floating-refresh-copy {
    gap: 4px;
  }

  .floating-refresh-copy span {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .floating-refresh-copy strong {
    font-size: 0.68rem;
  }

  .floating-refresh-status {
    font-size: 0.7rem;
    line-height: 1.35;
  }

  .floating-refresh-button {
    width: 32px;
    height: 32px;
  }
}

.payload-disclosure {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.mini-chart.is-empty {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-flow: row;
  grid-auto-columns: auto;
  place-items: center;
  justify-content: stretch;
  width: 100%;
  min-height: 262px;
  padding: 18px 0 0;
}

.mini-chart-empty-message {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
  text-align: center;
}

table {
  table-layout: auto;
}

th,
td,
.cell-title,
.muted {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  max-width: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media ((max-width: 1024px) and (pointer: coarse)), (max-width: 768px) {
  .table-screen,
  .table-card,
  .table-shell,
  .table-container,
  .table-wrapper,
  .table-scroll {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
  }
}

@media (min-width: 769px) {
  .table-scroll table {
    width: max(100%, calc(var(--table-rendered-columns, 1) * 148px));
    min-width: max(100%, calc(var(--table-rendered-columns, 1) * 148px));
  }

  .table-scroll th:not(:first-child),
  .table-scroll td:not(:first-child) {
    min-width: 148px;
  }
}

@media (max-width: 1024px) and (pointer: coarse) and (orientation: landscape) {
  .main-panel,
  .workspace-shell,
  .content-column,
  .panel-section,
  .table-screen,
  .table-card,
  .table-shell,
  .table-container,
  .table-wrapper,
  .table-scroll {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .main-panel,
  .workspace-shell,
  .content-column,
  .panel-section,
  .table-screen,
  .table-card,
  .table-shell,
  .table-container,
  .table-wrapper {
    overflow-x: hidden !important;
  }

  .table-screen,
  .table-card,
  .table-shell,
  .table-container,
  .table-wrapper {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
  }

  .table-shell,
  .table-container {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
  }

  .table-wrapper {
    overflow: hidden !important;
  }

  .table-scroll {
    min-height: 240px !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }

  table {
    width: auto !important;
    min-width: 100% !important;
    max-width: none !important;
  }

  .floating-refresh-badge {
    right: max(8px, env(safe-area-inset-right));
    left: auto;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: fit-content;
    max-width: min(320px, calc(100vw - 16px - env(safe-area-inset-right)));
    padding: 8px 10px;
    gap: 8px;
    font-size: 0.76rem;
    line-height: 1.28;
    justify-content: flex-start;
  }

  .floating-refresh-badge.is-mobile-collapsed {
    padding: 0 !important;
    gap: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }

  .floating-refresh-badge.is-mobile-collapsed .floating-refresh-copy {
    display: none !important;
  }

  .floating-refresh-badge.is-mobile-collapsed .floating-refresh-button {
    width: auto !important;
    min-width: 0 !important;
    height: 30px !important;
    padding: 0 12px !important;
    border-radius: 999px !important;
    background: rgba(88, 82, 82, 0.94) !important;
    border: 1px solid rgba(250, 214, 212, 0.18) !important;
    box-shadow: var(--shadow-soft) !important;
    font-size: 0.72rem !important;
    line-height: 1 !important;
  }

  .floating-refresh-badge.is-mobile-expanded {
    padding: 8px 10px !important;
    gap: 8px !important;
    background: rgba(88, 82, 82, 0.92) !important;
    border: 1px solid rgba(250, 214, 212, 0.18) !important;
    box-shadow: var(--shadow-soft) !important;
    backdrop-filter: blur(10px) !important;
  }

  .floating-refresh-badge.is-mobile-expanded .floating-refresh-copy {
    display: grid !important;
    gap: 2px;
    width: fit-content;
    flex: 0 1 auto;
  }

  .floating-refresh-badge.is-mobile-expanded .floating-refresh-head {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: fit-content;
  }

  .floating-refresh-badge.is-mobile-expanded .floating-refresh-copy span {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .floating-refresh-badge.is-mobile-expanded .floating-refresh-copy strong {
    font-size: 0.68rem;
  }

  .floating-refresh-badge.is-mobile-expanded .floating-refresh-status {
    font-size: 0.7rem;
    line-height: 1.32;
  }

  .floating-refresh-badge.is-mobile-expanded .floating-refresh-button {
    width: 30px;
    height: 30px;
  }
}

@media (min-width: 769px) {
  .alarm-status-pill {
    border-radius: 10px;
  }
}

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

@keyframes successPulse {
  0% {
    transform: scale(1);
    background: rgba(255, 255, 255, 0.88);
  }
  40% {
    transform: scale(1.01);
    background: rgba(245, 244, 244, 0.92);
  }
  100% {
    transform: scale(1);
    background: rgba(255, 255, 255, 0.88);
  }
}

@keyframes drawerSuccessPulse {
  0% {
    transform: translateX(0);
    background: var(--surface);
  }
  35% {
    transform: translateX(-2px);
    background: rgba(245, 244, 244, 0.92);
  }
  100% {
    transform: translateX(0);
    background: var(--surface);
  }
}

@keyframes drawerErrorPulse {
  0% {
    transform: translateX(0);
    background: var(--surface);
  }
  20% {
    transform: translateX(-3px);
    background: rgba(217, 72, 72, 0.1);
  }
  40% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-2px);
    background: rgba(217, 72, 72, 0.1);
  }
  80% {
    transform: translateX(2px);
  }
  100% {
    transform: translateX(0);
    background: var(--surface);
  }
}

/* Destaque padronizado de sucesso/erro em qualquer botão de salvar - usado
   pelo botão principal de "Salvar alterações"/"Criar" de todas as
   tabelas/seções, pelo card "Grupos associados" (Regras) e pelo fluxo de
   convite de contatos. Não precisa de nenhum HTML extra: o "check" é
   desenhado via ::after, reaproveitando o mesmo truque de esconder o texto
   original já usado por .is-loading acima. */
.primary-button.is-save-success,
.ghost-button.is-save-success {
  position: relative;
  color: transparent;
  background: var(--success);
  border-color: var(--success);
  pointer-events: none;
}

.primary-button.is-save-success::after,
.ghost-button.is-save-success::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  animation: profileSettingsCheckIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.primary-button.is-save-error,
.ghost-button.is-save-error {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  animation: profileSettingsShake 0.46s ease;
}

@media (max-width: 430px) {
  .table-toolbar {
    gap: 6px;
  }

  .toolbar-right > .filter-chip-group .ghost-button,
  .toolbar-right > .column-picker-desktop-shell .ghost-button,
  .toolbar-left > [data-open-filters] {
    padding-inline: 3px;
    font-size: 0.58rem;
  }

  .toolbar-right > [data-local-refresh] {
    width: 30px;
    min-width: 30px;
    height: 30px;
  }

  .toolbar-left > .table-filter-summary {
    padding-inline: 6px;
    font-size: 0.62rem;
  }

  .toolbar-left > .table-search {
    grid-column: 4 / 6;
  }

  .table-meta,
  .table-filter-summary {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 375px) {
  .editor-footer .editor-actions {
    flex-wrap: wrap;
  }

  .editor-actions .ghost-button,
  .editor-actions .primary-button {
    flex-basis: 100%;
  }

  .filter-chip,
  .ghost-button,
  .primary-button {
    min-width: 90px;
    max-width: 148px;
  }

  .mobile-row-head,
  .mobile-row-details summary {
    flex-direction: column;
    align-items: flex-start;
  }
}


.editor-delete-button {
  display: none !important;
}

.editor-input[readonly],
.editor-textarea[readonly] {
  background: rgba(127, 141, 135, 0.1);
  border-color: rgba(127, 141, 135, 0.24);
  color: #544E4E;
  cursor: text;
}

.editor-input[readonly]:focus,
.editor-textarea[readonly]:focus {
  border-color: rgba(237, 102, 95, 0.35);
  box-shadow: 0 0 0 3px rgba(237, 102, 95, 0.08);
}

.editor-drawer[data-section="alarms"] .editor-grid,
.editor-drawer[data-section="notifications"] .editor-grid,
.editor-drawer[data-section="leadsites"] .editor-grid {
  grid-template-columns: minmax(0, 1fr);
}

.editor-drawer[data-section="alarms"] .editor-body,
.editor-drawer[data-section="alarms"] .editor-field,
.editor-drawer[data-section="alarms"] .editor-input,
.editor-drawer[data-section="alarms"] .editor-select,
.editor-drawer[data-section="alarms"] .editor-textarea,
.editor-drawer[data-section="alarms"] .editor-multiselect,
.editor-drawer[data-section="alarms"] .phone-parts-field,
.editor-drawer[data-section="notifications"] .editor-body,
.editor-drawer[data-section="notifications"] .editor-field,
.editor-drawer[data-section="notifications"] .editor-input,
.editor-drawer[data-section="notifications"] .editor-select,
.editor-drawer[data-section="notifications"] .editor-textarea,
.editor-drawer[data-section="notifications"] .editor-multiselect,
.editor-drawer[data-section="notifications"] .phone-parts-field,
.editor-drawer[data-section="leadsites"] .editor-body,
.editor-drawer[data-section="leadsites"] .editor-field,
.editor-drawer[data-section="leadsites"] .editor-input,
.editor-drawer[data-section="leadsites"] .editor-select,
.editor-drawer[data-section="leadsites"] .editor-textarea,
.editor-drawer[data-section="leadsites"] .editor-multiselect,
.editor-drawer[data-section="leadsites"] .phone-parts-field {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.editor-drawer[data-section="alarms"] .editor-note,
.editor-drawer[data-section="alarms"] .selected-tags,
.editor-drawer[data-section="alarms"] .selected-tag,
.editor-drawer[data-section="alarms"] .editor-help,
.editor-drawer[data-section="alarms"] .editor-status,
.editor-drawer[data-section="notifications"] .editor-note,
.editor-drawer[data-section="notifications"] .selected-tags,
.editor-drawer[data-section="notifications"] .selected-tag,
.editor-drawer[data-section="notifications"] .editor-help,
.editor-drawer[data-section="notifications"] .editor-status,
.editor-drawer[data-section="leadsites"] .editor-note,
.editor-drawer[data-section="leadsites"] .selected-tags,
.editor-drawer[data-section="leadsites"] .selected-tag,
.editor-drawer[data-section="leadsites"] .editor-help,
.editor-drawer[data-section="leadsites"] .editor-status {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.editor-drawer[data-section="alarms"] .editor-textarea,
.editor-drawer[data-section="notifications"] .editor-textarea,
.editor-drawer[data-section="leadsites"] .editor-textarea {
  max-width: 100%;
}

.editor-drawer.is-compact[data-section="notifications"] .editor-shell,
.editor-drawer.is-compact[data-section="leadsites"] .editor-shell {
  height: auto;
  min-height: 0;
  padding-bottom: 12px;
  gap: 8px;
}

.editor-drawer.is-compact[data-section="notifications"] .editor-body,
.editor-drawer.is-compact[data-section="leadsites"] .editor-body {
  gap: 0;
  padding-bottom: 0;
}

.editor-drawer.is-compact[data-section="notifications"] .editor-note-empty,
.editor-drawer.is-compact[data-section="leadsites"] .editor-note-empty {
  padding: 10px 12px;
  font-size: 0.84rem;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .editor-drawer.is-alarm-ack .editor-body {
    gap: 6px;
  }

  .editor-alarm-subtitle {
    font-size: 0.8rem;
    line-height: 1.5;
    padding-right: 2px;
  }

  .editor-drawer.is-alarm-ack .editor-textarea {
    min-height: 104px;
  }

  .mobile-filters-bar {
    gap: 6px !important;
  }

  .mobile-filters-bar > .ghost-button,
  .mobile-filters-bar > .column-picker {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: 0 !important;
  }

  .mobile-filters-bar .ghost-button,
  .mobile-filters-bar .column-picker .ghost-button {
    min-width: 0 !important;
    max-width: none !important;
    padding: 9px 8px !important;
    font-size: 0.73rem !important;
    letter-spacing: 0.01em;
  }

  .mobile-filters-bar > .icon-button {
    flex: 0 0 38px !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
  }

  .editor-delete-button:not([hidden]) {
    display: inline-flex;
    flex: 1 1 100%;
    max-width: none;
  }

  .editor-body,
  .editor-grid,
  .editor-grid-scrollable,
  .editor-footer {
    border-radius: 18px;
  }

  .editor-footer .editor-actions {
    flex-wrap: wrap !important;
  }

  .editor-drawer[data-section="alarms"] .editor-shell,
  .editor-drawer[data-section="notifications"] .editor-shell,
  .editor-drawer[data-section="leadsites"] .editor-shell {
    width: min(94vw, 560px) !important;
  }
}

@media (max-width: 430px) {
  .mobile-filters-bar .ghost-button,
  .mobile-filters-bar .column-picker .ghost-button {
    padding: 8px 7px !important;
    font-size: 0.69rem !important;
  }
}


@media (max-width: 768px) {
  .table-toolbar {
    grid-template-columns: max-content max-content max-content 32px;
    gap: 6px;
    align-items: center;
  }

  .table-toolbar .toolbar-left,
  .table-toolbar .toolbar-right {
    display: contents;
  }

  .table-toolbar .toolbar-left > [data-open-filters],
  .table-toolbar .toolbar-right > .filter-chip-group,
  .table-toolbar .toolbar-right > .column-picker-desktop-shell,
  .table-toolbar .toolbar-right > [data-local-refresh],
  .table-toolbar .toolbar-left > .table-filter-summary,
  .table-toolbar .toolbar-left > .table-search,
  .table-toolbar .toolbar-left > .toolbar-extras {
    min-width: 0;
    max-width: 100%;
  }

  .table-toolbar .toolbar-left > [data-open-filters] {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    justify-self: start;
    width: auto;
  }

  .table-toolbar .toolbar-right > .filter-chip-group {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow: visible;
    align-self: center;
    justify-self: start;
    width: auto;
  }

  .table-toolbar .toolbar-right > .column-picker-desktop-shell {
    grid-column: 3;
    grid-row: 1;
    display: inline-flex !important;
    min-width: 0;
    overflow: visible;
    align-self: center;
    justify-self: start;
    width: auto;
  }

  .table-toolbar .toolbar-right > [data-local-refresh] {
    grid-column: 4;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    min-height: 32px;
    height: 32px;
    padding: 0;
  }

  .table-toolbar .toolbar-left > .table-filter-summary {
    grid-column: 1 / -1;
    grid-row: 3;
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.84);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.66rem;
    width: 100%;
    justify-self: stretch;
  }

  .table-toolbar .toolbar-left > .table-search {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    flex-basis: auto;
  }

  .table-toolbar .toolbar-left > .toolbar-extras {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  .table-toolbar .toolbar-right > .table-meta {
    display: none;
  }

  .table-toolbar .ghost-button,
  .table-toolbar .filter-chip,
  .table-toolbar .toolbar-right > .column-picker-desktop-shell .ghost-button,
  .table-toolbar .toolbar-left > [data-open-filters] {
    min-width: 0 !important;
    max-width: max-content !important;
    width: auto;
    min-height: 32px;
    padding: 4px 10px;
    font-size: 0.68rem;
    line-height: 1;
    white-space: nowrap;
  }

  .table-toolbar .table-search,
  .table-toolbar .table-search input {
    min-width: 0 !important;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .table-toolbar {
    grid-template-columns: max-content max-content max-content 30px;
    gap: 5px;
  }

  .table-toolbar .ghost-button,
  .table-toolbar .filter-chip,
  .table-toolbar .toolbar-right > .column-picker-desktop-shell .ghost-button,
  .table-toolbar .toolbar-left > [data-open-filters] {
    padding: 4px 9px;
    font-size: 0.64rem;
  }

  .table-toolbar .toolbar-left > .table-filter-summary {
    padding-inline: 6px;
    font-size: 0.62rem;
  }

  .table-toolbar .toolbar-right > [data-local-refresh] {
    width: 30px;
    min-width: 30px;
    max-width: 30px;
    height: 30px;
    min-height: 30px;
  }
}

@media (max-width: 430px) {
  .table-toolbar {
    gap: 4px;
  }

  .table-toolbar .ghost-button,
  .table-toolbar .filter-chip,
  .table-toolbar .toolbar-right > .column-picker-desktop-shell .ghost-button,
  .table-toolbar .toolbar-left > [data-open-filters] {
    padding-inline: 8px;
    font-size: 0.61rem;
  }

  .table-toolbar .toolbar-left > .table-filter-summary {
    padding-inline: 5px;
    font-size: 0.6rem;
    max-width: none;
  }

  .table-toolbar .toolbar-right > [data-local-refresh] {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    height: 28px;
    min-height: 28px;
  }
}

@media (max-width: 768px) {
  .table-toolbar {
    display: grid !important;
    grid-template-columns: max-content max-content max-content minmax(0, 1fr) 36px !important;
    gap: 8px !important;
    align-items: center !important;
  }

  .table-toolbar .toolbar-left,
  .table-toolbar .toolbar-right {
    display: contents !important;
  }

  .table-toolbar .toolbar-left > [data-open-filters] {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: auto !important;
    justify-self: start !important;
  }

  .table-toolbar .toolbar-right > .filter-chip-group {
    grid-column: 2 !important;
    grid-row: 1 !important;
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    overflow: visible !important;
    width: auto !important;
    justify-self: start !important;
  }

  .table-toolbar .toolbar-right > .column-picker-desktop-shell {
    grid-column: 3 !important;
    grid-row: 1 !important;
    display: inline-flex !important;
    overflow: visible !important;
    width: auto !important;
    justify-self: start !important;
  }

  .table-toolbar .toolbar-right > .column-picker-desktop-shell .column-picker-panel {
    position: fixed !important;
    top: 108px !important;
    bottom: auto !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: min(34vh, 240px) !important;
    padding: 10px !important;
    overflow: auto !important;
    border-radius: 16px !important;
    box-shadow: 0 18px 42px rgba(20, 18, 18, 0.24) !important;
  }

  .table-toolbar .toolbar-right > .column-picker-desktop-shell .column-option {
    align-items: flex-start !important;
    gap: 12px !important;
    font-size: 0.8rem !important;
  }

  .table-toolbar .toolbar-right > .column-picker-desktop-shell .column-option-main {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .table-toolbar .toolbar-right > .column-picker-desktop-shell .column-option-actions {
    flex: 0 0 auto !important;
  }

  .table-toolbar .toolbar-right > [data-local-refresh] {
    grid-column: 5 !important;
    grid-row: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
  }

  .table-toolbar .toolbar-left > .table-search {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .table-toolbar .toolbar-left > .table-filter-summary {
    grid-column: 4 !important;
    grid-row: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-self: stretch !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 36px !important;
    padding: 0 12px !important;
    border: 1px solid var(--line) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.84) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 0.7rem !important;
  }

  .table-toolbar .toolbar-left > .toolbar-extras {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
  }

  .table-toolbar .toolbar-right > .table-meta {
    display: none !important;
  }

  .table-toolbar .ghost-button,
  .table-toolbar .filter-chip,
  .table-toolbar .toolbar-right > .column-picker-desktop-shell .ghost-button,
  .table-toolbar .toolbar-left > [data-open-filters] {
    width: auto !important;
    max-width: max-content !important;
    min-width: 0 !important;
    min-height: 36px !important;
    padding: 6px 12px !important;
    font-size: 0.7rem !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 640px) {
  .table-toolbar {
    grid-template-columns: max-content max-content max-content minmax(0, 1fr) 34px !important;
    gap: 7px !important;
  }

  .table-toolbar .ghost-button,
  .table-toolbar .filter-chip,
  .table-toolbar .toolbar-right > .column-picker-desktop-shell .ghost-button,
  .table-toolbar .toolbar-left > [data-open-filters] {
    padding: 5px 11px !important;
    font-size: 0.67rem !important;
  }

  .table-toolbar .toolbar-right > [data-local-refresh] {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
  }

  .table-toolbar .toolbar-left > .table-filter-summary {
    min-height: 34px !important;
    padding-inline: 10px !important;
    font-size: 0.67rem !important;
  }
}

@media (max-width: 430px) {
  .table-toolbar {
    grid-template-columns: max-content max-content max-content minmax(0, 1fr) 32px !important;
    gap: 6px !important;
  }

  .table-toolbar .ghost-button,
  .table-toolbar .filter-chip,
  .table-toolbar .toolbar-right > .column-picker-desktop-shell .ghost-button,
  .table-toolbar .toolbar-left > [data-open-filters] {
    padding-inline: 10px !important;
    font-size: 0.64rem !important;
  }

  .table-toolbar .toolbar-right > [data-local-refresh] {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
  }

  .table-toolbar .toolbar-left > .table-filter-summary {
    min-height: 32px !important;
    padding-inline: 9px !important;
    font-size: 0.64rem !important;
  }

  .table-toolbar .toolbar-right > .column-picker-desktop-shell .column-picker-panel {
    top: 104px !important;
    left: 10px !important;
    right: 10px !important;
    max-height: min(30vh, 210px) !important;
    padding: 10px !important;
  }
}


.history-screen {
  display: grid;
}

.history-screen.history-screen--picker-only {
  height: calc(100vh - 178px);
  max-height: calc(100vh - 178px);
  min-height: calc(100vh - 178px);
  align-content: stretch;
  overflow: hidden;
  border-radius: var(--radius-xl);
}

.history-screen.history-screen--picker-only .history-selector-card {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  overflow: hidden;
}

.history-screen.history-screen--picker-only .history-space-search {
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.history-screen.history-screen--picker-only [data-history-space-results-container] {
  min-height: 0;
}

.history-screen.history-screen--picker-only .history-space-results {
  max-height: none;
  min-height: 0;
  height: 100%;
}

.history-shell-card {
  display: grid;
  gap: 22px;
  padding: 24px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(250, 249, 249, 0.94));
  border: 1px solid rgba(43, 40, 40, 0.08);
  box-shadow: var(--shadow-soft);
}

.history-header-card,
.history-toolbar,
.point-history-grid,
.history-kpi-grid,
.history-stat-grid,
.history-state-grid {
  display: grid;
}

.history-header-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.history-header-card h3,
.history-card-head h4 {
  margin: 0;
  color: #2B2828;
}

.history-meta {
  margin: 8px 0 0;
  color: rgba(43, 40, 40, 0.72);
}

.history-header-actions,
.history-toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.history-toolbar {
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: end;
}

.history-period-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.history-period-field select {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(43, 40, 40, 0.14);
  background: rgba(255, 255, 255, 0.92);
}

.history-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.history-kpi-card,
.history-stat-card,
.history-state-card {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(43, 40, 40, 0.08);
}

.history-kpi-card span,
.history-stat-card span,
.history-state-card span,
.history-state-card small {
  display: block;
  color: var(--muted);
}

.history-kpi-card strong,
.history-stat-card strong,
.history-state-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
  color: #2B2828;
}

.history-aggregation-note,
.table-section-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(237, 102, 95, 0.1);
  color: #585252;
  border: 1px solid rgba(237, 102, 95, 0.12);
}

.table-history-button {
  min-width: min(320px, 100%);
}

.point-history-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.point-history-grid.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.history-chart-card {
  display: grid;
  gap: 18px;
  padding: 20px;
  border-radius: 24px;
  background: rgba(252, 251, 251, 0.92);
  border: 1px solid rgba(43, 40, 40, 0.08);
}

.history-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.point-history-chart-wrap {
  overflow-x: auto;
}

.point-history-chart-svg {
  width: 100%;
  min-width: 640px;
  height: auto;
  display: block;
}

.history-axis-labels text {
  fill: rgba(43, 40, 40, 0.72);
  font-size: 12px;
}

.history-grid-line {
  stroke: rgba(43, 40, 40, 0.08);
  stroke-width: 1;
}

.history-zero-line {
  stroke: rgba(199, 74, 69, 0.35);
  stroke-width: 1.4;
  stroke-dasharray: 6 6;
}

.history-line-path {
  fill: none;
  stroke: #585252;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-line-path.is-step {
  stroke: var(--series-color, #585252);
}

.history-range-band {
  fill: rgba(237, 102, 95, 0.14);
  stroke: none;
}

.history-point-marker {
  fill: #f1a208;
  stroke: #ffffff;
  stroke-width: 1.6;
}

.history-stat-grid,
.history-state-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.point-history-chart-empty,
.history-state-empty {
  padding: 28px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .history-header-card,
  .history-header-card-inline {
    grid-template-columns: 1fr;
  }

  .history-period-field {
    width: 100%;
  }

  .point-history-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .history-shell-card {
    padding: 18px;
  }

  .history-header-card,
  .history-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-toolbar-actions {
    justify-content: stretch;
  }

  .history-toolbar-actions .ghost-button,
  .history-toolbar-actions .primary-button,
  .table-history-button {
    width: 100%;
  }

  .point-history-chart-svg {
    min-width: 560px;
  }
}


.point-history-access-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(237, 102, 95, 0.12), rgba(255, 255, 255, 0.94));
  border: 1px solid rgba(237, 102, 95, 0.16);
}

.point-history-access-copy {
  display: grid;
  gap: 4px;
}

.point-history-access-copy strong {
  color: #2B2828;
}

.point-history-access-copy span:last-child {
  color: var(--muted);
  line-height: 1.45;
}

.point-history-access-button,
.table-history-button {
  min-width: 220px;
}

/* Playbook da IA (PLAYBOOK-0) — site detail drawer, single-selection only.
   Built exclusively with the dashboard's existing CSS custom properties
   (--panel/--surface-strong/--text/--muted/--line/--shadow-soft), which
   this deployment already flips under :root[data-theme="dark"] — so this
   card follows the active theme automatically, light and dark. */
.site-playbook-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  margin: 4px 0 16px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.site-playbook-header {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-playbook-header strong {
  color: var(--text);
  font-size: 0.95rem;
}

.site-playbook-meta {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.site-playbook-loading,
.site-playbook-content.is-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 10px 0;
}

.site-playbook-content {
  max-height: 340px;
  overflow-y: auto;
  border-radius: 14px;
  background: var(--surface-soft, var(--surface));
  border: 1px solid var(--line);
  padding: 12px 14px;
}

.site-playbook-markdown {
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}

.site-playbook-actions,
.site-playbook-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.site-playbook-textarea {
  width: 100%;
  min-height: 260px;
  max-height: 60vh;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  line-height: 1.55;
  padding: 12px 14px;
}

.site-playbook-textarea:focus-visible {
  outline: 2px solid var(--brand-deep, #ED665F);
  outline-offset: 1px;
}

.site-playbook-textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.site-playbook-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #b3261e;
  background: rgba(179, 38, 30, 0.08);
  border: 1px solid rgba(179, 38, 30, 0.22);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.site-playbook-history {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.site-playbook-history-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.site-playbook-history-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.site-playbook-history-version {
  font-weight: 700;
  color: var(--text);
}

/* Card "Grupos associados" embutido no editor de Regras — antiga tela de
   Rotas, agora configurada direto na edição da própria regra. Reaproveita a
   mesma linguagem visual do .site-playbook-card acima. */
.rule-routes-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  margin: 4px 0 16px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.rule-routes-header {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rule-routes-header strong {
  color: var(--text);
  font-size: 0.95rem;
}

.rule-routes-empty,
.rule-routes-hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 4px 0;
}

/* Linha do tempo de escalonamento no topo do card "Grupos associados" -
   mostra todos os níveis já configurados, do mais baixo ao mais alto, com
   o tempo desde a abertura do alarme. Sem limite de quantos níveis cabem
   aqui - cresce naturalmente conforme mais grupos são associados. */
.rule-routes-timeline {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.rule-routes-timeline-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rule-routes-timeline-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rule-routes-timeline-step {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--bg-elevated, var(--surface));
  border: 1px solid var(--line);
  min-width: 96px;
}

.rule-routes-timeline-step strong {
  font-size: 0.78rem;
  color: var(--text);
}

.rule-routes-timeline-name {
  font-size: 0.72rem;
  color: var(--muted);
}

.rule-routes-timeline-time {
  font-size: 0.7rem;
  color: var(--brand-deep, var(--primary));
  font-weight: 700;
}

.rule-routes-timeline-arrow {
  color: var(--muted);
  font-weight: 700;
}

/* Referência de níveis já configurados, dentro do formulário de associar
   novo grupo - fica visível enquanto o usuário decide o delay do PRÓXIMO
   nível, pra não repetir por engano o mesmo número em todos (o delay é
   sempre "desde a abertura", não "desde o nível anterior"). */
.rule-routes-existing-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px dashed var(--line);
}

.rule-routes-existing-level-item {
  font-size: 0.76rem;
  color: var(--text);
  background: var(--bg-elevated, var(--surface));
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

.rule-routes-list {
  display: grid;
  gap: 10px;
}

.rule-routes-row {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-soft, var(--surface));
  border: 1px solid var(--line);
  transition: opacity 0.15s ease;
}

.rule-routes-row.is-saving {
  opacity: 0.6;
  pointer-events: none;
}

.rule-routes-row-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.rule-routes-row-group {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
}

.rule-routes-row-meta {
  color: var(--muted);
  font-size: 0.76rem;
}

.rule-routes-row-fields,
.rule-routes-add-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.rule-routes-field {
  display: grid;
  gap: 4px;
  min-width: 96px;
}

.rule-routes-field span {
  color: var(--muted);
  font-size: 0.72rem;
}

.rule-routes-input {
  width: 100%;
  min-width: 0;
}

/* Badge somente leitura mostrando o nível de escalonamento herdado do grupo
   (não é mais um campo editável aqui - edita-se no próprio grupo). */
.rule-routes-level-badge {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: help;
}

.rule-routes-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 0.8rem;
  white-space: nowrap;
}

.rule-routes-row-fields .icon-button {
  margin-left: auto;
  width: 34px;
  height: 34px;
}

.rule-routes-add-form {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-soft, var(--surface));
  border: 1px dashed var(--line);
}

.rule-routes-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.rule-routes-error {
  color: #b3261e;
  background: rgba(179, 38, 30, 0.08);
  border: 1px solid rgba(179, 38, 30, 0.22);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.surgical-rooms-mini-popover-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 2px;
}

.surgical-rooms-mini-history-access-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  height: 32px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  color: color-mix(in srgb, var(--muted) 86%, var(--text));
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.surgical-rooms-mini-history-access-button svg {
  width: 14px;
  height: 14px;
  display: block;
  flex: 0 0 auto;
}

.surgical-rooms-mini-history-access-button:hover {
  background: color-mix(in srgb, rgba(237, 102, 95, 0.14) 72%, var(--surface-strong));
  border-color: color-mix(in srgb, rgba(237, 102, 95, 0.34) 78%, var(--line));
  color: color-mix(in srgb, #585252 78%, var(--text));
}

.surgical-rooms-mini-history-access-button:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, rgba(237, 102, 95, 0.42) 80%, var(--line));
  box-shadow: 0 0 0 3px rgba(237, 102, 95, 0.16);
  color: color-mix(in srgb, #585252 82%, var(--text));
}

body.editor-active .content-column {
  transition: padding-right 0.24s ease;
}

@media (min-width: 1360px) {
  body.editor-active .content-column {
    padding-right: min(688px, 48vw);
  }
}

.history-shell-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(250, 249, 249, 0.96));
  border: 1px solid rgba(43, 40, 40, 0.08);
  box-shadow: var(--shadow-soft);
}

.history-header-card,
.history-toolbar,
.point-history-grid {
  display: grid;
}

.history-header-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.history-header-card-inline {
  align-items: center;
}

.history-card-head h4 {
  margin: 0;
  color: #2B2828;
}

.history-toolbar {
  justify-content: end;
}

.history-toolbar-right {
  grid-template-columns: minmax(220px, 280px);
  justify-content: end;
}

.history-period-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.history-period-field select {
  min-height: 40px;
  width: 100%;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid rgba(43, 40, 40, 0.14);
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.86rem;
}

.table-section-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(237, 102, 95, 0.1);
  border: 1px solid rgba(237, 102, 95, 0.14);
  color: #585252;
}

/* Keep the two multi-line sidebar items taller than the default nav buttons. */
.sidebar-nav .nav-item[data-section="serviceMonitor"],
.sidebar-nav .nav-item[data-section="alarms"] {
  min-height: 52px !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  align-items: flex-start;
}

.sidebar-nav .nav-item[data-section="serviceMonitor"] .nav-item-main,
.sidebar-nav .nav-item[data-section="alarms"] .nav-item-main {
  min-height: 100%;
  align-content: center;
}

.sidebar-nav .nav-item[data-section="serviceMonitor"] .nav-item-meta,
.sidebar-nav .nav-item[data-section="alarms"] .nav-item-meta {
  margin-top: 6px !important;
  padding-right: 10px !important;
}

.point-history-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.history-chart-card {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
  background: rgba(252, 251, 251, 0.94);
  border: 1px solid rgba(43, 40, 40, 0.08);
}

.history-chart-card.is-loading {
  overflow: hidden;
}

.history-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.history-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.history-legend-row.is-loading {
  opacity: 0.4;
}

.history-legend-item {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(43, 40, 40, 0.12);
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition: opacity 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.history-legend-item.is-muted {
  opacity: 0.45;
}

.history-legend-item.is-muted .history-legend-label {
  text-decoration: line-through;
}

.history-legend-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.history-legend-item:hover,
.history-legend-item:focus-visible {
  border-color: rgba(88, 82, 82, 0.34);
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px);
}

.history-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--series-color, #585252);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--series-color, #585252) 16%, transparent);
  flex: 0 0 auto;
}

.history-legend-label {
  color: #2B2828;
  font-weight: 700;
  min-width: 0;
}

.history-legend-visibility {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  min-width: 22px;
  color: rgba(43, 40, 40, 0.68);
  font-size: 0.95rem;
  line-height: 1;
  flex: 0 0 auto;
}

.history-legend-item.is-muted .history-legend-visibility {
  color: rgba(43, 40, 40, 0.44);
}

.history-legend-empty,
.point-history-chart-empty {
  padding: 24px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  text-align: center;
}

.point-history-chart-wrap {
  position: relative;
  overflow-x: auto;
  padding-right: 6px;
}

.point-history-plotly {
  width: 100%;
  min-width: 680px;
  min-height: 340px;
  cursor: default;
}

.point-history-chart-svg {
  width: 100%;
  min-width: 680px;
  height: auto;
  display: block;
}

.history-band-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.history-band-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(43, 40, 40, 0.1);
  background: rgba(255, 255, 255, 0.82);
  color: #443E3E;
  font-size: 0.84rem;
  font-weight: 700;
}

.history-band-legend-swatch {
  width: 18px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid var(--band-color, rgba(191, 50, 43, 0.32));
  background: var(--band-fill, rgba(191, 50, 43, 0.14));
  flex: 0 0 auto;
}

.history-chart-hitbox {
  cursor: crosshair;
}

.history-axis-labels text {
  fill: rgba(43, 40, 40, 0.72);
  font-size: 12px;
}

.history-grid-line {
  stroke: rgba(43, 40, 40, 0.08);
  stroke-width: 1;
}

.history-grid-line-vertical {
  stroke-dasharray: 4 8;
}

.history-zero-line {
  stroke: rgba(199, 74, 69, 0.4);
  stroke-width: 1.4;
  stroke-dasharray: 6 6;
}

.history-range-band {
  fill: color-mix(in srgb, var(--series-color, #5ea76a) 18%, rgba(119, 201, 134, 0.18));
  pointer-events: none;
}

.history-range-line {
  stroke: color-mix(in srgb, var(--series-color, #5ea76a) 58%, #255b31);
  stroke-width: 1.4;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

.history-line-path {
  fill: none;
  stroke: var(--series-color, #585252);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-hover-line {
  stroke: rgba(43, 40, 40, 0.38);
  stroke-width: 1.3;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

.point-history-plotly .hoverlayer .hovertext rect {
  fill: #ffffff !important;
  fill-opacity: 1 !important;
  stroke: #dcdcdc !important;
  stroke-opacity: 1 !important;
}

.point-history-plotly .hoverlayer .hovertext text {
  fill: #111111 !important;
}

.history-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  border-radius: inherit;
  background: rgba(252, 251, 251, 0.76);
  backdrop-filter: blur(5px);
  color: #585252;
  font-weight: 700;
}

.history-loading-spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(88, 82, 82, 0.18);
  border-top-color: #585252;
  animation: spin 0.8s linear infinite;
}

.history-compact-stats {
  display: grid;
  gap: 8px;
}

.history-series-disclosure {
  border-top: 1px solid rgba(43, 40, 40, 0.08);
  padding-top: 8px;
}

.history-series-disclosure.is-muted {
  opacity: 0.52;
}

.history-series-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.history-series-summary::-webkit-details-marker {
  display: none;
}

.history-series-summary-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  color: rgba(43, 40, 40, 0.68);
  font-size: 0.78rem;
  flex: 0 0 auto;
}

.history-series-summary-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.history-series-visibility-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(43, 40, 40, 0.78);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}

.history-series-visibility-button.is-off {
  color: rgba(43, 40, 40, 0.46);
}

.history-series-summary-toggle::before {
  content: "▼";
  transition: transform 0.18s ease;
}

:root[data-theme="dark"] .history-screen .history-series-summary-toggle {
  color: var(--text-primary) !important;
}

.history-series-disclosure[open] .history-series-summary-toggle::before {
  content: "▲";
}

.history-series-body {
  display: grid;
  gap: 6px;
  padding: 8px 0 0 22px;
}

.history-compact-stat-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #2B2828;
  font-weight: 700;
  font-size: 0.92rem;
}

.history-compact-stat-values {
  color: rgba(43, 40, 40, 0.74);
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}

.history-compact-stat-values.is-subtle {
  color: rgba(43, 40, 40, 0.58);
}

:root[data-theme="dark"] .history-screen .history-compact-stat-values,
:root[data-theme="dark"] .history-screen .history-compact-stat-values.is-subtle {
  color: var(--text-primary) !important;
}

@media (max-width: 1359px) {
  body.editor-active .content-column {
    padding-right: 0;
  }
}

@media (max-width: 1100px) {
  .history-header-card,
  .history-header-card-inline,
  .point-history-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-period-field {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .point-history-access-card,
  .history-header-card,
  .history-toolbar-right {
    grid-template-columns: minmax(0, 1fr);
  }

  .point-history-access-button,
  .table-history-button {
    width: 100%;
  }

  .history-shell-card {
    padding: 18px;
  }

  .point-history-chart-svg {
    min-width: 560px;
  }
}


.history-multi-stack {
  display: grid;
  gap: 14px;
}

.history-section-card {
  gap: 14px;
}

.history-section-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.history-section-header.history-section-header-actions-only {
  grid-template-columns: minmax(0, 1fr);
}

.history-section-header-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.history-section-header-copy h3 {
  margin: 0;
  color: #2B2828;
}

.history-section-order {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(88, 82, 82, 0.1);
  color: #585252;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: stretch;
}

.history-section-header.history-section-header-actions-only .history-section-actions {
  width: 100%;
  justify-content: stretch;
}

.history-section-actions .history-period-field {
  flex: 0 1 142px;
  min-width: 142px;
  max-width: 142px;
  margin-right: auto;
}

.history-section-header.history-section-header-actions-only .history-section-actions .history-period-field {
  flex: 0 1 142px;
  min-width: min(100%, 142px);
  max-width: 142px;
}

.history-section-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.history-environment-card {
  display: grid;
  gap: 14px;
}

.history-environment-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.history-environment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
}

.history-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 135;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  padding: 76px 14px 12px;
  background: rgba(17, 16, 16, 0.42);
  backdrop-filter: blur(10px);
}

.history-picker-dialog {
  width: min(78rem, calc(100vw - clamp(1.75rem, 4.5vw, 7rem)));
  max-width: calc(100vw - 1.75rem);
  height: 100%;
  min-height: 0;
  display: grid;
  gap: 14px;
}

.history-picker-dialog.history-selector-card {
  height: 100%;
  min-height: 0;
  padding: 14px 16px 16px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.history-selector-card,
.history-selector-header,
.history-selector-copy,
.history-space-search,
.history-space-results {
  display: grid;
}

.history-selector-card {
  gap: 12px;
  width: 100%;
  min-width: 0;
  max-width: none;
  justify-self: stretch;
}

.history-selector-header {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.history-selector-copy {
  gap: 4px;
}

.history-selector-copy h3,
.history-selector-copy p {
  margin: 0;
}

.history-selector-copy h3 {
  color: #2B2828;
}

.history-selector-copy p {
  color: rgba(43, 40, 40, 0.72);
}

.history-space-search {
  gap: 8px;
}

.history-picker-dialog .history-space-search {
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.history-picker-dialog [data-history-space-results-container] {
  min-height: 0;
}

.history-space-search-field {
  position: relative;
}

.history-space-search-input {
  min-height: 42px;
  padding: 0 40px 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(43, 40, 40, 0.14);
  background: rgba(255, 255, 255, 0.96);
  color: #2B2828;
  font: inherit;
  width: 100%;
  box-sizing: border-box;
}

.history-space-search-clear {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(43, 40, 40, 0.64);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.history-space-results {
  gap: 6px;
  max-height: min(420px, 60vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 4px;
  align-content: start;
}

.history-picker-dialog .history-space-results {
  max-height: none;
  height: 100%;
  min-height: 0;
  padding-right: 6px;
}

.history-period-limit-note {
  align-self: end;
  color: rgba(43, 40, 40, 0.72);
  font-size: 0.78rem;
  line-height: 1.35;
}

.history-space-results-empty {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  color: rgba(43, 40, 40, 0.66);
}

.history-space-option {
  appearance: none;
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(43, 40, 40, 0.1);
  background: rgba(255, 255, 255, 0.84);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.history-space-option strong {
  color: #2B2828;
}

.history-space-option span {
  color: rgba(43, 40, 40, 0.68);
  font-size: 0.92rem;
}

.history-space-option:hover,
.history-space-option:focus-visible,
.history-space-option.is-active {
  border-color: rgba(88, 82, 82, 0.28);
  background: rgba(248, 247, 247, 0.96);
  transform: translateY(-1px);
}

.history-selector-summary {
  margin-top: -4px;
}

.history-summary-chip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(43, 40, 40, 0.08);
  color: rgba(43, 40, 40, 0.76);
  line-height: 1.25;
  overflow: visible;
  word-break: break-word;
  font-size: 0.9rem;
}

.history-summary-chip strong {
  color: #2B2828;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.history-summary-chip-value {
  display: block;
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.2;
}

.history-summary-chip.is-period .history-summary-chip-value {
  font-size: 0.86rem;
}

.history-section-actions .ghost-button,
.history-section-actions .primary-button,
.point-history-footer-actions .primary-button,
.history-selector-header .ghost-button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 0.88rem;
}

.history-normal-band-toggle.is-active {
  border-color: rgba(94, 167, 106, 0.44);
  background: rgba(236, 248, 238, 0.96);
  color: #255b31;
}

.point-history-footer-actions {
  display: flex;
  justify-content: center;
}

.point-history-footer-actions .primary-button {
  min-width: min(320px, 100%);
}

.point-history-picker-banner {
  justify-content: space-between;
  gap: 16px;
  text-align: left;
}

.point-history-picker-banner-copy {
  display: grid;
  gap: 6px;
}

.point-history-picker-banner-copy strong {
  color: #2B2828;
}

.point-history-picker-banner-copy span {
  color: rgba(43, 40, 40, 0.74);
}

.point-history-period-dialog {
  max-width: min(680px, calc(100vw - 32px));
}

.point-history-period-card {
  gap: 18px;
}

.point-history-period-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.point-history-period-grid input {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(43, 40, 40, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: #2B2828;
}

.point-history-access-card.is-picker {
  background: linear-gradient(135deg, rgba(43, 40, 40, 0.08), rgba(237, 102, 95, 0.16));
}

@media (max-width: 1100px) {
  .history-section-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-section-actions {
    justify-content: stretch;
  }

  .history-selector-header {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .history-section-actions,
  .point-history-period-grid,
  .point-history-picker-banner {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-section-actions {
    display: grid;
  }

  .history-section-actions .ghost-button,
  .history-section-actions .primary-button,
  .history-section-actions .history-period-field,
  .point-history-picker-banner .ghost-button,
  .point-history-footer-actions .primary-button {
    width: 100%;
  }

  .history-section-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-environment-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-picker-modal {
    padding: 10px;
    align-items: flex-end;
  }

  .history-picker-dialog {
    width: 100%;
    max-width: 100%;
    height: min(78vh, calc(100dvh - 20px));
  }

  .history-picker-dialog.history-selector-card {
    border-radius: 22px;
    padding: 14px;
  }
}

.history-report-dialog {
  max-width: min(1220px, calc(100vw - 32px));
}

.history-report-header {
  align-items: center;
}

.history-report-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-report-body {
  max-height: min(78vh, 920px);
  overflow: auto;
  background:
    radial-gradient(circle at top left, rgba(237, 102, 95, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(249, 248, 248, 0.94), rgba(241, 241, 241, 0.92));
}

.history-report-document {
  display: grid;
  gap: 22px;
  padding: 8px 4px;
}

.history-report-cover,
.history-report-section,
.history-report-footer {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(43, 40, 40, 0.1);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 18px 46px rgba(43, 40, 40, 0.08);
}

.history-report-kicker {
  margin: 0 0 6px;
  color: #766C6C;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-report-logo-wrap {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.history-report-logo {
  max-width: 180px;
  max-height: 64px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.history-report-cover h2,
.history-report-section h4 {
  margin: 0;
  color: #2B2828;
}

.history-report-identification {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 14px;
  margin-top: 18px;
  color: #4D4747;
  font-size: 0.94rem;
}

.history-report-section {
  display: grid;
  gap: 18px;
}

.history-report-section-head p {
  margin: 6px 0 0;
  color: #766C6C;
}

.history-report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.history-report-kpi-card,
.history-report-table-card,
.history-report-chart-card,
.history-report-score-card {
  border-radius: 20px;
  border: 1px solid rgba(43, 40, 40, 0.09);
  background: rgba(251, 251, 251, 0.98);
  padding: 18px;
}

.history-report-kpi-card {
  display: grid;
  gap: 8px;
}

.history-report-kpi-card span,
.history-report-kpi-card small {
  color: #766C6C;
}

.history-report-kpi-card strong {
  color: #2B2828;
  font-size: 1.7rem;
  line-height: 1.05;
}

.history-report-score-card {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 220px;
  background: linear-gradient(135deg, #585252 0%, #EA4F47 100%);
  border-color: transparent;
}

.history-report-score-card span,
.history-report-score-card small {
  color: rgba(255, 255, 255, 0.82);
}

.history-report-score-card strong {
  color: #fff;
  font-size: 3rem;
  line-height: 1;
}

.history-report-section-grid,
.history-report-two-columns {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.history-report-two-columns {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.history-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.history-report-table thead th {
  color: #766C6C;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-report-table th,
.history-report-table td {
  padding: 11px 0;
  border-bottom: 1px solid rgba(43, 40, 40, 0.08);
  text-align: left;
}

.history-report-table tbody tr:last-child th,
.history-report-table tbody tr:last-child td {
  border-bottom: none;
}

.history-report-chart-shell {
  display: grid;
  gap: 14px;
}

.report-pdf-timeline-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px 14px;
  margin-top: 2px;
  color: #676060;
  font-size: 0.74rem;
  line-height: 1.2;
}

.report-pdf-timeline-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.report-pdf-timeline-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--timeline-legend-color, #2f9e44);
  flex: 0 0 auto;
}

.history-report-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.history-report-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4D4747;
  font-size: 0.88rem;
}

.history-report-chart-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--report-series-color, #585252);
  display: inline-block;
}

.history-report-chart-svg {
  width: 100%;
  display: block;
}

.history-report-grid-line {
  stroke: rgba(43, 40, 40, 0.08);
  stroke-width: 1;
}

.history-report-axis-label {
  fill: #766C6C;
  font-size: 11px;
}

.history-report-series-line {
  fill: none;
  stroke: var(--report-series-color, #585252);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-report-chart-empty {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(43, 40, 40, 0.15);
  color: #766C6C;
  text-align: center;
}

.history-report-insights {
  margin: 0;
  padding: 18px 20px;
  border-left: 4px solid #585252;
  border-radius: 18px;
  background: rgba(241, 241, 241, 0.95);
  color: #353030;
  line-height: 1.65;
}

.history-report-footer {
  gap: 6px;
  color: #766C6C;
  font-size: 0.9rem;
}

.history-compare-dialog {
  max-width: min(1380px, calc(100vw - 28px));
}

.history-compare-header {
  align-items: center;
}

.history-compare-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-compare-body {
  max-height: min(82vh, 980px);
  overflow: auto;
  background:
    radial-gradient(circle at top left, rgba(237, 102, 95, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(249, 248, 248, 0.96), rgba(242, 242, 242, 0.94));
}

.history-compare-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.history-compare-panel,
.history-compare-results {
  min-height: 0;
  border-radius: 24px;
  border: 1px solid rgba(43, 40, 40, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 40px rgba(43, 40, 40, 0.08);
}

.history-compare-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.history-compare-results {
  display: grid;
  gap: 14px;
  padding: 18px;
  align-content: start;
  overflow: auto;
}

.history-compare-panel-head,
.history-compare-results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 0;
}

.history-compare-panel-head h4,
.history-compare-results-head h4,
.history-compare-origin-head h5,
.history-compare-chart-card h5 {
  margin: 0;
  color: #2B2828;
}

.history-compare-panel-head p,
.history-compare-results-head p,
.history-compare-origin-head p,
.history-compare-chart-card p,
.history-compare-empty p,
.history-compare-inline-state p {
  margin: 4px 0 0;
  color: #766C6C;
}

.history-compare-panel-body {
  min-height: 0;
  overflow: auto;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.history-compare-origin-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(43, 40, 40, 0.08);
  background: linear-gradient(180deg, rgba(253, 252, 252, 0.98), rgba(248, 248, 248, 0.96));
}

.history-compare-origin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.history-compare-origin-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(88, 82, 82, 0.08);
  color: #585252;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.history-compare-series-list {
  display: grid;
  gap: 8px;
}

.history-compare-series-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(43, 40, 40, 0.08);
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease, transform 160ms ease;
}

.history-compare-series-row:hover,
.history-compare-series-row:focus-visible {
  border-color: rgba(88, 82, 82, 0.24);
  box-shadow: 0 10px 24px rgba(43, 40, 40, 0.08);
  background: rgba(255, 255, 255, 0.98);
  transform: translateY(-1px);
  outline: none;
}

.history-compare-series-row.is-selected {
  border-color: rgba(88, 82, 82, 0.3);
  background: linear-gradient(180deg, rgba(247, 247, 247, 0.98), rgba(251, 251, 251, 0.98));
  box-shadow: 0 14px 28px rgba(88, 82, 82, 0.12);
}

.history-compare-series-row input {
  margin-top: 3px;
  pointer-events: none;
}

.history-compare-series-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.history-compare-series-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.history-compare-series-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #554E4E;
  background: rgba(88, 82, 82, 0.08);
}

.history-compare-series-type.is-digital {
  color: #8b5e1f;
  background: rgba(245, 158, 11, 0.12);
}

.history-compare-series-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: #766C6C;
  font-size: 0.82rem;
}

.history-compare-summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-compare-summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(43, 40, 40, 0.06);
  color: #443F3F;
  font-size: 0.78rem;
  font-weight: 600;
}

.history-compare-chart-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(43, 40, 40, 0.08);
  background: rgba(251, 251, 251, 0.98);
}

.history-compare-chart-shell {
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(43, 40, 40, 0.06);
  background: rgba(255, 255, 255, 0.92);
  overflow: visible;
}

.history-compare-plot {
  width: 100%;
  min-height: 320px;
}

.history-compare-series-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.history-compare-series-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(43, 40, 40, 0.08);
  background: rgba(255, 255, 255, 0.94);
}

.history-compare-series-card strong {
  color: #2B2828;
}

.history-compare-series-card span,
.history-compare-series-card small {
  color: #766C6C;
}

.history-compare-inline-state,
.history-compare-empty {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(43, 40, 40, 0.15);
  background: rgba(255, 255, 255, 0.88);
  color: #413C3C;
}

.history-compare-inline-state strong,
.history-compare-empty strong {
  color: #2B2828;
}

.history-compare-inline-state.is-error {
  border-style: solid;
  border-color: rgba(184, 35, 24, 0.18);
  background: rgba(255, 242, 240, 0.96);
}

@media (max-width: 1100px) {
  .history-compare-panel {
    max-height: min(48vh, 520px);
  }
}

@media (max-width: 760px) {
  .history-compare-dialog {
    max-width: calc(100vw - 12px);
  }

  .history-compare-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .history-compare-body {
    max-height: min(84vh, 940px);
  }

  .history-compare-panel-head,
  .history-compare-results-head,
  .history-compare-panel-body,
  .history-compare-results {
    padding-left: 14px;
    padding-right: 14px;
  }

  .history-compare-series-row {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 11px 12px;
  }

  .history-compare-plot {
    min-height: 260px;
  }
}

@media (max-width: 560px) {
  .history-compare-header-actions {
    gap: 8px;
  }

  .history-compare-header-actions .primary-button {
    font-size: 0.82rem;
    padding-inline: 12px;
  }

  .history-compare-series-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  .history-report-section-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .history-report-dialog {
    max-width: calc(100vw - 12px);
  }

  .history-report-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .history-report-cover,
  .history-report-section,
  .history-report-footer {
    padding: 18px;
    border-radius: 20px;
  }

  .history-report-kpi-grid,
  .history-report-two-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

.report-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.10), transparent 28%),
    radial-gradient(circle at top right, rgba(88, 82, 82, 0.14), transparent 24%),
    linear-gradient(180deg, #F3F3F3 0%, #FAF9F9 42%, #F2F2F2 100%);
  color: #353030;
  font-family: "Manrope", "Segoe UI", sans-serif;
}

.report-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.report-topbar,
.report-hero-card,
.report-panel {
  border: 1px solid rgba(170, 162, 162, 0.24);
  box-shadow: 0 18px 48px rgba(30, 27, 27, 0.08);
}

.report-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
}

.report-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0f766e;
}

.report-topbar h1,
.report-hero-copy h2,
.report-panel h3 {
  margin: 0;
}

.report-subtitle {
  margin: 8px 0 0;
  color: #696060;
  font-size: 14px;
}

.report-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.report-status-card {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(197, 48, 48, 0.28);
  box-shadow: 0 18px 48px rgba(30, 27, 27, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

.report-status-card strong {
  font-size: 15px;
}

.report-status-card span {
  color: #696060;
  font-size: 14px;
}

.report-status-card.is-error {
  border-color: rgba(197, 48, 48, 0.28);
  background: rgba(255, 245, 245, 0.95);
}

.report-content {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.report-toolbar {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.report-page[data-export-mode="pdf"] .report-toolbar {
  display: none;
}

.report-close-button,
.report-export-button {
  border-color: #DFDDDD;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(30, 27, 27, 0.08);
}

.report-close-button {
  justify-content: flex-start;
}

.report-global-loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(240, 239, 239, 0.72);
  backdrop-filter: blur(4px);
}

.report-global-loading[hidden] {
  display: none !important;
}

.report-global-loading-card {
  width: min(520px, 100%);
  display: grid;
  gap: 16px;
  align-items: stretch;
  justify-items: stretch;
  padding: 22px 24px;
}

.report-global-loading-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.report-global-loading-head strong {
  display: block;
  color: #2B2828;
  font-size: 1rem;
}

.report-global-loading-head p {
  margin: 6px 0 0;
  color: rgba(43, 40, 40, 0.72);
  font-size: 0.92rem;
  line-height: 1.45;
}

.report-global-loading-percent {
  flex: 0 0 auto;
  color: #585252;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.report-global-loading-progress {
  position: relative;
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #E1DFDF;
  box-shadow: inset 0 0 0 1px rgba(88, 82, 82, 0.08);
}

.report-global-loading-progress-bar {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #ED665F;
}

.report-global-loading-copy {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #2B2828;
  font-size: 0.92rem;
}

.report-reference-document {
  max-width: 1120px;
  margin: 0 auto;
}

.report-reference-cover-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(240px, 320px);
  gap: 18px;
  align-items: stretch;
}

.report-reference-score-card {
  min-height: 100%;
}

.report-reference-section-grid {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
}

.report-reference-state-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.report-reference-chart-card {
  display: grid;
  gap: 12px;
}

.report-reference-chart-card h5 {
  margin: 0;
  color: #2B2828;
  font-size: 1rem;
}

.report-reference-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
  gap: 16px;
}

.report-reference-copy-card {
  display: grid;
  gap: 10px;
  color: #4D4747;
  line-height: 1.65;
}

.report-reference-copy-card p {
  margin: 0;
}

.history-report-section .report-metric-grid {
  margin-bottom: 0;
}

.history-report-section .report-metric-card {
  min-height: 0;
  padding: 18px;
  border-radius: 20px;
  border-color: rgba(43, 40, 40, 0.09);
  background: rgba(251, 251, 251, 0.98);
  box-shadow: none;
}

.history-report-section .report-metric-card strong {
  color: #2B2828;
  font-size: 1.7rem;
}

.history-report-section .report-metric-card span,
.history-report-section .report-metric-card small {
  color: #766C6C;
}

.history-report-section .report-chart-shell,
.history-report-section .report-chart {
  min-height: 320px;
}

.history-report-section .report-chart-shell-timeline,
.history-report-section .report-chart-timeline {
  min-height: 110px;
}

.report-page[data-export-mode="pdf"] {
  background: #F0EFEF;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.report-page[data-export-mode="pdf"] .report-shell {
  width: min(100% - 24px, 860px);
  padding: 16px 0 36px;
}

.report-page[data-export-mode="pdf"] .report-topbar {
  display: none;
}

.report-page[data-export-mode="pdf"] .report-content {
  gap: 16px;
  margin-top: 0;
}

.report-page[data-export-mode="pdf"] .report-reference-document {
  max-width: 820px;
  gap: 16px;
  padding: 0;
}

.report-page[data-export-mode="pdf"] .report-reference-page {
  display: block;
  padding: 12px;
  background: #fff;
  border: 1px solid #E1DEDE;
  box-shadow: 0 6px 22px rgba(30, 27, 27, 0.08);
  box-sizing: border-box;
  break-inside: auto;
  page-break-inside: auto;
  break-after: auto;
  page-break-after: auto;
}

.report-page[data-export-mode="pdf"] .history-report-section,
.report-page[data-export-mode="pdf"] .report-pdf-kpi-grid,
.report-page[data-export-mode="pdf"] .report-summary-grid,
.report-page[data-export-mode="pdf"] .report-pdf-timeline-row {
  break-inside: auto;
  page-break-inside: auto;
}

.report-page[data-export-mode="pdf"] .history-report-table-card,
.report-page[data-export-mode="pdf"] .history-report-chart-card,
.report-page[data-export-mode="pdf"] .report-pdf-ico-section,
.report-page[data-export-mode="pdf"] .report-period-banner,
.report-page[data-export-mode="pdf"] .report-diagnosis-banner,
.report-page[data-export-mode="pdf"] .report-summary-reference-bar,
.report-page[data-export-mode="pdf"] .report-summary-footnote,
.report-page[data-export-mode="pdf"] .report-metric-card,
.report-page[data-export-mode="pdf"] .report-pdf-kpi-grid > *,
.report-page[data-export-mode="pdf"] .report-summary-grid > *,
.report-page[data-export-mode="pdf"] .report-pdf-timeline-row,
.report-page[data-export-mode="pdf"] .report-occurrence-description,
.report-page[data-export-mode="pdf"] .report-occurrence-description-entry,
.report-page[data-export-mode="pdf"] .report-occurrence-item,
.report-page[data-export-mode="pdf"] .history-report-insights,
.report-page[data-export-mode="pdf"] .report-copy-block,
.report-page[data-export-mode="pdf"] .report-diagnosis-copy,
.report-page[data-export-mode="pdf"] .report-pdf-index-composition {
  break-inside: avoid-page;
  page-break-inside: avoid;
}

.report-page[data-export-mode="pdf"] .report-top-summary,
.report-page[data-export-mode="pdf"] .report-pdf-ico-section {
  break-inside: avoid-page;
  page-break-inside: avoid;
}

.report-page[data-export-mode="pdf"] .js-plotly-plot,
.report-page[data-export-mode="pdf"] .plot-container,
.report-page[data-export-mode="pdf"] .svg-container,
.report-page[data-export-mode="pdf"] .main-svg {
  width: 100% !important;
  max-width: 100% !important;
}

.report-page[data-export-mode="pdf"] .report-chart-shell,
.report-page[data-export-mode="pdf"] .report-chart {
  overflow: visible;
  break-inside: avoid-page;
  page-break-inside: avoid;
}

.report-page[data-export-mode="pdf"] .report-chart-shell-timeline,
.report-page[data-export-mode="pdf"] .report-chart-timeline {
  min-height: 118px;
}

.report-page[data-export-mode="pdf"] .history-report-section-head h4,
.report-page[data-export-mode="pdf"] .report-pdf-section-title,
.report-page[data-export-mode="pdf"] .report-pdf-chart-head h4,
.report-page[data-export-mode="pdf"] .report-inline-title,
.report-page[data-export-mode="pdf"] .report-summary-grid h5,
.report-page[data-export-mode="pdf"] .report-technical-block h5,
.report-page[data-export-mode="pdf"] .report-metric-card strong,
.report-page[data-export-mode="pdf"] .report-metric-card span,
.report-page[data-export-mode="pdf"] .report-metric-card small,
.report-page[data-export-mode="pdf"] .history-report-table th,
.report-page[data-export-mode="pdf"] .history-report-table td,
.report-page[data-export-mode="pdf"] .report-summary-footnote,
.report-page[data-export-mode="pdf"] .report-reference-page p {
  overflow: visible;
  line-height: 1.35;
}

.report-page[data-export-mode="pdf"] .report-occurrences-disclosure,
.report-page[data-export-mode="pdf"] .report-occurrences-table,
.report-page[data-export-mode="pdf"] .report-occurrence-description,
.report-page[data-export-mode="pdf"] .report-occurrence-description-entry {
  break-inside: auto;
  page-break-inside: auto;
}

.report-page[data-export-mode="pdf"] .report-occurrences-section,
.report-page[data-export-mode="pdf"] .report-occurrences-section .history-report-section-head,
.report-page[data-export-mode="pdf"] .report-occurrences-section .history-report-table-card,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrences-disclosure,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrences-content,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-table-wrap,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrences-table,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrences-table thead,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrences-table tbody,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrences-descriptions,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrence-description,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrence-description-body,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrence-description-entry {
  break-inside: auto;
  page-break-inside: auto;
}

.report-page[data-export-mode="pdf"] .report-occurrences-section .history-report-table-card,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrences-disclosure,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrences-content,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-table-wrap,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrences-descriptions {
  overflow: visible !important;
}

.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrences-table tr,
.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrence-item {
  break-inside: avoid-page;
  page-break-inside: avoid;
}

.report-page[data-export-mode="pdf"] .report-occurrences-section .report-occurrences-disclosure summary {
  break-after: avoid-page;
  page-break-after: avoid;
}

.report-page[data-export-mode="pdf"] .report-table-wrap,
.report-page[data-export-mode="pdf"] .report-occurrences-content,
.report-page[data-export-mode="pdf"] .report-occurrences-descriptions,
.report-page[data-export-mode="pdf"] .history-report-table-card,
.report-page[data-export-mode="pdf"] .history-report-chart-card,
.report-page[data-export-mode="pdf"] .history-report-section,
.report-page[data-export-mode="pdf"] .report-reference-page {
  overflow: visible !important;
}

.report-pdf-header {
  padding: 18px 20px;
  border: 1px solid rgba(211, 207, 207, 0.9);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(109, 100, 100, 0.08), rgba(255, 255, 255, 0) 40%),
    linear-gradient(180deg, #ffffff 0%, #FAF9F9 100%);
  box-shadow: 0 10px 22px rgba(35, 33, 33, 0.05);
}

.report-pdf-header-grid {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 112px;
  gap: 18px;
  align-items: center;
}

.report-pdf-header-logo {
  display: flex;
  align-items: center;
  min-height: 64px;
}

.report-pdf-header-logo.is-right {
  justify-content: flex-end;
}

.history-report-logo-fallback {
  display: inline-flex;
  align-items: center;
  min-height: 54px;
  max-width: 180px;
  font-weight: 700;
  color: #373333;
}

.report-pdf-brand-aacd {
  width: 54px;
  height: auto;
  display: block;
}

.report-pdf-title-stack {
  text-align: center;
  color: #373333;
}

.report-pdf-title-stack h2 {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.report-pdf-title-stack p {
  margin: 3px 0;
  font-size: 12px;
  line-height: 1.45;
}

.report-tk-brand {
  width: 82px;
  height: auto;
  display: block;
}

.report-reference-page .history-report-section {
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(43, 40, 40, 0.05);
  border: 1px solid #EEEDED;
  background: #fff;
  break-inside: avoid-page;
  page-break-inside: avoid;
}

.report-reference-page .report-top-summary {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #FBFBFB 100%);
  border: 1px solid #F3E5E4;
  box-shadow: 0 12px 28px rgba(43, 40, 40, 0.06);
}

.report-top-summary > .history-report-section,
.report-top-summary > .report-strategic-grid {
  margin: 0;
}

.report-top-summary > .history-report-section {
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  break-inside: auto;
  page-break-inside: auto;
}

.report-period-banner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: center;
  background: linear-gradient(180deg, #FDFDFD 0%, #F9F9F9 100%);
}

.report-period-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.report-period-copy span,
.report-summary-reference-bar strong,
.report-diagnosis-copy strong,
.report-pdf-index-composition strong {
  font-size: 11px;
  color: #575050;
}

.report-period-copy strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: #353131;
  line-height: 1.4;
}

.report-icon-chip,
.report-pdf-index-icon,
.report-executive-card-icon,
.report-icon-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.report-icon-chip {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #F5F4F4;
  color: #676060;
}

.report-icon-chip.is-info {
  background: #F5F4F4;
  color: #B62821;
}

.report-icon-chip svg,
.report-pdf-index-icon svg,
.report-executive-card-icon svg,
.report-icon-inline svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.report-strategic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.report-strategic-grid.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.report-reference-page .report-pdf-ico-section {
  position: relative;
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid #EFDEDD;
  border-left: 4px solid #ef7d32;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #FDFDFD 100%);
  box-shadow: 0 8px 18px rgba(43, 40, 40, 0.04);
}

.report-pdf-section-title,
.report-inline-title {
  margin: 0;
  color: #453F3F;
  font-size: 12px;
  font-weight: 700;
}

.report-pdf-ico-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.report-pdf-ico-main {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.report-pdf-index-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  color: #d9480f;
  background: linear-gradient(180deg, #fff5f2 0%, #fff1ec 100%);
}

.report-pdf-index-icon svg {
  width: 30px;
  height: 30px;
}

.report-pdf-index-icon.is-ok {
  color: #15803d;
  background: linear-gradient(180deg, #f1fbf4 0%, #e8f8ee 100%);
}

.report-pdf-index-icon.is-warning {
  color: #ea580c;
  background: linear-gradient(180deg, #fff7ed 0%, #fff1e6 100%);
}

.report-pdf-index-icon.is-critical {
  color: #dc2626;
  background: linear-gradient(180deg, #fff2f2 0%, #ffe9e9 100%);
}

.report-pdf-ico-copy strong {
  display: block;
  color: #2D2929;
  font-size: 15px;
  line-height: 1;
}

.report-pdf-ico-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.report-pdf-index-heading {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.report-pdf-index-title {
  margin: 0;
  color: #575050;
  font-size: 13px;
  line-height: 1.45;
}

.report-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: #F3F3F3;
  color: #4D4747;
  font-size: 12px;
  font-weight: 700;
  width: fit-content;
  max-width: 100%;
  white-space: normal;
  text-align: center;
}

.report-status-badge.is-ok {
  background: #edf8ef;
  color: #15803d;
}

.report-status-badge.is-warning {
  background: #fff3e9;
  color: #ea580c;
}

.report-status-badge.is-critical {
  background: #fff0f0;
  color: #dc2626;
}

.report-pdf-score-value {
  color: #2D2929;
  font-size: clamp(40px, 4.6vw, 54px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.report-pdf-ico-section.is-ok {
  border-left-color: #15803d;
}

.report-pdf-ico-section.is-warning {
  border-left-color: #ea580c;
}

.report-pdf-ico-section.is-critical {
  border-left-color: #dc2626;
}

.report-pdf-ico-band.is-ok strong,
.report-pdf-score-value.is-ok,
.report-ico-text.is-ok {
  color: #15803d;
}

.report-pdf-ico-band.is-warning strong,
.report-pdf-score-value.is-warning,
.report-ico-text.is-warning {
  color: #ea580c;
}

.report-pdf-ico-band.is-critical strong,
.report-pdf-score-value.is-critical,
.report-ico-text.is-critical {
  color: #dc2626;
}

.report-pdf-score-stack {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}

.report-pdf-index-description {
  margin: 0;
  color: #6A6262;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.report-pdf-index-composition {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  margin-top: 0;
  padding-top: 14px;
  border-top: 1px solid #EEEDED;
  color: #6A6262;
  font-size: 11px;
  line-height: 1.45;
  min-width: 0;
}

.report-pdf-index-composition span:last-child {
  overflow-wrap: anywhere;
}

.report-icon-inline {
  color: #635C5C;
}

.report-pdf-kpi-grid {
  display: grid;
  gap: 8px;
}

.report-pdf-kpi-grid.is-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-reference-page .report-metric-card {
  min-height: 0;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid #EBE9E9;
  background: #fff;
}

.report-reference-page .report-metric-card span,
.report-reference-page .report-metric-card small {
  font-size: 10px;
  color: #817878;
}

.report-reference-page .report-metric-card strong {
  font-size: 30px;
  color: #3A3636;
}

.report-reference-page .history-report-section-head h4,
.report-pdf-chart-head h4 {
  font-size: 13px;
  color: #453F3F;
}

.report-reference-page .history-report-section-head p,
.report-pdf-chart-head p {
  margin: 4px 0 0;
  font-size: 10px;
  color: #817878;
}

.report-reference-page .history-report-table-card,
.report-reference-page .history-report-chart-card {
  border-radius: 4px;
  padding: 10px;
  background: #fff;
  border: 1px solid #EBE9E9;
  break-inside: avoid-page;
  page-break-inside: avoid;
}

.report-reference-page .history-report-table,
.report-reference-page .history-report-table thead,
.report-reference-page .history-report-table tbody,
.report-reference-page .report-metric-card,
.report-reference-page .report-pdf-kpi-grid,
.report-reference-page .report-pdf-timeline-row,
.report-reference-page .js-plotly-plot,
.report-reference-page .plot-container,
.report-reference-page .svg-container {
  break-inside: auto;
  page-break-inside: auto;
}

.report-page[data-export-mode="pdf"] .history-report-table tr {
  break-inside: avoid-page;
  page-break-inside: avoid;
}

.report-page[data-export-mode="pdf"] .js-plotly-plot,
.report-page[data-export-mode="pdf"] .plot-container,
.report-page[data-export-mode="pdf"] .svg-container,
.report-page[data-export-mode="pdf"] .main-svg {
  break-inside: avoid-page;
  page-break-inside: avoid;
}

.report-page[data-export-mode="pdf"] .history-report-section-head,
.report-page[data-export-mode="pdf"] .report-inline-title,
.report-page[data-export-mode="pdf"] .report-pdf-chart-head {
  break-after: avoid;
  page-break-after: avoid;
}

.report-reference-page .history-report-table {
  font-size: 10px;
}

.report-reference-page .history-report-table thead th {
  font-size: 9px;
  color: #817878;
  letter-spacing: 0.04em;
}

.report-reference-page .history-report-table th,
.report-reference-page .history-report-table td {
  padding: 7px 0;
}

.report-table-emphasis {
  color: #d9480f;
  font-weight: 700;
}

.report-table-emphasis.is-below {
  color: #7e22ce;
}

.report-pdf-chart-head {
  text-align: center;
}

.report-pdf-timeline-stack {
  display: grid;
  gap: 14px;
}

.report-pdf-timeline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  width: 100%;
  margin-left: 0;
}

.report-pdf-timeline-row span {
  font-size: 10px;
  color: #635C5C;
  font-weight: 700;
  display: block;
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.report-summary-grid-executive {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.report-summary-grid-variable {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-summary-grid-executive.is-cag {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-summary-grid h5,
.report-technical-block h5 {
  margin: 0 0 6px;
  color: #453F3F;
  font-size: 11px;
}

.report-summary-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.report-summary-columns span {
  display: block;
  color: #817878;
  font-size: 10px;
}

.report-summary-columns strong {
  display: block;
  margin-top: 2px;
  color: #3A3636;
  font-size: 16px;
}

.report-summary-grid p,
.report-summary-footnote,
.report-technical-block p {
  margin: 6px 0 0;
  color: #6A6262;
  font-size: 10px;
  line-height: 1.45;
}

.report-technical-stack {
  display: grid;
  gap: 8px;
}

.report-executive-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid #F3E5E4;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #FDFDFD 100%);
}

.report-executive-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  color: #5E5656;
  background: linear-gradient(180deg, #F8F8F8 0%, #F4F3F3 100%);
}

.report-executive-card.is-ok .report-executive-card-icon {
  color: #15803d;
  background: linear-gradient(180deg, #effaf2 0%, #e5f7eb 100%);
}

.report-executive-card.is-warning .report-executive-card-icon {
  color: #0f766e;
  background: linear-gradient(180deg, #eefbfb 0%, #e1f6f5 100%);
}

.report-executive-card-icon.is-danger,
.report-executive-card.is-danger .report-executive-card-icon {
  color: #b42318;
  background: linear-gradient(180deg, #fff0ef 0%, #ffe4e1 100%);
}

.report-executive-card-icon.is-critical,
.report-executive-card.is-critical .report-executive-card-icon {
  color: #7c3aed;
  background: linear-gradient(180deg, #f4efff 0%, #ede5ff 100%);
}

.report-executive-card-copy span {
  display: block;
  font-size: 11px;
  color: #6D6464;
  line-height: 1.4;
}

.report-executive-card-copy strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  color: #302D2D;
  line-height: 1.15;
}

.report-executive-card-copy small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: #817878;
}

.report-top-summary > .report-diagnosis-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  background: linear-gradient(180deg, #FAF9F9 0%, #F7F6F6 100%);
  border-color: #FBDDDB;
  border-radius: 16px;
  padding: 14px 16px;
}

.report-diagnosis-copy p {
  margin: 4px 0 0;
  color: #5D5555;
  font-size: 12px;
  line-height: 1.55;
}

.report-summary-reference-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #F8E0DF;
  background: linear-gradient(180deg, #FDFDFD 0%, #F9F9F9 100%);
  color: #686060;
  font-size: 11px;
  line-height: 1.45;
}

.report-top-summary > .report-period-banner {
  padding: 12px 14px;
  border: 1px solid #EEEDED;
  border-radius: 16px;
}

.report-technical-block {
  padding: 0;
}

.report-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.7fr);
  gap: 18px;
  padding: 26px 28px;
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(88, 82, 82, 0.08), rgba(15, 118, 110, 0.06)),
    rgba(255, 255, 255, 0.92);
}

.report-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 18px;
  margin-top: 18px;
  font-size: 14px;
  color: #544D4D;
}

.report-ico-card {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 6px;
  min-height: 220px;
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(160deg, #353030 0%, #585252 45%, #0f766e 100%);
  color: #fff;
}

.report-ico-card span,
.report-ico-card small {
  color: rgba(255, 255, 255, 0.84);
}

.report-ico-card strong {
  font-size: clamp(48px, 7vw, 76px);
  line-height: 1;
}

.report-grid {
  display: grid;
  gap: 18px;
}

.report-drawer {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 30px;
  border: 1px solid rgba(170, 162, 162, 0.24);
  background: rgba(255, 255, 255, 0.48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.report-drawer-head h3 {
  margin: 0;
}

.report-grid-ico,
.report-grid-history,
.report-grid-failures,
.report-grid-humidity,
.report-grid-text {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-panel {
  padding: 24px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
}

.report-panel-drawer {
  display: grid;
  gap: 10px;
}

.report-panel-analysis {
  background:
    linear-gradient(135deg, rgba(88, 82, 82, 0.06), rgba(15, 118, 110, 0.05)),
    rgba(255, 255, 255, 0.94);
}

.report-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.report-inline-section {
  display: grid;
  gap: 8px;
}

.report-inline-section + .report-inline-section {
  padding-top: 6px;
  border-top: 1px solid rgba(234, 232, 232, 0.9);
}

.report-inline-section-state {
  gap: 4px;
}

.report-inline-section-failures {
  margin-top: 6px;
}

.report-inline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.report-inline-head h3 {
  margin: 0;
}

.report-inline-head-compact .report-kicker {
  margin-bottom: 2px;
}

.report-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.report-metric-grid-inline {
  margin-bottom: 18px;
}

.report-metric-card {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(216, 212, 212, 0.68);
  background: linear-gradient(180deg, #FBFAFA 0%, #ffffff 100%);
}

.report-metric-card span,
.report-metric-card small {
  color: #746B6B;
}

.report-metric-card strong {
  font-size: 26px;
  line-height: 1.1;
}

.report-chart-shell {
  min-height: 360px;
}

.report-chart {
  min-height: 360px;
}

.report-chart-shell-primary,
.report-chart-primary {
  min-height: 360px;
}

.report-chart-shell-compact,
.report-chart-compact {
  min-height: 260px;
}

.report-chart-shell-timeline,
.report-chart-timeline {
  min-height: 92px;
}

.report-chart-shell.is-empty,
.report-chart.is-empty {
  min-height: auto;
}

.report-empty-state {
  margin: 0;
  padding: 2px 0 0;
  color: #817878;
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
}

.report-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 12px;
  border: 1px solid #F5E6E5;
  background: #fff;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.report-table th,
.report-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #F5E6E5;
  text-align: left;
  vertical-align: top;
}

.report-table thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #746B6B;
}

.report-table tbody tr {
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.report-table tbody tr[data-episode-id] {
  cursor: pointer;
}

.report-table tbody tr[data-episode-id]:hover,
.report-table tbody tr.is-active {
  background: rgba(88, 82, 82, 0.08);
}

.report-copy-block {
  display: grid;
  gap: 10px;
  color: #544D4D;
  line-height: 1.65;
}

.report-copy-block p {
  margin: 0;
}

.report-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  gap: 18px;
}

.report-analysis-summary,
.report-analysis-meta {
  display: grid;
  gap: 10px;
  color: #544D4D;
  line-height: 1.7;
}

.report-occurrences-disclosure {
  display: grid;
  gap: 14px;
}

.report-occurrences-disclosure summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: #343030;
}

.report-occurrences-disclosure summary::-webkit-details-marker {
  display: none;
}

.report-occurrences-summary-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.report-occurrences-summary-title::before {
  content: "▸";
  font-size: 13px;
  color: #585252;
  transition: transform 0.18s ease;
}

.report-occurrences-disclosure[open] .report-occurrences-summary-title::before {
  transform: rotate(90deg);
}

.report-occurrences-content {
  display: grid;
  gap: 14px;
}

.report-occurrences-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.report-occurrences-filter-field {
  display: grid;
  gap: 6px;
}

.report-occurrences-filter-label {
  font-size: 13px;
  font-weight: 700;
  color: #343030;
}

.report-occurrences-filter-select,
.report-occurrences-filter-input {
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid #EED8D7;
  border-radius: 12px;
  background: #fff;
  color: #343030;
  font: inherit;
}

.report-occurrences-meta {
  margin: 0;
  color: #746B6B;
}

.report-occurrences-list {
  display: grid;
  gap: 12px;
}

.report-occurrences-table th,
.report-occurrences-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.report-occurrences-table {
  border-collapse: separate;
  border-spacing: 0;
}

.report-occurrences-table thead th {
  background: #F2F1F1;
  color: #585252;
  border-bottom-color: #F4D5D3;
}

.report-occurrences-table thead th:first-child {
  border-top-left-radius: 12px;
}

.report-occurrences-table thead th:last-child {
  border-top-right-radius: 12px;
}

.report-occurrences-table th:first-child,
.report-occurrences-table td:first-child {
  width: 56px;
  min-width: 56px;
  white-space: nowrap;
}

.report-occurrences-sort-button {
  width: 100%;
  justify-content: space-between;
  text-align: left;
}

.report-occurrences-table thead .sort-icon {
  color: rgba(88, 82, 82, 0.58);
}

.report-occurrences-table thead .sort-button[data-sort-dir="asc"] .sort-icon,
.report-occurrences-table thead .sort-button[data-sort-dir="desc"] .sort-icon {
  color: #585252;
}

.report-occurrences-empty[hidden] {
  display: none !important;
}

.report-occurrences-descriptions {
  display: grid;
  gap: 14px;
}

.report-occurrence-description {
  display: grid;
  gap: 8px;
  padding-top: 2px;
  border-top: 1px solid #F5E6E5;
}

.report-occurrence-description:first-child {
  padding-top: 0;
  border-top: none;
}

.report-occurrence-description h5,
.report-occurrence-description-summary {
  margin: 0;
}

.report-occurrence-description h5 {
  font-size: 14px;
  color: #343030;
}

.report-occurrence-description-summary {
  color: #746B6B;
  line-height: 1.5;
}

.report-occurrence-description-body {
  display: grid;
  gap: 8px;
}

.report-occurrence-description-entry {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #FBFBFB;
  border: 1px solid #EFD9D8;
}

.report-occurrence-description-title {
  color: #343030;
  font-weight: 600;
}

.report-occurrence-description-meta {
  color: #746B6B;
  line-height: 1.45;
}

.report-occurrence-item {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid #EFD9D8;
  border-radius: 14px;
  background: #FBFBFB;
}

.report-occurrence-item h5 {
  margin: 0;
  font-size: 14px;
  color: #343030;
}

.report-occurrence-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 14px;
}

.report-occurrence-fields span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #746B6B;
}

.report-occurrence-fields strong {
  color: #343030;
}

.report-analysis-summary p,
.report-analysis-meta p {
  margin: 0;
}

@media (max-width: 1080px) {
  .report-hero-card,
  .report-grid-ico,
  .report-grid-history,
  .report-grid-failures,
  .report-grid-humidity,
  .report-grid-text,
  .report-analysis-grid,
  .report-reference-cover-grid,
  .report-reference-section-grid,
  .report-reference-state-grid,
  .report-reference-analysis-grid,
  .report-summary-grid,
  .report-summary-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .report-shell {
    width: min(100% - 20px, 1320px);
    padding-top: 18px;
  }

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

  .report-close-button,
  .report-export-button {
    width: 100%;
    justify-content: center;
  }

  .report-topbar,
  .report-hero-card,
  .report-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .report-topbar {
    flex-direction: column;
  }

  .report-chart-shell,
  .report-chart {
    min-height: 300px;
  }

  .report-chart-shell-timeline,
  .report-chart-timeline {
    min-height: 92px;
  }

  .report-metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .report-reference-page {
    padding: 10px;
  }

  .report-pdf-header-grid,
  .report-period-banner,
  .report-strategic-grid,
  .report-pdf-timeline-row,
  .report-pdf-kpi-grid.is-three,
  .report-summary-grid-executive {
    grid-template-columns: 1fr;
  }

  .report-pdf-timeline-row {
    width: 100%;
    margin-left: 0;
  }

  .report-pdf-header-logo {
    justify-content: center;
  }

  .report-pdf-ico-band,
  .report-pdf-ico-main {
    grid-template-columns: 1fr;
  }

  .report-pdf-index-icon,
  .report-executive-card-icon,
  .report-icon-chip {
    margin: 0 auto;
  }

  .report-pdf-ico-copy,
  .report-pdf-score-stack,
  .report-diagnosis-copy,
  .report-period-copy {
    text-align: center;
  }
}

@media (max-width: 1180px) {
  .dashboard-manager-shell.is-editing {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "editbar"
      "main";
  }

  .dashboard-manager-shell.is-editing .dashboard-manager-sidebar-placeholder {
    display: none;
  }

  .dashboard-manager-library-grid {
    grid-template-columns: 1fr 1fr;
  }

  .machine-monitor-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .machine-monitor-shell.compact {
    grid-template-columns: minmax(108px, 128px) minmax(0, 1fr);
    align-items: stretch;
  }

  .machine-monitor-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .machine-monitor-metrics-grid.compact {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(3, minmax(0, 1fr));
    align-content: stretch;
  }

  .dashboard-widget-config-grid,
  .dashboard-widget-config-grid-watchlist,
  .dashboard-widget-image-upload-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-manager-toggle {
    top: 16px;
    right: 16px;
    padding: 11px 14px;
  }

  .dashboard-manager-toggle-label {
    display: none;
  }

  .dashboard-workspaces-menu {
    top: 70px;
    right: 16px;
  }

  .dashboard-manager-shell.is-editing .dashboard-manager-editbar {
    padding: 16px;
  }

  .dashboard-manager-editbar-title-input {
    font-size: 1.05rem;
  }

  .dashboard-library-fab {
    right: 18px;
    bottom: 18px;
    width: 52px;
    height: 52px;
  }

  .dashboard-manager-panel-shell {
    width: 100%;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
  }

  .dashboard-canvas {
    gap: 14px;
  }

  .dashboard-canvas-grid-large {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 96px;
  }

  .dashboard-canvas-grid-small {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 96px;
  }

  .dashboard-canvas-grid-large > .dashboard-card,
  .dashboard-canvas-grid-small > .dashboard-card {
    grid-column: span var(--dashboard-mobile-col-span, 1) !important;
    grid-row: span var(--dashboard-mobile-row-span, 1) !important;
    height: calc(var(--dashboard-mobile-row-span, 1) * 96px + (var(--dashboard-mobile-row-span, 1) - 1) * 14px);
    min-height: calc(var(--dashboard-mobile-row-span, 1) * 96px + (var(--dashboard-mobile-row-span, 1) - 1) * 14px);
  }

  .dashboard-card-editor-tools {
    top: 10px;
    right: 10px;
    gap: 6px;
  }

  .dashboard-card-tool {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .dashboard-card-tool-mobile-resize {
    display: inline-grid;
  }


  .dashboard-metric-card-action-trigger {
    width: 48px;
    height: 48px;
  }

  .dashboard-metric-card-action-icon {
    top: 9px;
    right: 9px;
    width: 22px;
    height: 22px;
    font-size: 0.76rem;
  }

  .dashboard-metric-card-popover {
    right: 8px;
    top: 8px;
    width: min(220px, calc(100vw - 36px));
    padding: 12px;
  }

  .dashboard-card-tool-handle {
    display: none;
  }

  .dashboard-kpi-card {
    min-height: max(108px, calc(var(--dashboard-mobile-row-span, 1) * 96px + (var(--dashboard-mobile-row-span, 1) - 1) * 14px));
    padding: 14px;
    gap: 6px;
  }

  .dashboard-kpi-card h3 {
    font-size: 0.84rem;
    line-height: 1.2;
  }

  .dashboard-kpi-value {
    font-size: clamp(1.52rem, 5vw, 2rem);
  }

  .dashboard-kpi-meta {
    display: none;
  }

  .dashboard-widget-card-shell {
    min-height: max(176px, calc(var(--dashboard-mobile-row-span, 2) * 96px + (var(--dashboard-mobile-row-span, 2) - 1) * 14px));
    height: 100%;
  }

  [data-dashboard-card^="watchlist"] .dashboard-widget-card-shell {
    min-height: max(206px, calc(var(--dashboard-mobile-row-span, 2) * 96px + (var(--dashboard-mobile-row-span, 2) - 1) * 14px));
    gap: 10px;
    padding: 14px;
    position: relative;
    z-index: 1;
  }

  [data-dashboard-card^="watchlist"] .dashboard-widget-card-heading h3 {
    font-size: 0.94rem;
  }

  [data-dashboard-card^="watchlist"] .dashboard-widget-card-heading p {
    display: none;
  }

  [data-dashboard-card^="machineMonitor"] .dashboard-widget-card-shell {
    min-height: max(320px, calc(var(--dashboard-mobile-row-span, 4) * 96px + (var(--dashboard-mobile-row-span, 4) - 1) * 14px));
  }

  [data-dashboard-card^="watchlist"] .watchlist-widget-table th,
  [data-dashboard-card^="watchlist"] .watchlist-widget-table td {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  [data-dashboard-card="alarmFeed"] .alarm-feed-table th,
  [data-dashboard-card="alarmFeed"] .alarm-feed-table td {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  [data-dashboard-card="surgicalRooms"] .dashboard-widget-card-shell {
    gap: 10px;
    padding: 14px;
  }

  [data-dashboard-card="surgicalRooms"] .surgical-rooms-table th,
  [data-dashboard-card="surgicalRooms"] .surgical-rooms-table td {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  [data-dashboard-card="surgicalRooms"] .surgical-rooms-legend {
    font-size: 0.68rem;
  }

  .dashboard-surgical-config-toolbar,
  .dashboard-surgical-mapping-head,
  .dashboard-surgical-column-grid,
  .dashboard-surgical-mapping-grid {
    grid-template-columns: 1fr;
  }

  [data-dashboard-card^="watchlist"] .watchlist-point-cell {
    gap: 8px;
  }


  [data-dashboard-card="samples"] .trend-card {
    min-height: 100%;
  }

  [data-dashboard-card="samples"] .mini-chart {
    min-height: 160px;
  }

  [data-dashboard-card="samples"] .chart-bar-hitbox {
    min-height: 128px;
    padding-top: 20px;
  }

  .dashboard-card-summary .hero-card,
  .dashboard-card-samples .trend-card,
  .dashboard-card-metric .dashboard-kpi-card {
    min-height: 100%;
    height: 100%;
  }

  .dashboard-card-summary .hero-card {
    min-height: 100%;
    height: 100%;
    overflow: hidden;
    padding: 10px 12px;
    gap: 0;
    justify-content: center;
  }

  .dashboard-card-summary .hero-copy {
    gap: 4px;
    padding-top: 0;
    max-width: 100%;
  }

  .dashboard-card-summary .hero-copy .eyebrow {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
  }

  .dashboard-card-summary .hero-copy h3 {
    font-size: clamp(1.34rem, 5.4vw, 1.74rem);
    line-height: 0.98;
  }

  [data-dashboard-card="summary"] {
    margin-bottom: 0;
  }

  .dashboard-manager-panel-body {
    max-height: none;
  }

  .dashboard-manager-library-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-widget-config-modal .filter-modal-dialog {
    width: min(100vw - 20px, 860px);
    max-height: min(92vh, 860px);
    padding: 18px;
  }

  .dashboard-widget-config-modal .filter-modal-body {
    overflow: auto;
  }


  .dashboard-mobile-resize-dialog {
    width: min(100vw - 20px, 420px);
    padding: 18px;
  }

  .dashboard-mobile-resize-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .machine-monitor-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .machine-monitor-metric-card {
    min-height: 120px;
  }

  .machine-monitor-metric-head {
    gap: 8px;
  }

  .machine-monitor-metric-head-stack {
    display: grid;
    gap: 8px;
  }

  .machine-monitor-metric-head-stack .pill {
    width: 100%;
    justify-content: center;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
  }

  .machine-monitor-metric-card-state {
    grid-column: span 2;
  }

  .machine-monitor-shell.compact {
    grid-template-columns: minmax(58px, 66px) minmax(0, 1fr);
    gap: 7px;
  }

  .machine-monitor-visual.compact {
    width: min(100%, 56px);
    border-radius: 12px;
  }

  .machine-monitor-metrics-grid.compact {
    grid-template-columns: minmax(0, 1fr);
  }

  .machine-monitor-metric-card-state {
    grid-column: auto;
  }

}

.dashboard-manager-shell.is-editing .dashboard-card.is-resizable-card {
  user-select: none;
}

.dashboard-manager-shell.is-editing .dashboard-card.is-resizable-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(237, 102, 95, 0.0);
  transition: box-shadow 0.18s ease;
}

.dashboard-manager-shell.is-editing .dashboard-card.is-resizable-card:hover::after {
  box-shadow: inset 0 0 0 1px rgba(237, 102, 95, 0.18);
}

.dashboard-manager-shell.is-editing.dashboard-card-resizing,
body.dashboard-card-resizing {
  cursor: nwse-resize;
}


.surgical-rooms-mini-chart-plot {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: visible !important;
}

.surgical-rooms-mini-chart-plot .svg-container,
.surgical-rooms-mini-chart-plot .main-svg,
.surgical-rooms-mini-chart-plot .hoverlayer {
  overflow: visible !important;
}

.surgical-rooms-mini-chart-plot .hoverlayer .hovertext {
  pointer-events: none;
}

.surgical-rooms-mini-chart-plot .hoverlayer .hovertext rect {
  rx: 10px;
  ry: 10px;
}

.surgical-rooms-mini-chart-plot .hoverlayer .hovertext text {
  font-size: 11px !important;
}

@media (max-width: 540px) {
  .surgical-rooms-mini-popover {
    width: min(420px, calc(100vw - 24px));
    min-height: 220px;
    padding: 12px;
  }

  .surgical-rooms-mini-popover-period-option {
    padding: 5px 8px;
  }

  .surgical-rooms-mini-popover-summary {
    gap: 6px 8px;
  }

  .surgical-rooms-mini-popover-summary-item strong {
    font-size: 0.72rem;
  }

  .surgical-rooms-mini-chart {
    height: 156px;
  }
}


.ai-lab-screen { min-height: calc(100vh - 132px); }
.ai-lab-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 14px; min-height: calc(100vh - 132px); }
.ai-lab-layout.engineering-open { grid-template-columns: 250px minmax(0, 1fr) 320px; }
.ai-lab-scenarios, .ai-lab-engineering, .ai-lab-chat, .ai-lab-composer { background: var(--surface, #1D1B1B); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; }
.ai-lab-scenarios { grid-row: 1 / 3; padding: 12px; overflow: auto; }
.ai-lab-scenarios button { width: 100%; display: grid; gap: 4px; text-align: left; margin-bottom: 8px; padding: 10px; border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; background: rgba(255,255,255,0.03); color: inherit; cursor: pointer; }
.ai-lab-scenarios button span, .ai-lab-muted { color: rgba(241, 222, 221,0.68); font-size: 0.84rem; }
.ai-lab-chat { min-height: 0; overflow: hidden; }
.ai-lab-chat-log { height: 100%; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.ai-lab-message { max-width: 84%; padding: 12px; border-radius: 8px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07); }
.ai-lab-message.user { align-self: flex-end; background: rgba(109, 101, 101,0.18); }
.ai-lab-message.assistant { align-self: flex-start; }
.ai-lab-message-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: rgba(241, 222, 221,0.72); font-size: 0.78rem; }
.ai-lab-message-meta code { font-size: 0.72rem; color: #F5ACA9; }
.ai-lab-message-body { display: grid; gap: 10px; white-space: pre-wrap; }
.ai-lab-warning, .ai-lab-chart-limitations span { display: block; padding: 8px; border-radius: 8px; background: rgba(242,176,72,0.14); color: #f7d58a; }
.ai-lab-metric-card, .ai-lab-alarm-card, .ai-lab-chart-card, .ai-lab-table-wrap { padding: 12px; border-radius: 8px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); }
.ai-lab-metric-card { display: grid; gap: 4px; }
.ai-lab-metric-card strong { font-size: 1.35rem; }
.ai-lab-table-wrap { overflow: auto; }
.ai-lab-table-wrap table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.ai-lab-table-wrap th, .ai-lab-table-wrap td { padding: 7px; border-bottom: 1px solid var(--border-default); text-align: left; }
.ai-lab-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ai-lab-chart-head div { display: grid; gap: 2px; }
.ai-lab-chart-head span { color: rgba(241, 222, 221,0.64); font-size: 0.82rem; }
.ai-lab-chart { min-height: 320px; background: #fff; border-radius: 8px; overflow: hidden; }
.ai-lab-engineering { grid-column: 3; grid-row: 1 / 3; padding: 12px; overflow: auto; }
.ai-lab-engineering pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.75rem; color: #FAD4D2; }
.ai-lab-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0; font-size: 0.76rem; color: rgba(241, 222, 221,0.72); }
.ai-lab-composer { grid-column: 2; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 8px; padding: 10px; align-items: end; }
.engineering-open .ai-lab-composer { grid-column: 2; }
.ai-lab-composer textarea { resize: vertical; min-height: 44px; max-height: 132px; }
.ai-lab-composer audio { max-width: 180px; height: 34px; }
.ai-lab-eval { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ai-lab-eval button { border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04); color: inherit; border-radius: 999px; padding: 5px 8px; cursor: pointer; font-size: 0.75rem; }
.ai-lab-eval button.selected { background: rgba(80,166,120,0.25); border-color: rgba(80,166,120,0.65); }
.ai-lab-empty { margin: auto; color: rgba(241, 222, 221,0.62); }
@media (max-width: 900px) { .ai-lab-layout, .ai-lab-layout.engineering-open { grid-template-columns: 1fr; grid-template-rows: auto minmax(55vh, 1fr) auto; } .ai-lab-scenarios { grid-row: auto; max-height: 210px; } .ai-lab-engineering { grid-column: 1; grid-row: auto; max-height: 260px; } .ai-lab-composer { grid-column: 1; grid-template-columns: 1fr 1fr; } .ai-lab-composer textarea { grid-column: 1 / 3; } .ai-lab-composer .primary-button { grid-column: 1 / 3; } .ai-lab-message { max-width: 100%; } }


/* IA Lab HYBRID-1 engine comparison */
.ai-lab-engine-selector { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ai-lab-engine-selector .ghost-button.selected { background: rgba(226, 82, 74,0.24); border-color: rgba(242, 144, 139,0.68); color: #FBDDDC; }
.ai-lab-comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: stretch; white-space: normal; }
.ai-lab-engine-result { min-width: 0; display: grid; gap: 10px; padding: 12px; border-radius: 8px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); }
.ai-lab-engine-result header { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: rgba(241, 222, 221,0.74); font-size: 0.82rem; }
.ai-lab-engine-result header strong { color: #F7F6F6; font-size: 0.9rem; }
.ai-lab-engine-answer { display: grid; gap: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-lab-attachment { display: grid; gap: 6px; margin: 0; padding: 10px; border-radius: 8px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); }
.ai-lab-attachment img { display: block; width: 100%; max-height: 420px; object-fit: contain; border-radius: 6px; background: #fff; }
.ai-lab-attachment figcaption, .ai-lab-attachment-link { color: rgba(241, 222, 221,0.74); font-size: 0.82rem; overflow-wrap: anywhere; }
@media (max-width: 900px) { .ai-lab-comparison-grid { grid-template-columns: 1fr; } .ai-lab-engine-selector { grid-column: 1 / -1; } }

/* IA Lab LAB-2.1 transport/interface fix */
.ai-lab-layout { grid-template-areas: "scenarios chat" "scenarios composer"; align-items: stretch; }
.ai-lab-layout.engineering-open { grid-template-areas: "scenarios chat engineering" "scenarios composer engineering"; }
.ai-lab-scenarios { grid-area: scenarios; }
.ai-lab-chat { grid-area: chat; }
.ai-lab-engineering { grid-area: engineering; }
.ai-lab-composer { grid-area: composer; position: sticky; bottom: 0; z-index: 3; }
.ai-lab-scenarios summary { list-style: none; cursor: default; }
.ai-lab-scenarios summary::-webkit-details-marker { display: none; }
.ai-lab-panel-body { display: grid; gap: 8px; }
.ai-lab-engineering dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; margin: 0 0 10px; }
.ai-lab-engineering dt { color: rgba(241, 222, 221,0.58); font-size: 0.75rem; }
.ai-lab-engineering dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: 0.78rem; }
.ai-lab-composer .primary-button, .ai-lab-composer .ghost-button { min-height: 40px; white-space: nowrap; }
.ai-lab-composer textarea { width: 100%; }
@media (max-width: 900px) {
  .ai-lab-layout, .ai-lab-layout.engineering-open { grid-template-areas: "chat" "scenarios" "engineering" "composer"; grid-template-columns: 1fr; grid-template-rows: minmax(48vh, 1fr) auto auto auto; }
  .ai-lab-scenarios:not([open]) .ai-lab-panel-body { display: none; }
  .ai-lab-scenarios summary { display: flex; align-items: center; justify-content: space-between; min-height: 40px; font-weight: 800; text-transform: uppercase; font-size: 0.76rem; color: rgba(241, 222, 221,0.72); }
  .ai-lab-scenarios summary::after { content: "+"; font-size: 1rem; }
  .ai-lab-scenarios[open] summary::after { content: "-"; }
  .ai-lab-chat { min-height: 48vh; }
  .ai-lab-composer { position: sticky; bottom: 0; grid-template-columns: 1fr 1fr; }
}

/* IA Lab LAB-2.2 composer/audio containment */
.ai-lab-screen { padding-bottom: 112px; }
.ai-lab-composer {
  bottom: 92px;
  grid-template-columns: auto auto minmax(0, auto) minmax(220px, 1fr) auto;
  max-width: 100%;
  box-shadow: 0 -10px 24px rgba(0,0,0,0.18);
}
.ai-lab-composer textarea { min-width: 0; }
.ai-lab-composer .primary-button { justify-self: end; min-width: 92px; }
.ai-lab-audio-status {
  align-self: center;
  max-width: 220px;
  overflow-wrap: anywhere;
  color: rgba(241, 222, 221,0.72);
  font-size: 0.8rem;
  line-height: 1.25;
}
.ai-lab-audio-status.is-error { color: #f7b4b4; }
@media (max-width: 1180px) {
  .ai-lab-layout.engineering-open { grid-template-columns: 220px minmax(0, 1fr) 280px; }
  .ai-lab-composer { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .ai-lab-audio-status { grid-column: 1 / -1; max-width: none; }
}
@media (max-width: 900px) {
  .ai-lab-screen { padding-bottom: 96px; }
  .ai-lab-composer { bottom: 76px; grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .ai-lab-composer textarea { grid-column: 1 / -1; }
  .ai-lab-composer .primary-button { grid-column: auto; }
  .ai-lab-audio-status { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
  .ai-lab-composer { grid-template-columns: 1fr auto; }
  .ai-lab-composer [data-ai-lab-engineering-toggle],
  .ai-lab-composer [data-ai-lab-record],
  .ai-lab-composer audio,
  .ai-lab-composer [data-ai-lab-cancel-audio],
  .ai-lab-composer textarea,
  .ai-lab-audio-status { grid-column: 1 / -1; }
  .ai-lab-composer .primary-button { grid-column: 2; width: auto; }
}


/* IA Lab HYBRID-1.1 attachment, contrast and composer layout */
.ai-lab-screen { padding-bottom: 178px; color: #F7F6F6; }
.ai-lab-scenarios, .ai-lab-engineering, .ai-lab-chat, .ai-lab-composer { background: #FAFAFA; border-color: rgba(88, 82, 82, 0.16); color: #2B2727; }
.ai-lab-chat-log { background: #F3F3F3; }
.ai-lab-message { color: #2D2929; background: #ffffff; border-color: rgba(88, 82, 82, 0.14); box-shadow: 0 8px 22px rgba(30, 27, 27, 0.08); }
.ai-lab-message.user { background: #F1F0F0; border-color: rgba(88, 82, 82, 0.18); }
.ai-lab-message.assistant.has-comparison { max-width: 100%; width: 100%; }
.ai-lab-message-meta { color: #5C5454; font-weight: 700; }
.ai-lab-message-meta code { color: #D8261D; background: #F7F7F7; border-radius: 6px; padding: 2px 5px; }
.ai-lab-empty, .ai-lab-muted, .ai-lab-scenarios button span { color: #5C5454; }
.ai-lab-scenarios summary, .ai-lab-panel-head { color: #3B3636; }
.ai-lab-scenarios button { background: #ffffff; color: #2D2929; border-color: rgba(88, 82, 82, 0.16); }
.ai-lab-scenarios button strong { color: #232020; }
.ai-lab-scenarios button:hover { border-color: rgba(88, 82, 82, 0.34); background: #F8F8F8; }
.ai-lab-engine-selector .ghost-button.selected { background: #FBDFDE; border-color: #EF726B; color: #433E3E; }
.ai-lab-comparison-grid { grid-template-columns: repeat(2, minmax(320px, 1fr)); gap: 14px; }
.ai-lab-engine-result { align-content: start; background: #ffffff; border-color: rgba(88, 82, 82, 0.16); color: #2D2929; box-shadow: 0 8px 18px rgba(30, 27, 27, 0.06); }
.ai-lab-engine-result header { color: #5C5454; border-bottom: 1px solid #EAE8E8; padding-bottom: 8px; }
.ai-lab-engine-result header div { display: grid; gap: 2px; }
.ai-lab-engine-result header strong { color: #232020; font-size: 0.96rem; }
.ai-lab-engine-result header small { color: #7C7373; font-weight: 700; text-transform: uppercase; letter-spacing: 0; font-size: 0.72rem; }
.ai-lab-engine-result header span { color: #433E3E; background: #F7F7F7; border-radius: 999px; padding: 4px 8px; font-weight: 800; white-space: nowrap; }
.ai-lab-engine-answer { color: #2D2929; line-height: 1.48; }
.ai-lab-warning, .ai-lab-chart-limitations span { color: #7a3d00; background: #fff7e6; border: 1px solid #fed7aa; }
.ai-lab-metric-card, .ai-lab-alarm-card, .ai-lab-chart-card, .ai-lab-table-wrap { background: #ffffff; color: #2D2929; border-color: #EEDCDB; }
.ai-lab-attachment.ready, .ai-lab-attachment-state { background: #FAFAFA; border: 1px solid #EEDCDB; border-radius: 8px; color: #474141; }
.ai-lab-attachment-state { padding: 12px; font-weight: 700; }
.ai-lab-attachment-state.is-error { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.ai-lab-attachment-image-button { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.ai-lab-attachment img { max-height: 520px; border: 1px solid #EEDCDB; }
.ai-lab-eval button { border-color: #D8D4D4; background: #FAFAFA; color: #474141; }
.ai-lab-eval button.selected { background: #dcfce7; border-color: #22c55e; color: #14532d; }
.ai-lab-composer { bottom: 88px; display: grid; grid-template-columns: 1fr; gap: 8px; padding: 10px; box-shadow: 0 -12px 28px rgba(30, 27, 27, 0.16); }
.ai-lab-composer-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ai-lab-composer-controls { justify-content: space-between; }
.ai-lab-composer-message textarea { flex: 1 1 360px; min-width: 180px; color: #1D1B1B; background: #ffffff; border: 1px solid #D8D4D4; }
.ai-lab-composer-message textarea::placeholder { color: #7C7373; opacity: 1; }
.ai-lab-composer .primary-button, .ai-lab-composer .ghost-button { color: #232020; border-color: #D8D4D4; }
.ai-lab-composer .primary-button { color: #ffffff; min-width: 92px; }
.ai-lab-composer .primary-button:disabled, .ai-lab-composer .ghost-button:disabled { opacity: 0.62; color: #5C5454; }
.ai-lab-audio-status { color: #474141; }
.ai-lab-audio-status.is-error { color: #b91c1c; }
body:has(#section-aiLab.panel-section.active) .floating-refresh-badge { bottom: 18px; transform: scale(0.92); transform-origin: right bottom; }
@media (max-width: 1180px) {
  .ai-lab-comparison-grid { grid-template-columns: 1fr; }
  .ai-lab-composer-message { flex-wrap: wrap; }
  .ai-lab-composer-message textarea { flex-basis: 100%; order: 5; }
  .ai-lab-composer-message .primary-button { margin-left: auto; order: 6; }
}
@media (max-width: 900px) {
  .ai-lab-screen { padding-bottom: 190px; }
  .ai-lab-composer { bottom: 74px; }
  .ai-lab-composer-controls, .ai-lab-composer-message, .ai-lab-engine-selector { flex-wrap: wrap; }
  .ai-lab-composer-message textarea { min-width: 0; }
}
@media (max-width: 540px) {
  .ai-lab-composer { bottom: 70px; }
  .ai-lab-composer .primary-button { width: auto; }
}

/* IA Lab HYBRID-4.1: viewport chain and conversation-only page growth */
@media (min-width: 901px) {
  body:has(#section-aiLab.panel-section.is-active) {
    overflow: hidden;
  }

  body:has(#section-aiLab.panel-section.is-active) .main-panel {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  body:has(#section-aiLab.panel-section.is-active) .topbar {
    flex: 0 0 auto;
  }

  body:has(#section-aiLab.panel-section.is-active) .workspace-shell,
  body:has(#section-aiLab.panel-section.is-active) .content-column,
  #section-aiLab.panel-section.is-active,
  .ai-lab-screen,
  .ai-lab-layout,
  .ai-lab-chat,
  .ai-lab-chat-log {
    min-height: 0;
  }

  body:has(#section-aiLab.panel-section.is-active) .workspace-shell {
    flex: 1 1 auto;
    overflow: hidden;
  }

  body:has(#section-aiLab.panel-section.is-active) .content-column,
  #section-aiLab.panel-section.is-active,
  .ai-lab-screen,
  .ai-lab-layout {
    height: 100%;
    overflow: hidden;
  }

  .ai-lab-screen {
    padding-bottom: 0;
  }

  .ai-lab-layout {
    min-height: 0;
  }

  .ai-lab-chat-log {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

}
@media (min-width: 901px) {
  #section-aiLab.panel-section.is-active {
    display: flex;
    flex-direction: column;
  }

  #section-aiLab.panel-section.is-active .ai-lab-screen {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }

  .ai-lab-composer {
    position: static;
    bottom: auto;
  }

}

/* IA Lab HYBRID-4.3A quick-test panel */
.ai-lab-scenarios { min-width: 0; }
.ai-lab-scenarios-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ai-lab-scenarios-head > strong { color: #3B3636; font-size: 0.84rem; }
.ai-lab-scenarios-head .ghost-button { min-height: 30px; padding: 5px 8px; font-size: 0.72rem; }
.ai-lab-scenarios-list { display: grid; gap: 8px; }
.ai-lab-scenario-category { border: 1px solid rgba(88, 82, 82, 0.14); border-radius: 8px; background: #FBFBFB; overflow: hidden; }
.ai-lab-scenario-category > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; cursor: pointer; list-style: none; color: #3B3636; font-size: 0.76rem; font-weight: 800; }
.ai-lab-scenario-category > summary::-webkit-details-marker { display: none; }
.ai-lab-scenario-category > summary::after { content: "+"; color: #6D6565; font-size: 1rem; }
.ai-lab-scenario-category[open] > summary::after { content: "−"; }
.ai-lab-scenario-category > summary small { margin-left: auto; color: #7C7373; font-size: 0.7rem; font-weight: 700; }
.ai-lab-scenario-category .ai-lab-panel-body { padding: 0 8px 8px; }
.ai-lab-scenario-card, .ai-lab-followup-card { width: 100%; margin: 0; padding: 9px; border: 1px solid #EEDCDB; border-radius: 7px; background: #fff; color: #2D2929; }
.ai-lab-scenario-card { display: grid; gap: 3px; text-align: left; cursor: pointer; }
.ai-lab-scenario-card:hover, .ai-lab-followup-steps button:hover { border-color: #DF837E; background: #F8F8F8; }
.ai-lab-scenario-card strong, .ai-lab-scenario-title strong { color: #232020; font-size: 0.78rem; }
.ai-lab-scenario-card span, .ai-lab-scenario-title span, .ai-lab-scenario-card small { color: #5C5454; font-size: 0.72rem; line-height: 1.3; }
.ai-lab-scenario-card small { color: #6D6565; font-weight: 700; }
.ai-lab-scenario-card em { font-style: normal; }
.ai-lab-followup-card { display: grid; gap: 7px; }
.ai-lab-scenario-title { display: grid; gap: 2px; }
.ai-lab-followup-steps { display: grid; gap: 5px; }
.ai-lab-followup-steps button { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 6px; align-items: start; width: 100%; padding: 6px; border: 1px solid #EEDCDB; border-radius: 6px; background: #FAFAFA; color: #474141; text-align: left; cursor: pointer; font-size: 0.7rem; }
.ai-lab-followup-steps b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #FBDFDE; color: #433E3E; font-size: 0.66rem; }
.ai-lab-scenarios.is-collapsed { display: grid; place-items: start center; padding: 8px; overflow: visible; }
.ai-lab-scenarios-reopen { width: 100%; min-height: 34px; padding: 5px 3px; border: 1px solid #EABBB9; border-radius: 7px; background: #F6F5F5; color: #433E3E; cursor: pointer; font-size: 0.7rem; font-weight: 800; writing-mode: vertical-rl; }
@media (min-width: 901px) {
  .ai-lab-layout.scenarios-collapsed { grid-template-columns: 48px minmax(0, 1fr); }
  .ai-lab-layout.engineering-open.scenarios-collapsed { grid-template-columns: 48px minmax(0, 1fr) 320px; }
  .ai-lab-layout.scenarios-collapsed .ai-lab-scenarios { grid-area: scenarios; }
}


/* IA Lab HYBRID-4.3B: mobile access and quick-test drawer */
@media (max-width: 900px) {
  #section-aiLab.panel-section.is-active,
  #section-aiLab.panel-section.is-active .ai-lab-screen {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  #section-aiLab.panel-section.is-active .ai-lab-screen {
    padding-bottom: 18px;
  }

  #section-aiLab.panel-section.is-active .ai-lab-layout,
  #section-aiLab.panel-section.is-active .ai-lab-layout.engineering-open {
    grid-template-areas: "chat" "quick-tests" "engineering" "composer";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(360px, 52dvh) auto auto auto;
    min-height: 0;
    width: 100%;
    gap: 12px;
  }

  #section-aiLab .ai-lab-chat {
    min-width: 0;
    min-height: 0;
  }

  #section-aiLab .ai-lab-chat-log {
    min-height: 0;
    height: 100%;
    max-height: 52dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  #section-aiLab .ai-lab-composer {
    position: static;
    bottom: auto;
    min-width: 0;
    max-width: 100%;
    box-shadow: none;
  }

  #section-aiLab .ai-lab-composer-controls,
  #section-aiLab .ai-lab-composer-message,
  #section-aiLab .ai-lab-engine-selector {
    align-items: stretch;
  }

  #section-aiLab .ai-lab-composer .ghost-button,
  #section-aiLab .ai-lab-composer .primary-button {
    white-space: normal;
  }

  #section-aiLab .ai-lab-engineering {
    min-width: 0;
    max-height: 42dvh;
    overflow: auto;
  }

  #section-aiLab .ai-lab-message,
  #section-aiLab .ai-lab-engine-result,
  #section-aiLab .ai-lab-chart-card,
  #section-aiLab .ai-lab-attachment,
  #section-aiLab .ai-lab-table-wrap {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  #section-aiLab .ai-lab-chart {
    min-height: 230px;
    max-width: 100%;
  }

  #section-aiLab .ai-lab-chart-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  #section-aiLab .ai-lab-attachment img {
    max-width: 100%;
    max-height: min(52dvh, 420px);
  }

  #section-aiLab .ai-lab-mobile-tests-trigger {
    grid-area: quick-tests;
    justify-self: start;
    width: auto;
    min-height: 38px;
  }

  #section-aiLab .ai-lab-mobile-tests-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(30, 27, 27, 0.42);
  }

  #section-aiLab .ai-lab-mobile-tests-backdrop.is-open {
    display: block;
  }

  #section-aiLab .ai-lab-mobile-tests-drawer {
    position: fixed;
    z-index: 71;
    right: 12px;
    bottom: 12px;
    left: 12px;
    display: none;
    max-height: min(72dvh, 620px);
    overflow: auto;
    padding: 12px;
    border: 1px solid rgba(88, 82, 82, 0.2);
    border-radius: 12px;
    background: #FAFAFA;
    box-shadow: 0 18px 42px rgba(30, 27, 27, 0.28);
  }

  #section-aiLab .ai-lab-mobile-tests-drawer.is-open {
    display: block;
  }

  #section-aiLab .ai-lab-mobile-tests-head {
    position: sticky;
    top: -12px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: -12px -12px 10px;
    padding: 12px;
    border-bottom: 1px solid #EEDCDB;
    background: #FAFAFA;
    color: #3B3636;
  }
}

@media (min-width: 901px) {
  .ai-lab-mobile-tests-trigger,
  .ai-lab-mobile-tests-backdrop,
  .ai-lab-mobile-tests-drawer {
    display: none !important;
  }
}
/* ========================================================================== *
 * All component colors below resolve through the Light/Dark tokens above.
 * ========================================================================== */

html,
body {
  background: var(--bg-app);
  color: var(--text-primary);
}

body {
  background-image: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

::selection {
  background: var(--primary-soft);
  color: var(--text-primary);
}

:focus-visible {
  outline-color: var(--primary);
}

.dashboard-loading-screen {
  background: var(--bg-app);
}

.dashboard-loading-panel,
.dashboard-loading-mark {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  box-shadow: var(--shadow);
}

.dashboard-loading-copy h1 {
  color: var(--text-primary);
}

.dashboard-loading-copy p:last-child {
  color: var(--text-secondary);
}

.dashboard-loading-bar {
  background: linear-gradient(180deg, var(--primary), var(--accent-cyan));
}

:root[data-theme="dark"] .dashboard-loading-logo--default {
  display: none;
}

:root[data-theme="dark"] .dashboard-loading-logo--dark {
  display: block;
}

.main-panel,
.workspace-shell,
.content-column,
.panel-section {
  background: var(--bg-app);
  color: var(--text-primary);
}

.topbar {
  background: var(--header-bg);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.topbar .eyebrow,
.eyebrow,
.muted,
.form-helper,
.table-filter-summary,
.table-meta,
.chart-helper,
.filter-modal-help {
  color: var(--text-secondary);
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-secondary));
  color: var(--text-on-dark);
}

.sidebar .eyebrow,
.nav-group-toggle,
.nav-group-arrow,
.nav-item-meta,
.profile-card-arrow {
  color: var(--text-on-dark-secondary);
}

.nav-group-toggle:hover,
.nav-group-toggle:focus-visible,
.profile-card:hover,
.profile-card:focus-visible {
  background: var(--sidebar-hover);
  color: var(--text-on-dark);
}

.nav-item {
  color: var(--text-on-dark-secondary);
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--text-on-dark);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--text-on-dark);
  border-left-color: var(--sidebar-active-line);
}

.nav-item[data-section="alarms"].has-no-alarm .nav-item-meta {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
}

.nav-item[data-section="alarms"].has-active-alarm,
.nav-item[data-section="alarms"].has-active-alarm:hover,
.nav-item[data-section="alarms"].has-active-alarm.active {
  background: var(--status-alarm-bg);
  color: var(--status-alarm-contrast-text);
  border-left-color: var(--status-alarm-border);
}

.nav-item[data-section="alarms"].has-active-alarm .nav-item-meta {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--status-alarm-contrast-text);
  font-weight: 800;
}

.client-dropdown-trigger,
.client-dropdown-menu {
  background: var(--sidebar-bg-secondary);
  border-color: var(--border-strong);
  color: var(--text-on-dark);
}

.client-dropdown-option {
  color: var(--text-on-dark-secondary);
}

.client-dropdown-option:hover,
.client-dropdown-option:focus-visible {
  background: var(--sidebar-hover);
  color: var(--text-on-dark);
}

.client-dropdown-option.is-active {
  background: var(--sidebar-active);
  color: var(--text-on-dark);
  box-shadow: inset 3px 0 0 var(--sidebar-active-line);
}

.sidebar-profile-row::before {
  background: var(--border-strong);
  box-shadow: none;
}

.account-menu {
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  width: auto;
  min-width: 250px;
  padding: 12px;
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
  box-shadow: var(--shadow);
  transform-origin: bottom left;
}

body.sidebar-collapsed .account-menu {
  left: calc(100% + 12px);
  right: auto;
  bottom: 0;
  width: 280px;
}

.account-menu-section,
.theme-choice-group {
  display: grid;
  gap: 8px;
}

.account-menu-heading {
  display: grid;
  gap: 4px;
  padding: 2px 4px 6px;
}

.account-menu-heading > span {
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 800;
}

.account-menu-heading small {
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.4;
}

.account-menu-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--border-default);
}

.theme-choice,
.collapsed-profile-menu-button {
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.theme-choice {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  text-align: left;
}

.theme-choice:hover,
.theme-choice:focus-visible,
.collapsed-profile-menu-button:hover,
.collapsed-profile-menu-button:focus-visible {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-accessible-text);
  transform: none;
}

.theme-choice.is-selected {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-accessible-text);
}

.theme-choice-icon {
  color: var(--primary);
  font-size: 1rem;
  text-align: center;
}

.theme-choice-check {
  color: var(--primary);
  opacity: 0;
  text-align: center;
}

.theme-choice.is-selected .theme-choice-check {
  opacity: 1;
}

.collapsed-profile-menu-button {
  padding: 10px 12px;
}

.collapsed-profile-menu-button.is-logout,
.collapsed-profile-menu-button.is-logout:hover,
.collapsed-profile-menu-button.is-logout:focus-visible {
  background: var(--danger-soft);
  border-color: var(--status-alarm-border);
  color: var(--danger-accessible-text);
}

#profileShortcut[aria-expanded="true"] {
  background: var(--sidebar-hover);
}

#profileShortcut[aria-expanded="true"] .profile-card-arrow {
  transform: rotate(-90deg);
}

.surface-card,
.section-card,
.trend-card,
.hero-card,
.table-card,
.editor-shell,
.service-monitor-status-card,
.kpi-card,
.todo-item,
.detail-list div,
.dashboard-card,
.dashboard-widget-card-shell,
.dashboard-manager-panel-shell,
.dashboard-widget-selection-item,
.dashboard-mobile-picker-option,
.history-shell-card,
.history-chart-card,
.history-section-card,
.history-summary-card,
.history-compare-series-row,
.column-picker-panel,
.selected-tags,
.editor-multiselect,
.empty-state {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.dashboard-card:hover,
.history-compare-series-row:hover,
.dashboard-mobile-picker-option:hover {
  background: var(--table-row-hover);
}

.history-compare-series-row.is-selected,
.dashboard-mobile-picker-option.is-selected {
  background: var(--table-row-selected);
  border-color: var(--primary);
}

.primary-button {
  background: var(--primary-action-bg);
  border-color: var(--primary-action-bg);
  color: var(--text-on-primary);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--primary-action-hover);
  border-color: var(--primary-action-hover);
  color: var(--text-on-primary);
}

.ghost-button,
.icon-button,
.sidebar-toggle,
.filter-chip,
.work-day-toggle,
.avatar-shape-button {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.ghost-button:hover,
.ghost-button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible,
.sidebar-toggle:hover,
.filter-chip:hover,
.work-day-toggle:hover,
.avatar-shape-button:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-accessible-text);
}

.filter-chip.is-active,
.work-day-toggle.is-active,
.avatar-shape-button.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-primary);
}

.danger-button,
.danger-button:hover,
.danger-button:focus-visible {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--text-on-dark);
}

.danger-outline {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger-accessible-text);
}

.text-input,
.editor-input,
.editor-select,
.editor-textarea,
.editor-multiselect,
.date-filter,
.date-filter input,
.filter-date-field input,
.table-search input,
.history-period-field select,
.dashboard-widget-field input,
.dashboard-widget-field select,
.dashboard-widget-field textarea,
[data-history-apply-all-period] {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder-text);
  opacity: 1;
}

select option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

input[type="checkbox"],
input[type="radio"],
.row-check,
.head-check {
  accent-color: var(--primary);
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

input:disabled,
textarea:disabled,
select:disabled,
button:disabled {
  background: var(--inactive-soft);
  border-color: var(--border-default);
  color: var(--text-muted);
}

.table-shell,
.table-container,
.table-wrapper,
.table-scroll,
table,
th,
td {
  background: var(--table-bg);
  color: var(--text-primary);
}

.table-shell,
.table-container {
  border-color: var(--border-default);
}

.table-toolbar .toolbar-left > .table-filter-summary {
  background: var(--bg-elevated) !important;
  border-color: var(--border-default) !important;
  color: var(--text-secondary) !important;
}

th,
td {
  border-bottom-color: var(--table-row-border);
}

thead th {
  background: var(--table-header-bg);
  color: var(--table-header-text);
  box-shadow: inset 0 -1px 0 var(--border-strong);
}

tbody tr:hover td {
  background: var(--table-row-hover);
}

tbody tr.is-selected td,
tbody tr.is-selected:hover td {
  background: var(--table-row-selected);
}

td .muted,
.table-cell-muted {
  color: var(--table-muted-contrast);
}

.sort-icon,
.sort-button[data-sort-dir="none"] .sort-icon {
  color: var(--table-cell-muted);
}

.sort-button[data-sort-dir="asc"] .sort-icon,
.sort-button[data-sort-dir="desc"] .sort-icon {
  color: var(--primary);
}

.pill.normal,
.pill.active,
.pill.ack,
.pill.sent,
.pill.closed,
.info-badge {
  background: var(--info-soft);
  border-color: var(--info);
  color: var(--info-accessible-text);
}

.pill.inactive,
.pill.disabled {
  background: var(--inactive-soft);
  color: var(--text-secondary);
}

.pill.open,
.pill.error,
.pill.alarm {
  background: var(--danger-soft);
  color: var(--danger-accessible-text);
}

.pill.candidate,
.pill.pending {
  background: var(--warning-soft);
  color: var(--warning-accessible-text);
}

.filter-modal,
.avatar-editor-modal,
.profile-reload-modal {
  background: var(--bg-overlay);
}

.filter-modal-dialog,
.avatar-editor-dialog,
.profile-reload-dialog {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
  box-shadow: var(--shadow);
}

.filter-modal-group,
.filter-modal-card,
.avatar-editor-preview-card,
.avatar-editor-shape,
.avatar-editor-zoom,
.avatar-editor-stage {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.info-tooltip-text,
.chart-tooltip,
.dashboard-hover-tooltip,
.dashboard-global-hover-tooltip,
.collapsed-sidebar-tooltip {
  background: var(--tooltip-bg);
  border-color: var(--border-strong);
  color: var(--tooltip-text);
  box-shadow: var(--shadow-soft);
}

.info-tooltip-text *,
.chart-tooltip *,
.dashboard-hover-tooltip *,
.dashboard-global-hover-tooltip *,
.collapsed-sidebar-tooltip * {
  color: inherit;
}

.toast {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
  box-shadow: var(--shadow);
}

.toast-success {
  border-left-color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

body,
.sidebar,
.sidebar-nav,
.table-scroll,
.filter-modal-body,
.editor-body,
.column-picker-panel {
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

body::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb,
.filter-modal-body::-webkit-scrollbar-thumb,
.editor-body::-webkit-scrollbar-thumb,
.column-picker-panel::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-color: transparent;
  background-clip: padding-box;
}

body::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track,
.table-scroll::-webkit-scrollbar-track,
.filter-modal-body::-webkit-scrollbar-track,
.editor-body::-webkit-scrollbar-track,
.column-picker-panel::-webkit-scrollbar-track {
  background: transparent;
}

#section-aiLab .ai-lab-message,
#section-aiLab .ai-lab-scenarios button,
#section-aiLab .ai-lab-engine-result,
#section-aiLab .ai-lab-metric-card,
#section-aiLab .ai-lab-alarm-card,
#section-aiLab .ai-lab-chart-card,
#section-aiLab .ai-lab-table-wrap,
#section-aiLab .ai-lab-scenario-card,
#section-aiLab .ai-lab-followup-card,
#section-aiLab .ai-lab-chart,
#section-aiLab .ai-lab-mobile-tests-drawer,
#section-aiLab .ai-lab-mobile-tests-head,
#section-aiLab .ai-lab-composer-message textarea {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
  box-shadow: none;
}

#section-aiLab .ai-lab-warning,
#section-aiLab .ai-lab-chart-limitations span {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning-accessible-text);
}

#section-aiLab .ai-lab-attachment-state.is-error {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger-accessible-text);
}

#section-aiLab .ai-lab-eval button.selected {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success-accessible-text);
}

#section-aiLab .ai-lab-engine-selector .ghost-button.selected {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-accessible-text);
}

.js-plotly-plot .plotly .bg {
  fill: var(--bg-surface) !important;
}

.js-plotly-plot .plotly .gridlayer path,
.js-plotly-plot .plotly .zerolinelayer path {
  stroke: var(--chart-grid) !important;
}

.js-plotly-plot .plotly .xtick text,
.js-plotly-plot .plotly .ytick text,
.js-plotly-plot .plotly .gtitle,
.js-plotly-plot .plotly .legendtext,
.js-plotly-plot .plotly .annotation-text {
  fill: var(--text-secondary) !important;
}

.js-plotly-plot .plotly .hoverlayer .hovertext text {
  fill: var(--tooltip-text) !important;
}

/* Dark-mode safety net for legacy surfaces that still carry fixed light paint. */
:root[data-theme="dark"] .system-health-indicator,
:root[data-theme="dark"] .editor-footer,
:root[data-theme="dark"] .selected-tag,
:root[data-theme="dark"] .cell-disclosure-entry,
:root[data-theme="dark"] .invite-result-detail-card,
:root[data-theme="dark"] .dashboard-manager-toggle,
:root[data-theme="dark"] .dashboard-manager-panel-shell,
:root[data-theme="dark"] .dashboard-library-card,
:root[data-theme="dark"] .dashboard-kpi-card,
:root[data-theme="dark"] .dashboard-metric-card-action-icon,
:root[data-theme="dark"] .dashboard-metric-card-popover,
:root[data-theme="dark"] .dashboard-mobile-resize-option,
:root[data-theme="dark"] .dashboard-mobile-picker-trigger,
:root[data-theme="dark"] .dashboard-mobile-picker-sheet,
:root[data-theme="dark"] .dashboard-widget-image-preview,
:root[data-theme="dark"] .history-kpi-card,
:root[data-theme="dark"] .history-stat-card,
:root[data-theme="dark"] .history-state-card,
:root[data-theme="dark"] .history-state-empty,
:root[data-theme="dark"] .history-legend-item,
:root[data-theme="dark"] .history-legend-empty,
:root[data-theme="dark"] .point-history-chart-empty,
:root[data-theme="dark"] .history-band-legend-item,
:root[data-theme="dark"] .history-space-search-input,
:root[data-theme="dark"] .history-space-results-empty,
:root[data-theme="dark"] .history-space-option,
:root[data-theme="dark"] .history-summary-chip,
:root[data-theme="dark"] .point-history-period-grid input,
:root[data-theme="dark"] .history-report-cover,
:root[data-theme="dark"] .history-report-section,
:root[data-theme="dark"] .history-report-footer,
:root[data-theme="dark"] .history-report-kpi-card,
:root[data-theme="dark"] .history-report-table-card,
:root[data-theme="dark"] .history-report-chart-card,
:root[data-theme="dark"] .history-compare-panel,
:root[data-theme="dark"] .history-compare-results,
:root[data-theme="dark"] .history-compare-origin-card,
:root[data-theme="dark"] .history-compare-chart-card,
:root[data-theme="dark"] .history-compare-chart-shell,
:root[data-theme="dark"] .history-compare-series-card,
:root[data-theme="dark"] .history-compare-inline-state,
:root[data-theme="dark"] .history-compare-empty,
:root[data-theme="dark"] .avatar-editor-canvas,
:root[data-theme="dark"] .avatar-editor-preview {
  background: var(--bg-surface) !important;
  border-color: var(--border-default) !important;
  color: var(--text-primary) !important;
}

/* A regra acima força background/border de volta ao padrão (!important),
   inclusive em cima do :hover do item clicável de membro de grupo - sem
   isso, passar o mouse não daria nenhum feedback visual no modo escuro. */
:root[data-theme="dark"] .cell-disclosure-entry-clickable:hover,
:root[data-theme="dark"] .cell-disclosure-entry-clickable:focus-visible {
  background: var(--bg-elevated) !important;
  border-color: var(--border-strong) !important;
}

:root[data-theme="dark"] .history-report-body,
:root[data-theme="dark"] .history-compare-body {
  background: var(--bg-soft);
}

:root[data-theme="dark"] .history-compare-series-row.is-selected,
:root[data-theme="dark"] .history-space-option:hover,
:root[data-theme="dark"] .history-space-option:focus-visible,
:root[data-theme="dark"] .history-space-option.is-active,
:root[data-theme="dark"] .history-legend-item:hover,
:root[data-theme="dark"] .history-legend-item:focus-visible,
:root[data-theme="dark"] .dashboard-mobile-resize-option.is-active {
  background: var(--table-row-selected) !important;
  border-color: var(--primary) !important;
}

:root[data-theme="dark"] :is(
  .system-health-copy strong,
  .profile-reload-copy h3,
  .profile-reload-copy p,
  .cell-disclosure-entry-title,
  .cell-disclosure-entry-meta,
  .dashboard-manager-panel-section-head,
  .dashboard-manager-pill span,
  .dashboard-kpi-card h3,
  .dashboard-kpi-value,
  .machine-monitor-metric-values strong,
  .dashboard-mobile-resize-option,
  .dashboard-mobile-picker-trigger,
  .dashboard-widget-field span,
  .history-kpi-card strong,
  .history-stat-card strong,
  .history-state-card strong,
  .history-legend-label,
  .history-band-legend-item,
  .history-space-option strong,
  .history-space-option span,
  .history-summary-chip,
  .history-summary-chip strong,
  .point-history-picker-banner-copy strong,
  .point-history-picker-banner-copy span,
  .history-report-cover h2,
  .history-report-section h4,
  .history-report-identification,
  .history-report-section-head p,
  .history-report-kpi-card span,
  .history-report-kpi-card small,
  .history-report-kpi-card strong,
  .history-report-chart-legend-item,
  .history-report-footer,
  .history-compare-panel-head h4,
  .history-compare-results-head h4,
  .history-compare-origin-head h5,
  .history-compare-chart-card h5,
  .history-compare-panel-head p,
  .history-compare-results-head p,
  .history-compare-origin-head p,
  .history-compare-chart-card p,
  .history-compare-series-card strong,
  .history-compare-series-card span,
  .history-compare-series-card small,
  .history-compare-empty strong,
  .history-compare-inline-state strong
) {
  color: var(--text-primary) !important;
}

:root[data-theme="dark"] :is(
  .profile-reload-copy .eyebrow,
  .selected-tag,
  .dashboard-mobile-resize-option-meta,
  .history-report-kicker,
  .history-compare-series-meta,
  .history-compare-summary-chip
) {
  color: var(--text-secondary) !important;
}

:root[data-theme="dark"] .editor-status.success {
  color: var(--success-accessible-text);
}

:root[data-theme="dark"] .history-axis-labels text,
:root[data-theme="dark"] .history-report-axis-label {
  fill: var(--text-secondary) !important;
}

:root[data-theme="dark"] .history-grid-line,
:root[data-theme="dark"] .history-report-grid-line {
  stroke: var(--chart-grid) !important;
}

@media (max-width: 840px) {
  .account-menu {
    min-width: 0;
  }

  body.sidebar-collapsed .account-menu {
    left: calc(100% + 8px);
    width: min(280px, calc(100vw - 112px));
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .account-menu,
  .theme-choice,
  .profile-card-arrow {
    transition: none !important;
  }
}

/* Visual corrections after cross-page theme review. */
.topbar,
body:has(#section-aiLab.panel-section.is-active) .topbar {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.dashboard-card,
.dashboard-card:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.history-selector-copy h3 {
  color: var(--text-primary);
}

/* Dark-only legibility audit across every BMS Advisor section. */
:root[data-theme="dark"] .main-panel :is(h1, h2, h3, h4, h5, h6) {
  color: var(--text-primary);
}

:root[data-theme="dark"] .main-panel :is(p, small, dt, label) {
  color: var(--text-secondary);
}

:root[data-theme="dark"] .point-history-access-card,
:root[data-theme="dark"] .point-history-access-card.is-picker {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  border-left: 4px solid var(--accent-cyan);
  box-shadow: 0 14px 30px var(--shadow-color-soft);
}

:root[data-theme="dark"] .point-history-access-copy strong {
  color: var(--text-primary);
}

:root[data-theme="dark"] .point-history-access-copy span:last-child {
  color: var(--text-secondary);
}

:root[data-theme="dark"] :is(
  .payload-disclosure,
  .cell-disclosure,
  .editor-note,
  .table-inline-state,
  .history-aggregation-note,
  .table-section-banner
) {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
}

:root[data-theme="dark"] :is(
  .payload-disclosure summary,
  .payload-primitive,
  .cell-disclosure-title,
  .cell-disclosure-entry-title,
  .loading-state,
  .editor-header-copy h3,
  .editor-note,
  .dashboard-manager-panel-section-head,
  .dashboard-manager-pill span,
  .dashboard-kpi-card h3,
  .dashboard-kpi-value,
  .dashboard-metric-card-popover strong,
  .dashboard-card-tool,
  .dashboard-widget-card-context-inline,
  .widget-empty-state strong,
  .watchlist-value-cell,
  .alarm-feed-alarm-cell strong,
  .dashboard-surgical-config-head strong,
  .dashboard-surgical-inline-check,
  .surgical-rooms-pressure,
  .watchlist-widget-single-metrics strong,
  .machine-monitor-metric-values strong,
  .machine-monitor-panel-head h3,
  .dashboard-widget-image-copy strong
) {
  color: var(--text-primary);
}

:root[data-theme="dark"] .dashboard-card-tool {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  box-shadow: 0 10px 24px var(--shadow-color-soft);
}

/* Limpeza modo escuro - editor de dashboard (2026-08-11): estes widgets/paineis
   ficaram com fundo claro fixo (rgba(255,255,255,...)) desde que foram
   escritos, então no tema escuro viravam "caixas brancas" no meio do
   dashboard e texto/ícones escuros ilegíveis por cima delas. */
:root[data-theme="dark"] :is(
  .dashboard-widget-card-shell,
  .widget-empty-state,
  .alarm-feed-table-shell,
  .watchlist-widget-single,
  .watchlist-widget-table-shell,
  .machine-monitor-metric-card,
  .dashboard-manager-pill,
  .dashboard-manager-empty-mini,
  .dashboard-mobile-picker-option,
  .dashboard-widget-selection-item,
  .dashboard-widget-field select
) {
  background: var(--bg-elevated);
  border-color: var(--border-default);
}

:root[data-theme="dark"] :is(
  .dashboard-widget-card-context-inline,
  .machine-monitor-image-placeholder,
  .dashboard-widget-field span
) {
  color: var(--text-primary);
}

:root[data-theme="dark"] .machine-monitor-visual {
  background: linear-gradient(160deg, var(--bg-elevated) 0%, var(--bg-soft) 54%, var(--bg-elevated) 100%);
  border-color: var(--border-default);
}

:root[data-theme="dark"] .dashboard-manager-panel-header {
  border-bottom-color: var(--border-default);
}

:root[data-theme="dark"] .dashboard-library-sheet-handle {
  background: var(--border-strong);
}

:root[data-theme="dark"] .dashboard-kpi-fill {
  background: var(--border-default);
}

/* Barra indicadora de "soltar aqui" ao arrastar um card para reordenar -
   a ponta em #2B2828 (navy) quase sumia contra um fundo já escuro. */
:root[data-theme="dark"] .dashboard-card.is-drop-target-before::before,
:root[data-theme="dark"] .dashboard-card.is-drop-target-after::after {
  background: linear-gradient(90deg, var(--accent-cyan), var(--primary));
}

:root[data-theme="dark"] :is(
  .payload-summary-meta,
  .payload-label,
  .cell-disclosure-meta,
  .cell-disclosure-entry-meta,
  .dashboard-metric-card-popover p,
  .watchlist-widget-table th,
  .alarm-feed-table th,
  .watchlist-widget-single-metrics span,
  .machine-monitor-metric-label,
  .dashboard-widget-config-status,
  .editor-field label,
  .editor-help,
  .editor-alarm-subtitle,
  .editor-input[readonly],
  .editor-textarea[readonly]
) {
  color: var(--text-secondary);
}

:root[data-theme="dark"] :is(
  .refresh-status.success,
  .floating-refresh-status.success,
  .toast-success,
  .editor-status.success
) {
  color: var(--success-accessible-text);
}

:root[data-theme="dark"] :is(
  .service-monitor-status-pill.is-ok,
  .surgical-rooms-status.tone-ok,
  .surgical-rooms-legend-item.tone-ok,
  .surgical-rooms-pressure.tone-ok,
  .surgical-rooms-metric.tone-ok
) {
  color: var(--success-accessible-text);
}

:root[data-theme="dark"] :is(
  .service-monitor-status-pill.is-warning,
  .surgical-rooms-status.tone-warning,
  .surgical-rooms-legend-item.tone-warning,
  .surgical-rooms-pressure.tone-warning,
  .surgical-rooms-metric.tone-warning
) {
  color: var(--warning-accessible-text);
}

:root[data-theme="dark"] :is(
  .service-monitor-status-pill.is-critical,
  .surgical-rooms-status.tone-critical,
  .surgical-rooms-legend-item.tone-critical,
  .surgical-rooms-pressure.tone-critical,
  .surgical-rooms-metric.tone-critical,
  .service-monitor-error,
  .table-inline-state.is-error
) {
  color: var(--danger-accessible-text);
}

:root[data-theme="dark"] .history-screen :is(h1, h2, h3, h4, h5, h6, strong),
:root[data-theme="dark"] .history-picker-modal :is(h1, h2, h3, h4, h5, h6, strong) {
  color: var(--text-primary);
}

:root[data-theme="dark"] .history-screen :is(p, small, label),
:root[data-theme="dark"] .history-picker-modal :is(p, small, label) {
  color: var(--text-secondary);
}

:root[data-theme="dark"] :is(
  .history-header-card h3,
  .history-card-head h4,
  .history-kpi-card strong,
  .history-stat-card strong,
  .history-state-card strong,
  .history-compact-stat-name,
  .history-section-header-copy h3,
  .history-selector-copy h3,
  .history-space-option strong,
  .history-summary-chip strong,
  .point-history-picker-banner-copy strong
) {
  color: var(--text-primary);
}

:root[data-theme="dark"] :is(
  .history-selector-copy p,
  .history-space-option span,
  .history-period-limit-note,
  .history-space-results-empty,
  .history-summary-chip-value,
  .point-history-picker-banner-copy span
) {
  color: var(--text-secondary);
}

:root[data-theme="dark"] :is(
  .history-section-order,
  .history-aggregation-note,
  .table-section-banner,
  .history-loading-overlay,
  .history-compare-origin-count,
  .history-compare-series-type
) {
  color: var(--primary-accessible-text);
}

:root[data-theme="dark"] .history-report-dialog :is(h1, h2, h3, h4, h5, h6, strong) {
  color: var(--text-primary);
}

:root[data-theme="dark"] .history-report-dialog :is(p, span, small, th, td, blockquote) {
  color: var(--text-secondary);
}

:root[data-theme="dark"] :is(
  .history-report-cover,
  .history-report-section,
  .history-report-footer,
  .history-report-kpi-card,
  .history-report-table-card,
  .history-report-chart-card,
  .history-report-insights
) {
  background: var(--bg-surface);
  border-color: var(--border-default);
}

:root[data-theme="dark"] .history-report-insights {
  border-left-color: var(--primary);
  color: var(--text-primary);
}

:root[data-theme="dark"] .history-report-score-card,
:root[data-theme="dark"] .history-report-score-card * {
  color: var(--text-on-dark) !important;
}

:root[data-theme="dark"] #section-aiLab :is(
  [class^="ai-lab-"],
  [class*=" ai-lab-"]
) {
  color: var(--text-primary);
}

:root[data-theme="dark"] #section-aiLab :is(
  .ai-lab-message-meta,
  .ai-lab-empty,
  .ai-lab-muted,
  .ai-lab-scenarios button span,
  .ai-lab-engine-result header,
  .ai-lab-engine-result header small,
  .ai-lab-composer-message textarea::placeholder,
  .ai-lab-scenario-category > summary small,
  .ai-lab-scenario-card span,
  .ai-lab-scenario-title span,
  .ai-lab-scenario-card small
) {
  color: var(--text-secondary);
}

:root[data-theme="dark"] #section-aiLab :is(
  .ai-lab-message-meta code,
  .ai-lab-engine-result header span,
  .ai-lab-scenario-category > summary::after,
  .ai-lab-followup-steps b,
  .ai-lab-scenarios-reopen
) {
  color: var(--primary-accessible-text);
}

:root[data-theme="dark"] #section-aiLab :is(
  .ai-lab-warning,
  .ai-lab-chart-limitations span
) {
  color: var(--warning-accessible-text);
}

:root[data-theme="dark"] #section-aiLab :is(
  .ai-lab-attachment-state.is-error,
  .ai-lab-audio-status.is-error
) {
  color: var(--danger-accessible-text);
}

/* IA Lab: complete Dark surface and text contrast after legacy Light rules. */
:root[data-theme="dark"] #section-aiLab .ai-lab-screen {
  color: var(--text-primary);
}

:root[data-theme="dark"] #section-aiLab :is(
  .ai-lab-scenarios,
  .ai-lab-engineering,
  .ai-lab-chat,
  .ai-lab-composer,
  .ai-lab-mobile-tests-drawer,
  .ai-lab-mobile-tests-head
) {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
}

:root[data-theme="dark"] #section-aiLab .ai-lab-chat-log {
  background: var(--bg-soft);
  color: var(--text-primary);
}

:root[data-theme="dark"] #section-aiLab :is(
  .ai-lab-message,
  .ai-lab-engine-result,
  .ai-lab-metric-card,
  .ai-lab-alarm-card,
  .ai-lab-chart-card,
  .ai-lab-table-wrap,
  .ai-lab-scenario-card,
  .ai-lab-followup-card,
  .ai-lab-attachment,
  .ai-lab-attachment-state
) {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
  box-shadow: none;
}

:root[data-theme="dark"] #section-aiLab .ai-lab-message.user {
  background: var(--primary-soft);
  border-color: var(--primary);
}

:root[data-theme="dark"] #section-aiLab .ai-lab-scenario-category {
  background: var(--bg-soft);
  border-color: var(--border-default);
}

:root[data-theme="dark"] #section-aiLab :is(
  .ai-lab-followup-steps button,
  .ai-lab-eval button,
  .ai-lab-scenarios-reopen,
  .ai-lab-composer .ghost-button,
  .ai-lab-scenarios-head .ghost-button,
  .ai-lab-mobile-tests-head .ghost-button,
  .ai-lab-chart-head .ghost-button,
  .ai-lab-engineering button
) {
  background: var(--bg-soft);
  border-color: var(--border-default);
  color: var(--text-primary);
}

:root[data-theme="dark"] #section-aiLab .ghost-button {
  border: 1px solid var(--border-default);
  background: var(--bg-soft);
  color: var(--text-primary);
}

:root[data-theme="dark"] #section-aiLab .primary-button {
  border: 1px solid var(--primary-action-bg);
  background: var(--primary-action-bg);
  color: var(--text-on-primary);
}

:root[data-theme="dark"] #section-aiLab :is(
  .ghost-button,
  .primary-button
):is(:hover, :focus-visible) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
}

:root[data-theme="dark"] #section-aiLab .ai-lab-engine-selector .ghost-button.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
  box-shadow: inset 0 0 0 1px var(--primary);
}

:root[data-theme="dark"] #section-aiLab :is(
  .ai-lab-scenarios-head > strong,
  .ai-lab-scenario-category > summary,
  .ai-lab-scenario-card strong,
  .ai-lab-scenario-title strong,
  .ai-lab-engine-result header strong,
  .ai-lab-chart-head strong,
  .ai-lab-message-body strong,
  .ai-lab-table-wrap > strong
) {
  color: var(--text-primary);
}

:root[data-theme="dark"] #section-aiLab :is(
  .ai-lab-message-meta,
  .ai-lab-empty,
  .ai-lab-muted,
  .ai-lab-scenarios button span,
  .ai-lab-scenario-category > summary small,
  .ai-lab-scenario-card span,
  .ai-lab-scenario-title span,
  .ai-lab-scenario-card small,
  .ai-lab-engine-result header,
  .ai-lab-engine-result header small,
  .ai-lab-chart-head span,
  .ai-lab-attachment figcaption,
  .ai-lab-attachment-link,
  .ai-lab-engineering dt,
  .ai-lab-audio-status
) {
  color: var(--text-secondary);
}

:root[data-theme="dark"] #section-aiLab :is(
  .ai-lab-composer textarea,
  .ai-lab-engineering pre
) {
  background: var(--bg-soft);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

:root[data-theme="dark"] #section-aiLab .ai-lab-composer textarea::placeholder {
  color: var(--placeholder-text);
  opacity: 1;
}

:root[data-theme="dark"] #section-aiLab .ai-lab-table-wrap th {
  background: var(--table-header-bg);
  color: var(--table-header-text);
}

:root[data-theme="dark"] #section-aiLab .ai-lab-table-wrap td {
  color: var(--text-primary);
  border-bottom-color: var(--table-row-border);
}

:root[data-theme="dark"] #section-aiLab .ai-lab-followup-steps b {
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
}

:root[data-theme="dark"] #section-aiLab .ai-lab-composer :is(
  .primary-button,
  .ghost-button
):disabled {
  color: var(--text-muted);
}

/* On-screen standalone reports follow Dark; PDF/export remains intentionally light. */
:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) {
  background: var(--bg-app);
  color: var(--text-primary);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) :is(
  .report-topbar,
  .report-status-card,
  .report-global-loading-card,
  .report-hero-card,
  .report-drawer,
  .report-panel,
  .report-metric-card,
  .report-table-wrap,
  .history-report-section,
  .history-report-table-card,
  .history-report-chart-card,
  .report-reference-page,
  .report-pdf-header,
  .report-period-banner,
  .report-pdf-ico-section,
  .report-executive-card,
  .report-diagnosis-banner,
  .report-summary-reference-bar,
  .report-occurrences-disclosure,
  .report-occurrence-description,
  .report-occurrence-description-entry,
  .report-occurrence-item
) {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) :is(h1, h2, h3, h4, h5, h6, strong) {
  color: var(--text-primary);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) :is(p, span, small, label, th, td) {
  color: var(--text-secondary);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) :is(
  .report-close-button,
  .report-export-button,
  .report-occurrences-filter-select,
  .report-occurrences-filter-input
) {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) :is(
  table,
  thead,
  tbody,
  th,
  td
) {
  background: var(--table-bg);
  border-color: var(--table-row-border);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) thead th {
  background: var(--table-header-bg);
  color: var(--table-header-text);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) .report-ico-card,
:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) .report-ico-card * {
  color: var(--text-on-dark) !important;
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) :is(
  .is-ok,
  .is-ok strong,
  .report-ico-text.is-ok
) {
  color: var(--success-accessible-text);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) :is(
  .is-warning,
  .is-warning strong,
  .report-ico-text.is-warning
) {
  color: var(--warning-accessible-text);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) :is(
  .is-critical,
  .is-critical strong,
  .is-danger,
  .is-danger strong,
  .report-ico-text.is-critical
) {
  color: var(--danger-accessible-text);
}

/* Refresh feedback and global AI assistant refinements. */
.table-inline-state.is-loading .loading-state {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
}

.table-inline-state.is-loading .loading-spinner {
  border-color: var(--border-strong);
  border-top-color: var(--primary);
}

.global-ai-command[hidden],
.global-ai-launcher[hidden] {
  display: none !important;
}

.topbar {
  align-items: center;
}

.topbar-title,
.topbar-side {
  flex: 1 1 0;
  min-width: 0;
  align-items: center;
}

.topbar-title > div {
  min-width: 0;
}

.global-ai-command {
  display: block;
  flex: 0 0 min(520px, 40vw);
  width: min(520px, 40vw);
  min-width: 420px;
  align-self: center;
}

.global-ai-command-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 48px;
  padding: 4px 5px 4px 14px;
  border: 1px solid var(--border-default);
  border-radius: 16px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-soft);
}

.global-ai-command-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.global-ai-command-icon,
.global-ai-command-field > button {
  display: inline-grid;
  place-items: center;
}

.global-ai-command-icon {
  color: var(--primary);
}

.global-ai-command-icon svg,
.global-ai-command-field button svg {
  width: 19px;
  height: 19px;
}

.global-ai-command-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  box-shadow: none;
  font: inherit;
  font-size: 0.88rem;
}

.global-ai-command-field input:focus {
  border: 0;
  box-shadow: none;
}

.global-ai-command-field input::placeholder {
  color: var(--placeholder-text);
  opacity: 1;
}

.global-ai-command-submit {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
}

.global-ai-command-submit {
  background: var(--primary-action-bg);
  color: var(--text-on-primary);
}

.global-ai-command-submit:hover,
.global-ai-command-submit:focus-visible {
  background: var(--primary-action-hover);
  border-color: var(--primary-action-hover);
}

.global-ai-chat-audio.is-recording {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger-accessible-text);
}

.global-ai-chat-audio.is-processing {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning-accessible-text);
}

.global-ai-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 145;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 64px;
  height: 64px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--primary);
  border-radius: 22px;
  background: var(--primary-action-bg);
  color: var(--text-on-primary);
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
}

.global-ai-launcher:hover,
.global-ai-launcher:focus-visible,
.global-ai-launcher[aria-expanded="true"] {
  background: var(--primary-action-hover);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.global-ai-launcher svg {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
}

.global-ai-launcher > span:last-child {
  position: relative;
  z-index: 1;
}

.global-ai-launcher-orbit {
  position: absolute;
  inset: 7px;
  border: 1px solid currentColor;
  border-radius: 18px;
  opacity: 0.22;
  transform: rotate(12deg);
}

.global-ai-chat {
  position: fixed;
  right: 24px;
  bottom: 100px;
  z-index: 150;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(420px, calc(100vw - 24px));
  height: min(680px, calc(100dvh - 130px));
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: 24px;
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.global-ai-chat.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.global-ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 40px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-elevated);
}

.global-ai-chat-close {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 1.15rem;
}

.global-ai-chat-close:hover,
.global-ai-chat-close:focus-visible {
  border-color: var(--border-default);
  background: var(--bg-soft);
  color: var(--text-primary);
}

.global-ai-chat-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-soft);
  color: var(--text-secondary);
  font-size: 0.74rem;
}

.global-ai-chat-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.global-ai-chat-status.is-recording .global-ai-chat-status-dot,
.global-ai-chat-status.is-error .global-ai-chat-status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.global-ai-chat-status.is-processing .global-ai-chat-status-dot {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
}

.global-ai-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg-soft);
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.global-ai-chat-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 100%;
  padding: 28px;
  color: var(--text-secondary);
  text-align: center;
}

.global-ai-chat-empty strong,
.global-ai-message-body p {
  color: var(--text-primary);
}

.global-ai-chat-empty p,
.global-ai-message-body p {
  margin: 0;
  line-height: 1.48;
}

.global-ai-chat-empty-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--primary);
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
}

.global-ai-message {
  display: grid;
  gap: 6px;
  width: fit-content;
  max-width: 88%;
  padding: 11px 12px;
  border: 1px solid var(--border-default);
  border-radius: 16px 16px 16px 6px;
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.global-ai-message.user {
  align-self: flex-end;
  border-color: var(--primary);
  border-radius: 16px 16px 6px;
  background: var(--primary-soft);
}

.global-ai-message-role {
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.global-ai-message-body {
  display: grid;
  gap: 7px;
  overflow-wrap: anywhere;
}

.global-ai-message-body p {
  white-space: pre-wrap;
}

.global-ai-message-media {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border-default);
}

.global-ai-typing {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 5px;
  width: fit-content;
  padding: 9px 12px;
  border: 1px solid var(--border-default);
  border-radius: 14px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.global-ai-typing > span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--primary);
  animation: global-ai-typing 1s infinite ease-in-out;
}

.global-ai-typing > span:nth-child(2) { animation-delay: 0.14s; }
.global-ai-typing > span:nth-child(3) { animation-delay: 0.28s; }

.global-ai-typing em {
  margin-left: 4px;
  font-size: 0.72rem;
  font-style: normal;
}

@keyframes global-ai-typing {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.global-ai-chat-composer {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border-default);
  background: var(--bg-surface);
}

.global-ai-chat-composer textarea {
  width: 100%;
  min-height: 54px;
  max-height: 130px;
  padding: 14px 16px;
  resize: vertical;
  border: 1px solid var(--border-default);
  border-radius: 14px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font: inherit;
  line-height: 1.45;
}

.global-ai-chat-composer textarea::placeholder {
  color: var(--placeholder-text);
  opacity: 1;
}

.global-ai-chat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.global-ai-chat-audio {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--border-default);
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
}

.global-ai-chat-audio svg {
  width: 18px;
  height: 18px;
}

.global-ai-chat-submit {
  min-width: 92px;
}

:root[data-theme="dark"] :is(
  .service-monitor-host-card,
  .service-monitor-card,
  .service-monitor-status-card
) {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
}

:root[data-theme="dark"] :is(
  button.selected,
  button.is-selected,
  button[aria-pressed="true"]:not(.global-ai-chat-audio),
  button[aria-checked="true"]
) {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-accessible-text);
  box-shadow: inset 0 0 0 1px var(--primary);
}

:root[data-theme="dark"] #section-aiLab .ai-lab-engine-selector .ghost-button.selected {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-accessible-text);
  box-shadow: inset 0 0 0 1px var(--primary);
}

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
  }

  .global-ai-command {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .global-ai-command-field {
    grid-template-columns: minmax(0, 1fr) 36px;
    padding-left: 10px;
  }

  .global-ai-launcher {
    right: 12px;
    bottom: 12px;
    width: 58px;
    height: 58px;
    border-radius: 19px;
  }

  .global-ai-chat {
    right: 12px;
    bottom: 82px;
    width: calc(100vw - 24px);
    height: min(680px, calc(100dvh - 100px));
    border-radius: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .global-ai-chat,
  .global-ai-launcher,
  .global-ai-typing > span {
    transition: none;
    animation: none;
  }
}

/*
 * BMS AI Entity: the same ai-energy-field / ai-orb-icon reference used on the
 * main site. The custom element keeps every dashboard integration on one source.
 */
.bms-ai-entity {
  --ai-entity-size: 36px;
  --ai-orb-drift-speed: 8.4s;
  --ai-orb-halo-speed: 9.6s;
  --ai-orb-pulse-speed: 5.8s;
  --ai-orb-rotate-speed: 13s;
  --ai-orb-smoke-speed: 6.4s;
  --ai-orb-breathe-speed: 5.2s;
  --ai-orb-surface-core-current: var(--ai-orb-surface-core);
  --ai-orb-surface-mid-current: var(--ai-orb-surface-mid);
  --ai-orb-surface-soft-current: var(--ai-orb-surface-soft);
  --ai-orb-form-a-current: var(--ai-orb-form-a);
  --ai-orb-form-b-current: var(--ai-orb-form-b);
  --ai-orb-form-c-current: var(--ai-orb-form-c);
  --ai-orb-form-d-current: var(--ai-orb-form-d);
  --ai-orb-form-e-current: var(--ai-orb-form-e);
  --ai-orb-form-f-current: var(--ai-orb-form-f);
  --ai-orb-form-g-current: var(--ai-orb-form-g);
  --ai-orb-core-current: var(--ai-orb-idle-core);
  --ai-orb-core-mid-current: var(--ai-orb-idle-mid);
  --ai-orb-core-soft-current: var(--ai-orb-idle-soft);
  --ai-orb-blur: clamp(4px, calc(var(--ai-entity-size) * 0.3125), 32px);
  --ai-orb-form-blur: clamp(1px, calc(var(--ai-entity-size) * 0.046875), 6px);
  --ai-orb-form-blur-rest: clamp(1px, calc(var(--ai-entity-size) * 0.053125), 7px);
  --ai-orb-form-blur-expanded: clamp(1.5px, calc(var(--ai-entity-size) * 0.075), 10px);
  --ai-orb-form-blur-settled: clamp(1.2px, calc(var(--ai-entity-size) * 0.059375), 8px);
  --ai-orb-core-blur: clamp(0.4px, calc(var(--ai-entity-size) * 0.01875), 3px);
  --ai-orb-shadow-tight: clamp(3px, calc(var(--ai-entity-size) * 0.1875), 24px);
  --ai-orb-shadow-wide: clamp(7px, calc(var(--ai-entity-size) * 0.4375), 56px);
  display: inline-grid;
  place-items: center;
  width: var(--ai-entity-size);
  height: var(--ai-entity-size);
  flex: 0 0 var(--ai-entity-size);
  contain: layout style;
  isolation: isolate;
  overflow: visible;
  vertical-align: middle;
}

.bms-ai-entity[interactive] {
  border-radius: 48% 52% 51% 49%;
  cursor: pointer;
}

.bms-ai-entity[interactive]:hover .bms-ai-entity-visual,
.global-ai-launcher:hover .bms-ai-entity-visual {
  transform: scale(1.04);
}

.bms-ai-entity[interactive]:active .bms-ai-entity-visual,
.global-ai-launcher:active .bms-ai-entity-visual {
  transform: scale(0.965);
}

.bms-ai-entity[interactive]:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

.bms-ai-entity-visual,
.bms-ai-entity .ai-energy-field {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.bms-ai-entity-visual {
  transition: transform 0.16s ease;
}

.bms-ai-entity .ai-energy-field {
  position: relative;
  overflow: visible;
  pointer-events: none;
  isolation: isolate;
  animation: ai-orb-drift var(--ai-orb-drift-speed) ease-in-out infinite;
}

.bms-ai-entity .ai-energy-field::before {
  content: "";
  position: absolute;
  width: 150%;
  height: 131.25%;
  border-radius: 37% 63% 48% 52% / 54% 38% 62% 46%;
  background:
    radial-gradient(ellipse at 32% 46%, var(--ai-orb-halo-white), transparent 30%),
    radial-gradient(ellipse at 60% 38%, var(--ai-orb-halo-ice), transparent 38%),
    radial-gradient(ellipse at 62% 70%, var(--ai-orb-halo-cyan), transparent 42%),
    radial-gradient(ellipse at 28% 76%, var(--ai-orb-halo-silver), transparent 44%);
  filter: blur(var(--ai-orb-blur));
  opacity: 0.56;
  z-index: -1;
  animation: ai-orb-halo var(--ai-orb-halo-speed) ease-in-out infinite;
}

.bms-ai-entity .ai-orb-icon {
  position: relative;
  display: block;
  width: 87.5%;
  height: 87.5%;
  border-radius: 40% 60% 45% 55% / 58% 42% 62% 38%;
  background:
    radial-gradient(circle at 51% 49%, var(--ai-orb-surface-core-current) 0 16%, var(--ai-orb-surface-mid-current) 17% 25%, var(--ai-orb-surface-soft-current) 36%, transparent 58%),
    radial-gradient(ellipse at 28% 28%, var(--ai-orb-surface-white), transparent 34%),
    radial-gradient(ellipse at 72% 34%, var(--ai-orb-surface-ice), transparent 38%),
    radial-gradient(ellipse at 72% 76%, var(--ai-orb-surface-cyan), transparent 44%),
    radial-gradient(ellipse at 24% 74%, var(--ai-orb-surface-silver), transparent 46%);
  filter:
    drop-shadow(0 0 var(--ai-orb-shadow-tight) var(--ai-orb-shadow-white))
    drop-shadow(0 0 var(--ai-orb-shadow-wide) var(--ai-orb-shadow-cyan));
  animation:
    ai-orb-pulse var(--ai-orb-pulse-speed) ease-in-out infinite,
    ai-organic-rotate var(--ai-orb-rotate-speed) ease-in-out infinite;
}

.bms-ai-entity .ai-orb-icon::before,
.bms-ai-entity .ai-orb-icon::after {
  content: "";
  position: absolute;
  inset: -12.5%;
  border-radius: 33% 67% 41% 59% / 56% 34% 66% 44%;
}

.bms-ai-entity .ai-orb-icon::before {
  background:
    radial-gradient(ellipse at 18% 36%, var(--ai-orb-form-a-current), transparent 24%),
    radial-gradient(ellipse at 37% 12%, var(--ai-orb-form-b-current), transparent 24%),
    radial-gradient(ellipse at 68% 20%, var(--ai-orb-form-c-current), transparent 28%),
    radial-gradient(ellipse at 88% 48%, var(--ai-orb-form-d-current), transparent 25%),
    radial-gradient(ellipse at 70% 88%, var(--ai-orb-form-e-current), transparent 31%),
    radial-gradient(ellipse at 28% 84%, var(--ai-orb-form-f-current), transparent 29%),
    radial-gradient(ellipse at 48% 52%, var(--ai-orb-form-g-current), transparent 42%);
  filter: blur(var(--ai-orb-form-blur));
  opacity: 0.82;
  animation: smokeExpand var(--ai-orb-smoke-speed) ease-in-out infinite;
}

.bms-ai-entity .ai-orb-icon::after {
  inset: 25%;
  border-radius: 47% 53% 45% 55% / 52% 46% 54% 48%;
  background: radial-gradient(
    circle at 50% 50%,
    var(--ai-orb-core-current) 0 38%,
    var(--ai-orb-core-mid-current) 52%,
    var(--ai-orb-core-soft-current) 72%,
    transparent 100%
  );
  filter: blur(var(--ai-orb-core-blur));
  opacity: 0.94;
  animation: ai-orb-breathe var(--ai-orb-breathe-speed) ease-in-out infinite;
}

/* Listening, thinking and responding share the blue, faster active treatment. */
.bms-ai-entity:is(
  [data-state="listening"],
  [data-state="thinking"],
  [data-state="responding"]
) {
  --ai-orb-drift-speed: 2.8s;
  --ai-orb-halo-speed: 3.4s;
  --ai-orb-pulse-speed: 2s;
  --ai-orb-rotate-speed: 3.2s;
  --ai-orb-smoke-speed: 1.9s;
  --ai-orb-breathe-speed: 1.7s;
  --ai-orb-surface-core-current: var(--ai-orb-thinking-core);
  --ai-orb-surface-mid-current: var(--ai-orb-thinking-mid);
  --ai-orb-surface-soft-current: var(--ai-orb-thinking-soft);
  --ai-orb-form-a-current: var(--ai-orb-thinking-core);
  --ai-orb-form-b-current: var(--ai-orb-thinking-mid);
  --ai-orb-form-c-current: var(--ai-orb-thinking-mid);
  --ai-orb-form-d-current: var(--ai-orb-thinking-core);
  --ai-orb-form-e-current: var(--ai-orb-thinking-soft);
  --ai-orb-form-f-current: var(--ai-orb-thinking-mid);
  --ai-orb-form-g-current: var(--ai-orb-thinking-soft);
  --ai-orb-core-current: var(--ai-orb-thinking-core);
  --ai-orb-core-mid-current: var(--ai-orb-thinking-mid);
  --ai-orb-core-soft-current: var(--ai-orb-thinking-soft);
}

/* Alarm changes only the nucleus color and retains idle movement speed. */
.bms-ai-entity[data-state="alert"] {
  --ai-orb-core-current: var(--ai-orb-alarm-core);
  --ai-orb-core-mid-current: var(--ai-orb-alarm-mid);
  --ai-orb-core-soft-current: var(--ai-orb-alarm-soft);
}

.bms-ai-entity[data-paused="true"] *,
.bms-ai-entity[data-paused="true"] *::before,
.bms-ai-entity[data-paused="true"] *::after {
  animation-play-state: paused !important;
}

@keyframes ai-orb-pulse {
  0%, 100% {
    opacity: 0.9;
    border-radius: 42% 58% 47% 53% / 57% 39% 61% 43%;
    transform: scale(0.92);
  }
  36% {
    opacity: 1;
    border-radius: 31% 69% 55% 45% / 43% 62% 38% 57%;
    transform: scale(1.13);
  }
  62% {
    opacity: 0.96;
    border-radius: 61% 39% 42% 58% / 48% 37% 63% 52%;
    transform: scale(1.02);
  }
}

@keyframes smokeExpand {
  0%, 100% {
    opacity: 0.62;
    border-radius: 38% 62% 44% 56% / 58% 42% 61% 39%;
    transform: translate(-0.5px, 0.4px) scale(0.76, 0.82);
    filter: blur(var(--ai-orb-form-blur-rest));
  }
  44% {
    opacity: 0.9;
    border-radius: 68% 32% 56% 44% / 39% 65% 35% 61%;
    transform: translate(0.9px, -0.8px) scale(1.22, 1.08);
    filter: blur(var(--ai-orb-form-blur-expanded));
  }
  73% {
    opacity: 0.76;
    border-radius: 45% 55% 35% 65% / 62% 36% 64% 38%;
    transform: translate(-0.8px, 0.7px) scale(1.04, 1.18);
    filter: blur(var(--ai-orb-form-blur-settled));
  }
}

@keyframes ai-organic-rotate {
  0%, 100% { rotate: -1.2deg; }
  32% { rotate: 3.4deg; }
  67% { rotate: -2.6deg; }
}

@keyframes ai-orb-breathe {
  0%, 100% { opacity: 0.86; transform: scale(0.92); }
  48% { opacity: 1; transform: scale(1.08); }
}

@keyframes ai-orb-drift {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  24% { transform: translate(0.8px, -0.8px) rotate(1.8deg); }
  52% { transform: translate(-0.7px, 0.9px) rotate(-1.2deg); }
  78% { transform: translate(0.5px, 0.2px) rotate(0.8deg); }
}

@keyframes ai-orb-halo {
  0%, 100% { opacity: 0.42; transform: scale(0.82) rotate(-8deg); }
  44% { opacity: 0.74; transform: scale(1.14) rotate(10deg); }
}

/* Remove the Light-only shadow band below the command field. */
:root:not([data-theme="dark"]) .global-ai-command,
:root:not([data-theme="dark"]) .global-ai-command-field {
  background-image: none;
  filter: none;
}

:root:not([data-theme="dark"]) .global-ai-command-field {
  background-color: var(--bg-surface);
  box-shadow: none;
}

.global-ai-command-field {
  grid-template-columns: minmax(0, 1fr) 38px;
}

.global-ai-launcher .bms-ai-entity-visual {
  position: static;
  width: 100%;
  height: 100%;
}

.global-ai-launcher {
  width: 59px;
  height: 59px;
  border-radius: 20px;
  overflow: visible;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  transition:
    right 0.28s ease,
    top 0.28s ease,
    bottom 0.28s ease,
    transform 0.18s ease;
}

.global-ai-launcher:hover,
.global-ai-launcher:focus-visible,
.global-ai-launcher[aria-expanded="true"] {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.global-ai-launcher:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

.global-ai-chat {
  bottom: 95px;
}

@media (max-width: 640px) {
  .global-ai-command-field {
    grid-template-columns: minmax(0, 1fr) 36px;
  }

  .global-ai-launcher {
    width: 53px;
    height: 53px;
    border-radius: 18px;
  }

  .global-ai-chat {
    bottom: 77px;
  }
}

/*
 * Keep the floating entity outside edit drawers. On narrow screens, where
 * there is no lateral room, it moves above the drawer instead.
 */
body.editor-active .global-ai-launcher {
  top: 12px;
  right: 12px;
  bottom: auto;
}

@media (min-width: 780px) {
  body.editor-active .global-ai-launcher {
    top: auto;
    right: 690px;
    bottom: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bms-ai-entity *,
  .bms-ai-entity *::before,
  .bms-ai-entity *::after {
    animation: none !important;
    transition: none !important;
  }

  .bms-ai-entity-visual {
    opacity: 0.96;
    transform: none !important;
  }
}


/* Ajustes de navegação, presença e histórico. */
.sidebar-system-status {
  display: block;
}

.sidebar-system-status-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sidebar-system-status-label #floatingMonitorIndicator {
  position: static;
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: var(--warning);
  box-shadow: 0 0 0 2px var(--warning-soft);
  cursor: help;
}

.sidebar-system-status-label #floatingMonitorIndicator.is-ok {
  background: var(--success);
  box-shadow: 0 0 0 2px var(--success-soft);
}

.sidebar-system-status-label #floatingMonitorIndicator.is-warning {
  background: var(--warning);
  box-shadow: 0 0 0 2px var(--warning-soft);
}

.sidebar-system-status-label #floatingMonitorIndicator.is-critical {
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--danger-soft);
}

.sidebar-system-status-label #floatingMonitorIndicator.is-loading {
  background: var(--text-muted);
  box-shadow: 0 0 0 2px var(--bg-soft);
}

.sidebar-nav {
  width: 100%;
  padding-right: 2px;
  margin-right: 0;
  scrollbar-width: thin;
}

.sidebar-nav::-webkit-scrollbar {
  width: 8px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  border-width: 2px;
}

.history-environment-actions {
  align-items: center;
}

.history-environment-actions .history-environment-period-field {
  display: block;
  flex: 0 0 142px;
  width: 142px;
  min-width: 142px;
  max-width: 142px;
  margin: 0;
}

.history-environment-actions .history-environment-period-field select {
  width: 100%;
}

.js-plotly-plot .plotly .hoverlayer .hovertext rect,
.js-plotly-plot .plotly .hoverlayer .hovertext path,
.js-plotly-plot .plotly .hoverlayer .axistext path,
.js-plotly-plot .plotly .hoverlayer .axistext rect {
  fill: var(--tooltip-bg) !important;
  stroke: var(--border-strong) !important;
}

.js-plotly-plot .plotly .hoverlayer .hovertext text,
.js-plotly-plot .plotly .hoverlayer .axistext text {
  fill: var(--tooltip-text) !important;
}

@media (min-width: 641px) {
  .global-ai-launcher {
    bottom: 14px;
  }
}

@media (min-width: 780px) {
  body.editor-active .global-ai-launcher {
    bottom: 14px;
  }
}

@media (max-width: 760px) {
  .history-environment-actions .history-environment-period-field {
    flex-basis: 100%;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
  }
}


/* Transição leve para os grupos do menu lateral. */
body:not(.sidebar-collapsed) .nav-group-items {
  display: grid;
  max-height: 420px;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transform-origin: top;
  transition:
    max-height 0.26s ease,
    opacity 0.18s ease,
    transform 0.22s ease,
    visibility 0s linear;
}

body:not(.sidebar-collapsed) .nav-group.is-collapsed .nav-group-items {
  display: grid;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    max-height 0.24s ease,
    opacity 0.15s ease,
    transform 0.2s ease,
    visibility 0s linear 0.24s;
}

@media (prefers-reduced-motion: reduce) {
  body:not(.sidebar-collapsed) .nav-group-items,
  body:not(.sidebar-collapsed) .nav-group.is-collapsed .nav-group-items {
    transition: none !important;
    transform: none !important;
  }
}


/* Evita o piscar da scrollbar enquanto os grupos recalculam a altura. */
.sidebar-nav.is-group-transitioning,
.sidebar-nav.is-group-transitioning:hover,
.sidebar-nav.is-group-transitioning:focus-within {
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  scrollbar-color: transparent transparent !important;
}

.sidebar-nav.is-group-transitioning::-webkit-scrollbar,
.sidebar-nav.is-group-transitioning:hover::-webkit-scrollbar,
.sidebar-nav.is-group-transitioning:focus-within::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.sidebar-nav.is-group-transitioning::-webkit-scrollbar-thumb,
.sidebar-nav.is-group-transitioning:hover::-webkit-scrollbar-thumb,
.sidebar-nav.is-group-transitioning:focus-within::-webkit-scrollbar-thumb {
  background: transparent !important;
}

/* Remove os botoes/setas nativos da scrollbar da navegacao lateral. */
.sidebar-nav::-webkit-scrollbar-button,
.sidebar-nav:hover::-webkit-scrollbar-button,
.sidebar-nav:focus-within::-webkit-scrollbar-button,
.sidebar-nav.is-group-transitioning::-webkit-scrollbar-button,
.sidebar-nav.is-group-transitioning:hover::-webkit-scrollbar-button,
.sidebar-nav.is-group-transitioning:focus-within::-webkit-scrollbar-button {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.sidebar-nav::-webkit-scrollbar-button:single-button,
.sidebar-nav:hover::-webkit-scrollbar-button:single-button,
.sidebar-nav:focus-within::-webkit-scrollbar-button:single-button,
.sidebar-nav.is-group-transitioning::-webkit-scrollbar-button:single-button,
.sidebar-nav.is-group-transitioning:hover::-webkit-scrollbar-button:single-button,
.sidebar-nav.is-group-transitioning:focus-within::-webkit-scrollbar-button:single-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

/* Título do eixo temporal com contraste integral no Histórico escuro. */
:root[data-theme="dark"] .point-history-plotly .xtitle,
:root[data-theme="dark"] .point-history-plotly .g-xtitle text {
  color: var(--tooltip-text) !important;
  fill: var(--tooltip-text) !important;
}
/* HYBRID-4.4.3B — IA Lab only */
#section-aiLab .ai-lab-engine-selector { display: inline-flex; max-width: 100%; }
#section-aiLab .ai-lab-engine-selector select { min-height: 34px; max-width: 100%; padding: 6px 32px 6px 11px; border: 1px solid #D8D4D4; border-radius: 999px; color: #232020; background: #FAFAFA; font: inherit; font-size: .76rem; font-weight: 700; cursor: pointer; }
#section-aiLab .ai-lab-engine-selector select:focus { outline: 0; border-color: #6D6565; box-shadow: 0 0 0 3px rgba(109, 101, 101, .14); }
#section-aiLab .ai-lab-debug-toggle { display: inline-flex; align-items: center; gap: 6px; }
#section-aiLab .ai-lab-debug-toggle.is-active { background: #fef3c7; border-color: #f59e0b; color: #78350f; }
#section-aiLab .ai-lab-composer { border-radius: 18px 18px 12px 12px; padding: 12px; }
#section-aiLab .ai-lab-composer-message { align-items: flex-end; padding: 5px; border: 1px solid #EEDCDB; border-radius: 14px; background: #fff; }
#section-aiLab .ai-lab-composer-message textarea { min-height: 48px; border: 0; outline: 0; box-shadow: none; border-radius: 10px; }
#section-aiLab .ai-lab-composer-message:focus-within { border-color: #6D6565; box-shadow: 0 0 0 3px rgba(109, 101, 101, .14); }
#section-aiLab .ai-lab-composer .primary-button { min-height: 42px; border-radius: 12px; }
#section-aiLab .ai-lab-feedback { display: grid; gap: 9px; margin-top: 12px; padding: 11px; border: 1px solid #EEDCDB; border-radius: 12px; background: #FBFBFB; white-space: normal; }
#section-aiLab .ai-lab-feedback-title, #section-aiLab .ai-lab-feedback-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#section-aiLab .ai-lab-feedback-title strong { color: #232020; font-size: .82rem; }
#section-aiLab .ai-lab-feedback-title small { color: #7C7373; font-size: .7rem; }
#section-aiLab .ai-lab-feedback fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
#section-aiLab .ai-lab-feedback legend, #section-aiLab .ai-lab-feedback-comment > span { color: #5C5454; font-size: .72rem; font-weight: 700; }
#section-aiLab .ai-lab-feedback-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
#section-aiLab .ai-lab-feedback-options label { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border: 1px solid #D8D4D4; border-radius: 999px; background: #fff; color: #474141; cursor: pointer; font-size: .72rem; }
#section-aiLab .ai-lab-feedback-options input { accent-color: #544E4E; }
#section-aiLab .ai-lab-feedback-comment { display: grid; gap: 5px; }
#section-aiLab .ai-lab-feedback-comment textarea { width: 100%; box-sizing: border-box; resize: vertical; border: 1px solid #D8D4D4; border-radius: 8px; padding: 8px; color: #2D2929; background: #fff; }
#section-aiLab .ai-lab-feedback-comment textarea:focus { outline: 0; border-color: #6D6565; box-shadow: 0 0 0 3px rgba(109, 101, 101, .12); }
#section-aiLab .ai-lab-feedback-actions { justify-content: flex-start; flex-wrap: wrap; }
@media (max-width: 700px) {
  #section-aiLab .ai-lab-composer-controls { align-items: stretch; }
  #section-aiLab .ai-lab-engine-selector { width: 100%; }
  #section-aiLab .ai-lab-engine-selector select { width: 100%; }
  #section-aiLab .ai-lab-composer-message { align-items: stretch; }
  #section-aiLab .ai-lab-composer-message .primary-button { width: 100%; }
}

/* IA-LAB-CHANNEL-SIM-1.1 */
#section-aiLab .ai-lab-channel-selector { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid #D8D4D4; border-radius: 999px; background: #FAFAFA; }
#section-aiLab .ai-lab-channel-selector > span { padding: 0 7px; color: #5C5454; font-size: .72rem; font-weight: 800; }
#section-aiLab .ai-lab-channel-selector .ghost-button { min-height: 28px; padding: 5px 9px; border-radius: 999px; border-color: transparent; font-size: .72rem; }
#section-aiLab .ai-lab-channel-selector .ghost-button.is-active { background: var(--success-soft); border-color: var(--success); color: var(--success-accessible-text); }
/* chart_visual_refine_1: WhatsApp shell keeps green as its channel identity, but
   every color below is derived from the Dashboard's own tokens via color-mix()/
   var() instead of fixed hex, so it follows the existing Claro/Escuro/Sistema
   mechanism instead of a parallel palette. */
#section-aiLab .ai-lab-layout.channel-whatsapp_preview .ai-lab-chat-log { background: color-mix(in srgb, var(--success) 14%, var(--bg-soft)); background-image: linear-gradient(135deg, color-mix(in srgb, var(--bg-surface) 22%, transparent) 25%, transparent 25%), linear-gradient(225deg, color-mix(in srgb, var(--bg-surface) 16%, transparent) 25%, transparent 25%); background-size: 18px 18px; }
#section-aiLab .ai-lab-layout.channel-whatsapp_preview .ai-lab-message { box-shadow: 0 2px 7px rgba(30, 27, 27, .12); border-color: var(--border-default); }
#section-aiLab .ai-lab-layout.channel-whatsapp_preview .ai-lab-message.user { background: color-mix(in srgb, var(--success) 26%, var(--bg-surface)); }
#section-aiLab .ai-lab-layout.channel-whatsapp_preview .ai-lab-message.assistant { background: var(--bg-surface); }
#section-aiLab .ai-lab-message.is-whatsapp-preview .ai-lab-message-body { gap: 7px; white-space: pre-wrap; }
#section-aiLab .ai-lab-message.is-whatsapp-preview .ai-lab-attachment.ready, #section-aiLab .ai-lab-message.is-whatsapp-preview .ai-lab-attachment-state { padding: 5px; background: transparent; border: 0; }
#section-aiLab .ai-lab-message.is-whatsapp-preview .ai-lab-attachment img { max-height: 560px; border-radius: 7px; border-color: #D8D4D4; }
@media (max-width: 760px) {
  #section-aiLab .ai-lab-channel-selector { width: 100%; justify-content: space-between; }
  #section-aiLab .ai-lab-channel-selector .ghost-button { flex: 1 1 auto; }
}

#section-aiLab .ai-lab-chat { display: grid; grid-template-rows: auto minmax(0, 1fr); }
#section-aiLab .ai-lab-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid #EEDCDB; background: #FAFAFA; }
#section-aiLab .ai-lab-chat-head > div { display: grid; gap: 2px; min-width: 0; }
#section-aiLab .ai-lab-chat-head strong { color: #232020; font-size: .86rem; }
#section-aiLab .ai-lab-chat-head span { color: #7C7373; font-size: .72rem; font-weight: 700; }
/* chart_visual_refine_1: removed the hardcoded hover override that used to force
   the IA Lab chart's tooltip to always white/dark text. It now inherits the
   Dashboard's existing global Plotly tooltip theming (.js-plotly-plot .plotly
   .hoverlayer, var(--tooltip-bg)/var(--tooltip-text)) which already tracks
   Claro/Escuro/Sistema. */
@media (max-width: 760px) {
  #section-aiLab .ai-lab-chat-head { align-items: stretch; flex-direction: column; }
}
