: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 clear blue entity across nucleus, forms, gradients,
 * halo and shadows. Dark keeps the original luminous white palette.
 */
:root:not([data-theme="dark"]) {
  --ai-orb-halo-white: rgba(56, 169, 235, 0.34);
  --ai-orb-halo-ice: rgba(93, 184, 238, 0.30);
  --ai-orb-halo-cyan: rgba(44, 198, 232, 0.22);
  --ai-orb-halo-silver: rgba(120, 205, 245, 0.18);
  --ai-orb-surface-core: rgba(36, 141, 209, 0.98);
  --ai-orb-surface-mid: rgba(56, 169, 235, 0.90);
  --ai-orb-surface-soft: rgba(93, 184, 238, 0.40);
  --ai-orb-surface-white: rgba(56, 169, 235, 0.48);
  --ai-orb-surface-ice: rgba(93, 184, 238, 0.42);
  --ai-orb-surface-cyan: rgba(44, 198, 232, 0.32);
  --ai-orb-surface-silver: rgba(120, 205, 245, 0.26);
  --ai-orb-form-a: rgba(36, 141, 209, 0.78);
  --ai-orb-form-b: rgba(56, 169, 235, 0.70);
  --ai-orb-form-c: rgba(93, 184, 238, 0.62);
  --ai-orb-form-d: rgba(44, 198, 232, 0.68);
  --ai-orb-form-e: rgba(120, 205, 245, 0.44);
  --ai-orb-form-f: rgba(72, 179, 235, 0.56);
  --ai-orb-form-g: rgba(44, 198, 232, 0.48);
  --ai-orb-idle-core: rgba(36, 141, 209, 0.99);
  --ai-orb-idle-mid: rgba(56, 169, 235, 0.94);
  --ai-orb-idle-soft: rgba(44, 198, 232, 0.42);
  --ai-orb-shadow-white: rgba(36, 141, 209, 0.44);
  --ai-orb-shadow-cyan: rgba(44, 198, 232, 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(4, 29, 36, 0.16), transparent 28%),
    radial-gradient(circle at right 10%, rgba(241, 162, 8, 0.18), transparent 24%),
    linear-gradient(180deg, #f5f9ff 0%, #ebf2fb 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(77, 163, 255, 0.16), transparent 30%),
    radial-gradient(circle at right 14%, rgba(15, 42, 68, 0.1), transparent 24%),
    linear-gradient(180deg, rgba(245, 249, 255, 0.96), rgba(235, 242, 251, 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(15, 42, 68, 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(77, 163, 255, 0.14), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(232, 241, 251, 0.92));
  border: 1px solid rgba(77, 163, 255, 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: #0f2a44;
  letter-spacing: -0.02em;
}

.dashboard-loading-copy p:last-child {
  margin: 0;
  color: rgba(15, 42, 68, 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(15, 42, 68, 0.9), rgba(77, 163, 255, 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(4, 29, 36, 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(31, 90, 139, 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(9, 23, 38, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 22px 50px rgba(4, 10, 18, 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: #f6fbff;
  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(77, 163, 255, 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: #f8fbff;
  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(15, 42, 68, 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(15, 42, 68, 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(3, 5, 10, 0.34), rgba(4, 29, 36, 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(3, 5, 10, 0.52), rgba(4, 29, 36, 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(4, 29, 36, 0.94), transparent 54%),
    linear-gradient(180deg, rgba(3, 5, 10, 0.98), rgba(4, 29, 36, 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(3, 5, 10, 0.82), rgba(4, 29, 36, 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;
  padding-bottom: 24px;
  scrollbar-width: thin;
  /* 20/10/2026: era "transparent transparent" (so' aparecia no hover) - com
     o grupo "Ferramentas Internas" tendo crescido pra 10 itens, a area
     rolavel ficou bem menor que o conteudo (~253px pra ~600px) e sem
     indicio visual nenhum de que da pra rolar, o ultimo item (Chamados)
     parecia simplesmente "nao estar la". Trilha/polegar sempre visiveis
     (ainda discretos) resolvem isso sem mudar o layout. */
  scrollbar-color: rgba(118, 162, 170, 0.32) rgba(255, 255, 255, 0.05);
}

.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: rgba(118, 162, 170, 0.22);
  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-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(8, 20, 33, 0.28);
  background: linear-gradient(135deg, rgba(3, 5, 10, 0.98), rgba(4, 29, 36, 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(3, 5, 10, 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(3, 5, 10, 0.92), rgba(4, 29, 36, 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;
}

/* Badge de "Suporte" (30/09/2026): é só um número curto (mensagens não
   lidas), não uma frase como a de Alarmes — faz mais sentido do lado do
   nome da seção do que numa segunda linha embaixo, sozinho. */
.nav-item[data-section="support"] {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.nav-item[data-section="support"] .nav-item-meta {
  margin-top: 0;
}
.nav-item[data-section="support"] .nav-item-meta.is-alert {
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  justify-content: center;
}

.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(20, 30, 45, 0.94);
  color: #fff;
  box-shadow: 0 24px 60px rgba(7, 18, 31, 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(7, 18, 31, 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: #12263a;
  box-shadow: 0 28px 70px rgba(7, 18, 31, 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: #5c7288;
}

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

.profile-reload-copy p:last-child {
  margin: 0;
  color: #24384d;
  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(15, 42, 68, 0.06);
  color: #16324c;
}

.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(15, 42, 68, 0.12);
  background: #f8fbff;
  color: #17324b;
}

.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: #5c7288;
}

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

.payload-disclosure {
  border: 1px solid rgba(16, 62, 104, 0.12);
  border-radius: 14px;
  background: rgba(239, 246, 255, 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: #0f2a44;
}

.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(31, 90, 139, 0.12);
  color: #1f5a8b;
  font-size: 0.95rem;
  line-height: 1;
}

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

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

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

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

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

.cell-disclosure {
  margin-top: 8px;
  border: 1px solid rgba(15, 42, 68, 0.1);
  border-radius: 12px;
  background: rgba(245, 249, 255, 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: #18446d;
}

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

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

.cell-disclosure-meta {
  font-size: 0.7rem;
  color: #617b93;
  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(31, 90, 139, 0.08);
}

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

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

.cell-disclosure-entry-subtle {
  font-size: 0.68rem;
  color: #7a93aa;
  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(31, 90, 139, 0.32);
  background: rgba(234, 243, 255, 0.95);
  transform: translateX(2px);
}

.cell-disclosure-entry-clickable:focus-visible {
  outline: 2px solid var(--brand-deep, #4da3ff);
  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: #4a6985;
}

.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: #12263a;
}

.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: #4DA3FF;
  box-shadow: 0 0 0 6px rgba(77, 163, 255, 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(77, 163, 255, 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(77, 163, 255, 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: #9ca3af;
  box-shadow: 0 0 0 8px rgba(156, 163, 175, 0.14), 0 0 20px rgba(156, 163, 175, 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: #0f2a44;
}

.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: #94a3b8;
  box-shadow: 0 0 0 8px rgba(148, 163, 184, 0.12), 0 0 20px rgba(148, 163, 184, 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(9, 23, 38, 0.94);
    color: #f8fbff;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    box-shadow: 0 14px 28px rgba(6, 18, 31, 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(9, 23, 38, 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(9, 23, 38, 0.96);
  color: #f8fbff;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  box-shadow: 0 14px 28px rgba(6, 18, 31, 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(9, 23, 38, 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, #4DA3FF 0%, #1F5A8B 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(234, 243, 255, 0.92);
  border-color: rgba(77, 163, 255, 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;
}

/* 20/10/2026: feedback visual IMEDIATO ao trocar de cliente (tier demo) -
   sem isso, o conteúdo da tela só mudava quando o fetch terminava, dando a
   impressão de que o clique não fez nada até, de repente, mudar. Mesmo
   padrão visual de .primary-button.is-loading (esconde o texto, spinner por
   cima), aplicado no próprio seletor. */
.client-dropdown-trigger.is-loading {
  position: relative;
  pointer-events: none;
  color: transparent;
}

.client-dropdown-trigger.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(245, 255, 249, 0.28);
  border-top-color: #f5fff9;
  animation: spin 0.8s linear infinite;
}

.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(234, 243, 255, 0.92);
  border-color: rgba(77, 163, 255, 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(31, 90, 139, 0.92);
  color: #f5fff9;
  border: 1px solid rgba(207, 229, 255, 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(234, 243, 255, 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: #94a3b8;
  box-shadow: 0 0 0 5px rgba(148, 163, 184, 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: #94a3b8;
  box-shadow: 0 0 0 5px rgba(148, 163, 184, 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(234, 243, 255, 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(15, 42, 68, 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(244, 250, 255, 0.96);
  color: #0f2a44;
  border-color: rgba(77, 163, 255, 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(77, 163, 255, 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(77, 163, 255, 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(77, 163, 255, 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-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(234, 243, 255, 0.92);
  color: var(--brand-deep);
  border: 1px solid rgba(77, 163, 255, 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;
}

/* Modo de edição: a área do menu lateral vira o dock da biblioteca de widgets.
   Os cards são arrastáveis daqui direto pra dentro do dashboard. */
.dashboard-manager-shell.is-editing .dashboard-manager-sidebar-placeholder {
  grid-area: aside;
  display: flex;
  flex-direction: column;
  width: max(var(--sidebar-width), 300px);
  min-height: 0;
  padding: 0;
  background: linear-gradient(180deg, #0F2A44 0%, #1F5A8B 100%);
  color: #f5fff9;
  overflow: hidden;
}

/* O botão da borda (seta) também recolhe o dock da biblioteca no modo de
   edição. A regra antiga de body.sidebar-collapsed valia pro placeholder
   "menu lateral não editável" e se perdeu quando ele virou o dock — por isso o
   botão parecia não fazer nada durante a edição. Recolhido, o dock some por
   completo e o canvas usa a largura inteira. */
body.sidebar-collapsed .dashboard-manager-shell.is-editing {
  grid-template-columns: 0 minmax(0, 1fr);
}

body.sidebar-collapsed .dashboard-manager-shell.is-editing .dashboard-manager-sidebar-placeholder {
  width: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.dashboard-manager-shell.is-editing .dashboard-manager-sidebar-placeholder {
  transition: width 0.26s ease, opacity 0.2s ease;
}

/* A seta acompanha a borda do dock (e vai pro canto quando ele está recolhido). */
body.dashboard-manager-editing .sidebar-edge-toggle {
  left: max(var(--sidebar-width), 300px);
}

body.dashboard-manager-editing.sidebar-collapsed .sidebar-edge-toggle {
  left: 22px;
}

.dashboard-library-dock-head {
  padding: 22px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.dashboard-library-dock-head .eyebrow {
  color: rgba(245, 255, 249, 0.62);
}

.dashboard-library-dock-head h3 {
  margin: 4px 0 0;
  color: #fff;
}

.dashboard-library-dock-hint {
  margin: 8px 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(245, 255, 249, 0.7);
}

.dashboard-library-dock-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 16px 14px 24px;
}

.dashboard-library-dock-body .dashboard-manager-panel-section-head,
.dashboard-library-dock-body .dashboard-manager-panel-section-head span {
  color: rgba(245, 255, 249, 0.85);
}

.dashboard-library-dock-body {
  gap: 8px;
}

.dashboard-library-group {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.dashboard-library-group-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  color: #fff;
  user-select: none;
}

.dashboard-library-group-summary::-webkit-details-marker {
  display: none;
}

.dashboard-library-group-summary strong {
  flex: 1 1 auto;
  font-size: 0.86rem;
  font-weight: 700;
}

.dashboard-library-group-chevron {
  display: inline-flex;
  color: rgba(245, 255, 249, 0.75);
  transition: transform 0.18s ease;
}

.dashboard-library-group[open] > .dashboard-library-group-chevron,
.dashboard-library-group[open] > .dashboard-library-group-summary .dashboard-library-group-chevron {
  transform: rotate(90deg);
}

.dashboard-library-group-count {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0f2a44;
  background: rgba(255, 255, 255, 0.85);
}

.dashboard-library-group-list {
  display: grid;
  gap: 6px;
  padding: 4px 8px 10px;
}

/* Linha compacta e arrastável: grip + título + botão "+" só com ícone. */
.dashboard-library-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 10px;
  border-radius: 12px;
  background: var(--bg-surface, rgba(255, 255, 255, 0.92));
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.08));
  cursor: grab;
  user-select: none;
  -webkit-user-drag: element;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-library-row:hover {
  box-shadow: 0 6px 18px rgba(5, 16, 28, 0.25);
  transform: translateX(2px);
}

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

.dashboard-library-row-grip {
  display: inline-flex;
  color: var(--text-muted, rgba(15, 42, 68, 0.4));
}

.dashboard-library-row-copy {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.dashboard-library-row-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary, #0f2a44);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-library-row-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 0;
  background: linear-gradient(135deg, #0f2a44, #1f5a8b);
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
}

.dashboard-library-row-add:hover {
  filter: brightness(1.12);
}

.dashboard-library-dock-body .dashboard-manager-pill {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.dashboard-library-dock-body .dashboard-manager-pill span {
  color: #fff;
}

.dashboard-library-dock-body .dashboard-manager-empty-mini {
  color: rgba(245, 255, 249, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

/* Popover "Utilizar modelo", ancorado abaixo do botão na barra de edição. */
.dashboard-template-anchor {
  position: relative;
}

/* O [hidden] do navegador (display:none) perde de qualquer display declarado
   aqui, então o popover precisa desligar o display explicitamente — sem isso a
   caixa vazia (só a borda) ficava visível o tempo todo e não sumia no clique. */
.dashboard-template-menu[hidden] {
  display: none !important;
}

.dashboard-template-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  width: min(360px, 90vw);
  max-height: min(70vh, 560px);
  overflow-y: auto;
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: 18px;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.1));
  color: var(--text-primary, #0f2a44);
  box-shadow: 0 24px 60px var(--shadow-color, rgba(15, 42, 68, 0.18));
}

.dashboard-template-section {
  display: grid;
  gap: 6px;
}

.dashboard-template-section-title {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.dashboard-template-option {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-default, transparent);
  background: var(--bg-soft, rgba(15, 42, 68, 0.04));
  color: var(--text-primary, #0f2a44);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dashboard-template-option:hover,
.dashboard-template-option:focus-visible {
  background: rgba(77, 163, 255, 0.12);
  border-color: rgba(77, 163, 255, 0.35);
  outline: none;
}

.dashboard-template-option-name {
  font-weight: 700;
  color: var(--text-primary, #0f2a44);
}

.dashboard-template-option-desc {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-secondary, var(--muted));
}

.dashboard-template-empty {
  margin: 0;
  padding: 10px 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.dashboard-history-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dashboard-history-button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.dashboard-history-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dashboard-home-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-home-button.is-active {
  color: #8a6000;
  border-color: rgba(241, 162, 8, 0.45);
  background: rgba(241, 162, 8, 0.14);
}

.dashboard-home-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Popover de configurações do dashboard (modo de edição) ── */
.dashboard-settings-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-settings-menu {
  width: min(340px, 90vw);
}

.dashboard-settings-section {
  display: grid;
  gap: 4px;
}

.dashboard-settings-title {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary, var(--muted));
}

.dashboard-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary, #0f2a44);
  cursor: pointer;
}

.dashboard-settings-row > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-settings-row:hover {
  background: var(--bg-soft, rgba(15, 42, 68, 0.04));
}

.dashboard-settings-row.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.dashboard-settings-hint {
  margin: 0;
  padding: 0 10px 4px;
  font-size: 0.74rem;
  color: var(--text-secondary, var(--muted));
}

/* Tamanho da grade de ajuste do posicionamento livre. */
.dashboard-settings-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 10px 6px;
}

.dashboard-settings-chips.is-disabled {
  opacity: 0.45;
}

.dashboard-settings-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.16));
  background: var(--bg-surface, #fff);
  color: var(--text-secondary, #4b5563);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.dashboard-settings-chip:hover:not(:disabled) {
  border-color: var(--primary, #1f5a8b);
  color: var(--primary-accessible-text, #1f5a8b);
}

.dashboard-settings-chip.is-active {
  border-color: var(--primary, #1f5a8b);
  background: var(--primary-soft, rgba(77, 163, 255, 0.16));
  color: var(--primary-accessible-text, #1f5a8b);
}

.dashboard-settings-chip:disabled {
  cursor: not-allowed;
}

/* Interruptor simples, sem depender de biblioteca. */
.dashboard-settings-switch {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  border: 0;
  background: var(--border-strong, rgba(15, 42, 68, 0.25));
  position: relative;
  cursor: pointer;
  transition: background 0.18s ease;
}

.dashboard-settings-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}

.dashboard-settings-switch:checked {
  background: var(--primary, #1f5a8b);
}

.dashboard-settings-switch:checked::after {
  transform: translateX(16px);
}

.dashboard-settings-switch:disabled {
  cursor: not-allowed;
}

/* Elementos que o dashboard ativo pode ocultar (só na seção do dashboard). */
body.dashboard-hide-search .global-ai-command,
body.dashboard-hide-aiEntity .global-ai-launcher,
body.dashboard-hide-alarmButton .topbar-alarm-shell {
  display: none !important;
}

/* O título some mas continua ocupando o lugar: assim a barra de pesquisa não
   escorrega pra esquerda quando ele é ocultado. */
body.dashboard-hide-titles .topbar-title {
  visibility: hidden !important;
  pointer-events: none;
}

/* ── Widgets de ferramentas ── */
.dashboard-card-tool-widget {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-xl, 16px);
}

body.dashboard-manager-editing .dashboard-card-tool-widget {
  outline: 1px dashed var(--border-default, rgba(15, 42, 68, 0.28));
  outline-offset: -1px;
}

.dashboard-text-note {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--text-note-font-scale, 1));
  width: 100%;
  min-height: 0;
  padding: 10px 14px;
  border-radius: var(--radius-xl, 16px);
  border: 1px solid transparent;
}

/* Modelo "com fundo": a mesma superfície dos outros cards, nos dois temas. */
.dashboard-card.is-text-filled .dashboard-text-note {
  background: var(--bg-surface, rgba(255, 255, 255, 0.9));
  border-color: var(--border-default, rgba(15, 42, 68, 0.08));
  box-shadow: var(--shadow);
}

.dashboard-card.is-card-tiny .dashboard-text-note {
  padding: 6px 10px;
}

.dashboard-text-note-icon {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: calc(36px * var(--text-note-font-scale, 1));
  height: calc(36px * var(--text-note-font-scale, 1));
  border-radius: 12px;
  color: var(--text-note-color, #1f5a8b);
  background: color-mix(in srgb, var(--text-note-color, #1f5a8b) 14%, transparent);
}

.dashboard-text-note-text {
  margin: 0;
  min-width: 0;
  font-size: calc(0.95rem * var(--text-note-font-scale, 1));
  line-height: 1.35;
  font-weight: 600;
  color: var(--text-primary, #0f2a44);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
}

.dashboard-text-note-text.is-empty {
  font-weight: 500;
  color: var(--text-muted, var(--muted));
}

/* Variante "título": texto solto, sem card, no lugar do antigo cabeçalho
   "Visão do dia a dia". Ocupa uma linha da grade e pode ficar em cima de
   qualquer faixa de widgets. */
.dashboard-card.is-text-heading {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  min-height: 0;
}

.dashboard-card.is-text-heading .dashboard-text-note {
  align-items: flex-end;
  padding: 4px 6px 8px;
}

.dashboard-card.is-text-heading .dashboard-text-note-text {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-note-color, var(--text-primary, #0f2a44));
  -webkit-line-clamp: 2;
}

.dashboard-card.is-text-heading .dashboard-text-note-icon {
  width: 32px;
  height: 32px;
}

/* Painel de alarmes: mesmos cards da tela de alarmes, dentro do dashboard. */
.dashboard-alarm-panel {
  width: 100%;
  padding: 10px 12px;
}

.dashboard-alarm-panel .alarm-stats-grid {
  margin-bottom: 0;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.dashboard-alarm-panel-period {
  font-size: 0.7rem;
  color: var(--text-secondary, var(--muted));
  margin: 0 0 8px;
}

/* Lista de alarmes */
.dashboard-alarm-list-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-alarm-list-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dashboard-alarm-list-search {
  min-width: 140px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.15));
  background: var(--bg-surface, #fff);
  color: var(--text-primary, #0f2a44);
  font: inherit;
  font-size: 0.76rem;
}

.dashboard-alarm-list-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.15));
  background: var(--bg-soft, rgba(15, 42, 68, 0.04));
  color: var(--text-secondary, #4a5b6a);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.dashboard-alarm-list-chip.is-active {
  background: var(--primary, #1f5a8b);
  border-color: var(--primary, #1f5a8b);
  color: #fff;
}

.dashboard-alarm-list {
  width: 100%;
  min-height: 0;
  overflow: auto;
}

.dashboard-alarm-list table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.dashboard-alarm-list th,
.dashboard-alarm-list td {
  padding: 6px 8px;
  font-size: 0.74rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-default, rgba(15, 42, 68, 0.08));
  background: transparent;
  white-space: nowrap;
  max-width: none;
  overflow: visible;
}

.dashboard-alarm-list th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-surface, #fff);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, var(--muted));
}

.dashboard-alarm-list td.cell-center,
.dashboard-alarm-list th.cell-center {
  text-align: center;
}

.dashboard-alarm-list .pill {
  padding: 3px 8px;
  font-size: 0.66rem;
}

.dashboard-alarm-list-empty {
  padding: 18px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted, var(--muted));
}

.dashboard-alarm-list-sub {
  display: block;
  font-size: 0.66rem;
  color: var(--text-secondary, var(--muted));
}

/* Watchlist: ícone de estado do ponto */
.watchlist-state-icon {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  color: var(--text-muted, #8295a5);
}

.watchlist-state-icon svg {
  width: 15px;
  height: 15px;
}

.watchlist-state-icon.is-alarm {
  color: #fff;
  background: var(--danger, #dc2626);
  animation: watchlistAlarmBlink 1s ease-in-out infinite;
}

.watchlist-state-icon.is-candidate {
  color: var(--warning-accessible-text, #8a6000);
  background: var(--warning-soft, rgba(241, 162, 8, 0.18));
}

.watchlist-state-icon.is-ack {
  color: var(--warning-accessible-text, #8a6000);
  background: var(--warning-soft, rgba(241, 162, 8, 0.18));
}

.watchlist-state-icon.is-silenced {
  color: var(--text-secondary, #5d6a65);
  background: var(--inactive-soft, rgba(127, 141, 135, 0.16));
}

@keyframes watchlistAlarmBlink {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  50% { opacity: 0.55; box-shadow: 0 0 0 5px rgba(220, 38, 38, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .watchlist-state-icon.is-alarm {
    animation: none;
  }
}

/* Gráfico de rosquinha de alarmes */
.dashboard-alarm-donut {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.dashboard-alarm-donut-plot {
  width: 100%;
  height: 100%;
  min-height: 160px;
}

/* Calendário: próximos eventos por dia no rodapé */
.dashboard-calendar-upcoming {
  /* Duas/três colunas conforme a largura do card, preenchendo o rodapé todo. */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(160px * var(--calendar-scale, 1)), 1fr));
  align-content: start;
  gap: 3px 12px;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
}

.dashboard-calendar-upcoming-day {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: calc(0.7rem * var(--calendar-scale, 1));
}

.dashboard-calendar-upcoming-day .dashboard-calendar-tag {
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  min-width: 0;
}

.dashboard-calendar-upcoming-date {
  flex: 0 0 auto;
  min-width: calc(44px * var(--calendar-scale, 1));
  font-weight: 800;
  color: var(--text-primary, #0f2a44);
}

.dashboard-calendar-upcoming-date.is-today {
  color: var(--primary, #1f5a8b);
}

/* Previsão diária: umidade e chuva em cada dia */
.dashboard-weather-day-extra {
  display: flex;
  gap: 4px;
  font-size: 0.6rem;
  color: var(--info-accessible-text, #1f5a8b);
  white-space: nowrap;
}

.dashboard-weather-day-extra span {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.dashboard-calendar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
}

.dashboard-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.dashboard-calendar-nav,
.dashboard-calendar-title {
  border: 0;
  background: transparent;
  color: var(--text-primary, #0f2a44);
  cursor: pointer;
  font: inherit;
}

.dashboard-calendar-nav {
  width: calc(26px * var(--calendar-scale, 1));
  height: calc(26px * var(--calendar-scale, 1));
  border-radius: 8px;
  font-size: calc(1.1rem * var(--calendar-scale, 1));
  line-height: 1;
}

.dashboard-calendar-nav:hover,
.dashboard-calendar-title:hover {
  background: var(--primary-soft, rgba(77, 163, 255, 0.12));
}

.dashboard-calendar-title {
  padding: 2px 8px;
  border-radius: 8px;
}

.dashboard-calendar-title strong {
  font-size: calc(0.9rem * var(--calendar-scale, 1));
  text-transform: capitalize;
}

.dashboard-calendar-title span {
  font-size: calc(0.78rem * var(--calendar-scale, 1));
  color: var(--text-secondary, var(--muted));
}

.dashboard-calendar-cell {
  position: relative;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.dashboard-calendar-cell.is-blank {
  cursor: default;
}

.dashboard-calendar-cell:not(.is-blank):hover {
  background: var(--primary-soft, rgba(77, 163, 255, 0.12));
}

.dashboard-calendar-cell.is-selected {
  box-shadow: inset 0 0 0 2px var(--primary, #1f5a8b);
}

.dashboard-calendar-dot {
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: var(--danger, #c74a45);
}

.dashboard-calendar-cell.is-state .dashboard-calendar-dot {
  background: var(--warning, #f1a208);
}

.dashboard-calendar-cell.is-optional .dashboard-calendar-dot {
  background: var(--text-muted, #8295a5);
}

.dashboard-calendar-cell.is-holiday.is-national {
  color: var(--danger-accessible-text, #c74a45);
  font-weight: 700;
}

.dashboard-calendar-cell.is-holiday.is-state {
  color: var(--warning-accessible-text, #8a6000);
  font-weight: 700;
}

.dashboard-calendar-cell.is-today .dashboard-calendar-dot {
  background: #fff;
}

.dashboard-calendar-foot {
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  min-height: 0;
  max-height: 52%;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border-default, rgba(15, 42, 68, 0.1));
}

.dashboard-calendar-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
  font-size: calc(0.72rem * var(--calendar-scale, 1));
  color: var(--text-primary, #0f2a44);
  overflow-y: auto;
}

.dashboard-calendar-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: calc(0.68rem * var(--calendar-scale, 1));
  font-weight: 700;
  white-space: nowrap;
  background: var(--danger-soft, rgba(199, 74, 69, 0.12));
  color: var(--danger-accessible-text, #c74a45);
}

.dashboard-calendar-tag.is-state {
  background: var(--warning-soft, rgba(241, 162, 8, 0.16));
  color: var(--warning-accessible-text, #8a6000);
}

.dashboard-calendar-tag.is-optional {
  background: var(--inactive-soft, rgba(127, 141, 135, 0.14));
  color: var(--text-secondary, #5d6a65);
}

.dashboard-calendar-empty,
.dashboard-calendar-state {
  font-size: calc(0.68rem * var(--calendar-scale, 1));
  color: var(--text-muted, var(--muted));
}

.dashboard-calendar-dot.is-event {
  background: var(--primary, #1f5a8b);
  transform: translateX(3px);
}

.dashboard-calendar-cell.is-holiday.has-event .dashboard-calendar-dot:not(.is-event) {
  transform: translateX(-4px);
}

.dashboard-calendar-cell.has-event {
  font-weight: 700;
}

.dashboard-calendar-tag.is-event {
  gap: 4px;
  background: var(--primary-soft, rgba(77, 163, 255, 0.14));
  color: var(--primary-accessible-text, #1f5a8b);
}

.dashboard-calendar-tag-remove {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
}

.dashboard-calendar-add {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px dashed var(--primary, #1f5a8b);
  background: transparent;
  color: var(--primary, #1f5a8b);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
}

.dashboard-calendar-event-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 4px;
  align-items: center;
}

.dashboard-calendar-event-form input,
.dashboard-calendar-event-form select {
  min-width: 0;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.15));
  background: var(--bg-surface, #fff);
  color: var(--text-primary, #0f2a44);
  font: inherit;
  font-size: 0.74rem;
}

.dashboard-calendar-event-form .primary-button,
.dashboard-calendar-event-form .ghost-button {
  padding: 5px 10px;
  font-size: 0.72rem;
}

/* Compacto: só a grade do mês, sem rodapé; células menores. */
.dashboard-card.is-calendar-compact .dashboard-calendar {
  gap: 4px;
  padding: 8px 10px;
}

.dashboard-card.is-calendar-mini .dashboard-calendar-foot {
  display: none;
}

.dashboard-card.is-calendar-compact .dashboard-calendar-cell,
.dashboard-card.is-calendar-compact .dashboard-calendar-weekday {
  min-height: 14px;
  font-size: calc(0.72rem * var(--calendar-scale, 1));
}

.dashboard-card.is-calendar-compact .dashboard-calendar-title strong {
  font-size: calc(0.82rem * var(--calendar-scale, 1));
}

.dashboard-card.is-calendar-compact .dashboard-calendar-nav {
  width: 20px;
  height: 20px;
}

.dashboard-card.is-card-tiny .dashboard-calendar-grid {
  gap: 0;
}

/* Clima */
.dashboard-weather {
  display: flex;
  width: 100%;
  min-height: 0;
  padding: 12px 14px;
}

.dashboard-weather-empty {
  margin: auto;
  font-size: 0.8rem;
  text-align: center;
  color: var(--text-muted, var(--muted));
}

.dashboard-weather-icon {
  display: inline-grid;
  place-items: center;
  color: var(--primary, #1f5a8b);
}

.dashboard-weather-compact {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.dashboard-weather-compact-copy,
.dashboard-weather-now-copy {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.dashboard-weather-temp {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #0f2a44);
}

.dashboard-weather-temp.is-large {
  font-size: 2.4rem;
}

.dashboard-weather-desc {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary, #0f2a44);
}

.dashboard-weather-place {
  font-size: 0.7rem;
  color: var(--text-secondary, var(--muted));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-weather-full {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-height: 0;
}

.dashboard-weather-now {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.dashboard-weather-stats {
  display: flex;
  gap: 14px;
  margin: 0 0 0 auto;
}

.dashboard-weather-stats div {
  display: grid;
  gap: 1px;
}

.dashboard-weather-stats div.is-highlight {
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--info-soft, rgba(90, 167, 237, 0.14));
}

.dashboard-weather-stats div.is-highlight dt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--info-accessible-text, #1f5a8b);
}

.dashboard-weather-stats div.is-highlight dd {
  font-size: 1.05rem;
  color: var(--info-accessible-text, #1f5a8b);
}

.dashboard-weather-stats div.is-sun dt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--warning-accessible-text, #8a6000);
}

.dashboard-weather-compact-stats {
  display: grid;
  gap: 4px;
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--info-accessible-text, #1f5a8b);
}

.dashboard-weather-compact-stats span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--info-soft, rgba(90, 167, 237, 0.14));
  white-space: nowrap;
}

.dashboard-card.is-card-compact .dashboard-weather-temp.is-large {
  font-size: 1.8rem;
}

.dashboard-weather-stats dt {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, var(--muted));
}

.dashboard-weather-stats dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary, #0f2a44);
}

.dashboard-weather-days {
  display: grid;
  /* A quantidade de colunas vem do JS: são os dias que couberam na largura. */
  grid-template-columns: repeat(var(--weather-day-count, 6), minmax(0, 1fr));
  gap: 4px;
  min-height: 0;
}

.dashboard-weather-day {
  display: grid;
  justify-items: center;
  align-content: space-evenly;
  gap: 4px;
  padding: 10px 2px;
  border-radius: 10px;
  background: var(--bg-soft, rgba(15, 42, 68, 0.04));
  color: var(--text-primary, #0f2a44);
  font-size: 0.7rem;
  overflow: hidden;
}

.dashboard-weather-day.is-today {
  background: var(--primary-soft, rgba(77, 163, 255, 0.14));
}

.dashboard-weather-day-label {
  text-transform: capitalize;
  font-weight: 700;
}

.dashboard-weather-day-icon {
  color: var(--primary, #1f5a8b);
}

.dashboard-weather-day-temps small {
  color: var(--text-secondary, var(--muted));
}

.dashboard-weather-day-rain {
  font-size: 0.64rem;
  color: var(--info-accessible-text, #1f5a8b);
}

.dashboard-weather-results {
  display: grid;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.dashboard-weather-result {
  display: grid;
  gap: 1px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.12));
  background: var(--bg-soft, rgba(15, 42, 68, 0.04));
  color: var(--text-primary, #0f2a44);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.dashboard-weather-result:hover {
  border-color: var(--primary, #1f5a8b);
}

.dashboard-weather-result span {
  font-size: 0.74rem;
  color: var(--text-secondary, var(--muted));
}

.dashboard-widget-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-secondary, var(--muted));
}

@media (max-width: 768px) {
  .dashboard-weather-days {
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  }

  .dashboard-weather-stats {
    margin-left: 0;
  }
}

.dashboard-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
}

.dashboard-calendar-weekday,
.dashboard-calendar-cell {
  display: grid;
  place-items: center;
  min-height: calc(20px * var(--calendar-scale, 1));
  border-radius: 6px;
  font-size: calc(0.78rem * var(--calendar-scale, 1));
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #0f2a44);
}

.dashboard-calendar-weekday {
  font-size: calc(0.64rem * var(--calendar-scale, 1));
  font-weight: 800;
  color: var(--text-secondary, var(--muted));
}

.dashboard-calendar-cell.is-weekend {
  color: var(--text-secondary, var(--muted));
}

.dashboard-calendar-cell.is-today {
  background: var(--primary, #1f5a8b);
  color: #fff;
  font-weight: 800;
}

.dashboard-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(4px * var(--clock-scale, 1));
  width: 100%;
  padding: 4px 6px;
  text-align: center;
}

/* A hora acompanha o tamanho do card (--clock-scale vem do JS): card grande,
   número grande - em vez de um relógio miúdo no meio de um card vazio. */
.dashboard-clock-time {
  font-size: calc(2rem * var(--clock-scale, 1));
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #0f2a44);
}

.dashboard-clock-date {
  font-size: calc(0.8rem * var(--clock-scale, 1));
  text-transform: capitalize;
  color: var(--text-secondary, var(--muted));
}

.dashboard-clock-ampm {
  font-size: 0.4em;
  font-weight: 600;
  margin-left: 0.25em;
  letter-spacing: 0.02em;
  color: var(--text-secondary, var(--muted));
}

/* Posição */
.dashboard-card.is-clock-align-left .dashboard-clock {
  align-items: flex-start;
  text-align: left;
  padding-left: 12px;
}

.dashboard-card.is-clock-align-right .dashboard-clock {
  align-items: flex-end;
  text-align: right;
  padding-right: 12px;
}

/* Fontes: pilhas do sistema (as da Apple entram quando existem no aparelho). */
.dashboard-card.is-clock-font-rounded .dashboard-clock {
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Manrope", "Segoe UI", sans-serif;
}

.dashboard-card.is-clock-font-mono .dashboard-clock {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

.dashboard-card.is-clock-font-serif .dashboard-clock {
  font-family: "New York", "Iowan Old Style", "Playfair Display", Georgia, "Times New Roman", serif;
}

/* Modelos */
.dashboard-card.is-clock-thin .dashboard-clock-time {
  font-size: calc(2.7rem * var(--clock-scale, 1));
  font-weight: 200;
  letter-spacing: -0.03em;
}

.dashboard-card.is-clock-minimal .dashboard-clock-time {
  font-size: calc(2.4rem * var(--clock-scale, 1));
  font-weight: 500;
  letter-spacing: 0;
}

.dashboard-clock-stack {
  display: grid;
  gap: 0;
  line-height: 0.86;
  font-size: calc(3.4rem * var(--clock-scale, 1));
  font-weight: 800;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #0f2a44);
}

.dashboard-clock-stack strong {
  font-weight: inherit;
}

.dashboard-clock-stack strong + strong {
  color: var(--primary, #1f5a8b);
}

.dashboard-clock-analog {
  width: calc(128px * var(--clock-scale, 1));
  height: calc(128px * var(--clock-scale, 1));
  max-width: 100%;
  max-height: 100%;
  color: var(--text-primary, #0f2a44);
}

.dashboard-clock-analog-face {
  fill: var(--bg-surface, #fff);
  stroke: var(--border-default, rgba(15, 42, 68, 0.14));
  stroke-width: 1.5;
}

.dashboard-clock-analog-ticks line {
  stroke: var(--text-muted, #6b7280);
  stroke-width: 1;
  stroke-linecap: round;
}

.dashboard-clock-analog-ticks line.is-major {
  stroke: var(--text-primary, #0f2a44);
  stroke-width: 2;
}

.dashboard-clock-hand {
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 3;
}

.dashboard-clock-hand.is-minute {
  stroke-width: 2.2;
}

.dashboard-clock-hand.is-second {
  stroke: var(--danger, #c74a45);
  stroke-width: 1;
}

.dashboard-clock-analog-pin {
  fill: var(--danger, #c74a45);
}

/* Formulário dos widgets de ferramentas */
.dashboard-tool-textarea {
  resize: vertical;
  min-height: 96px;
}

.dashboard-tool-color-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-tool-color-chip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--chip);
  cursor: pointer;
  /* O anel externo mantém visível até o branco da paleta de fundo. */
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 0 1px var(--border-default, rgba(15, 42, 68, 0.18));
}

.dashboard-tool-color-chip.is-selected {
  border-color: var(--text-primary, #0f2a44);
}

.dashboard-tool-color-input {
  width: 34px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.2));
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.dashboard-tool-icon-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.dashboard-tool-icon-option {
  display: grid;
  place-items: center;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.12));
  background: var(--bg-soft, rgba(15, 42, 68, 0.04));
  color: var(--text-primary, #0f2a44);
  cursor: pointer;
}

.dashboard-tool-icon-option.is-selected {
  border-color: var(--primary, #1f5a8b);
  background: var(--primary-soft, rgba(77, 163, 255, 0.14));
  color: var(--primary, #1f5a8b);
}

.dashboard-tool-icon-none {
  font-weight: 800;
  color: var(--text-muted, var(--muted));
}

.danger-ghost-button {
  color: var(--danger);
  border-color: rgba(199, 74, 69, 0.35);
}

.danger-ghost-button:hover {
  background: rgba(199, 74, 69, 0.08);
}

.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);
}

/* "Ver dashboards" virou um botão minimalista de três bolinhas, na barra do
   topo à esquerda do sino. Ele também é a indicação do carrossel: com um
   carrossel girando, as bolinhas esticam em barrinhas arredondadas que correm
   na horizontal. */
/* Botão com o nome do dashboard em exibição, sem moldura. Com carrossel
   girando, embaixo do nome entra uma barrinha por tela no estilo dos stories,
   a atual enchendo no tempo daquela tela. */
.dashboard-manager-toggle {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
  max-width: 220px;
  min-height: 32px;
  padding: 2px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  box-shadow: none;
  color: var(--text-secondary, #4a5b6a);
  cursor: pointer;
  transition: color 0.18s ease, transform 0.18s ease;
}

.dashboard-manager-toggle:hover,
.dashboard-manager-toggle.is-active {
  background: none;
  color: var(--primary, #1f5a8b);
}

/* Quando o botão morava dentro da seção do dashboard, sumia junto com ela.
   Na barra do topo, o atributo hidden precisa vencer o display declarado
   acima — sem isso ele continuava visível em Alarmes, Regras etc. */
.dashboard-manager-toggle[hidden] {
  display: none !important;
}

.dashboard-manager-toggle-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.dashboard-carousel-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 100%;
}

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

.dashboard-carousel-bar {
  position: relative;
  flex: 1 1 0;
  min-width: 8px;
  max-width: 28px;
  height: 3px;
  border-radius: 999px;
  background: var(--border-default, rgba(15, 42, 68, 0.18));
  overflow: hidden;
}

.dashboard-carousel-bar.is-done {
  background: var(--primary, #1f5a8b);
  opacity: 0.55;
}

.dashboard-carousel-bar.is-active i {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: inherit;
  background: var(--primary, #1f5a8b);
  transform-origin: left center;
  animation-name: dashboardCarouselFill;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes dashboardCarouselFill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-carousel-bar.is-active i {
    animation: none;
    transform: scaleX(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(77, 163, 255, 0.08);
  border-color: rgba(77, 163, 255, 0.18);
}

.dashboard-manager-editbar-title-input:focus {
  outline: none;
  background: rgba(77, 163, 255, 0.12);
  border-color: rgba(77, 163, 255, 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: 360px;
  max-width: calc(100vw - 32px);
  max-height: min(680px, calc(100vh - 96px));
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  padding: 12px;
  border-radius: 22px;
  background: rgba(9, 23, 38, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 22px 50px rgba(4, 10, 18, 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: #f6fbff;
}

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

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

.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: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border-radius: 12px;
  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(77, 163, 255, 0.14);
  transform: translateX(2px);
}

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

.dashboard-workspaces-row-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #f6fbff;
  padding: 7px 4px 7px 8px;
  text-align: left;
  font: inherit;
  font-size: 0.86rem;
  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-home {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  color: #ffd479;
  background: rgba(255, 212, 121, 0.16);
}

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

/* ── Carrosséis dentro do menu "Seus dashboards" ── */
.dashboard-carousels-block {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.dashboard-carousels-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 6px;
  color: #f6fbff;
}

.dashboard-carousels-head .eyebrow {
  margin: 0;
  color: rgba(246, 251, 255, 0.62);
}

.dashboard-carousels-count {
  font-size: 0.74rem;
  font-weight: 700;
  color: rgba(246, 251, 255, 0.75);
}

.dashboard-carousel-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px 28px;
  align-items: center;
  gap: 5px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.dashboard-carousel-row.is-readonly {
  grid-template-columns: 28px minmax(0, 1fr);
}

.dashboard-carousel-row.is-running {
  background: rgba(47, 158, 111, 0.18);
  box-shadow: inset 0 0 0 1px rgba(47, 158, 111, 0.4);
}

.dashboard-carousel-row-play {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 0;
  display: inline-grid;
  place-items: center;
  background: rgba(77, 163, 255, 0.18);
  color: #dceeff;
  cursor: pointer;
}

.dashboard-carousel-row.is-running .dashboard-carousel-row-play {
  background: rgba(47, 158, 111, 0.32);
  color: #eafff5;
}

.dashboard-carousel-row-play:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dashboard-carousel-row-copy {
  display: grid;
  min-width: 0;
  line-height: 1.25;
  color: #f6fbff;
}

.dashboard-carousel-row-name {
  font-weight: 700;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-carousel-row-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.66rem;
  color: rgba(246, 251, 255, 0.66);
}

.dashboard-carousel-interval {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  color: rgba(246, 251, 255, 0.78);
}

.dashboard-carousel-interval select {
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(9, 23, 38, 0.9);
  color: #f6fbff;
  font: inherit;
}

.dashboard-carousel-picks {
  display: grid;
  gap: 5px;
  max-height: 230px;
  overflow-y: auto;
}

.dashboard-carousel-pick-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.dashboard-carousel-pick-row.is-custom {
  grid-template-columns: minmax(0, 1fr) 58px auto;
}

.dashboard-carousel-pick-time {
  width: 100%;
  padding: 6px 7px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(9, 23, 38, 0.9);
  color: #f6fbff;
  font: inherit;
  font-size: 0.78rem;
  text-align: center;
}

.dashboard-carousel-pick-unit {
  font-size: 0.72rem;
  color: rgba(246, 251, 255, 0.6);
}

.dashboard-carousel-picks-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(246, 251, 255, 0.6);
}

.dashboard-carousel-pick {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #f6fbff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dashboard-carousel-pick.is-selected {
  background: rgba(77, 163, 255, 0.22);
  border-color: rgba(77, 163, 255, 0.5);
}

.dashboard-carousel-pick-order {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.72rem;
  font-weight: 800;
}

.dashboard-carousel-pick-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
}

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

.dashboard-workspaces-visibility-badge.is-shared {
  background: rgba(77, 163, 255, 0.18);
  color: #7fbcff;
}

.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: 9px;
  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(77, 163, 255, 0.16);
  border-color: rgba(77, 163, 255, 0.3);
  color: #7fbcff;
}

.dashboard-workspaces-row-action.is-edit:hover {
  background: rgba(77, 163, 255, 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(246, 251, 255, 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(77, 163, 255, 0.35);
  background: rgba(77, 163, 255, 0.06);
  color: #f6fbff;
  border-radius: 11px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

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

.dashboard-workspaces-create:hover {
  background: rgba(77, 163, 255, 0.16);
  border-color: rgba(77, 163, 255, 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: 8px;
  padding: 10px;
  border-radius: 13px;
  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: #f6fbff;
  padding: 11px 12px;
  font: inherit;
}

.dashboard-workspaces-create-form input[type="text"]:focus {
  outline: none;
  border-color: rgba(77, 163, 255, 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(246, 251, 255, 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, #4da3ff 0%, #1f5a8b 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(77, 163, 255, 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: #f6fbff;
}

.dashboard-workspaces-create-form-submit {
  background: linear-gradient(135deg, #4DA3FF 0%, #1F5A8B 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, #0f2a44, #1f5a8b);
  color: #fff;
  box-shadow: 0 18px 40px rgba(15, 42, 68, 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(15, 42, 68, 0.32);
}

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

@media (min-width: 1181px) {
  .dashboard-manager-shell.is-editing .dashboard-library-fab,
  .dashboard-manager-shell.is-editing .dashboard-manager-panel {
    display: none;
  }
}

.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(5, 16, 28, 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(15, 42, 68, 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(15, 42, 68, 0.08);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 24px 60px rgba(15, 42, 68, 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(15, 42, 68, 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: #0f2a44;
}

.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(15, 42, 68, 0.06);
  border: 1px solid rgba(15, 42, 68, 0.08);
}

.dashboard-manager-pill.is-active {
  background: linear-gradient(180deg, rgba(77, 163, 255, 0.12), rgba(77, 163, 255, 0.06));
}

.dashboard-manager-pill span {
  font-weight: 600;
  color: #0f2a44;
}

.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(15, 42, 68, 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(15, 42, 68, 0.04);
  border: 1px dashed rgba(15, 42, 68, 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;
}

/* Posicionamento livre: a grade vira uma tela e cada card recebe left/top/width/
   height em pixels pelo JS (dashboardApplyCardClasses → applyDashboardFreeLayout). */
.dashboard-canvas-grid.is-free-layout {
  display: block;
  position: relative;
}

.dashboard-canvas-grid.is-free-layout > .dashboard-card {
  position: absolute;
  margin: 0;
}

/* No modo livre a altura vem em pixels do próprio card: a altura mínima
   calculada a partir das células não pode brigar com ela. */
.dashboard-canvas-grid.is-free-layout .dashboard-widget-card-shell {
  min-height: 0;
}

/* Pontinhos da grade de ajuste, só enquanto o dashboard está em edição. */
.dashboard-canvas-grid.is-free-layout.is-free-snap {
  background-image: radial-gradient(circle, rgba(15, 42, 68, 0.16) 1px, transparent 1px);
  background-size: var(--dashboard-free-snap, 10px) var(--dashboard-free-snap, 10px);
  border-radius: 16px;
}

:root[data-theme="dark"] .dashboard-canvas-grid.is-free-layout.is-free-snap {
  background-image: radial-gradient(circle, rgba(226, 236, 246, 0.14) 1px, transparent 1px);
}

.dashboard-card.is-free-dragging {
  transition: none;
  cursor: grabbing;
  box-shadow: 0 18px 40px rgba(6, 20, 35, 0.28);
}

body.dashboard-card-free-moving {
  user-select: none;
}

.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(15, 42, 68, 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: #0f2a44;
}

.dashboard-kpi-value {
  display: block;
  font-size: clamp(2rem, 2.6vw, 2.7rem);
  line-height: 1;
  font-weight: 800;
  color: #0f2a44;
  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(15, 42, 68, 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(77, 163, 255, 0.26) 0%, rgba(77, 163, 255, 0.18) 18%, rgba(77, 163, 255, 0.04) 54%, rgba(77, 163, 255, 0) 70%),
    linear-gradient(180deg, rgba(15, 42, 68, 0.1), rgba(15, 42, 68, 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: #1f5a8b;
  font-size: 0.84rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 24px rgba(15, 42, 68, 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: #0f2a44;
}

.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(15, 42, 68, 0.08);
  box-shadow: 0 20px 44px rgba(8, 21, 33, 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: #35516d;
  font-size: 0.88rem;
  line-height: 1.45;
}

.dashboard-metric-card-popover strong {
  color: #0f2a44;
}

.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(15, 42, 68, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: #0f2a44;
  box-shadow: 0 10px 24px rgba(15, 42, 68, 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, #0f2a44, #4da3ff);
  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));
  /* Respiro enxuto: sobra área útil pro conteúdo do widget. */
  padding: 14px 16px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 42, 68, 0.08);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
}

.dashboard-card.is-card-compact .dashboard-widget-card-shell {
  padding: 10px 12px;
  gap: 8px;
}

/* Card no tamanho mínimo: o sobre-título (grupo) só rouba altura do conteúdo. */
.dashboard-card.is-card-tiny .dashboard-widget-card-heading .eyebrow {
  display: none;
}

.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-equipment-monitor-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: #4b5563;
  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: #0f2a44;
  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(15, 42, 68, 0.12);
  background: linear-gradient(180deg, rgba(247, 250, 253, 0.96), rgba(241, 246, 251, 0.94));
  color: var(--muted);
}

.widget-empty-state strong {
  color: #0f2a44;
  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 .equipment-monitor-* 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: #6d859e;
}

.watchlist-widget-table-shell {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(15, 42, 68, 0.08);
  background: rgba(248, 251, 255, 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(15, 42, 68, 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: #46607b;
  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: #0f2a44;
}

.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(15, 42, 68, 0.08);
  background: rgba(248, 251, 255, 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(15, 42, 68, 0.06);
  vertical-align: middle;
  font-size: 0.83rem;
}

.alarm-feed-table th {
  position: sticky;
  top: 0;
  background: rgba(248, 251, 255, 0.96);
  color: #46607b;
  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: #0f2a44;
  line-height: 1.15;
}

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


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

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

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

.dashboard-equipment-monitor-config-head strong {
  color: #0f2a44;
}

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

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

.dashboard-equipment-monitor-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f2a44;
  font-size: 0.82rem;
}

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

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

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

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

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

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

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

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

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

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

.equipment-monitor-skeleton-line.is-wide {
  width: 150px;
}

.equipment-monitor-skeleton-line.is-short {
  width: 56px;
}

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

.equipment-monitor-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);
}

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

.equipment-monitor-table th,
.equipment-monitor-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(15, 42, 68, 0.06);
  vertical-align: middle;
  font-size: 0.84rem;
}

.equipment-monitor-table th:first-child,
.equipment-monitor-table td:first-child {
  text-align: left;
}

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

.equipment-monitor-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;
  /* A tabela é pra rolar de lado quando aperta (min-width:720px abaixo), não
     pra espremer a coluna até o texto do cabeçalho quebrar letra por letra. */
  white-space: nowrap;
}

/* Rótulo do cabeçalho com reticências se mesmo assim sobrar pouco espaço
   (ex.: coluna ganha min-width num breakpoint intermediário) -- nunca deixa
   voltar a quebrar palavra/letra. min-width:0 é necessário pro ellipsis
   funcionar dentro do botão flex (.equipment-monitor-sort-button). */
.equipment-monitor-sort-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.equipment-monitor-table tbody tr:last-child td {
  border-bottom: 0;
}

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

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

.equipment-monitor-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;
}

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

.equipment-monitor-state-bar:focus-visible {
  outline: 2px solid rgba(77, 163, 255, 0.42);
  outline-offset: 3px;
}

.equipment-monitor-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;
}

.equipment-monitor-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);
}

.equipment-monitor-metric.is-performance {
  gap: 7px;
}

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

.equipment-monitor-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;
}

.equipment-monitor-metric-button:focus-visible {
  outline: 2px solid rgba(77, 163, 255, 0.42);
  outline-offset: 4px;
  border-radius: 10px;
}

.equipment-monitor-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;
}

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

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

.equipment-monitor-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);
}

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

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

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

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

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

.equipment-monitor-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;
}

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

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

.equipment-monitor-popover-close-button:focus-visible {
  outline: 2px solid rgba(77, 163, 255, 0.42);
  outline-offset: 2px;
  background: color-mix(in srgb, #b42318 10%, transparent);
  color: color-mix(in srgb, #b42318 82%, var(--text));
}

.equipment-monitor-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);
}

.equipment-monitor-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;
}

.equipment-monitor-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);
}

.equipment-monitor-mini-popover-period-option:focus-visible {
  outline: 2px solid rgba(77, 163, 255, 0.42);
  outline-offset: 1px;
}

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

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

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

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

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

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

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

.equipment-monitor-mini-chart svg {
  width: 100%;
  height: 100%;
  display: block;
}

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

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

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

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

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

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

.equipment-monitor-trend-mock em,
.equipment-monitor-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;
}

.equipment-monitor-pressure {
  font-variant-numeric: tabular-nums;
  color: #0f2a44;
}

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

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

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

.equipment-monitor-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;
}

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

.equipment-monitor-status-button:focus-visible {
  outline: 2px solid rgba(77, 163, 255, 0.42);
  outline-offset: 4px;
  border-radius: 10px;
}

.equipment-monitor-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);
}

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

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

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

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

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

.equipment-monitor-popover-item {
  display: grid;
  gap: 3px;
  padding-top: 10px;
  border-top: 1px solid rgba(15, 42, 68, 0.08);
}

.equipment-monitor-popover-item:first-child {
  padding-top: 0;
  border-top: 0;
}

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

.equipment-monitor-popover-item.is-fallback strong {
  color: #dc2626;
}

.equipment-monitor-legend-item-mock {
  color: var(--muted);
}

.equipment-monitor-legend-item-mock strong {
  color: #ea580c;
}

.equipment-monitor-legend-item-mock span {
  color: inherit;
}

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

/* Média de ICO/IEC dos ambientes selecionados (08/10/2026) -- canto superior
   direito do CABEÇALHO do card (espaço que ficava vazio ao lado do título,
   mesmo slot que .room-history-legend usa em outro card), não no corpo:
   .dashboard-widget-card-heading-with-legend já reserva esse layout
   title-esquerda/extra-direita e já tem o respiro certo pro modo de edição
   (.dashboard-manager-shell.is-editing, acima). */
.equipment-monitor-heading-summary { flex: 0 0 auto; }
.equipment-monitor-heading-summary-inner { display: flex; gap: 10px; }
.equipment-monitor-heading-stat {
  display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 10px;
  border-radius: 999px; background: var(--surface-strong); border: 1px solid var(--line);
  font-size: 0.78rem; cursor: default;
}
.equipment-monitor-heading-stat-label { color: var(--muted); font-weight: 600; }
.equipment-monitor-heading-stat-value { font-weight: 700; }

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

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

.equipment-monitor-legend-copy {
  color: var(--muted);
}

.equipment-monitor-status.tone-ok,
.equipment-monitor-legend-item.tone-ok,
.equipment-monitor-pressure.tone-ok,
.equipment-monitor-metric.tone-ok,
.equipment-monitor-heading-stat-value.tone-ok {
  color: #16a34a;
}

.equipment-monitor-status.tone-warning,
.equipment-monitor-legend-item.tone-warning,
.equipment-monitor-pressure.tone-warning,
.equipment-monitor-metric.tone-warning,
.equipment-monitor-heading-stat-value.tone-warning {
  color: #d97706;
}

.equipment-monitor-status.tone-critical,
.equipment-monitor-legend-item.tone-critical,
.equipment-monitor-pressure.tone-critical,
.equipment-monitor-metric.tone-critical,
.equipment-monitor-heading-stat-value.tone-critical {
  color: #dc2626;
}

.equipment-monitor-status.tone-offline,
.equipment-monitor-legend-item.tone-offline,
.equipment-monitor-pressure.tone-offline,
.equipment-monitor-metric.tone-offline,
.equipment-monitor-heading-stat-value.tone-offline {
  color: var(--gray);
}

/* ──────────── Saúde Geral do Prédio (buildingHealth, 21/10/2026) ──────────── */
.building-health-widget-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  overflow-y: auto;
  padding-right: 2px;
}

.building-health-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.building-health-head-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
}

.building-health-head-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.building-health-site-name {
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.building-health-site-count {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.building-health-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.building-health-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-soft);
}

.building-health-stat-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--border-default);
  color: var(--muted);
}

.building-health-stat.tone-ok .building-health-stat-icon {
  background: color-mix(in srgb, var(--status-ok) 16%, transparent);
  color: var(--status-ok);
}

.building-health-stat.tone-warning .building-health-stat-icon {
  background: color-mix(in srgb, var(--status-warning) 16%, transparent);
  color: var(--status-warning);
}

.building-health-stat.tone-critical .building-health-stat-icon {
  background: color-mix(in srgb, var(--status-critical) 16%, transparent);
  color: var(--status-critical);
}

.building-health-stat-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.building-health-stat-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.building-health-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
}

.building-health-stat-value.tone-ok { color: var(--status-ok); }
.building-health-stat-value.tone-warning { color: var(--status-warning); }
.building-health-stat-value.tone-critical { color: var(--status-critical); }
.building-health-stat-value.tone-offline { color: var(--muted); }

.building-health-stat-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Detalhamento (ICO/IEC por status, piores ambientes): <details> colapsados por
   padrão. Abrir um deles nunca redimensiona o card — o shell acima já tem
   height:100%/overflow-y:auto, então o conteúdo extra só ganha rolagem interna. */
.building-health-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.building-health-disclosure {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.building-health-disclosure summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  transition: background 0.15s ease;
}

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

.building-health-disclosure summary:hover {
  background: color-mix(in srgb, var(--primary) 7%, transparent);
}

.building-health-disclosure[open] summary {
  border-bottom: 1px solid var(--border-default);
}

.building-health-disclosure-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
}

.building-health-disclosure-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
}

.building-health-disclosure-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.building-health-disclosure-meta {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.building-health-disclosure-chevron {
  color: var(--muted);
  transition: transform 0.2s ease;
  flex: 0 0 auto;
}

.building-health-disclosure[open] .building-health-disclosure-chevron {
  transform: rotate(180deg);
}

.building-health-disclosure-body {
  padding: 8px 12px 12px;
}

.building-health-empty-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.building-health-breakdown {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.building-health-breakdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.building-health-breakdown-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.building-health-breakdown-dot.tone-ok { background: var(--status-ok); }
.building-health-breakdown-dot.tone-warning { background: var(--status-warning); }
.building-health-breakdown-dot.tone-critical { background: var(--status-critical); }
.building-health-breakdown-dot.tone-offline { background: var(--muted); }

.building-health-breakdown-label {
  flex: 1 1 auto;
  color: var(--text-primary);
}

.building-health-breakdown-count {
  font-weight: 700;
  color: var(--text-primary);
}

.building-health-worst-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.building-health-worst-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
}

.building-health-worst-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.building-health-worst-value {
  font-weight: 700;
  flex: 0 0 auto;
}

.building-health-worst-value.tone-ok { color: var(--status-ok); }
.building-health-worst-value.tone-warning { color: var(--status-warning); }
.building-health-worst-value.tone-critical { color: var(--status-critical); }
.building-health-worst-value.tone-offline { color: var(--muted); }

.equipment-monitor-state-bar.tone-ok {
  background: #16a34a;
}

.equipment-monitor-state-bar.tone-warning {
  background: #d97706;
}

.equipment-monitor-state-bar.tone-mock {
  background: #ea580c;
}

.equipment-monitor-state-bar.tone-critical {
  background: #dc2626;
}

.equipment-monitor-state-bar.tone-offline {
  background: var(--gray);
}

.equipment-monitor-metric.tone-neutral {
  color: var(--text);
}

.equipment-monitor-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;
}

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

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

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

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

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

.equipment-monitor-sort-button:focus-visible {
  outline: 2px solid rgba(77, 163, 255, 0.42);
  outline-offset: 3px;
  border-radius: 8px;
}

.equipment-monitor-table td.is-numeric {
  text-align: center;
}

.equipment-monitor-table td.is-numeric .equipment-monitor-metric {
  justify-content: center;
}

.equipment-monitor-metric-text {
  font-weight: 600;
}

.watchlist-widget-single {
  display: grid;
  gap: 12px;
  min-height: 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(15, 42, 68, 0.08);
  background: rgba(248, 251, 255, 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: #5b7390;
  margin-bottom: 4px;
}

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

.widget-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 5px rgba(15, 42, 68, 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: #94a3b8;
}

.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, #e8f2ff 0%, #dbe9fb 54%, #f6faff 100%);
  border: 1px solid rgba(77, 163, 255, 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: #1f5a8b;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.machine-monitor-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(15, 42, 68, 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(100, 116, 139, 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(248, 251, 255, 0.92);
  border: 1px solid rgba(15, 42, 68, 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(15, 42, 68, 0.1);
  background: rgba(255, 255, 255, 0.96);
  color: #0f2a44;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  font: inherit;
  box-shadow: 0 14px 28px rgba(15, 42, 68, 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: #5b7390;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-mobile-resize-option.is-active {
  background: rgba(77, 163, 255, 0.14);
  border-color: rgba(77, 163, 255, 0.34);
  color: #1f5a8b;
}

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

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

.dashboard-mobile-picker-trigger {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(15, 42, 68, 0.12);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.94);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #0f2a44;
  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(244, 248, 252, 0.96);
  border: 1px solid rgba(15, 42, 68, 0.08);
}

.dashboard-mobile-picker-option {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(15, 42, 68, 0.08);
  border-radius: 12px;
  background: #fff;
  color: #0f2a44;
  font: inherit;
  text-align: left;
}

.dashboard-mobile-picker-option.is-selected {
  background: rgba(77, 163, 255, 0.12);
  border-color: rgba(77, 163, 255, 0.26);
}

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

.machine-monitor-metric-values strong {
  color: #0f2a44;
  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(15, 42, 68, 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: #94a3b8; }

.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(247, 250, 255, 0.96));
  border: 1px solid rgba(15, 42, 68, 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: #0f2a44;
}

.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: #5b7390;
  min-width: 0;
  flex: 1 1 auto;
  /* Sem isso, o rótulo quebra em 2 linhas quando o card fica no tamanho
     mínimo e a bolinha de status (flex item fixo, alinhada ao centro da
     linha) passa a flutuar por cima do texto em vez de ficar ao lado. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.machine-monitor-state-chip {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 4px rgba(15, 42, 68, 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: #94a3b8; }

.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(148, 163, 184, 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(8, 24, 38, 0.96);
  border: 1px solid rgba(118, 157, 196, 0.28);
  box-shadow: 0 18px 38px rgba(15, 42, 68, 0.24);
  color: #f7fbff;
  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(8, 24, 38, 0.96);
  border-left: 1px solid rgba(118, 157, 196, 0.28);
  border-top: 1px solid rgba(118, 157, 196, 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(247, 251, 255, 0.3);
  border-bottom: 1px solid rgba(118, 157, 196, 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: #a9c2d9;
  flex: 1 1 auto;
  min-width: 0;
}

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

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

.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: #7dd3fc; }
.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: #7dd3fc; }
.dashboard-hover-tooltip-row.tone-offline .dashboard-hover-tooltip-icon,
.dashboard-hover-tooltip-row.tone-offline .dashboard-hover-tooltip-value { color: #94a3b8; }

.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="equipmentMonitor"] .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(8, 24, 38, 0.98);
  border: 1px solid rgba(118, 157, 196, 0.28);
  box-shadow: 0 18px 38px rgba(15, 42, 68, 0.24);
  color: #f7fbff;
  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(8, 24, 38, 0.98);
  border-left: 1px solid rgba(118, 157, 196, 0.28);
  border-top: 1px solid rgba(118, 157, 196, 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(118, 157, 196, 0.28);
  border-bottom: 1px solid rgba(118, 157, 196, 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(1080px, calc(100vw - 32px));
  max-height: min(92vh, 880px);
}

/* Seletor em duas colunas (watchlist e gráfico X/Y): o modal inteiro vira uma
   coluna flex e a rolagem acontece só dentro das duas listas — sem a barra de
   rolagem do modal inteiro por cima das barras internas. */
.dashboard-widget-config-modal-body:has(.watchlist-picker-shell) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dashboard-widget-config-shell.watchlist-picker-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 12px;
}

/* ── Watchlist: seletor em duas colunas (incluídos | estrutura em pastas) ── */
.watchlist-picker {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr);
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
}

/* O rodapé com "Salvar" fica sempre à vista, fora da área que rola. */
.watchlist-picker-shell .dashboard-widget-config-footer {
  flex: 0 0 auto;
  z-index: 2;
  margin: 0;
  padding: 12px 0 2px;
  background: var(--bg-surface, #fff);
}

.watchlist-picker-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.12));
  border-radius: 16px;
  background: var(--bg-surface, #fff);
  overflow: hidden;
}

.watchlist-picker-pane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-default, rgba(15, 42, 68, 0.1));
  font-size: 0.82rem;
  color: var(--text-primary, #0f2a44);
}

.watchlist-picker-pane-head > span {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-secondary, var(--muted));
}

.watchlist-picker-search {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.watchlist-picker-mini {
  padding: 5px 10px;
  font-size: 0.74rem;
  min-height: 0;
  white-space: nowrap;
}

.watchlist-picker-selection {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--primary-soft, rgba(77, 163, 255, 0.12));
  font-size: 0.76rem;
}

.watchlist-picker-list,
.watchlist-picker-scroll {
  flex: 1 1 auto;
  min-height: 140px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px;
}

.watchlist-picker-list {
  display: grid;
  gap: 6px;
  align-content: start;
}

.watchlist-picker-empty {
  margin: auto;
  padding: 24px 16px;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted, var(--muted));
}

.watchlist-picker-included.is-drop-target {
  border-color: var(--primary, #1f5a8b);
  box-shadow: inset 0 0 0 2px var(--primary-soft, rgba(77, 163, 255, 0.25));
  background: var(--primary-soft, rgba(77, 163, 255, 0.08));
}

.watchlist-picker .htree-row.is-partial > .htree-label {
  color: var(--primary-accessible-text, #1f5a8b);
  font-weight: 700;
}

.watchlist-picker .htree-leaf.is-included {
  color: var(--success-accessible-text, #2f9e6f);
}

.watchlist-picker .htree-add.is-done {
  color: var(--success-accessible-text, #2f9e6f);
  border-color: transparent;
  background: var(--success-soft, rgba(47, 158, 111, 0.14));
  cursor: default;
}

.watchlist-picker .htree-label[draggable="true"] {
  cursor: grab;
}

@media (max-width: 860px) {
  /* Telas estreitas: as duas colunas viram uma embaixo da outra e quem rola
     volta a ser o modal inteiro. */
  .watchlist-picker {
    grid-template-columns: minmax(0, 1fr);
    flex: 0 0 auto;
  }

  .dashboard-widget-config-modal-body:has(.watchlist-picker-shell) {
    overflow: auto;
  }

  .watchlist-picker-list,
  .watchlist-picker-scroll {
    min-height: 180px;
    max-height: 40vh;
  }
}

.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: #3c5874;
}

.dashboard-widget-field select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(15, 42, 68, 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(15, 42, 68, 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(15, 42, 68, 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: #5d7690;
  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(15, 42, 68, 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(15, 42, 68, 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: #0f2a44;
}

.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: #1f5a8b;
}

.dashboard-card-tool[data-dashboard-card-config].is-active {
  background: rgba(77, 163, 255, 0.18);
  border-color: rgba(77, 163, 255, 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, #0F2A44, #1F5A8B),
    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(245, 250, 255, 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(5, 17, 28, 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(245, 250, 255, 0.14);
  color: rgba(245, 250, 255, 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(15, 42, 68, 0.98), rgba(31, 90, 139, 0.94)),
    var(--surface);
  color: #f7fbff;
}

.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(234, 243, 255, 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(15, 42, 68, 0.04);
  border: 1px solid rgba(15, 42, 68, 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: #9ca3af;
  box-shadow: 0 0 0 8px rgba(156, 163, 175, 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;
}

/* A tela de tabela é uma coluna: o que vem antes do card (faixa de aviso, cards
   de resumo, seletor de visualização) tem altura própria e o card da tabela
   ocupa exatamente o espaço restante.
   Antes era `display: grid` sem linhas declaradas: com mais de um filho, o
   espaço sobrando era dividido IGUALMENTE entre as linhas automáticas, então a
   altura do card variava conforme o conteúdo — era isso que fazia a janela da
   estrutura de pastas crescer e encolher com a quantidade de itens. */
.table-screen {
  min-width: 0;
  min-height: 0;
  height: calc(100vh - var(--table-chrome-reserve));
  max-height: calc(100vh - var(--table-chrome-reserve));
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.table-screen > * {
  flex: 0 0 auto;
}

.table-screen > .table-card {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

.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: #EAF3FF;
  border-color: #4DA3FF;
  color: #4DA3FF;
}

.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(77, 163, 255, 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(77, 163, 255, 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(77, 163, 255, 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(234, 243, 255, 0.92);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #EAF3FF;
  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(77, 163, 255, 0.22);
  background: rgba(234, 243, 255, 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;
}

/* Colunas de "botão" (pills de Estado/Status/Alarme): sempre centralizadas,
   no cabeçalho e nas células, em todas as tabelas — ver column.align. */
th.cell-center,
td.cell-center {
  text-align: center;
  vertical-align: middle;
}

th.cell-center .sort-button {
  justify-content: center;
  margin: 0 auto;
}

/* Tabela de alarmes: o #id vira linha secundária, menor, abaixo do equipamento. */
.alarm-id-meta {
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.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(234, 243, 255, 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;
}

/* Ferramentas Internas: Usuários demo (16/10/2026) — mesmo molde visual de
   usage-ranked-row, sem reinventar layout de card. */
.demo-users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-users-row {
  border: 1px solid var(--border-default);
  border-radius: 12px;
  background: var(--surface-strong);
  overflow: hidden;
}

.demo-users-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
}

.demo-users-row-name {
  font-weight: 700;
}

.demo-users-row-email,
.demo-users-row-client,
.demo-users-row-meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.demo-users-row-meta {
  margin-left: auto;
}

.demo-users-row-detail {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border-default);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.demo-users-history {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

.demo-users-history ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

@media (max-width: 720px) {
  .demo-users-history {
    grid-template-columns: 1fr;
  }
}

.demo-users-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 2px;
}

.demo-users-conversations-list {
  list-style: none;
  padding-left: 0 !important;
}

.demo-users-conversation-group {
  margin-bottom: 10px;
}

.demo-users-conversation-group > strong {
  display: block;
  margin-bottom: 4px;
}

.demo-users-conversation {
  margin-bottom: 4px;
}

.demo-users-conversation-toggle {
  border: 0;
  background: transparent;
  color: var(--text-link, var(--text-secondary));
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 0;
  font: inherit;
  text-align: left;
}

.demo-users-conversation-body {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  margin: 6px 0 10px;
}

.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, #17395f 0%, #3e84cb 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, #16385d 0%, #3f83ca 100%);
  height: max(16px, var(--bar-height, 16px));
  min-height: 16px;
  box-shadow: 0 12px 24px rgba(24, 61, 102, 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(23, 59, 99, 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(19, 47, 78, 0.98);
  color: #f8fbff;
  box-shadow: 0 14px 30px rgba(15, 42, 68, 0.24);
  border: 1px solid rgba(207, 229, 255, 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(234, 243, 255, 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(112, 122, 132, 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;
}

/* O [hidden] do navegador (display:none) perde de qualquer display declarado
   aqui. Sem isto, os campos condicionais do popup de regra (valor minimo,
   ponto de referencia, offset) continuavam visiveis mesmo escondidos por JS. */
.settings-toggle[hidden],
.settings-select-field[hidden] {
  display: none;
}

.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, #4da3ff);
}

.time-picker-trigger:focus-visible {
  outline: none;
  border-color: var(--brand-deep, #4da3ff);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.18);
}

.time-picker.is-open .time-picker-trigger {
  border-color: var(--brand-deep, #4da3ff);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 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(77, 163, 255, 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(234, 243, 255, 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(77, 163, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 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(77, 163, 255, 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(5, 16, 28, 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(5, 16, 28, 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(248, 251, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 28px;
  box-shadow: 0 30px 70px rgba(6, 20, 35, 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;
}

/* Agrupa Salvar + Fechar no canto do cabeçalho do modal (08/10/2026, card
   "Monitoramento de equipamentos") -- o cabeçalho já fica fora da área que
   rola, então o Salvar sempre está visível sem precisar de uma barra sticky
   separada dentro do corpo. */
.dashboard-widget-config-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.dashboard-widget-config-header-actions .primary-button {
  min-width: 0;
  padding: 8px 16px;
}

.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(248, 251, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 30px;
  box-shadow: 0 30px 70px rgba(6, 20, 35, 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(77, 163, 255, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(232, 241, 251, 0.96));
  border: 1px solid rgba(77, 163, 255, 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(77, 163, 255, 0.08) 25%, transparent 25%) -12px 0 / 24px 24px,
    linear-gradient(-45deg, rgba(77, 163, 255, 0.08) 25%, transparent 25%) -12px 0 / 24px 24px,
    linear-gradient(45deg, transparent 75%, rgba(77, 163, 255, 0.08) 75%) -12px 0 / 24px 24px,
    linear-gradient(-45deg, transparent 75%, rgba(77, 163, 255, 0.08) 75%) -12px 0 / 24px 24px,
    #f4f8fc;
  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: #eef4fb;
}

.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(15, 42, 68, 0.12);
  background: rgba(244, 248, 252, 0.92);
  color: #0f2a44;
  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(77, 163, 255, 0.42);
  background: rgba(225, 237, 249, 0.96);
}

.avatar-shape-button.is-active {
  background: linear-gradient(135deg, rgba(31, 90, 139, 0.92), rgba(77, 163, 255, 0.42));
  border-color: rgba(31, 90, 139, 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 {
  position: relative;
  display: grid;
  place-items: center;
  /* `.login-page` (body) já é ~100vh e começa no topo do documento — então
     o limite de corte daqui coincide com a borda da viewport. O card entra
     de fora da tela por baixo (translateY bem além de 100vh) e só fica
     visível quando cruza essa mesma borda — igual aconteceria sem nenhum
     overflow aqui, só que sem o risco de uma barra de rolagem piscando
     durante o 1s da entrada. */
  overflow: hidden;
  background: var(--bg-app);
}

/* ──────────────── Fundo: foto real de cidade (29/10/2026) ────────────────
   Era um céu+skyline ilustrado em SVG (estilo cartoon); trocado por uma foto
   de verdade (dashboard/images/login-background.jpg) pra ficar mais real.
   Mantém a mesma paralaxe sutil que reage ao mouse (login.js escreve
   --px/--py em #loginBg) e o véu por cima pra garantir contraste do texto/
   chips nos dois temas — só a camada visual embaixo mudou. */
.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
  --px: 0;
  --py: 0;
}

.login-bg-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  /* Um pouco de blur pra não competir com o card/chips em primeiro plano —
     scale(1.04) compensa, "puxando" a borda borrada pra fora da viewport
     (senão o blur encolhe a imagem visível e deixa uma friso vazando nas
     bordas). */
  filter: blur(3px);
  transition: transform 0.2s ease-out;
  transform: translate3d(calc(var(--px) * 10px), calc(var(--py) * 7px), 0) scale(1.04);
}

.login-bg-wash {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 20, 38, 0.35) 0%, rgba(8, 20, 38, 0.12) 35%, rgba(8, 20, 38, 0.1) 70%, rgba(8, 20, 38, 0.3) 100%);
}

:root[data-theme="dark"] .login-bg-wash {
  background: linear-gradient(180deg, rgba(4, 10, 20, 0.6) 0%, rgba(4, 10, 20, 0.35) 35%, rgba(4, 10, 20, 0.3) 70%, rgba(4, 10, 20, 0.55) 100%);
}

/* ──────────────── Chips de telemetria — "isso é o nosso produto" ────────────────
   Mini cards no mesmo vidro/sombra do `.login-card`, flutuando sobre o
   skyline, como se o dashboard já estivesse lendo esses prédios ali atrás.
   Dois elementos por chip: `-pos` cuida só da paralaxe (reage ao mouse,
   sempre liga, igual as outras camadas) e `.login-bg-chip` cuida só da
   flutuação/entrada (autônomas, respeitam "reduzir movimento") — assim as
   duas nunca disputam a mesma propriedade `transform` no mesmo elemento. */
.login-bg-chip-pos {
  position: absolute;
  transition: transform 0.2s ease-out;
  transform: translate3d(calc(var(--px, 0) * 26px), calc(var(--py, 0) * 18px), 0);
  pointer-events: none;
}

.login-bg-chip-pos-1 {
  left: 4%;
  top: 40%;
}

.login-bg-chip-pos-2 {
  right: 4%;
  top: 32%;
}

.login-bg-chip-pos-live {
  left: 50%;
  top: 7%;
  transform: translate3d(calc(var(--px, 0) * 26px - 50%), calc(var(--py, 0) * 18px), 0);
}

.login-bg-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 9px 9px;
  border-radius: 14px;
  /* Vidro escuro (29/10/2026 v4) — mesmo tom do card, pros 3 chips soltos
     combinarem com o fundo noturno em vez de ficarem brancos destoando. */
  background: rgba(16, 14, 20, 0.6);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 200, 140, 0.2);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  white-space: nowrap;
  animation:
    loginChipIn 0.6s ease-out calc(1.6s + var(--fd, 0s)) forwards,
    loginChipFloat 5s ease-in-out calc(1.6s + var(--fd, 0s)) infinite;
}

@keyframes loginChipIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes loginChipFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.login-bg-chip-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(36, 141, 209, 0.14);
  color: var(--primary);
  flex-shrink: 0;
}

.login-bg-chip-icon svg {
  width: 16px;
  height: 16px;
}

.login-bg-chip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.login-bg-chip-text strong {
  font-size: 13px;
  color: #F3F8FC;
}

.login-bg-chip-text small {
  font-size: 10.5px;
  color: rgba(243, 248, 252, 0.68);
}

.login-bg-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(60, 178, 110, 0.18);
}

.login-bg-chip-dot-live {
  background: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(36, 192, 229, 0.2);
  animation: loginBgNodePulse 2.6s ease-in-out infinite;
}

/* WhatsApp tem identidade própria (verde) — sobrescreve só a cor, mantém a
   mesma animação de pulso "ao vivo" das outras. */
.login-bg-chip-dot-whatsapp {
  background: #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.22);
}

.login-bg-chip-icon-whatsapp {
  background: rgba(37, 211, 102, 0.16);
  color: #25d366;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

/* Wrap sem overflow:hidden (ao contrário do card em si) — existe só pra dar
   um ponto de referência de posição pra fita de cor (abaixo), que precisa
   "vir de fora" e por isso não pode estar presa dentro do corte do próprio
   card. O wrap abraça o card exatamente (nenhum padding/tamanho próprio),
   então `top:0` nele já é o topo do card. */
.login-card-wrap {
  position: relative;
  width: min(460px, 100%);
}

/* ──────────────── Card: vidro fosco com entrada longa e em etapas ────────────────
   A entrada só toca quando o JS marca <body class="login-ready"> (ver login.js)
   — assim ela não depende de exatamente quando o CSS termina de carregar/
   repintar, e começa só quando a página já está visualmente estável na tela
   do usuário. Sem JS, o card aparece direto no estado final (grid acima já
   garante isso: resting state é opacity:1, sem transform). */
.login-card {
  position: relative;
  width: 100%;
  /* Vidro escuro (combina com a foto noturna de fundo, 29/10/2026 v3) — tom
     quase preto com leve matiz âmbar, borda com brilho âmbar sutil (ecoa as
     luzes da cidade). `color` dá a base clara pro texto que só herda (h1/h2/
     parágrafo); os elementos com cor própria (eyebrow, links, hint) têm
     override logo abaixo — inputs continuam brancos de propósito. */
  background: rgba(16, 14, 20, 0.62);
  color: #F3F8FC;
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid rgba(255, 200, 140, 0.22);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  gap: 20px;
  overflow: hidden;
  opacity: 1;
  /* Inclinação 3D sutil que segue o mouse (--tilt-x/--tilt-y, via login.js) —
     fica "parada" (0deg) o resto do tempo, inclusive durante a entrada
     abaixo, que assume o controle de `transform` enquanto toca. */
  transform: perspective(1000px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform 0.25s ease-out;
}

/* Sem suporte a backdrop-filter (raro, mas existe): troca o vidro fosco por
   um gradiente diagonal com as cores da marca "assado" no próprio fundo —
   ainda parece desenhado de propósito, em vez de um card branco liso. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .login-card {
    background:
      linear-gradient(145deg, rgba(36, 141, 209, 0.14), rgba(36, 192, 229, 0.1) 45%, rgba(255, 255, 255, 0.94) 75%),
      #fff;
  }
}

/* Brilho de vidro que segue o cursor — um ponto de luz (radial-gradient)
   posicionado por --mx/--my (login.js, mousemove) que só aparece no hover.
   Nasce antes do conteúdo real no DOM, então pinta atrás dele sem precisar
   de z-index. */
.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.75), transparent 42%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.login-card:hover::before {
  opacity: 1;
}

/* Brilho diagonal de uma vez só, cruzando o vidro — o acabamento final da
   entrada, depois que o card já pousou (ver atraso de 1.05s abaixo). */
.login-card::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -65%;
  width: 36%;
  height: 220%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.6) 45%, transparent 62%);
  transform: translateX(0) rotate(8deg);
  opacity: 0;
  pointer-events: none;
}

body.login-ready .login-card::after {
  animation: loginCardSweep 1s 1.08s cubic-bezier(0.37, 0, 0.63, 1);
}

@keyframes loginCardSweep {
  0% { opacity: 0; transform: translateX(0) rotate(8deg); }
  14% { opacity: 0.9; }
  58% { opacity: 0.9; }
  100% { opacity: 0; transform: translateX(480%) rotate(8deg); }
}

/* Uma caixa de 460×~440 com border-radius:50% em ESCALA CHEIA vira elipse,
   não bola — feio. A correção: a escala fica PEQUENA (bolinha de verdade,
   redonda) por quase toda a viagem, e só "explode" pro tamanho/formato
   final no fim. Position e scale precisam estar no MESMO `transform` (não
   dá pra separar em 2 animações, senão uma sobrescreve a outra) — por isso
   aqui tem só uma animação de transform, com timing-function DIFERENTE por
   trecho, usando o `animation-timing-function` de dentro de cada keyframe.
   Importante pra não "parar" antes de explodir: o keyframe do meio NÃO
   chega no valor final (ainda falta um pouco de viagem e de escala) — a
   última sobra de trajeto termina JUNTO com a explosão, como um gesto só,
   contínuo, em vez de "chega, para, só depois explode". O border-radius
   guarda esse mesmo ritmo numa animação separada (só border-radius não é
   problema, já que não mexe em `transform`). */
body.login-ready .login-card {
  animation:
    loginCardEnter 1.1s cubic-bezier(0.22, 1, 0.36, 1),
    loginCardRound 1.1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes loginCardEnter {
  0% {
    opacity: 0;
    transform: translate3d(0, 120vh, 0) scale(0.14);
    filter: blur(14px);
    box-shadow: 0 0 0 0 transparent;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }
  22% {
    opacity: 1;
  }
  62% {
    transform: translate3d(0, 3vh, 0) scale(0.19);
    filter: blur(4px);
    animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
    box-shadow: var(--shadow);
  }
}

@keyframes loginCardRound {
  0% { border-radius: 50%; }
  62% { border-radius: 50%; }
  100% { border-radius: 28px; }
}

/* Chispa que dança: percorre um caminho curvo de verdade (offset-path, não
   translate+scale combinados — era essa combinação que vazava pro lado)
   pairando por cima do card antes de "pousar" bem onde a fita começa. Mora
   no `.login-card-wrap` (sem overflow:hidden) pra não ser cortada pelo
   corte do próprio card enquanto ainda está fora dele.
   O ponto final do caminho (34,2) fica DEPOIS do raio de 28px do canto
   (não em 2,2, que cai dentro da curva do canto, fora da silhueta
   arredondada do card) — pousa já na parte reta do topo, na altura do
   centro da fita de 4px (y:2), bem onde a fita visivelmente começa. */
.login-card-spark {
  position: absolute;
  top: 0;
  left: 0;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 14px 4px rgba(36, 192, 229, 0.65);
  opacity: 0;
  pointer-events: none;
  offset-path: path("M 250,-130 C 150,-170 40,-150 70,-80 C 100,-10 180,10 110,30 C 55,25 42,8 34,2");
  offset-distance: 0%;
  offset-rotate: 0deg;
}

body.login-ready .login-card-spark {
  animation: loginSparkDance 1.15s cubic-bezier(0.45, 0, 0.4, 1) 0.1s forwards;
}

@keyframes loginSparkDance {
  0% { offset-distance: 0%; opacity: 0; transform: scale(0.5); }
  12% { opacity: 1; }
  80% { opacity: 1; transform: scale(1); }
  100% { offset-distance: 100%; opacity: 0; transform: scale(0.4); }
}

/* Fita de cor — fica no lugar o tempo todo (sem translate nenhum, só
   scaleX) exatamente pra nunca mais vazar pro lado; o "vir de outro lugar"
   agora é inteiramente trabalho da chispa acima, que termina bem onde essa
   fita começa (canto esquerdo), passando o bastão pra ela. */
/* De volta a ser filha do `.login-card` (não mais irmã no wrap): uma barra
   reta, por mais que tivesse seu próprio border-radius, nunca ia reproduzir
   a curva REAL de um canto de 28px (o raio do canto é alto comparado aos
   4px de altura da barra — ela sempre ia "vazar" além do contorno
   arredondado do card). Sendo filha, o próprio overflow:hidden do card
   recorta a barra exatamente no formato que o card tiver NAQUELE instante
   (bola ou caixa, não importa) — sem precisar replicar raio nenhum aqui. */
.login-card-accent {
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan), var(--success), var(--warning), var(--primary));
  background-size: 300% 100%;
  transform-origin: left center;
  transform: scaleX(0);
  pointer-events: none;
}

body.login-ready .login-card-accent {
  animation:
    loginAccentDraw 0.5s 1.08s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
    loginAccentShift 9s linear infinite 1.58s;
}

@keyframes loginAccentDraw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes loginAccentShift {
  to { background-position: 300% 0; }
}

/* `.is-shake` troca a animação só temporariamente (removida via JS depois de
   tocar) — como a entrada acima já não depende de "segurar" opacidade via
   fill-mode (resting state já é opacity:1), trocar a animação aqui não some
   com o card, só adiciona o tremor por cima. */
.login-card.is-shake {
  animation: loginCardShake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes loginCardShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* Cascata de conteúdo: cada bloco do card entra em sequência, logo depois do
   card materializar (--d é o índice, lido do atributo style no HTML). Só
   toca com `body.login-ready` (ver `.login-card` acima) — mesmo motivo: não
   depender de timing de carregamento, e nunca ficar com opacity:0 preso se o
   JS não rodar por algum motivo (resting state já é opacity:1 aqui).
   `.login-reveal-l`/`.login-reveal-r` alternam o lado de onde cada bloco
   entra (esquerda/direita, não só de baixo pra cima) — marcado direto no
   HTML, elemento por elemento, pra não depender de aritmética de CSS. Cada
   uma tem seu próprio leve overshoot (mola), igual ao card. */
.login-reveal {
  opacity: 1;
}

/* Mesma lógica do card: 2 estados só (0%/100%), curva "back ease out" cuida
   do overshoot sozinha — contínuo, sem estágios manuais no meio. */
body.login-ready .login-reveal-l {
  animation: loginRevealLeft 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation-delay: calc(0.28s + (var(--d, 0) * 0.08s));
  animation-fill-mode: backwards;
}

body.login-ready .login-reveal-r {
  animation: loginRevealRight 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation-delay: calc(0.28s + (var(--d, 0) * 0.08s));
  animation-fill-mode: backwards;
}

@keyframes loginRevealLeft {
  0% { opacity: 0; transform: translateX(-24px) scale(0.95); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes loginRevealRight {
  0% { opacity: 0; transform: translateX(24px) scale(0.95); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

/* `.login-reveal-box`: igual a `.login-reveal-l`/`-r`, mas pros elementos que
   são mesmo "caixas" (campos de texto, botão) — nascem como uma bolinha
   (border-radius:50%, bem pequena) e crescem até a forma final (14px, o
   raio de canto real desses elementos). Precisa de mais especificidade que
   `.login-reveal-l`/`-r` sozinhas pra vencer (mesma classe de direção +
   `-box` junto no HTML). */
/* Mesmo truque do card: posição/escala numa curva, border-radius noutra
   (bem mais lenta no começo) — fica bolinha por mais tempo antes de virar
   caixa, em vez de desarredondar junto com o movimento. */
body.login-ready .login-reveal-box.login-reveal-l {
  animation:
    loginBoxMorphLeft 0.5s cubic-bezier(0.22, 1, 0.36, 1) calc(0.28s + (var(--d, 0) * 0.08s)) backwards,
    loginBoxRound 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) calc(0.28s + (var(--d, 0) * 0.08s)) backwards;
}

body.login-ready .login-reveal-box.login-reveal-r {
  animation:
    loginBoxMorphRight 0.5s cubic-bezier(0.22, 1, 0.36, 1) calc(0.28s + (var(--d, 0) * 0.08s)) backwards,
    loginBoxRound 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) calc(0.28s + (var(--d, 0) * 0.08s)) backwards;
}

/* Campo de texto é bem mais largo que alto — em escala cheia, 50% de raio
   vira uma elipse achatada, não bola. Mesma correção do card: fica pequeno
   (bolinha de verdade) até 65%, só então "explode" pro tamanho/formato
   final — por isso o scale e o translateX só mudam de verdade depois dos
   65%, igual o border-radius (`loginBoxRound`, abaixo). */
@keyframes loginBoxMorphLeft {
  0% { opacity: 0; transform: translateX(-20px) scale(0.16); }
  65% { opacity: 1; transform: translateX(-4px) scale(0.16); }
  100% { transform: translateX(0) scale(1); }
}

@keyframes loginBoxMorphRight {
  0% { opacity: 0; transform: translateX(20px) scale(0.16); }
  65% { opacity: 1; transform: translateX(4px) scale(0.16); }
  100% { transform: translateX(0) scale(1); }
}

@keyframes loginBoxRound {
  0% { border-radius: 50%; }
  65% { border-radius: 50%; }
  100% { border-radius: 14px; }
}

/* Botão de mostrar/ocultar senha: não é uma "caixa de texto", só some/
   aparece junto, um pouco depois do campo de senha já estar crescendo. */
.login-reveal-fade {
  opacity: 1;
}

body.login-ready .login-reveal-fade {
  animation: loginFadeIn 0.4s ease-out;
  animation-delay: calc(0.42s + (var(--d, 0) * 0.08s));
  animation-fill-mode: backwards;
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: scale(0.7); }
}

/* `.brand h1` e `.refresh-status.error` já são compartilhados com a barra
   lateral/outras telas de fundo escuro (texto claro por padrão) — o card do
   login voltou a ser escuro (29/10/2026 v3), então as regras originais já
   servem sem override nenhum aqui (tinham sido sobrescritas numa versão
   anterior em que o card era claro). */

.login-copy h2,
.login-copy p {
  margin: 0;
}

.login-form {
  display: grid;
  gap: 12px;
}

/* Bloco de identidade confirmada pelo Google (foto + nome + e-mail), no
   painel "Complete seu cadastro" (21/10/2026). O e-mail não é editável aqui
   de propósito -- é o que veio verificado do Google; o nome continua como
   campo de texto normal, só pré-preenchido, pra poder corrigir formatação. */
.login-google-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-google-identity-photo {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--bg-soft);
  border: 1px solid var(--border-default);
}

.login-google-identity-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.login-google-identity-copy #googleCompleteEmail {
  font-size: 0.86rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-card .text-input {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.login-card .text-input:focus-visible,
.login-card .text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.login-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.login-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.google-logo-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.login-button-check {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.login-button-check path {
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
}

.login-button.is-success .login-button-label {
  opacity: 0;
}

.login-button.is-success .login-button-check {
  opacity: 1;
  transform: scale(1);
}

.login-button.is-success .login-button-check path {
  animation: loginCheckDraw 0.4s 0.05s ease forwards;
}

@keyframes loginCheckDraw {
  to { stroke-dashoffset: 0; }
}

.password-toggle {
  overflow: hidden;
}

/* `.password-toggle .eye-icon` (não só `.eye-icon`) de propósito: a regra
   antiga `.password-toggle svg { margin: 0 auto; }` (mais acima no arquivo)
   tem mais especificidade que `.eye-icon` sozinha e zerava a margem vertical
   — o ícone ficava colado no topo do botão em vez de centralizado. */
.password-toggle .eye-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.eye-icon-hidden {
  opacity: 0;
  transform: scale(0.6) rotate(-12deg);
}

.password-toggle[aria-pressed="true"] .eye-icon-shown {
  opacity: 0;
  transform: scale(0.6) rotate(12deg);
}

.password-toggle[aria-pressed="true"] .eye-icon-hidden {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.login-helper-link {
  color: #0f2a44;
  font-size: 0.92rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(15, 42, 68, 0.18);
  transition: border-color 0.18s ease;
  white-space: nowrap;
}

.login-helper-link:hover {
  border-bottom-color: rgba(15, 42, 68, 0.52);
}

/* Alternância login/cadastro (16/10/2026) — duas seções na mesma página,
   alternadas via JS com startViewTransition (mesmo padrão já usado no
   dashboard em setDashboardManagerEditingAndRender, CSS global acima em
   ::view-transition-old/new(root)). */
.auth-panel[hidden] {
  display: none;
}

.login-link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(15, 42, 68, 0.3);
  cursor: pointer;
}

.login-link-button:hover {
  text-decoration-color: rgba(15, 42, 68, 0.6);
}

.login-helper-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

/* Card escuro (29/10/2026 v3): essas classes têm cor própria hardcoded/var
   pensada pra card claro — sobrescreve só dentro do card, pro resto do app
   (onde `.eyebrow` etc. também aparecem) continuar igual. */
.login-card .eyebrow {
  color: rgba(243, 248, 252, 0.6);
}

.login-card .login-helper-link {
  color: #F3F8FC;
  border-bottom-color: rgba(243, 248, 252, 0.32);
}

.login-card .login-helper-link:hover {
  border-bottom-color: rgba(243, 248, 252, 0.65);
}

.login-card .login-link-button {
  color: #F3F8FC;
  text-decoration-color: rgba(243, 248, 252, 0.4);
}

.login-card .login-link-button:hover {
  text-decoration-color: rgba(243, 248, 252, 0.75);
}

.login-card .login-helper-hint {
  color: rgba(243, 248, 252, 0.72);
}

.google-placeholder {
  opacity: 0.55;
  cursor: not-allowed;
}

.badge-soon {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 6px;
  font-weight: 500;
}

@media (max-width: 640px) {
  .login-shell {
    padding: 16px;
  }

  .login-card {
    padding: 22px 18px;
    border-radius: 22px;
  }

  /* Pouco espaço sobrando ao redor do card num telão pequeno — os chips
     brigam com o card em vez de ficar "ao redor" dele. */
  .login-bg-chip-pos {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Pedido explícito do dono: a entrada do card/campos deve tocar sempre,
     mesmo com "reduzir movimento" ligado no sistema — por isso ela NÃO está
     nesta lista (diferente da maioria dos componentes do app). Mantemos
     suprimidos só os movimentos contínuos/sem fim (auroras, fita de cor) e o
     tremor de erro, que são os casos clássicos de desconforto vestibular. */
  .login-button-check path {
    animation: none;
    opacity: 1;
    transform: none;
  }

  /* `!important`: `body.login-ready .login-card` tem mais especificidade que
     `.login-card.is-shake` sozinha e venceria mesmo dentro desta media query. */
  .login-card.is-shake {
    animation: none !important;
  }

  .login-bg-chip {
    animation: none;
    opacity: 1;
  }

  .login-bg-chip-dot-live {
    animation: none;
  }

  /* A fita de cor "desenhando" é a mesma lógica do pedido do dono (entrada
     sempre toca) — só o looping infinito do gradiente depois é que some. */
  body.login-ready .login-card-accent {
    animation: loginAccentDraw 0.5s 1.08s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  }

  /* A chispa é passeio/decoração pura (sem propósito funcional, só dança) —
     some, igual o brilho diagonal; a fita ainda aparece, só que sem a
     "viagem" antes. */
  .login-card-spark {
    animation: none;
    opacity: 0;
  }

  /* O brilho diagonal (::after) é movimento puro sem propósito funcional —
     some, mas o resto da entrada (card, cascata, fita) continua tocando.
     `!important`: `body.login-ready .login-card::after` (mais acima) tem mais
     especificidade e venceria mesmo dentro desta media query. */
  .login-card::after {
    animation: none !important;
  }
}

.finance-card {
  background:
    radial-gradient(circle at top right, rgba(77, 163, 255, 0.12), transparent 35%),
    linear-gradient(135deg, rgba(241, 162, 8, 0.08), rgba(77, 163, 255, 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;
}

.billing-screen .card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.billing-screen .card-heading h3 {
  margin: 0;
}

.billing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .billing-layout {
    grid-template-columns: 1fr;
  }
}

.billing-eyebrow {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.billing-hero-number {
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  margin-top: 2px;
}

.billing-hero-number.is-payg {
  color: var(--warning-accessible-text);
}

.billing-hero-unit {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  margin-left: 6px;
}

.billing-meter {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  overflow: hidden;
  margin: 14px 0 8px;
}

.billing-meter-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.billing-meter-fill.is-full {
  background: var(--warning);
}

.billing-hero-subrow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.billing-channel-split {
  display: flex;
  gap: 18px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.billing-channel-split span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.billing-channel-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  background: var(--primary);
}

.billing-channel-dot.is-whatsapp {
  background: var(--accent-cyan);
}

.billing-channel-dot.is-boletim {
  background: var(--accent-amber, #f0b429);
}

/* Etiqueta do cliente ativo: peça do celular. O JS tira o `hidden` dela sempre
   que a conta é global, sem olhar a largura da tela, então quem decide que ela
   não existe no computador é o CSS — lá o seletor da gaveta já diz onde a pessoa
   está. O mobile.css (dentro de @media max-width: 700px) a acende de novo. */
.mobile-client-flag {
  display: none;
}

.billing-hero-card h4 {
  margin: 18px 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.billing-chart-svg {
  width: 100%;
  height: 96px;
  display: block;
  overflow: visible;
}

.billing-chart-bar {
  fill: var(--primary);
}

.billing-chart-bar.is-empty {
  fill: var(--line);
}

.billing-chart-baseline {
  stroke: var(--line);
  stroke-width: 1;
}

.billing-chart-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
}

.billing-limit-card {
  border-color: var(--line);
}

.billing-limit-card.is-active {
  border-color: var(--warning);
  background: var(--warning-soft);
}

.billing-limit-detail {
  margin: 6px 0 0;
  font-size: 0.86rem;
  color: var(--text);
}

.billing-limit-card.is-inactive .empty-state {
  border: none;
  padding: 8px 0 0;
  text-align: left;
  justify-items: start;
}

.billing-increase-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.billing-increase-form .groupprice-input {
  width: 160px;
}

/* Limites de IA (Financeiro): dois campos que o gerente do cliente ou a conta
   global editam. Empilhados no celular, lado a lado quando cabe. */
.billing-limits-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.billing-limits-field {
  display: grid;
  gap: 6px;
}

.billing-limits-field > span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.billing-limits-field em {
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
}

.billing-limits-field .groupprice-input {
  width: 100%;
  /* 16px evita o zoom automático do Safari/iOS ao focar o campo. */
  font-size: 16px;
}

.billing-limits-save {
  margin-top: 12px;
  width: 100%;
}

.billing-limits-preview {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
}

.billing-limits-hint,
.billing-limits-author,
.billing-client-note {
  margin: 8px 0 0;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.35;
}

.billing-limits-readonly {
  margin: 10px 0 0;
  font-size: 0.86rem;
  color: var(--text);
}

/* Quadro de todos os clientes — só a conta global recebe este bloco. */
.billing-clients-rows {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.billing-client-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-elevated);
}

.billing-client-row.is-over {
  border-color: var(--warning);
  background: var(--warning-soft);
}

.billing-client-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  justify-content: space-between;
}

.billing-client-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.billing-client-usage {
  font-size: 0.76rem;
  color: var(--muted);
}

.billing-client-fields {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  grid-template-columns: 1fr 1fr;
  align-items: end;
}

.billing-client-fields label {
  display: grid;
  gap: 4px;
}

.billing-client-fields label > span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.billing-client-fields .groupprice-input {
  width: 100%;
  font-size: 16px;
}

.billing-client-fields .ghost-button {
  grid-column: 1 / -1;
  width: 100%;
}

.billing-secondary-cards {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

/* Cartões fechados por padrão (<details>, nunca com [open] no HTML) — clique no
   cabeçalho abre/fecha, seta gira pra indicar o estado. */
.billing-collapsible summary {
  cursor: pointer;
  list-style: none;
  margin-bottom: 0;
}

.billing-collapsible summary::-webkit-details-marker {
  display: none;
}

.billing-collapsible-chevron {
  flex: 0 0 auto;
  display: inline-flex;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.billing-collapsible[open] .billing-collapsible-chevron {
  transform: rotate(90deg);
}

.billing-collapsible[open] summary {
  margin-bottom: 14px;
}

.billing-per-user-hint {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.billing-settings-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ai-model-card {
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--primary) 8%, transparent), transparent 160px);
  background-color: var(--surface);
  border-color: color-mix(in srgb, var(--primary) 28%, var(--line));
}

.ai-model-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 2px;
}

.ai-model-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.ai-model-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 12px 18px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  cursor: pointer;
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.ai-model-option:hover {
  transform: translateY(-3px);
  border-color: var(--vendor-accent, var(--primary));
  box-shadow: 0 12px 24px -14px color-mix(in srgb, var(--vendor-accent, var(--primary)) 55%, transparent);
}

.ai-model-option:active {
  transform: translateY(-1px) scale(0.98);
}

.ai-model-option.is-selected {
  border-color: var(--vendor-accent, var(--primary));
  background: color-mix(in srgb, var(--vendor-accent, var(--primary)) 9%, var(--surface-soft));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--vendor-accent, var(--primary)) 24%, transparent);
}

.ai-model-option-logo-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18), inset 0 0 0 1px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  transition: transform 0.18s ease;
  flex: 0 0 auto;
}

.ai-model-option:hover .ai-model-option-logo-wrap {
  transform: scale(1.07);
}

.ai-model-option-logo-wrap--default {
  background: color-mix(in srgb, var(--primary) 16%, var(--bg-elevated));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 32%, transparent);
}

.ai-model-option-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.ai-model-option-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.ai-model-option-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.ai-model-option-sub {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: -4px;
}

.ai-model-cost-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 2px 7px;
  border-radius: 999px;
}

.ai-model-cost-badge.is-baixo {
  background: color-mix(in srgb, var(--success) 20%, transparent);
  color: var(--success);
}

.ai-model-cost-badge.is-medio {
  background: color-mix(in srgb, var(--warning) 22%, transparent);
  color: var(--warning);
}

.ai-model-cost-badge.is-alto {
  background: color-mix(in srgb, var(--danger) 20%, transparent);
  color: var(--danger);
}

.ai-model-option-check {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--vendor-accent, var(--primary));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.3);
}

.billing-collapsible-card {
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.billing-collapsible-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% + 0px);
  background: none;
  border: none;
  cursor: pointer;
  padding: 20px 0;
  margin: 0;
  text-align: left;
  color: inherit;
  font: inherit;
}

.billing-collapsible-toggle h3 {
  margin: 0;
}

.billing-settings-chevron {
  font-size: 1.1rem;
  color: var(--muted);
  transition: transform 0.18s ease;
  flex: 0 0 auto;
}

.billing-collapsible-toggle[aria-expanded="true"] .billing-settings-chevron {
  transform: rotate(90deg);
}

.billing-collapsible-content {
  padding-bottom: 20px;
}

.billing-recipient-list {
  display: grid;
  gap: 4px;
}

.billing-recipient-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.billing-recipient-row:last-child {
  border-bottom: none;
}

.billing-recipient-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.billing-recipient-name {
  flex: 0 1 auto;
  color: var(--text);
  font-weight: 600;
  font-size: 0.86rem;
}

.billing-recipient-email {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.82rem;
}

.billing-unlimited-badge {
  color: var(--success-accessible-text, var(--success));
  font-weight: 600;
}

.billing-recent-rows {
  display: grid;
}

.billing-recent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
}

.billing-recent-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.billing-recent-when {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.billing-recent-meta {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.billing-recent-tokens {
  min-width: 56px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.billing-channel-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
}

.billing-channel-badge.is-whatsapp {
  background: var(--success-soft);
  color: var(--success-accessible-text, var(--success));
}

/* Financeiro — visualização "Custo por Equipamento": 4 cartões de estatística,
   um gráfico de barras por categoria, busca e uma grade responsiva de grupos
   (2-3 colunas conforme o espaço) — nunca uma coluna única esticada. */
.billing-cost-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.billing-cost-stat {
  min-width: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
  padding: 14px 16px;
  display: grid;
  gap: 6px;
  border-left: 3px solid var(--line-strong);
}

.billing-cost-stat.is-primary {
  border-left-color: var(--primary);
}

.billing-cost-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.billing-cost-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -0.01em;
}

.billing-cost-stat.is-primary .billing-cost-stat-value {
  color: var(--primary);
}

.billing-cost-chart-card {
  margin-bottom: 16px;
}

.billing-cost-bar-list {
  display: grid;
  gap: 12px;
}

.billing-cost-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.billing-cost-bar-label {
  min-width: 0;
  overflow-wrap: break-word;
  font-size: 0.84rem;
  color: var(--text);
}

.billing-cost-bar-track {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 68%, transparent);
  overflow: hidden;
}

.billing-cost-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.4s ease;
}

.billing-cost-bar-value {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

@media (max-width: 640px) {
  .billing-cost-bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .billing-cost-bar-value {
    text-align: right;
  }
}

.billing-cost-groups-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.billing-cost-groups-head h3 {
  margin: 0;
}

.billing-cost-search {
  min-width: 220px;
  flex: 0 1 280px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
}

.billing-equipment-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  align-items: start;
}

.billing-equipment-group {
  min-width: 0;
}

.billing-equipment-group summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  padding: 2px 0;
}

.billing-equipment-group summary::-webkit-details-marker {
  display: none;
}

.billing-equipment-group-label {
  min-width: 0;
  overflow-wrap: break-word;
  font-weight: 700;
  color: var(--text);
}

.billing-equipment-group-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.billing-equipment-group-bar {
  display: block;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 68%, transparent);
  overflow: hidden;
  margin-top: 8px;
}

.billing-equipment-group-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.billing-equipment-group[open] summary {
  margin-bottom: 10px;
}

.billing-equipment-rows {
  display: grid;
}

.billing-equipment-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
  color: var(--text);
}

.billing-equipment-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.billing-equipment-row-tag {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.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(238, 244, 251, 0.94));
  border: 1px solid rgba(77, 163, 255, 0.14);
  box-shadow: 0 16px 36px rgba(15, 42, 68, 0.08);
  color: #0f2a44;
  font-size: 0.92rem;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(15, 42, 68, 0.12);
  border-top-color: #4DA3FF;
  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(77, 163, 255, 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(31, 90, 139, 0.94) !important;
    border: 1px solid rgba(207, 229, 255, 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(31, 90, 139, 0.92) !important;
    border: 1px solid rgba(207, 229, 255, 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(5, 16, 28, 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: #0f2a44;
  }

  .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;
  }

  .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;
  }

  /* O card "Monitoramento de equipamentos" (08/10/2026) é a exceção: a tabela
     dele é sempre larga (6 colunas fixas) e já tem o próprio mecanismo de
     rolagem lateral (.equipment-monitor-table-shell, overflow:auto) -- sem
     este override mais específico, a regra genérica acima força min-width:100%
     e espreme as colunas até o texto do cabeçalho quebrar letra por letra. */
  .equipment-monitor-table {
    width: auto !important;
    max-width: none !important;
    min-width: 720px !important;
  }

  /* Sem pista visual, uma tabela que rola pro lado (.has-horizontal-scroll,
     aplicada via JS quando a tabela é mais larga que o card) parecia
     simplesmente ter perdido colunas no celular — dava pra arrastar, mas
     nada avisava (auditoria mobile de 25/09/2026). */
  .table-wrapper {
    position: relative;
  }
  .table-wrapper:has(.table-scroll.has-horizontal-scroll)::after {
    content: "◄ arraste para o lado ►";
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 3px 12px;
    border-radius: 999px;
    background: var(--bg-surface-translucent);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    box-shadow: 0 2px 8px var(--shadow-color-soft);
    pointer-events: none;
    z-index: 2;
  }
}

@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;
  }

  /* Mesma exceção do breakpoint retrato logo acima -- ver comentário lá. */
  .equipment-monitor-table {
    min-width: 720px !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(31, 90, 139, 0.94) !important;
    border: 1px solid rgba(207, 229, 255, 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(31, 90, 139, 0.92) !important;
    border: 1px solid rgba(207, 229, 255, 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(234, 243, 255, 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(234, 243, 255, 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;
  }
}


/* Excluir vive no rodapé do editor, à esquerda de "Salvar alterações". */
.editor-footer .editor-actions {
  justify-content: flex-end;
}

.editor-footer .editor-delete-button {
  margin-right: auto;
}

/* O botão é escondido pelo atributo hidden (criação de registro, seleção sem
   permissão de excluir), e o display declarado nas regras do rodapé ganhava
   dele - o "Excluir" aparecia na tela de criação, onde não há o que excluir. */
.editor-delete-button[hidden] {
  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: #425160;
  cursor: text;
}

.editor-input[readonly]:focus,
.editor-textarea[readonly]:focus {
  border-color: rgba(77, 163, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 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(7, 18, 31, 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 {
  /* A reserva vertical era 178px e sobrava um vão grande abaixo do cartão: o
     topo da tela fica em ~96px e o painel principal só precisa dos 26px de
     respiro embaixo. 140px mantém uma folga para o cabeçalho crescer (busca
     unificada, quebra de linha em telas estreitas) sem criar barra de rolagem. */
  height: calc(100vh - 140px);
  max-height: calc(100vh - 140px);
  min-height: calc(100vh - 140px);
  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);
}

/* A árvore de pontos e a configuração do histórico esticam até o fim do
   cartão. O teto de 560px vinha de .history-builder-tree/-staging e deixava
   uma faixa vazia embaixo em telas grandes; aqui a altura já é definida pelo
   próprio cartão, que é de altura fixa. */
.history-screen.history-screen--picker-only .history-builder-tree,
.history-screen.history-screen--picker-only .history-builder-staging {
  max-height: none;
  height: 100%;
}

.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(244, 249, 255, 0.94));
  border: 1px solid rgba(15, 42, 68, 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: #0f2a44;
}

.history-meta {
  margin: 8px 0 0;
  color: rgba(15, 42, 68, 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(15, 42, 68, 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(15, 42, 68, 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: #0f2a44;
}

.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(77, 163, 255, 0.1);
  color: #1f5a8b;
  border: 1px solid rgba(77, 163, 255, 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(248, 251, 255, 0.92);
  border: 1px solid rgba(15, 42, 68, 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(15, 42, 68, 0.72);
  font-size: 12px;
}

.history-grid-line {
  stroke: rgba(15, 42, 68, 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: #1f5a8b;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-line-path.is-step {
  stroke: var(--series-color, #1F5A8B);
}

.history-range-band {
  fill: rgba(77, 163, 255, 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(77, 163, 255, 0.12), rgba(255, 255, 255, 0.94));
  border: 1px solid rgba(77, 163, 255, 0.16);
}

.point-history-access-copy {
  display: grid;
  gap: 4px;
}

.point-history-access-copy strong {
  color: #0f2a44;
}

.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, #4da3ff);
  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;
}

.equipment-monitor-mini-popover-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 2px;
}

.equipment-monitor-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;
}

.equipment-monitor-mini-history-access-button svg {
  width: 14px;
  height: 14px;
  display: block;
  flex: 0 0 auto;
}

.equipment-monitor-mini-history-access-button:hover {
  background: color-mix(in srgb, rgba(77, 163, 255, 0.14) 72%, var(--surface-strong));
  border-color: color-mix(in srgb, rgba(77, 163, 255, 0.34) 78%, var(--line));
  color: color-mix(in srgb, #1f5a8b 78%, var(--text));
}

.equipment-monitor-mini-history-access-button:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, rgba(77, 163, 255, 0.42) 80%, var(--line));
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.16);
  color: color-mix(in srgb, #1f5a8b 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(244, 249, 255, 0.96));
  border: 1px solid rgba(15, 42, 68, 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: #0f2a44;
}

.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(15, 42, 68, 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(77, 163, 255, 0.1);
  border: 1px solid rgba(77, 163, 255, 0.14);
  color: #1f5a8b;
}

/* 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(248, 251, 255, 0.94);
  border: 1px solid rgba(15, 42, 68, 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(15, 42, 68, 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(31, 90, 139, 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, #1F5A8B);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--series-color, #1F5A8B) 16%, transparent);
  flex: 0 0 auto;
}

.history-legend-label {
  color: #0f2a44;
  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(15, 42, 68, 0.68);
  font-size: 0.95rem;
  line-height: 1;
  flex: 0 0 auto;
}

.history-legend-item.is-muted .history-legend-visibility {
  color: rgba(15, 42, 68, 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(15, 42, 68, 0.1);
  background: rgba(255, 255, 255, 0.82);
  color: #23415f;
  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(43, 124, 191, 0.32));
  background: var(--band-fill, rgba(43, 124, 191, 0.14));
  flex: 0 0 auto;
}

.history-chart-hitbox {
  cursor: crosshair;
}

.history-axis-labels text {
  fill: rgba(15, 42, 68, 0.72);
  font-size: 12px;
}

.history-grid-line {
  stroke: rgba(15, 42, 68, 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, #1F5A8B);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-hover-line {
  stroke: rgba(15, 42, 68, 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(248, 251, 255, 0.76);
  backdrop-filter: blur(5px);
  color: #1f5a8b;
  font-weight: 700;
}

.history-loading-spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(31, 90, 139, 0.18);
  border-top-color: #1f5a8b;
  animation: spin 0.8s linear infinite;
}

.history-compact-stats {
  display: grid;
  gap: 8px;
}

.history-series-disclosure {
  border-top: 1px solid rgba(15, 42, 68, 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(15, 42, 68, 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(15, 42, 68, 0.78);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}

.history-series-visibility-button.is-off {
  color: rgba(15, 42, 68, 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;
}

/* Sem isto, o botão herdava a cor fixa rgba(15,42,68,...) (azul-marinho) pensada
   pro fundo claro, que no tema escuro fica quase idêntica ao fundo do card
   (--bg-surface: #102230) — o botão ficava visualmente invisível (mas ainda
   clicável, só sem contraste) ao ocultar/exibir uma série no Histórico. */
:root[data-theme="dark"] .history-screen .history-series-visibility-button {
  color: var(--text-primary) !important;
}

:root[data-theme="dark"] .history-screen .history-series-visibility-button.is-off {
  color: var(--text-secondary) !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: #0f2a44;
  font-weight: 700;
  font-size: 0.92rem;
}

.history-compact-stat-values {
  color: rgba(15, 42, 68, 0.74);
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}

.history-compact-stat-values.is-subtle {
  color: rgba(15, 42, 68, 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: #0f2a44;
}

.history-section-order {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(31, 90, 139, 0.1);
  color: #1f5a8b;
  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(5, 16, 28, 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: #0f2a44;
}

.history-selector-copy p {
  color: rgba(15, 42, 68, 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(15, 42, 68, 0.14);
  background: rgba(255, 255, 255, 0.96);
  color: #0f2a44;
  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(15, 42, 68, 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(15, 42, 68, 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(15, 42, 68, 0.66);
}

.history-space-option {
  appearance: none;
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15, 42, 68, 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: #0f2a44;
}

.history-space-option span {
  color: rgba(15, 42, 68, 0.68);
  font-size: 0.92rem;
}

.history-space-option:hover,
.history-space-option:focus-visible,
.history-space-option.is-active {
  border-color: rgba(31, 90, 139, 0.28);
  background: rgba(240, 247, 255, 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(15, 42, 68, 0.08);
  color: rgba(15, 42, 68, 0.76);
  line-height: 1.25;
  overflow: visible;
  word-break: break-word;
  font-size: 0.9rem;
}

.history-summary-chip strong {
  color: #0f2a44;
  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: #0f2a44;
}

.point-history-picker-banner-copy span {
  color: rgba(15, 42, 68, 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(15, 42, 68, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: #0f2a44;
}

.point-history-access-card.is-picker {
  background: linear-gradient(135deg, rgba(15, 42, 68, 0.08), rgba(77, 163, 255, 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(77, 163, 255, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(245, 248, 252, 0.94), rgba(235, 241, 247, 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(15, 42, 68, 0.1);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 18px 46px rgba(15, 42, 68, 0.08);
}

.history-report-kicker {
  margin: 0 0 6px;
  color: #5f7183;
  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: #0f2a44;
}

.history-report-identification {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 14px;
  margin-top: 18px;
  color: #314a63;
  font-size: 0.94rem;
}

.history-report-section {
  display: grid;
  gap: 18px;
}

.history-report-section-head p {
  margin: 6px 0 0;
  color: #5f7183;
}

.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(15, 42, 68, 0.09);
  background: rgba(248, 251, 254, 0.98);
  padding: 18px;
}

.history-report-kpi-card {
  display: grid;
  gap: 8px;
}

.history-report-kpi-card span,
.history-report-kpi-card small {
  color: #5f7183;
}

.history-report-kpi-card strong {
  color: #0f2a44;
  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, #1f5a8b 0%, #3b82f6 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: #5f7183;
  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(15, 42, 68, 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: #4f6478;
  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: #314a63;
  font-size: 0.88rem;
}

.history-report-chart-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--report-series-color, #1f5a8b);
  display: inline-block;
}

.history-report-chart-svg {
  width: 100%;
  display: block;
}

.history-report-grid-line {
  stroke: rgba(15, 42, 68, 0.08);
  stroke-width: 1;
}

.history-report-axis-label {
  fill: #5f7183;
  font-size: 11px;
}

.history-report-series-line {
  fill: none;
  stroke: var(--report-series-color, #1f5a8b);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-report-chart-empty {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(15, 42, 68, 0.15);
  color: #5f7183;
  text-align: center;
}

.history-report-insights {
  margin: 0;
  padding: 18px 20px;
  border-left: 4px solid #1f5a8b;
  border-radius: 18px;
  background: rgba(232, 242, 250, 0.95);
  color: #17324e;
  line-height: 1.65;
}

.history-report-footer {
  gap: 6px;
  color: #5f7183;
  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(77, 163, 255, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(245, 248, 252, 0.96), rgba(236, 242, 248, 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(15, 42, 68, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 40px rgba(15, 42, 68, 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: #0f2a44;
}

.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: #5f7183;
}

.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(15, 42, 68, 0.08);
  background: linear-gradient(180deg, rgba(250, 252, 255, 0.98), rgba(244, 248, 252, 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(31, 90, 139, 0.08);
  color: #1f5a8b;
  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(15, 42, 68, 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(31, 90, 139, 0.24);
  box-shadow: 0 10px 24px rgba(15, 42, 68, 0.08);
  background: rgba(255, 255, 255, 0.98);
  transform: translateY(-1px);
  outline: none;
}

.history-compare-series-row.is-selected {
  border-color: rgba(31, 90, 139, 0.3);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.98), rgba(247, 251, 255, 0.98));
  box-shadow: 0 14px 28px rgba(31, 90, 139, 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: #28507b;
  background: rgba(31, 90, 139, 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: #5f7183;
  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(15, 42, 68, 0.06);
  color: #24445f;
  font-size: 0.78rem;
  font-weight: 600;
}

.history-compare-chart-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(15, 42, 68, 0.08);
  background: rgba(248, 251, 254, 0.98);
}

.history-compare-chart-shell {
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(15, 42, 68, 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(15, 42, 68, 0.08);
  background: rgba(255, 255, 255, 0.94);
}

.history-compare-series-card strong {
  color: #0f2a44;
}

.history-compare-series-card span,
.history-compare-series-card small {
  color: #5f7183;
}

.history-compare-inline-state,
.history-compare-empty {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(15, 42, 68, 0.15);
  background: rgba(255, 255, 255, 0.88);
  color: #21405c;
}

.history-compare-inline-state strong,
.history-compare-empty strong {
  color: #0f2a44;
}

.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(31, 90, 139, 0.14), transparent 24%),
    linear-gradient(180deg, #eef4f8 0%, #f7fafc 42%, #edf2f7 100%);
  color: #16324f;
  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(148, 163, 184, 0.24);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 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: #526277;
  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(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

.report-status-card strong {
  font-size: 15px;
}

.report-status-card span {
  color: #526277;
  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: #d6dde6;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 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(236, 239, 243, 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: #0f2a44;
  font-size: 1rem;
}

.report-global-loading-head p {
  margin: 6px 0 0;
  color: rgba(15, 42, 68, 0.72);
  font-size: 0.92rem;
  line-height: 1.45;
}

.report-global-loading-percent {
  flex: 0 0 auto;
  color: #1f5a8b;
  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: #d8e0e8;
  box-shadow: inset 0 0 0 1px rgba(31, 90, 139, 0.08);
}

.report-global-loading-progress-bar {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #4da3ff;
}

.report-global-loading-copy {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #0f2a44;
  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: #0f2a44;
  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: #314a63;
  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(15, 42, 68, 0.09);
  background: rgba(248, 251, 254, 0.98);
  box-shadow: none;
}

.history-report-section .report-metric-card strong {
  color: #0f2a44;
  font-size: 1.7rem;
}

.history-report-section .report-metric-card span,
.history-report-section .report-metric-card small {
  color: #5f7183;
}

.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: #eceff3;
  -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 #d9dfe6;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 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(196, 208, 222, 0.9);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(46, 111, 163, 0.08), rgba(255, 255, 255, 0) 40%),
    linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
  box-shadow: 0 10px 22px rgba(16, 35, 52, 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: #233647;
}

.report-pdf-brand-aacd {
  width: 54px;
  height: auto;
  display: block;
}

.report-pdf-title-stack {
  text-align: center;
  color: #233647;
}

.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(15, 42, 68, 0.05);
  border: 1px solid #e7edf4;
  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%, #f8fbfe 100%);
  border: 1px solid #e4ebf3;
  box-shadow: 0 12px 28px rgba(15, 42, 68, 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, #fbfdff 0%, #f6f9fc 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: #405467;
}

.report-period-copy strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: #1f3447;
  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: #eef4fb;
  color: #2d5f9a;
}

.report-icon-chip.is-info {
  background: #eaf2ff;
  color: #2157b6;
}

.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 #dde6ef;
  border-left: 4px solid #ef7d32;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 8px 18px rgba(15, 42, 68, 0.04);
}

.report-pdf-section-title,
.report-inline-title {
  margin: 0;
  color: #2f4355;
  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: #1f2937;
  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: #405467;
  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: #eef3f8;
  color: #314a63;
  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: #1f2937;
  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: #536579;
  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 #e6edf5;
  color: #536579;
  font-size: 11px;
  line-height: 1.45;
  min-width: 0;
}

.report-pdf-index-composition span:last-child {
  overflow-wrap: anywhere;
}

.report-icon-inline {
  color: #4d6072;
}

.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 #e4e9f0;
  background: #fff;
}

.report-reference-page .report-metric-card span,
.report-reference-page .report-metric-card small {
  font-size: 10px;
  color: #6c7c8d;
}

.report-reference-page .report-metric-card strong {
  font-size: 30px;
  color: #26384a;
}

.report-reference-page .history-report-section-head h4,
.report-pdf-chart-head h4 {
  font-size: 13px;
  color: #2f4355;
}

.report-reference-page .history-report-section-head p,
.report-pdf-chart-head p {
  margin: 4px 0 0;
  font-size: 10px;
  color: #6c7c8d;
}

.report-reference-page .history-report-table-card,
.report-reference-page .history-report-chart-card {
  border-radius: 4px;
  padding: 10px;
  background: #fff;
  border: 1px solid #e4e9f0;
  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: #6c7c8d;
  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: #4d6072;
  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: #2f4355;
  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: #6c7c8d;
  font-size: 10px;
}

.report-summary-columns strong {
  display: block;
  margin-top: 2px;
  color: #26384a;
  font-size: 16px;
}

.report-summary-grid p,
.report-summary-footnote,
.report-technical-block p {
  margin: 6px 0 0;
  color: #536579;
  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 #e4ebf3;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.report-executive-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  color: #27548d;
  background: linear-gradient(180deg, #f1f7ff 0%, #e8f2ff 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: #55697c;
  line-height: 1.4;
}

.report-executive-card-copy strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  color: #163047;
  line-height: 1.15;
}

.report-executive-card-copy small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: #6c7c8d;
}

.report-top-summary > .report-diagnosis-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  background: linear-gradient(180deg, #f4f8ff 0%, #eef4ff 100%);
  border-color: #dbe7fb;
  border-radius: 16px;
  padding: 14px 16px;
}

.report-diagnosis-copy p {
  margin: 4px 0 0;
  color: #45596d;
  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 #dfebf8;
  background: linear-gradient(180deg, #fbfdff 0%, #f5f9fd 100%);
  color: #516577;
  font-size: 11px;
  line-height: 1.45;
}

.report-top-summary > .report-period-banner {
  padding: 12px 14px;
  border: 1px solid #e6edf5;
  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(31, 90, 139, 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: #405261;
}

.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, #16324f 0%, #1f5a8b 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(148, 163, 184, 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(31, 90, 139, 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(226, 232, 240, 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(203, 213, 225, 0.68);
  background: linear-gradient(180deg, #f8fbfd 0%, #ffffff 100%);
}

.report-metric-card span,
.report-metric-card small {
  color: #5b6f84;
}

.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: #6c7c8d;
  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 #e5edf5;
  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 #e5edf5;
  text-align: left;
  vertical-align: top;
}

.report-table thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5b6f84;
}

.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(31, 90, 139, 0.08);
}

.report-copy-block {
  display: grid;
  gap: 10px;
  color: #405261;
  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: #405261;
  line-height: 1.7;
}

.report-occurrences-disclosure {
  display: grid;
  gap: 14px;
}

.report-occurrences-disclosure summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: #17324d;
}

.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: #1f5a8b;
  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: #17324d;
}

.report-occurrences-filter-select,
.report-occurrences-filter-input {
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid #d7e2ee;
  border-radius: 12px;
  background: #fff;
  color: #17324d;
  font: inherit;
}

.report-occurrences-meta {
  margin: 0;
  color: #5b6f84;
}

.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: #e8f2fb;
  color: #1f5a8b;
  border-bottom-color: #d3e3f4;
}

.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(31, 90, 139, 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: #1f5a8b;
}

.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 #e5edf5;
}

.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: #17324d;
}

.report-occurrence-description-summary {
  color: #5b6f84;
  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: #f8fbfe;
  border: 1px solid #d8e4ef;
}

.report-occurrence-description-title {
  color: #17324d;
  font-weight: 600;
}

.report-occurrence-description-meta {
  color: #5b6f84;
  line-height: 1.45;
}

.report-occurrence-item {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid #d8e4ef;
  border-radius: 14px;
  background: #f8fbfe;
}

.report-occurrence-item h5 {
  margin: 0;
  font-size: 14px;
  color: #17324d;
}

.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: #5b6f84;
}

.report-occurrence-fields strong {
  color: #17324d;
}

.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);
  }
}

/* Faixa intermediária (tablet / janela estreita no desktop): a grade de 20
   colunas segue proporcional, mas com spans mínimos por card. */
@media (max-width: 1180px) and (min-width: 769px) {
  .dashboard-canvas-grid-large > .dashboard-card,
  .dashboard-canvas-grid-small > .dashboard-card {
    grid-column: span var(--dashboard-tablet-col-span, 10) !important;
  }
}

@media (max-width: 960px) and (min-width: 769px) {
  .dashboard-canvas-grid-large > .dashboard-card,
  .dashboard-canvas-grid-small > .dashboard-card {
    grid-column: span var(--dashboard-tablet-narrow-col-span, 10) !important;
  }
}

@media (max-width: 768px) {
  .dashboard-manager-toggle {
    max-width: 140px;
    padding: 2px 6px;
  }

  .dashboard-manager-toggle-name {
    font-size: 0.76rem;
  }

  .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="equipmentMonitor"] .dashboard-widget-card-shell {
    gap: 10px;
    padding: 14px;
  }

  [data-dashboard-card="equipmentMonitor"] .equipment-monitor-table th,
  [data-dashboard-card="equipmentMonitor"] .equipment-monitor-table td {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  [data-dashboard-card="equipmentMonitor"] .equipment-monitor-legend {
    font-size: 0.68rem;
  }

  .dashboard-equipment-monitor-config-toolbar,
  .dashboard-equipment-monitor-mapping-head,
  .dashboard-equipment-monitor-column-grid,
  .dashboard-equipment-monitor-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(77, 163, 255, 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(77, 163, 255, 0.18);
}

.dashboard-manager-shell.is-editing.dashboard-card-resizing,
body.dashboard-card-resizing {
  cursor: nwse-resize;
}


.equipment-monitor-mini-chart-plot {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: visible !important;
}

.equipment-monitor-mini-chart-plot .svg-container,
.equipment-monitor-mini-chart-plot .main-svg,
.equipment-monitor-mini-chart-plot .hoverlayer {
  overflow: visible !important;
}

.equipment-monitor-mini-chart-plot .hoverlayer .hovertext {
  pointer-events: none;
}

.equipment-monitor-mini-chart-plot .hoverlayer .hovertext rect {
  rx: 10px;
  ry: 10px;
}

.equipment-monitor-mini-chart-plot .hoverlayer .hovertext text {
  font-size: 11px !important;
}

@media (max-width: 540px) {
  .equipment-monitor-mini-popover {
    width: min(420px, calc(100vw - 24px));
    min-height: 220px;
    padding: 12px;
  }

  .equipment-monitor-mini-popover-period-option {
    padding: 5px 8px;
  }

  .equipment-monitor-mini-popover-summary {
    gap: 6px 8px;
  }

  .equipment-monitor-mini-popover-summary-item strong {
    font-size: 0.72rem;
  }

  .equipment-monitor-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, #101a28); 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(221,226,241,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(40,118,170,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(221,226,241,0.72); font-size: 0.78rem; }
.ai-lab-message-meta code { font-size: 0.72rem; color: #9fd7ff; }
.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(221,226,241,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: #cde7ff; }
.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(221,226,241,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(221,226,241,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(74,144,226,0.24); border-color: rgba(126,185,255,0.68); color: #d8ecff; }
.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(221,226,241,0.74); font-size: 0.82rem; }
.ai-lab-engine-result header strong { color: #eef5ff; 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(221,226,241,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(221,226,241,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(221,226,241,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(221,226,241,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: #eef5ff; }
.ai-lab-scenarios, .ai-lab-engineering, .ai-lab-chat, .ai-lab-composer { background: #f8fafc; border-color: rgba(31, 90, 139, 0.16); color: #18263a; }
.ai-lab-chat-log { background: #eef3f8; }
.ai-lab-message { color: #1f2937; background: #ffffff; border-color: rgba(31, 90, 139, 0.14); box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08); }
.ai-lab-message.user { background: #e6f1fb; border-color: rgba(31, 90, 139, 0.18); }
.ai-lab-message.assistant.has-comparison { max-width: 100%; width: 100%; }
.ai-lab-message-meta { color: #475569; font-weight: 700; }
.ai-lab-message-meta code { color: #1d4ed8; background: #eff6ff; border-radius: 6px; padding: 2px 5px; }
.ai-lab-empty, .ai-lab-muted, .ai-lab-scenarios button span { color: #475569; }
.ai-lab-scenarios summary, .ai-lab-panel-head { color: #24364d; }
.ai-lab-scenarios button { background: #ffffff; color: #1f2937; border-color: rgba(31, 90, 139, 0.16); }
.ai-lab-scenarios button strong { color: #102033; }
.ai-lab-scenarios button:hover { border-color: rgba(31, 90, 139, 0.34); background: #f3f8fd; }
.ai-lab-engine-selector .ghost-button.selected { background: #dbeafe; border-color: #60a5fa; color: #0f3c72; }
.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(31, 90, 139, 0.16); color: #1f2937; box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06); }
.ai-lab-engine-result header { color: #475569; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; }
.ai-lab-engine-result header div { display: grid; gap: 2px; }
.ai-lab-engine-result header strong { color: #102033; font-size: 0.96rem; }
.ai-lab-engine-result header small { color: #64748b; font-weight: 700; text-transform: uppercase; letter-spacing: 0; font-size: 0.72rem; }
.ai-lab-engine-result header span { color: #0f3c72; background: #eff6ff; border-radius: 999px; padding: 4px 8px; font-weight: 800; white-space: nowrap; }
.ai-lab-engine-answer { color: #1f2937; 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: #1f2937; border-color: #dbe3ee; }
.ai-lab-attachment.ready, .ai-lab-attachment-state { background: #f8fafc; border: 1px solid #dbe3ee; border-radius: 8px; color: #334155; }
.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 #dbe3ee; }
.ai-lab-eval button { border-color: #cbd5e1; background: #f8fafc; color: #334155; }
.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(15, 23, 42, 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: #111827; background: #ffffff; border: 1px solid #cbd5e1; }
.ai-lab-composer-message textarea::placeholder { color: #64748b; opacity: 1; }
.ai-lab-composer .primary-button, .ai-lab-composer .ghost-button { color: #102033; border-color: #cbd5e1; }
.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: #475569; }
.ai-lab-audio-status { color: #334155; }
.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: #24364d; 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(31, 90, 139, 0.14); border-radius: 8px; background: #f8fbfe; 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: #24364d; 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: #2876aa; font-size: 1rem; }
.ai-lab-scenario-category[open] > summary::after { content: "−"; }
.ai-lab-scenario-category > summary small { margin-left: auto; color: #64748b; 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 #dbe3ee; border-radius: 7px; background: #fff; color: #1f2937; }
.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: #7eb9df; background: #f3f8fd; }
.ai-lab-scenario-card strong, .ai-lab-scenario-title strong { color: #102033; font-size: 0.78rem; }
.ai-lab-scenario-card span, .ai-lab-scenario-title span, .ai-lab-scenario-card small { color: #475569; font-size: 0.72rem; line-height: 1.3; }
.ai-lab-scenario-card small { color: #2876aa; 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 #dbe3ee; border-radius: 6px; background: #f8fafc; color: #334155; 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: #dbeafe; color: #0f3c72; 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 #b9d4ea; border-radius: 7px; background: #eef6fd; color: #0f3c72; 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(15, 23, 42, 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(31, 90, 139, 0.2);
    border-radius: 12px;
    background: #f8fafc;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 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 #dbe3ee;
    background: #f8fafc;
    color: #24364d;
  }
}

@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);
}

/* 20/10/2026: visual de "desabilitado" pro tier demo SEM o atributo nativo
   `disabled` - esse impede o evento de clique de disparar, e o botão
   precisa continuar clicável pra mostrar o aviso ("disponível apenas em
   contas reais"). Ver data-demo-locked no main.js. */
/* !important de proposito: esse atributo é colado em cima de classes de
   botão variadas (.primary-button, .ghost-button, .action-new, etc.), cada
   uma com seu próprio estado de :hover que teria MAIS especificidade que um
   seletor de atributo simples e voltaria a parecer habilitado ao passar o
   mouse — exatamente o momento em que a pessoa decide clicar. */
[data-demo-locked],
[data-demo-locked]:hover,
[data-demo-locked]:focus-visible {
  background: var(--inactive-soft) !important;
  border-color: var(--border-default) !important;
  color: var(--text-muted) !important;
  cursor: not-allowed;
}

.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;
}

/* Aviso nativo do Plotly ("Duplo clique para reverter zoom" etc.), mostrado
   depois de um zoom por arraste (dragmode:'zoom', hoje só no gráfico X/Y).
   Plotly injeta o próprio <style> com cor genérica (#8c97af) e cantos retos,
   sem nenhuma relação com o visual do app — alinhado aqui com o mesmo toast
   usado em showCenterStatusToast (.center-status-toast). !important necessário:
   a regra do Plotly tem a mesma especificidade (.plotly-notifier .notifier-note). */
.plotly-notifier .notifier-note {
  border: none !important;
  border-radius: 14px !important;
  background: rgba(20, 30, 45, 0.94) !important;
  color: #fff !important;
  box-shadow: 0 16px 40px rgba(7, 18, 31, 0.3) !important;
  font-family: inherit !important;
}

.plotly-notifier .notifier-close {
  opacity: 0.75 !important;
}

.plotly-notifier .notifier-close:hover {
  color: #fff !important;
  opacity: 1 !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"] .dashboard-template-menu,
:root[data-theme="dark"] .dashboard-library-row,
: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;
}

/* Modo escuro: opções do popover de modelo e hover das linhas de widget. */
:root[data-theme="dark"] .dashboard-template-option {
  background: var(--bg-elevated);
  border-color: var(--border-default);
}

:root[data-theme="dark"] .dashboard-template-option:hover,
:root[data-theme="dark"] .dashboard-template-option:focus-visible {
  background: var(--table-row-selected);
  border-color: var(--primary);
}

:root[data-theme="dark"] .dashboard-library-row:hover {
  background: var(--bg-elevated) !important;
  border-color: var(--border-strong) !important;
}

:root[data-theme="dark"] .dashboard-library-row-add {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: var(--text-on-primary);
}

: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-equipment-monitor-config-head strong,
  .dashboard-equipment-monitor-inline-check,
  .equipment-monitor-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 #0f2a44 (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,
  .equipment-monitor-status.tone-ok,
  .equipment-monitor-legend-item.tone-ok,
  .equipment-monitor-pressure.tone-ok,
  .equipment-monitor-metric.tone-ok
) {
  color: var(--success-accessible-text);
}

:root[data-theme="dark"] :is(
  .service-monitor-status-pill.is-warning,
  .equipment-monitor-status.tone-warning,
  .equipment-monitor-legend-item.tone-warning,
  .equipment-monitor-pressure.tone-warning,
  .equipment-monitor-metric.tone-warning
) {
  color: var(--warning-accessible-text);
}

:root[data-theme="dark"] :is(
  .service-monitor-status-pill.is-critical,
  .equipment-monitor-status.tone-critical,
  .equipment-monitor-legend-item.tone-critical,
  .equipment-monitor-pressure.tone-critical,
  .equipment-monitor-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);
}

/* Selo de classificação e chips de ícone do topo do relatório (16/09/2026).
   Os dois cartões ICO/IEC carregam a pintura fixa do PDF: selo com fundo creme
   e chip com fundo azul-claro. No Dark só a letra era trocada (a regra geral de
   :is(p, span, ...) acima manda var(--text-secondary)), então sobrava claro em
   cima de claro - os selos "Atenção"/"Bom" ficavam ilegíveis. Aqui o fundo vem
   junto com a letra, mantendo a cor do tom. */
:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) .report-status-badge {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) .report-status-badge.is-ok {
  background: var(--success-soft);
  color: var(--success-accessible-text);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) .report-status-badge.is-warning {
  background: var(--warning-soft);
  color: var(--warning-accessible-text);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) .report-status-badge.is-critical {
  background: var(--danger-soft);
  color: var(--danger-accessible-text);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) .report-icon-chip {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) .report-icon-chip.is-info {
  background: var(--info-soft);
  color: var(--info-accessible-text);
}

/* Ícone pequeno ao lado de "Composição:" e da barra de faixas: #4d6072 some no
   fundo escuro. */
:root[data-theme="dark"] body.report-page:not([data-export-mode="pdf"]) .report-icon-inline {
  color: var(--text-secondary);
}

: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;
}

/* v1.03: dentro da janela a entidade não se repete — quem mostra o estado da
   IA é a própria borda, que assume as cores dela e muda de ritmo conforme
   ouvindo / pensando / respondendo. O anel é um gradiente mascarado (só a
   moldura aparece), animado deslocando o gradiente. */
.global-ai-chat::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 1.5px;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff8f70, #ff5f74, #b57cff, #4f86ff, #64dcff, #4f86ff, #b57cff, #ff5f74, #ff8f70);
  background-size: 300% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.4s ease;
  animation: global-ai-border-flow 12s linear infinite;
}

.global-ai-chat[data-ai-state="listening"]::before {
  opacity: 0.95;
  animation-duration: 5s;
}

.global-ai-chat[data-ai-state="thinking"]::before {
  opacity: 1;
  animation-duration: 2.8s;
}

.global-ai-chat[data-ai-state="responding"]::before {
  opacity: 1;
  animation-duration: 4s;
}

.global-ai-chat[data-ai-state="success"]::before {
  opacity: 0.9;
}

.global-ai-chat[data-ai-state="error"]::before {
  opacity: 1;
  background: linear-gradient(90deg, #ffc36b, #ff8c5a, #ff5c66, #ff4d7e, #ff5c66, #ff8c5a, #ffc36b);
  background-size: 300% 100%;
  animation-duration: 3.4s;
}

@keyframes global-ai-border-flow {
  to { background-position: 300% 0; }
}

/* Gravação no chat flutuante: a onda sonora ocupa o lugar do campo de texto. */
.global-ai-chat-composer textarea[hidden] {
  display: none;
}

.global-ai-chat-recorder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--border-default));
  border-radius: 14px;
  background: var(--bg-elevated);
}

.global-ai-chat-recorder[hidden] {
  display: none;
}

#globalAiChatWave {
  --ai-wave-height: 34px;
  min-width: 0;
}

.global-ai-chat-recorder-time {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
  .global-ai-chat::before {
    animation: none;
  }
}

.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-action-card {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  margin-top: 4px;
  border: 1px solid var(--border-default);
  border-radius: 12px;
  background: var(--bg-surface, var(--bg-elevated));
}

.global-ai-action-card strong {
  font-size: 0.82rem;
  color: var(--text-primary);
}

.global-ai-action-summary {
  display: grid;
  gap: 3px;
  margin: 0;
  padding-left: 18px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.global-ai-action-summary li.is-warning {
  color: var(--danger-accessible-text);
  font-weight: 600;
}

.global-ai-action-buttons {
  display: flex;
  gap: 8px;
}

.global-ai-action-btn {
  flex: 1 1 auto;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.global-ai-action-btn.is-confirm {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-contrast, #fff);
}

.global-ai-action-btn.is-cancel {
  background: transparent;
  color: var(--text-secondary);
}

.global-ai-action-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.global-ai-action-status {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.global-ai-action-status.is-success {
  color: var(--success-accessible-text, var(--success));
}

.global-ai-action-status.is-error {
  color: var(--danger-accessible-text);
}

.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;
}

/* v1.05: mesmo microfone da tela BMS Advisor — redondo, só ícone, vermelho e
   pulsando enquanto grava. O que ele faz está no rótulo acessível e na linha
   de status logo acima do campo. */
.global-ai-chat-audio {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.global-ai-chat-audio svg {
  width: 20px;
  height: 20px;
}

/* O :not(:disabled) deixa o hover mais específico que .is-recording; sem
   excluir o estado de gravação aqui, o botão perdia o vermelho enquanto o
   ponteiro continuasse em cima dele — que é justamente o caso depois do
   clique que inicia a gravação. */
.global-ai-chat-audio:hover:not(:disabled):not(.is-recording),
.global-ai-chat-audio:focus-visible:not(.is-recording) {
  background: var(--primary-soft);
  color: var(--primary);
  outline: none;
}

.global-ai-chat-audio.is-recording {
  background: var(--danger);
  color: #fff;
  animation: global-ai-mic-pulse 1.4s ease-in-out infinite;
}

.global-ai-chat-audio:disabled {
  opacity: 0.45;
  cursor: default;
}

@keyframes global-ai-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 45%, transparent); }
  50% { box-shadow: 0 0 0 9px transparent; }
}

.global-ai-chat-recorder-cancel {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.global-ai-chat-recorder-cancel svg {
  width: 14px;
  height: 14px;
}

.global-ai-chat-recorder-cancel:hover,
.global-ai-chat-recorder-cancel:focus-visible {
  background: color-mix(in srgb, var(--danger) 22%, transparent);
  color: var(--danger);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .global-ai-chat-audio.is-recording {
    animation: none;
  }
}

.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;
}

/* v1.02: quem desenha a entidade pequena agora é o <bms-ai-orb> (canvas), o
   mesmo modelo da tela BMS Advisor. O orbe é maior que a caixa nominal para o
   brilho poder vazar para fora, como fazia o halo da versão anterior. As regras
   de .ai-energy-field/.ai-orb-icon abaixo ficam só como referência do modelo
   antigo — o componente não gera mais essa estrutura. */
.bms-ai-entity-orb {
  --ai-orb-size: 150%;
  display: block;
}

.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 #cbd5e1; border-radius: 999px; color: #102033; background: #f8fafc; font: inherit; font-size: .76rem; font-weight: 700; cursor: pointer; }
#section-aiLab .ai-lab-engine-selector select:focus { outline: 0; border-color: #2876aa; box-shadow: 0 0 0 3px rgba(40, 118, 170, .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 #dbe3ee; 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: #2876aa; box-shadow: 0 0 0 3px rgba(40, 118, 170, .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 #dbe3ee; border-radius: 12px; background: #f8fbfe; 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: #102033; font-size: .82rem; }
#section-aiLab .ai-lab-feedback-title small { color: #64748b; 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: #475569; 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 #cbd5e1; border-radius: 999px; background: #fff; color: #334155; cursor: pointer; font-size: .72rem; }
#section-aiLab .ai-lab-feedback-options input { accent-color: #0f5f93; }
#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 #cbd5e1; border-radius: 8px; padding: 8px; color: #1f2937; background: #fff; }
#section-aiLab .ai-lab-feedback-comment textarea:focus { outline: 0; border-color: #2876aa; box-shadow: 0 0 0 3px rgba(40, 118, 170, .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 #cbd5e1; border-radius: 999px; background: #f8fafc; }
#section-aiLab .ai-lab-channel-selector > span { padding: 0 7px; color: #475569; 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(15, 23, 42, .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: #cbd5e1; }
@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 #dbe3ee; background: #f8fafc; }
#section-aiLab .ai-lab-chat-head > div { display: grid; gap: 2px; min-width: 0; }
#section-aiLab .ai-lab-chat-head strong { color: #102033; font-size: .86rem; }
#section-aiLab .ai-lab-chat-head span { color: #64748b; 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; }
}

/* ============================================================
   Sino de alarmes do cabeçalho (substitui o botão do tour, que
   migrou pro menu da conta) — presente em todas as telas.
   ============================================================ */
.topbar-alarm-shell {
  position: relative;
  display: flex;
  align-items: center;
}

.topbar-alarm-button {
  position: relative;
}

.topbar-alarm-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.topbar-alarm-button.has-open-alarms {
  color: var(--danger-accessible-text);
  border-color: var(--danger);
}

/* Seletor com o botão de propósito: `.icon-button span` (mais específico que
   `.topbar-alarm-badge` sozinho) impunha 1.1rem e line-height 1 ao contador, e
   o "1" saía maior que a bolinha e 3px acima do centro. Flex centraliza o
   glifo independente da métrica da fonte. */
.topbar-alarm-button .topbar-alarm-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: var(--text-on-primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 2px 6px var(--shadow-color);
}
.topbar-alarm-button .topbar-alarm-badge[hidden] {
  display: none;
}

.topbar-alarm-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: 260px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 14px 34px var(--shadow-color);
  cursor: pointer;
}

.topbar-alarm-popover-head {
  margin-bottom: 10px;
}

.topbar-alarm-popover-head strong {
  font-size: 0.92rem;
}

.topbar-alarm-popover-rows {
  display: grid;
  gap: 6px;
}

.topbar-alarm-popover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.topbar-alarm-popover-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.topbar-alarm-popover-row.is-critical strong {
  color: var(--danger-accessible-text);
}

.topbar-alarm-popover-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--primary-accessible-text);
}

/* ============================================================
   Portal de alarmes — cards de resumo, filtros rápidos e
   tabela compacta.
   ============================================================ */
.alarm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.alarm-stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--text);
  box-shadow: 0 6px 18px var(--shadow-color-soft);
}

.alarm-stat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.alarm-stat-icon {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--primary-soft, rgba(77, 163, 255, 0.14));
  color: var(--primary, #1f5a8b);
}

.alarm-stat-icon.tone-ok {
  background: var(--success-soft, rgba(47, 158, 111, 0.14));
  color: var(--success-accessible-text, #2f9e6f);
}

.alarm-stat-icon.tone-warning {
  background: var(--warning-soft, rgba(241, 162, 8, 0.16));
  color: var(--warning-accessible-text, #8a6000);
}

.alarm-stat-icon.tone-critical {
  background: var(--danger-soft, rgba(199, 74, 69, 0.14));
  color: var(--danger-accessible-text, #c74a45);
}

.alarm-stat-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  /* letter-spacing soma um espaco extra DEPOIS de cada letra, inclusive a
     ultima -- quando o titulo quebra em 2 linhas bem no limite da largura
     (ex.: "SEM RECONHECIMENTO" nos cards de alarme), essa sobra empurra o
     fim do texto pra fora do padding direito do card. A margem negativa
     cancela exatamente essa sobra final, sem afetar o espacamento entre as
     letras em si. */
  margin-right: -0.04em;
  color: var(--muted);
}

.alarm-stat-value {
  font-size: 1.35rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.alarm-stat-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alarm-stat-card.is-critical {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.alarm-stat-card.is-critical .alarm-stat-value {
  color: var(--danger-accessible-text);
}

.alarm-stat-card.is-warning {
  border-color: var(--warning);
  background: var(--warning-soft);
}

.alarm-stat-card.is-warning .alarm-stat-value {
  color: var(--warning-accessible-text);
}

.alarm-stat-card.is-ok .alarm-stat-value {
  color: var(--success-accessible-text);
}

/* Tom por métrica (porcentagem / tempo), independente da moldura do card. */
.alarm-stat-card .alarm-stat-value.tone-ok,
.alarm-stat-hint .alarm-stat-pct.tone-ok {
  color: var(--success-accessible-text, #2f9e6f);
}

.alarm-stat-card .alarm-stat-value.tone-warning,
.alarm-stat-hint .alarm-stat-pct.tone-warning {
  color: var(--warning-accessible-text, #8a6000);
}

.alarm-stat-card .alarm-stat-value.tone-critical,
.alarm-stat-hint .alarm-stat-pct.tone-critical {
  color: var(--danger-accessible-text, #c74a45);
}

.alarm-stat-pct {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.alarm-quick-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.alarm-quick-filters-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.alarm-quick-filters-divider {
  width: 1px;
  height: 22px;
  background: var(--line-strong);
}

.alarm-quick-chip {
  padding: 6px 10px;
  font-size: 0.78rem;
}

/* Portal de alarmes não precisa de tanto espaço horizontal — fonte um pouco
   menor nas linhas pra caber mais informação por tela. */
.table-card-compact table th,
.table-card-compact table td {
  font-size: 0.8rem;
}

.table-card-compact table .cell-title {
  font-size: 0.8rem;
}

.table-card-compact table .muted {
  font-size: 0.72rem;
}

/* ============================================================
   Portal de alarmes v2 — layout travado (a tela é um grid de
   altura fixa; sem isso as linhas "auto" são esticadas pra
   preencher 100vh e os cards crescem com espaço em branco,
   empurrando a tabela pra baixo), popover de período e
   indicação animada de alarme ativo no sino.
   ============================================================ */
#screen-alarms.table-screen {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

#screen-alarms .alarm-stats-grid {
  flex: 0 0 auto;
}

#screen-alarms .table-card {
  flex: 1 1 auto;
  min-height: 0;
}

.alarm-stat-card {
  align-self: start;
}

.alarm-period-shell {
  position: relative;
  display: inline-flex;
}

.alarm-period-chip-range {
  margin-left: 6px;
  padding-left: 6px;
  border-left: 1px solid currentColor;
  font-weight: 600;
  white-space: nowrap;
}

.alarm-period-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 55;
  display: grid;
  gap: 10px;
  width: 230px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 14px 34px var(--shadow-color);
}

.alarm-period-popover[hidden] {
  display: none;
}

.alarm-period-popover .filter-date-field {
  display: grid;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.alarm-period-popover .filter-date-field input {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--text);
  font: inherit;
}

.alarm-period-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.alarm-period-popover-actions .ghost-button,
.alarm-period-popover-actions .primary-button {
  padding: 8px 12px;
  font-size: 0.8rem;
  border-radius: 10px;
}

/* Linhas do portal de alarmes selecionáveis por clique direto (Ctrl/Cmd
   alterna, Shift estende o intervalo). user-select desligado pra o
   Shift+clique não arrastar seleção de texto junto. */
tr.row-selectable {
  cursor: pointer;
}

tr.row-selectable td {
  user-select: none;
}

/* Popover "Reconhecer e comentar" da toolbar (reusa a base do popover de
   período, só com o campo de comentário maior). */
.alarm-ack-popover {
  width: 280px;
}

.alarm-ack-comment-field {
  display: grid;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.alarm-ack-comment-field textarea {
  min-height: 72px;
  resize: vertical;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
}

/* Coluna "Comentário": resumido em uma linha (reticências); comentários
   longos viram botão clicável que expande/recolhe o texto completo. */
.alarm-comment-toggle {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alarm-comment-toggle.is-expanded {
  white-space: pre-wrap;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}

/* Sino do cabeçalho: pulso sutil enquanto houver alarme aberto. */
@keyframes topbar-alarm-pulse {
  0% { box-shadow: 0 0 0 0 rgba(217, 72, 72, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(217, 72, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 72, 72, 0); }
}

.topbar-alarm-button.has-open-alarms {
  animation: topbar-alarm-pulse 2s ease-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .topbar-alarm-button.has-open-alarms {
    animation: none;
  }
}

/* ============================================================
   Histórico — picker de ambientes enriquecido: grade de cards
   com contagens (equipamentos/pontos), localização e seletor de
   período inicial já na tela de seleção.
   ============================================================ */
.history-space-results {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.history-space-option {
  gap: 6px;
  align-content: start;
}

.history-space-option-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-space-option-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.history-space-option-stat {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.history-selector-summary-line {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.history-default-period-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-default-period-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.history-default-period-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.history-default-period-chip {
  padding: 6px 10px;
  font-size: 0.78rem;
}

/* ============================================================
   Histórico — builder em duas janelas: árvore de ambientes/
   equipamentos/pontos (esquerda) e bancada de montagem com
   drag-and-drop, olhinhos e período (direita).
   ============================================================ */
.history-selector-hint {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.history-builder {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: stretch;
  min-height: 0;
}

@media (max-width: 900px) {
  .history-builder {
    grid-template-columns: minmax(0, 1fr);
  }
}

.history-builder-tree {
  min-width: 0;
  max-height: min(560px, 64vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
}

.htree {
  display: grid;
  gap: 2px;
  font-size: 0.86rem;
}

.htree-node {
  min-width: 0;
}

.htree-children {
  margin-left: 18px;
  padding-left: 8px;
  border-left: 1px dashed var(--line-strong);
  display: grid;
  gap: 2px;
}

.htree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  border-radius: 10px;
  padding: 2px 4px;
}

.htree-row:hover {
  background: var(--table-row-hover);
}

.htree-toggle {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 22px;
}

.htree-label {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 4px 4px;
  cursor: pointer;
  border-radius: 8px;
  font: inherit;
}

.htree-label small {
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.htree-label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.htree-icon {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  color: var(--text-secondary);
}

.htree-leaf {
  padding-left: 26px;
  color: var(--text-secondary);
  cursor: grab;
}

.htree-leaf .htree-label-text {
  flex: 1 1 auto;
  font-size: 0.82rem;
}

.htree-add {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--primary-accessible-text);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.htree-row:hover .htree-add,
.htree-add:focus-visible {
  opacity: 1;
}

.htree-playbook-btn {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  /* Diferente do "+" (opacity:0, só para ação já conhecida/repetitiva),
     este fica sutilmente visível mesmo sem hover — é uma feature nova
     (playbook de equipamento) que ninguém sabe procurar ainda; escondê-la
     por completo até o hover já causou confusão real de um usuário que não
     conseguia achar onde a feature estava. */
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.htree-row:hover .htree-playbook-btn,
.htree-playbook-btn:focus-visible {
  opacity: 1;
}

[data-history-drag] {
  cursor: grab;
}

.history-builder-staging {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-height: min(560px, 64vh);
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
}

.history-builder-staging.is-drop-target {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

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

.history-staging-head strong {
  font-size: 0.92rem;
}

.history-staging-body {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: 10px;
  align-content: start;
}

.history-staging-empty {
  display: grid;
  gap: 4px;
  place-content: center;
  text-align: center;
  min-height: 140px;
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--text-muted);
  padding: 16px;
}

.history-staging-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  padding: 8px 10px;
  display: grid;
  gap: 6px;
}

.history-staging-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.history-staging-group-copy {
  display: grid;
  min-width: 0;
}

.history-staging-group-copy strong {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-staging-group-copy span {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.history-staging-remove {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

/* Tela "Vínculo de Equipamentos" — os dois painéis (árvore + grupos) esticam
   pra preencher a altura visível da tela (mesma reserva vertical usada por
   .ai-lab-screen, outra tela de "Ferramentas Internas" com layout parecido),
   em vez do max-height curto herdado de .history-builder-tree/-staging, que
   deixava um vão vazio grande abaixo em telas de notebook. */
.equipment-groups-screen .history-builder {
  min-height: calc(100vh - 168px);
}

.equipment-groups-screen .history-builder-tree,
.equipment-groups-screen .history-builder-staging {
  height: calc(100vh - 168px);
  max-height: calc(100vh - 168px);
}

@media (max-width: 900px) {
  .equipment-groups-screen .history-builder-tree,
  .equipment-groups-screen .history-builder-staging {
    height: 60vh;
    max-height: 60vh;
  }
}

/* Painel direito (grupos de preço como alvo de drop), em grade responsiva de
   2 colunas quando há espaço — e chip de vínculo já feito na árvore. */
.eqgroup-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  align-content: start;
}

.eqgroup-category {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.eqgroup-category-title {
  min-width: 0;
  overflow-wrap: break-word;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.eqgroup-category-items {
  display: grid;
  gap: 6px;
}

.eqgroup-drop-target {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  font-size: 0.84rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.eqgroup-drop-target.is-drop-target {
  border-color: var(--primary);
  border-style: solid;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.eqgroup-drop-label {
  min-width: 0;
  overflow-wrap: break-word;
  color: var(--text);
}

.eqgroup-drop-count {
  flex: 0 0 auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
  font-weight: 700;
  font-size: 0.76rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.eqgroup-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
  font-size: 0.72rem;
  font-weight: 600;
}

.eqgroup-unlink-btn {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  line-height: 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
}

/* Tela "Preços dos Grupos" — grade responsiva de categorias (em vez de uma
   coluna só ocupando a largura inteira) e cada item como uma linha simples
   (não tabela — o <thead><th> genérico do app é desenhado pras grades de
   dados grandes, com cantos bem arredondados que ficam cortados/estranhos
   numa tabela de só 2 colunas). */
.group-pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
}

.group-pricing-category {
  min-width: 0;
}

.group-pricing-rows {
  display: grid;
}

.group-pricing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.group-pricing-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.group-pricing-row:first-child {
  padding-top: 0;
}

.group-pricing-row-label {
  flex: 1 1 160px;
  min-width: 0;
  color: var(--text);
  font-size: 0.86rem;
}

.billing-invoice-download {
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.billing-invoice-download:hover {
  text-decoration: underline;
}

.groupprice-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.groupprice-currency {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.groupprice-input {
  width: 90px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.history-staging-points {
  display: grid;
  gap: 2px;
}

.history-staging-point {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 3px 4px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
}

.history-staging-point:hover {
  background: var(--table-row-hover);
}

.history-staging-point-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-staging-eye {
  flex: 0 0 auto;
}

.history-staging-point.is-hidden {
  color: var(--text-muted);
}

.history-staging-point.is-hidden .history-staging-eye {
  opacity: 0.35;
}

.history-staging-point.is-hidden .history-staging-point-label {
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}

.history-staging-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.history-staging-count {
  color: var(--text-muted);
  font-size: 0.76rem;
}

/* ============================================================
   Histórico builder v2 — multi-seleção de pontos, expandir/
   recolher tudo, grupos recolhíveis na bancada.
   ============================================================ */
.htree-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 2px 8px;
  margin-bottom: 6px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--line);
}

.htree-toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.htree-toolbar-button {
  padding: 5px 10px;
  font-size: 0.74rem;
  border-radius: 9px;
}

.htree-leaf.is-selected {
  background: var(--table-row-selected);
  color: var(--primary-accessible-text);
}

.htree-leaf.is-selected .htree-icon {
  color: var(--primary-accessible-text);
  font-weight: 700;
}

.history-staging-caret {
  flex: 0 0 auto;
  width: 14px;
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.history-staging-group-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font: inherit;
}

.history-staging-space {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: var(--bg-surface);
}

.history-staging-space-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  text-align: left;
}

.history-staging-space-head strong {
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-staging-space-head small {
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.history-staging-space-body {
  display: grid;
  gap: 8px;
}

.history-staging-group.is-collapsed {
  padding-bottom: 8px;
}

/* Histórico builder v3 — seleção estilo explorador (clique normal = 1;
   Ctrl/Cmd/Shift = múltiplos). Ponto selecionado com destaque de "linha
   ativa", não de botão pressionado. */
.htree-leaf {
  user-select: none;
}

.htree-leaf.is-selected {
  background: var(--primary-soft);
  outline: 1px solid var(--primary);
  outline-offset: -1px;
}

/* Alça de arraste das pastas da árvore do histórico (drag sem interferir no
   clique de expandir). Aparece no hover da linha. */
.htree-grip {
  flex: 0 0 auto;
  width: 14px;
  text-align: center;
  color: var(--text-muted);
  cursor: grab;
  opacity: 0;
  transition: opacity 0.15s ease;
  user-select: none;
}
.htree-grip.is-empty {
  cursor: default;
}
.htree-row:hover .htree-grip {
  opacity: 0.7;
}

/* CORREÇÃO CRÍTICA: o atributo `hidden` (usado para recolher pastas da árvore
   e grupos da bancada) tem display:none pela UA, mas uma regra de classe
   `display:grid` do autor vencia por especificidade — então recolher não
   surtia efeito visual. Estas regras [hidden] restauram o recolhimento. */
.htree-children[hidden],
.history-staging-points[hidden],
.history-staging-space-body[hidden] {
  display: none !important;
}

/* ============================================================
   TELA DE RELATÓRIOS — biblioteca (estante) + painel de config.
   ============================================================ */
.reports-builder {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
  gap: 14px;
  align-items: stretch;
  min-height: 0;
}
@media (max-width: 900px) {
  .reports-builder { grid-template-columns: minmax(0, 1fr); }
}

.reports-library {
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
}
.reports-library-head h3 { margin: 2px 0 0; }
.reports-library-hint { margin: 4px 0 0; color: var(--text-muted); font-size: 0.82rem; }

.reports-shelf {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.report-book {
  position: relative;
  display: block;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elevated);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.report-book:hover { transform: translateY(-2px); box-shadow: 0 10px 26px var(--shadow-color-soft); }
.report-book.is-selected { border-color: var(--report-accent, var(--primary)); box-shadow: 0 0 0 2px var(--report-accent, var(--primary)); }
.report-book-spine {
  position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  background: var(--report-accent, var(--primary));
}
.report-book-body { display: grid; gap: 8px; padding: 14px 14px 14px 18px; }
.report-book-icon { font-size: 1.4rem; }
.report-book-title { font-size: 0.98rem; line-height: 1.25; }
.report-book-norms { display: flex; flex-wrap: wrap; gap: 4px; }
.report-norm-chip {
  font-size: 0.68rem; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-secondary); border: 1px solid var(--line);
}
.report-book-summary { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }
.report-book-highlights { display: flex; flex-wrap: wrap; gap: 4px; }
.report-highlight {
  font-size: 0.7rem; padding: 2px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--report-accent, var(--primary)) 12%, transparent);
  color: var(--report-accent, var(--primary-accessible-text));
}
.report-book-count { font-size: 0.74rem; color: var(--text-muted); }

.report-book-add {
  display: grid; place-items: center; min-height: 180px;
  border-style: dashed; border-width: 2px; background: var(--bg-surface);
}
.report-book-add-inner { display: grid; gap: 4px; justify-items: center; color: var(--text-muted); }
.report-book-add-plus {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.6rem; border: 2px solid var(--line-strong); color: var(--text-secondary);
}
.report-book-add small { font-size: 0.7rem; }

.reports-config {
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-surface);
  max-height: min(640px, 76vh);
}
.reports-config-empty { display: grid; gap: 6px; place-content: center; text-align: center; min-height: 200px; color: var(--text-muted); padding: 16px; }
.reports-config-empty strong { color: var(--text); }
.reports-config-head strong { font-size: 0.95rem; }

.reports-equip-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.reports-equip-title { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.reports-equip-actions { display: flex; gap: 6px; }
.reports-equip-actions .ghost-button { padding: 5px 10px; font-size: 0.74rem; border-radius: 9px; }
.reports-equip-hint { margin: 0; font-size: 0.72rem; color: var(--text-muted); }

.reports-equip-list {
  flex: 1 1 auto; min-height: 100px; overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: 4px; align-content: start;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: var(--bg-elevated);
}
.reports-equip-empty { color: var(--text-muted); font-size: 0.82rem; padding: 12px; text-align: center; }
.report-equip {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: none; background: transparent; padding: 6px 8px; border-radius: 8px; cursor: pointer;
  color: var(--text); font: inherit;
}
.report-equip:hover { background: var(--table-row-hover); }
.report-equip.is-selected { background: var(--primary-soft); outline: 1px solid var(--primary); outline-offset: -1px; }
.report-equip-check { flex: 0 0 auto; width: 16px; color: var(--primary-accessible-text); font-weight: 700; }
.report-equip-copy { display: grid; min-width: 0; }
.report-equip-copy strong { font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-equip-copy span { font-size: 0.74rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.reports-output { display: grid; gap: 4px; }
.reports-output-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.reports-output-option { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.reports-output-option.is-active { border-color: var(--primary); background: var(--primary-soft); }
.reports-output-option small { color: var(--text-muted); }

.reports-config-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.reports-config-count { font-size: 0.78rem; color: var(--text-muted); }
.reports-config-buttons { display: flex; gap: 8px; }

/* Modal "qual modelo?" */
.report-model-list { display: grid; gap: 8px; margin-bottom: 12px; }
.report-model-option { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elevated); padding: 12px; cursor: pointer; }
.report-model-option:hover { border-color: var(--primary); background: var(--primary-soft); }
.report-model-option-icon { font-size: 1.4rem; }
.report-model-option-copy { display: grid; }
.report-model-option-copy strong { font-size: 0.9rem; }
.report-model-option-copy span { font-size: 0.74rem; color: var(--text-muted); }

/* ============================================================
   Relatórios v2 — título no topo do card, ícones SVG (termômetro
   + gota), e bloco de saída ao lado dos filtros.
   ============================================================ */
.report-book-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.report-book-header .report-book-title {
  order: 0;
  font-size: 0.98rem;
  line-height: 1.25;
}
.report-book-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--report-accent, var(--primary));
}
.report-book-glyph svg {
  width: 22px;
  height: 22px;
  display: block;
}
.report-book-glyph.is-humidity { color: #2CA6E0; }
.report-book-glyph.is-temp { color: var(--report-accent, var(--primary)); }

/* Topo do painel de configuração: período (filtros) + saída lado a lado. */
.reports-config-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.reports-config-top .history-default-period-row { flex: 1 1 auto; min-width: 0; }

.reports-output-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.reports-output-seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.reports-output-seg-btn {
  border: none;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.76rem;
  padding: 6px 10px;
  cursor: pointer;
}
.reports-output-seg-btn + .reports-output-seg-btn { border-left: 1px solid var(--line); }
.reports-output-seg-btn.is-active {
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
  font-weight: 600;
}

/* ============================================================
   Relatórios v3 — título sempre no topo do card, ícone único de
   tamanho padrão no canto superior direito.
   ============================================================ */
.report-book-body { position: relative; }
.report-book-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  color: var(--report-accent, var(--primary));
}
.report-book-glyph svg {
  width: 22px;
  height: 22px;
  display: block;
}
.report-book-title {
  margin: 0;
  padding-right: 34px; /* espaço para o ícone no canto */
  align-self: flex-start;
}
/* Cards da estante alinhados pelo topo, para os títulos casarem. */
.reports-shelf { align-items: start; }

/* ============================================================
   Relatórios v4 — cards de mesma altura; resumo ocupa o meio e
   os destaques + contagem ficam sempre alinhados ao rodapé.
   ============================================================ */
.reports-shelf {
  align-items: stretch;
  grid-auto-rows: 1fr;
}
.report-book { height: 100%; }
.report-book-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}
.report-book-summary { flex: 0 1 auto; }
/* Empurra destaques + contagem para o rodapé do card. */
.report-book-highlights { margin-top: auto; }
.report-book-count { margin-top: 0; }

/* Card "adicionar" com o mesmo tamanho dos demais. */
.report-book-add {
  min-height: 0;
  height: 100%;
}

/* ============================================================
   Relatórios > "Agendados" (08/10/2026) — relatórios automáticos por e-mail.
   Mesma linguagem visual do construtor de Relatórios acima (bg-surface/
   bg-elevated, border-radius 10-14px).
   ============================================================ */
.reports-scheduled-screen { display: flex; flex-direction: column; gap: 12px; }
.reports-schedule-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.reports-schedule-list-state {
  padding: 24px; text-align: center; color: var(--text-muted); font-size: 0.86rem;
  border: 1px dashed var(--line); border-radius: 12px; background: var(--bg-surface);
}
.reports-schedule-list-state.is-error { color: var(--danger-accessible-text, var(--danger)); border-color: var(--danger); }

/* Cards dos agendamentos salvos reaproveitam o visual do "estante" de modelos
   da aba Gerador (.report-book/.report-book-spine/.report-book-icon etc.),
   pedido explícito do dono em 08/10/2026 -- mesma cor de destaque (--report-accent)
   e ícone do modelo escolhido no agendamento. Usa <article>, não <button> (o
   card tem vários botões de ação reais dentro, que não podem aninhar dentro
   de outro <button>). */
.reports-schedule-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  align-items: stretch;
  grid-auto-rows: 1fr;
}
.reports-schedule-card { cursor: default; text-align: left; }
.reports-schedule-card.is-paused { opacity: 0.68; }
.reports-schedule-card-badge {
  align-self: flex-start;
  font-size: 0.68rem; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--line);
}
.reports-schedule-card-badge.is-active { background: color-mix(in srgb, var(--success, #2e9e5b) 16%, transparent); color: var(--success-accessible-text, var(--success, #2e9e5b)); border-color: transparent; }
.reports-schedule-card-meta { margin: 0; font-size: 0.78rem; color: var(--text-secondary); }
.reports-schedule-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.reports-schedule-card-actions .ghost-button { padding: 5px 10px; font-size: 0.74rem; border-radius: 9px; }

/* Modal (reaproveita a base .filter-modal/.filter-modal-dialog, só alargando
   e deixando mais baixo -- largo o bastante pra caber tudo numa tela normal
   sem precisar rolar, igual ao modal grande de config de widget). z-index
   acima do botão de recolher o menu lateral (.sidebar-edge-toggle, 1600) pra
   ele também ficar sob o blur do fundo em vez de destacado por cima dele. */
.report-schedule-modal { z-index: 1650; }
.report-schedule-modal .filter-modal-dialog {
  width: min(1180px, calc(100vw - 32px));
  max-height: min(90vh, 760px);
}
.report-schedule-modal .filter-modal-body { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.reports-schedule-form { display: flex; flex-direction: column; gap: 14px; min-height: 0; flex: 1 1 auto; }
.reports-schedule-form-error {
  padding: 8px 12px; border-radius: 8px; font-size: 0.82rem;
  background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger-accessible-text, var(--danger));
}

/* Três colunas: dados básicos | ambientes (com busca) | destinatários.
   Cada coluna rola por conta própria -- o modal inteiro não precisa rolar
   numa tela comum, só o conteúdo interno de cada lista quando é longa. */
.reports-schedule-form-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.85fr) minmax(260px, 1.15fr) minmax(220px, 1fr);
  gap: 20px;
  min-height: 0;
  flex: 1 1 auto;
}
.reports-schedule-form-grid > section { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.reports-schedule-col-basics { overflow-y: auto; padding-right: 2px; }
.reports-schedule-col-equip,
.reports-schedule-col-recipients {
  border-left: 1px solid var(--line); padding-left: 20px; min-height: 0;
}
.reports-schedule-col-equip .reports-equip-list,
.reports-schedule-col-recipients .reports-schedule-recipients { flex: 1 1 auto; }

.reports-schedule-form-row { display: grid; grid-template-columns: minmax(150px, 170px) minmax(0, 1fr); gap: 14px; align-items: center; }
@media (max-width: 560px) { .reports-schedule-form-row { grid-template-columns: minmax(0, 1fr); } }
.reports-schedule-form-row .work-days-picker { justify-content: center; }
/* Seletor de horário rico (mesmo componente do expediente, em Configurações),
   substitui o <input type="time"> nativo -- pedido explícito do dono. */
.reports-schedule-form-row .time-picker-trigger { min-width: 0; }

.reports-schedule-recipients { display: grid; gap: 2px; min-height: 120px; max-height: 100%; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: var(--bg-elevated); }

/* Cancelar ao lado do Salvar, agrupados à direita -- status de erro fica à
   esquerda, no espaço que sobra (mesmo <div> de sempre, só que vazio aqui). */
.reports-schedule-form-footer-actions { display: flex; align-items: center; gap: 10px; }

@media (max-width: 960px) {
  .report-schedule-modal .filter-modal-dialog { max-height: min(94vh, 880px); }
  .report-schedule-modal .filter-modal-body { overflow-y: auto; }
  .reports-schedule-form { flex: 0 0 auto; min-height: auto; }
  .reports-schedule-form-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  /* Empilhado em 1 coluna, quem rola é só o corpo do modal (acima) -- a
     coluna "basics" NAO pode mais ter seu próprio overflow/scroll interno
     (era pensado só pro layout de 3 colunas lado a lado), senão ela vira
     uma caixinha de altura travada e esconde "Dias da semana"/"Período"
     dentro de uma rolagem interna invisível, sem nenhum indício visual de
     que falta conteúdo. */
  .reports-schedule-col-basics { overflow: visible; padding-right: 0; }
  /* `.reports-schedule-form-grid` tinha `flex:1 1 auto; min-height:0` pra
     dividir a altura fixa do modal entre 3 colunas lado a lado (desktop).
     Empilhado em 1 coluna isso vira 3 LINHAS de grid dentro do mesmo espaço
     travado -- o grid comprime cada linha abaixo da altura real do
     conteúdo (min-height:0 nas sections deixa encolher) e o conteúdo
     vaza/sobrepõe a seção seguinte, em vez de simplesmente rolar. Em mobile
     cada seção deve crescer pro tamanho natural do conteúdo; quem rola é
     only o corpo do modal (overflow-y:auto acima). */
  .reports-schedule-form-grid { flex: 0 0 auto; min-height: auto; }
  .reports-schedule-form-grid > section { min-height: auto; }
  .reports-schedule-col-equip, .reports-schedule-col-recipients { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 14px; }
  .reports-schedule-col-equip .reports-equip-list { max-height: 280px; }
  .reports-schedule-recipients { max-height: 220px; }
}

/* ============================================================
   Padrão de cores de alarme do sistema:
   vermelho = ativo sem reconhecimento; amarelo = reconhecido em
   alarme; verde = normalizado; cinza = silenciado / NA.
   ============================================================ */
.pill.alarm-active {
  background: var(--danger-soft);
  color: var(--danger-accessible-text);
}
.pill.alarm-ack {
  background: var(--warning-soft);
  color: var(--warning-accessible-text);
}
.pill.alarm-ok {
  background: var(--success-soft);
  color: var(--success-accessible-text);
}
.pill.alarm-muted {
  background: var(--inactive-soft);
  color: var(--text-secondary);
}

/* Sino do cabeçalho: cinza em repouso; amarelo quando os ativos já foram
   todos reconhecidos; vermelho (com pulso, regra existente) quando há ativo
   sem reconhecimento. */
.topbar-alarm-button.is-idle {
  color: var(--text-muted);
}
.topbar-alarm-button.has-ack-alarms {
  color: var(--warning-accessible-text);
  border-color: var(--warning);
}
.topbar-alarm-button.has-ack-alarms .topbar-alarm-badge {
  background: var(--warning);
  color: #3d2c00;
}

/* Chip de ação destrutiva na toolbar de alarmes. */
.alarm-chip-danger {
  color: var(--danger-accessible-text);
  border-color: var(--danger);
}
.alarm-chip-danger:hover {
  background: var(--danger-soft);
}

/* ============================================================
   Pontos monitorados — modos de visualização (tabela / pastas /
   classes). A árvore reaproveita as classes .htree* do histórico;
   aqui entram só o seletor de modo, as linhas de ponto enriquecidas
   e os cards de classe.
   ============================================================ */
.assets-view-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
.assets-view-switch-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.assets-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.assets-view-btn:hover {
  border-color: var(--line-strong);
  color: var(--text-primary);
}
.assets-view-btn.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-accessible-text);
}
.assets-view-btn span[aria-hidden] {
  display: inline-flex;
  align-items: center;
}
.assets-view-btn svg {
  display: block;
}

/* Legenda de eixos do gráfico histórico com escala dupla: chips coloridos
   vinculando cada variável ao seu lado (esquerda/direita). */
.history-axis-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 10px 6px;
}
.history-axis-legend-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.history-axis-legend-side.is-right {
  margin-left: auto;
  justify-content: flex-end;
}
.history-axis-legend-caption {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}
.history-axis-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.history-axis-legend-chip i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  flex: 0 0 auto;
}

/* Placeholder "vivo" da barra global do topo: troca de mensagem com fade. */
#globalAiCommandInput::placeholder {
  opacity: 1;
  transition: opacity 0.26s ease;
}
#globalAiCommandInput.is-placeholder-fading::placeholder {
  opacity: 0;
}

.assets-view-shell {
  padding: 0;
}
.assets-view-scroll {
  /* Preenche a linha disponível do card (que já tem altura fixa vinda de
     .table-screen), então recolher pastas continua não encolhendo a janela.
     Antes usava min(680px, 72vh) fixo: quando a área útil era menor que isso,
     a caixa passava do container (que tem overflow: hidden) e o fim da lista
     ficava cortado, sem scroll pra alcançar. */
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 14px 16px;
}

/* O shell da visualização agrupada não tem rodapé de paginação, então a única
   linha do grid precisa poder encolher — sem isso o conteúdo empurra a altura. */
.assets-view-shell {
  grid-template-rows: minmax(0, 1fr);
}

/* Cabeçalho de colunas das visualizações agrupadas (fixo no topo do scroll). */
.assets-view-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 8px 30px;
  margin: 0 -2px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.assets-view-header-main {
  flex: 1 1 auto;
  min-width: 0;
}
.assets-view-header-meta .assets-point-cell {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  /* Títulos alinhados à esquerda, na mesma borda do conteúdo das linhas
     (antes centralizados, ficavam deslocados em relação aos valores). */
  text-align: left;
}
.assets-view-header-meta .assets-point-status {
  justify-content: flex-start;
}
/* Ferramentas das visualizações agrupadas dentro da toolbar do card. */
.assets-view-inline-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.assets-selection-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-accessible-text);
}
.assets-view-empty,
.assets-view-hint {
  padding: 18px 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.assets-view-hint {
  padding: 4px 2px 10px;
}

/* Linha de ponto das visualizações agrupadas: nome à esquerda, informações
   (valor, classe, atualização, status) à direita. */
.assets-point-leaf {
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 3px solid transparent;
  border-radius: 8px;
  /* Linhas achatadas: mais pontos visíveis por tela. */
  padding: 1px 8px 1px 26px;
}
.assets-point-main {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  flex: 1 1 auto;
}
.assets-point-name {
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.2;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.assets-point-tag,
.assets-point-desc {
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Estrutura da tela Classes: Equipamento e Ponto viram COLUNAS próprias,
   alinhadas com os títulos do cabeçalho (que ordenam ao serem clicados). */
.assets-point-main.is-columns,
.assets-view-header-main.is-columns {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.assets-point-col {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
/* Largura fixa no Equipamento (as tags são curtas) para o Ponto começar logo
   ao lado, em vez de na metade do espaço livre. O cabeçalho usa as mesmas
   classes, então as duas colunas continuam alinhadas com as linhas. */
.assets-point-col.assets-point-equipment {
  flex: 0 0 160px;
}
.assets-point-col.assets-point-point {
  flex: 1 1 auto;
}
.assets-point-main .assets-point-equipment {
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.2;
  color: var(--text-primary);
}
.assets-point-main .assets-point-point {
  font-size: 0.76rem;
  line-height: 1.2;
  color: var(--text-secondary);
}

/* Títulos que ordenam: parecem cabeçalho, não botão. */
.assets-view-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  min-height: 0;
  min-width: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.assets-view-sort:hover {
  color: var(--text-primary);
  text-decoration: underline;
}
.assets-view-sort.is-active {
  color: var(--primary-accessible-text);
}
.assets-view-sort-arrow {
  font-size: 0.6rem;
  line-height: 1;
}
/* O cabeçalho da classe começa onde começa o texto das linhas (recuo da
   linha + caixa de marcação + espaçamento). */
.assets-class-children .assets-view-header.is-sortable {
  padding-left: 50px;
}

/* Regras da classe como "chips" na linha abaixo do nome (sem cartão). */
.assets-class-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}
.assets-class-meta-row small {
  flex: 0 0 auto;
}
.class-rule-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 1px 8px;
  margin: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.7rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 0;
  min-width: 0;
}
button.class-rule-chip {
  cursor: pointer;
}
button.class-rule-chip:hover {
  color: var(--text-primary);
  border-color: var(--primary);
}
.class-rule-chip.is-inactive {
  border-left-color: var(--text-muted);
  opacity: 0.75;
}
.class-rule-chip.has-alarms {
  border-left-color: var(--danger);
}
.class-rule-chip.is-empty {
  border-left-color: var(--warning);
  color: var(--text-muted);
}

/* Filtro rápido Todas / Com regra / Sem regra na toolbar do modo Estrutura. */
.assets-rule-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.assets-rule-filter .filter-chip {
  min-width: 0;
  padding: 5px 10px;
  font-size: 0.72rem;
}
/* No celular os três chips não cabem ao lado de Expandir/Recolher e saíam da
   caixa do card. Somem daqui; a mesma escolha (Todas / Com regra / Sem regra)
   continua no popup "Filtros", que lê o mesmo ui.filter. */
@media (max-width: 768px) {
  .assets-rule-filter {
    display: none;
  }
}

/* Pontos monitorados, Estrutura: "Até Pavimento / Ambiente / Equipamento" abre
   a árvore só até aquele nível. */
.assets-level-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.assets-level-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 2px 0 4px;
}
.assets-level-filter .filter-chip {
  min-width: 0;
  padding: 5px 10px;
  font-size: 0.72rem;
}
/* No celular a coluna da toolbar é dimensionada pelo conteúdo numa linha só
   (max-content), então qualquer chip a mais estoura a caixa — foi o que
   aconteceu com os chips de regra. Por isso o grupo aparece numa barra própria,
   logo abaixo da toolbar, e some de dentro dela. No computador é o inverso. */
.assets-level-bar {
  display: none;
}
@media (max-width: 768px) {
  .table-toolbar .assets-level-filter {
    display: none;
  }
  .assets-level-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 0 12px 10px;
  }
  .assets-level-bar .assets-level-filter {
    flex-wrap: wrap;
  }
}

/* Rodapé do editor em modo criação: pode ter mais de uma ação. */
.editor-create-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Sem ação declarada o span fica vazio; escondê-lo evita um vão no rodapé. */
.editor-create-actions:empty {
  display: none;
}

/* Computador: as ações da classe (pontos e regras) ficam numa linha própria
   em cima, para "Excluir" e "Salvar alterações" não serem espremidos em duas
   linhas de texto quando a classe tem várias regras. */
@media (min-width: 769px) {
  .editor-footer .editor-actions {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .editor-footer .editor-actions .editor-create-actions {
    order: -1;
    flex: 1 1 100%;
    justify-content: flex-start;
  }
}

/* Celular: "Adicionar pontos" toma a linha de cima (onde o Excluir ficava) e o
   Excluir desce menor, ao lado de "Salvar alterações" - a ação do dia a dia
   fica grande e a destrutiva, pequena. */
@media (max-width: 768px) {
  .editor-footer .editor-actions {
    flex-wrap: wrap !important;
  }

  .editor-footer .editor-actions .editor-create-actions {
    order: 1;
    flex: 1 1 100%;
    width: 100%;
  }

  .editor-footer .editor-actions .editor-create-actions .editor-create-action {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
    min-height: 44px;
    font-weight: 600;
  }

  /* Classe com várias regras rende três ou mais botões; aí eles vão de dois em
     dois, senão o rodapé come a altura do formulário. */
  .editor-footer .editor-actions .editor-create-actions:has(> :nth-child(3)) .editor-create-action {
    flex: 1 1 calc(50% - 4px);
    width: auto;
    min-width: 0;
    white-space: normal;
    font-size: 0.78rem;
    padding: 8px 10px;
  }

  .editor-footer .editor-actions .editor-delete-button:not([hidden]) {
    order: 2;
    flex: 0 1 auto;
    width: auto;
    max-width: 44%;
    min-height: 40px;
    padding: 9px 10px;
    font-size: 0.78rem;
  }

  .editor-footer .editor-actions .primary-button {
    order: 3;
    flex: 1 1 auto;
    max-width: none;
  }
}

/* Popup de criação/edição de regra. */
.rule-editor-dialog {
  width: min(700px, 94vw);
}
.rule-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 640px) {
  .rule-editor-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Popup de escolha de pontos sem classe (rodapé da criação de classe). */
.editor-create-action {
  white-space: nowrap;
}
.class-points-picker-dialog {
  width: min(760px, 94vw);
  max-height: min(84vh, 760px);
}
.class-points-picker-body {
  display: grid;
  gap: 12px;
  min-height: 0;
}
.class-points-picker-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.class-points-picker-search {
  flex: 1 1 260px;
  min-width: 0;
}
.class-points-picker-count {
  font-size: 0.76rem;
  color: var(--text-muted);
}
.class-points-picker-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
/* Estrutura em arvore dentro do popup: bloco > andar > ambiente >
   equipamento > pontos, com caixa de marcacao em cada nivel. */
.class-points-picker-selectall {
  white-space: nowrap;
}
.class-points-picker-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}
.class-points-picker-tree {
  overflow: auto;
  max-height: 46vh;
  padding: 8px 10px;
}
.class-points-picker-folder .htree-label {
  font-weight: 600;
}
.class-points-picker-leaf {
  cursor: pointer;
  border-left: 3px solid transparent;
}
.class-points-picker-leaf.is-selected {
  background: var(--primary-soft);
  border-left-color: var(--primary);
}
.class-points-picker-leaf .htree-label-text {
  font-size: 0.82rem;
  color: var(--text-primary);
}
.class-points-picker-spacer {
  flex: 0 0 auto;
  width: 22px;
}
.class-points-picker-list .assets-point-check {
  margin: 0 2px;
}
/* No celular a arvore perde largura em cada nivel: recua menos e deixa a
   observacao de qual classe o ponto esta saindo cair para a linha de baixo,
   em vez de comer o nome do ponto. */
@media (max-width: 720px) {
  .class-points-picker-tree .htree-children {
    margin-left: 8px;
    padding-left: 6px;
  }
  .class-points-picker-tree .htree-label {
    flex-wrap: wrap;
  }
  .class-points-picker-tree .htree-label small {
    white-space: normal;
    flex: 1 1 100%;
  }
  .class-points-picker-tree {
    max-height: 42vh;
    padding: 6px;
  }
}
.class-points-picker-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Caixa de marcação do ponto (seleção para adicionar/mudar de classe). */
.assets-point-check {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.assets-point-selection-count {
  color: var(--text-primary);
}

.assets-class-assign {
  padding: 7px 14px;
  min-height: 32px;
  font-size: 0.78rem;
}
.assets-point-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}
/* Células tabuladas: larguras fixas para as colunas alinharem entre linhas
   (e com o cabeçalho), independentemente do recuo da árvore. */
.assets-point-cell {
  font-size: 0.74rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 0 auto;
}
.assets-point-value {
  font-weight: 700;
  color: var(--text-primary);
  width: 104px;
  text-align: left;
}
.assets-point-class {
  width: 140px;
}
.assets-point-updated {
  width: 148px;
  color: var(--text-muted);
}
.assets-point-status {
  width: 96px;
  display: inline-flex;
  justify-content: flex-start;
  overflow: visible;
}
/* Pill de status compacto (Ativo azul / Inativo cinza / Pausado âmbar). */
.assets-point-status .pill {
  font-size: 0.6rem;
  padding: 2px 8px;
}

/* Cores por estado do ponto: desabilitado (inativo) e pausado (sem
   monitoramento) destacados; selecionado sempre vence. */
.assets-point-leaf.is-disabled {
  background: var(--inactive-soft);
  border-left-color: var(--danger);
}
.assets-point-leaf.is-disabled .assets-point-name {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.assets-point-leaf.is-disabled .assets-point-value {
  color: var(--text-muted);
  font-weight: 600;
}
.assets-point-leaf.is-paused {
  background: var(--warning-soft);
  border-left-color: var(--warning);
}
.assets-point-leaf.is-selected,
.assets-point-leaf.is-disabled.is-selected,
.assets-point-leaf.is-paused.is-selected {
  background: var(--primary-soft);
  border-left-color: var(--primary);
}

/* Visualização por classe: um card recolhível por classe, "Sem classe"
   agrupa os pontos sem associação. */
.assets-class-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.assets-class-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-surface);
  overflow: hidden;
}
.assets-class-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--line);
}
.assets-class-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1 1 auto;
}
.assets-class-title strong {
  font-size: 0.9rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.assets-class-title small {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.assets-class-counts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}
.assets-class-total {
  font-size: 0.74rem;
  color: var(--text-muted);
}
.assets-class-group.is-unclassified .assets-class-head {
  border-left: 3px solid var(--warning);
}
.assets-class-children {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
}
.assets-class-children[hidden] {
  display: none;
}
.assets-class-children .assets-view-header {
  position: static;
  padding: 4px 8px 6px 30px;
  margin: 0;
  border-bottom: 1px dashed var(--line);
  background: transparent;
}
.assets-class-empty {
  padding: 10px 12px;
}

/* Pastas da estrutura e cabeçalhos de classe clicáveis (seleção). */
.assets-branch-row,
.assets-branch-row .htree-label {
  cursor: pointer;
}
.assets-class-head.is-selectable {
  cursor: pointer;
}
.assets-class-head.is-selectable:hover {
  background: var(--primary-soft);
}
.assets-class-group.is-selected {
  border-color: var(--primary);
}
.assets-class-group.is-selected .assets-class-head {
  background: var(--primary-soft);
}

/* Ecrãs estreitos: as informações do ponto quebram para baixo do nome e o
   cabeçalho de colunas deixa de fazer sentido. */
@media (max-width: 760px) {
  .assets-view-header {
    display: none;
  }
  .assets-point-leaf {
    flex-wrap: wrap;
  }
  .assets-point-meta {
    width: 100%;
    justify-content: flex-start;
    padding-left: 22px;
  }
  .assets-point-value,
  .assets-point-class,
  .assets-point-updated,
  .assets-point-status {
    width: auto;
    text-align: left;
  }
  /* Sem cabeçalho para alinhar, o Equipamento pode encolher e ficar colado
     no Ponto. */
  .assets-point-col.assets-point-equipment {
    flex: 0 1 auto;
    max-width: 45%;
  }
}

/* Pontos monitorados, visualização Estrutura em tela estreita (celular e
   tablet até 1024px, caso do Z Fold aberto): cada ponto cabe numa linha só e a
   lista rola para o lado, em vez de espremer o nome ("Es…") ou empilhar em
   quatro linhas. Vale só para a árvore desta tela (.assets-tree) - a
   Estrutura da tela Classes continua como estava. */
@media (max-width: 1024px) {
  .assets-view-scroll:has(.assets-tree) {
    overflow-x: auto;
  }

  /* Com a coluna do nome fixa, o cabeçalho flexível desalinharia das linhas. */
  .assets-view-scroll:has(.assets-tree) .assets-view-header {
    display: none;
  }

  .htree.assets-tree {
    min-width: max-content;
  }

  .assets-tree .assets-point-leaf {
    flex-wrap: nowrap;
  }

  /* Coluna do nome com largura fixa: é ela que faz valor, classe, hora e
     estado começarem no mesmo ponto em todas as linhas. 250px cobre até os
     nomes mais longos do sistema (39 caracteres). */
  .assets-tree .assets-point-main {
    flex: 0 0 250px;
    width: 250px;
  }

  /* A tag técnica repetiria o nome e roubaria a linha; fica só no modo Tabela. */
  .assets-tree .assets-point-tag,
  .assets-tree .assets-point-desc {
    display: none;
  }

  .assets-tree .assets-point-meta {
    width: auto;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding-left: 0;
  }

  .assets-tree .assets-point-value {
    width: 104px;
  }

  .assets-tree .assets-point-class {
    width: 140px;
  }

  .assets-tree .assets-point-updated {
    width: 148px;
  }

  .assets-tree .assets-point-status {
    width: 96px;
  }
}

/* Botão "Filtrar" da tela de Pontos monitorados: existe só no celular, onde a
   barra de busca do topo não aparece. No computador a busca continua sendo a
   barra global. */
.assets-mobile-filter-btn {
  display: none;
}
.assets-filter-dialog {
  width: min(520px, 94vw);
}

/* No celular todo .filter-modal vira folha colada no rodapé. Para este aqui
   isso é ruim: a caixa é curta e abre o teclado, então ela ficava lá embaixo,
   atrás do teclado e fora do campo de visão de quem acabou de tocar em
   "Filtrar", lá em cima. Este desce do topo. */
@media (max-width: 640px) {
  .assets-filter-modal {
    align-items: flex-start;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 12px;
  }

  .assets-filter-modal .assets-filter-dialog {
    width: 100%;
    max-height: calc(100dvh - 48px);
    border-radius: 24px;
    padding: 18px 16px;
  }
}
@media (max-width: 760px) {
  .assets-mobile-filter-btn {
    display: inline-flex;
    white-space: nowrap;
  }
  .assets-mobile-filter-btn.is-active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Grupo "Gráficos": gráfico X/Y de pontos (xyChart) — card
   ══════════════════════════════════════════════════════════════════════════ */
.dashboard-widget-card-shell > [data-dashboard-xy-chart-body],
.dashboard-widget-card-shell > [data-dashboard-samples-per-hour-body],
.dashboard-widget-card-shell > [data-dashboard-alarms-per-hour-body] {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.xy-chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px 12px;
}

.xy-chart-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* Escala de tempo fica à direita; o zoom, à esquerda. */
.xy-chart-toolbar-group.is-right {
  margin-left: auto;
}

.space-ranking-chip.xy-chart-toggle.is-on {
  background: var(--primary-soft, rgba(77, 163, 255, 0.16));
  border-color: var(--primary, #1f5a8b);
  color: var(--primary-accessible-text, #1f5a8b);
  font-weight: 700;
}

.xy-chart-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.xy-chart-plotly {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 200px;
  height: 100%;
}

/* Legenda de cada eixo Y girada 90 graus: ocupa uma faixa estreita ao lado do
   gráfico, com o texto correndo no sentido do eixo (de baixo pra cima à esquerda,
   de cima pra baixo à direita). */
.xy-chart-axis-legend {
  flex: 0 0 auto;
  writing-mode: vertical-rl;
  max-width: 34%;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 2px;
  font-size: 0.72rem;
  color: var(--text-secondary, #4b5563);
}

.xy-chart-axis-legend.is-left {
  transform: rotate(180deg);
}

/* Girada, a legenda escorreria pro pé do card: alinha o texto no início do
   gráfico (topo da área de plotagem) nos dois lados. */
.xy-chart-axis-legend.is-left .xy-chart-axis-legend-title,
.xy-chart-axis-legend.is-left .xy-chart-legend-item {
  justify-content: flex-end;
  text-align: end;
}

.xy-chart-axis-legend.is-right .xy-chart-axis-legend-title,
.xy-chart-axis-legend.is-right .xy-chart-legend-item {
  justify-content: flex-start;
  text-align: start;
}

.xy-chart-axis-legend-title {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
}

.xy-chart-legend-empty {
  font-size: 0.7rem;
  color: var(--text-muted, #9ca3af);
  font-style: italic;
}

.xy-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  padding: 2px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.xy-chart-legend-item:hover {
  background: var(--bg-muted, rgba(15, 42, 68, 0.06));
}

.xy-chart-legend-item.is-off {
  opacity: 0.45;
}

.xy-chart-legend-item.is-off .xy-chart-legend-swatch {
  border-color: currentColor;
}

.xy-chart-legend-eye {
  flex: none;
}

.xy-chart-legend-item > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  min-height: 0;
}

.xy-chart-legend-swatch {
  flex: none;
  display: inline-block;
  width: 20px;
  height: 0;
  border-top: var(--xy-swatch-width, 2px) var(--xy-swatch-style, solid) var(--xy-swatch-color, currentColor);
}

/* Dentro da legenda girada o mesmo traço vira uma linha vertical. */
.xy-chart-axis-legend .xy-chart-legend-swatch {
  width: 0;
  height: 20px;
  border-top: 0;
  border-left: var(--xy-swatch-width, 2px) var(--xy-swatch-style, solid) var(--xy-swatch-color, currentColor);
}

.is-card-compact .xy-chart-axis-legend {
  font-size: 0.68rem;
  gap: 8px;
}

@media (max-width: 860px) {
  .xy-chart-stage {
    flex-direction: column;
  }

  .xy-chart-axis-legend {
    writing-mode: horizontal-tb;
    transform: none;
    max-width: none;
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 2px 0;
  }

  .xy-chart-axis-legend.is-left {
    transform: none;
  }

  .xy-chart-axis-legend .xy-chart-legend-swatch {
    width: 20px;
    height: 0;
    border-left: 0;
    border-top: var(--xy-swatch-width, 2px) var(--xy-swatch-style, solid) var(--xy-swatch-color, currentColor);
  }

  .xy-chart-axis-legend-title {
    flex-basis: 100%;
  }

  .xy-chart-axis-legend.is-right {
    order: 3;
  }
}

/* ── xyChart: modal de configuração (árvore + séries) ── */
.xy-picker-general {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 10px 14px;
  align-items: end;
  flex: 0 0 auto;
}

.xy-picker-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.xy-picker-toggles .dashboard-widget-checkbox-row {
  padding: 6px 8px;
}

.xy-series-list {
  gap: 8px;
}

.xy-series-item {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.12));
  border-radius: 12px;
  background: var(--bg-surface, #fff);
}

.xy-series-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.xy-series-head .xy-chart-legend-swatch {
  width: 24px;
}

.xy-series-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 1px;
}

.xy-series-copy strong {
  font-size: 0.8rem;
  color: var(--text-primary, #0f2a44);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xy-series-copy strong small {
  font-weight: 600;
  color: var(--text-muted, #6b7280);
}

.xy-series-copy span {
  font-size: 0.7rem;
  color: var(--text-secondary, #4b5563);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xy-series-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.xy-series-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  color: var(--text-secondary, #4b5563);
}

.xy-series-controls select,
.xy-series-controls input[type="number"] {
  font-size: 0.74rem;
  padding: 3px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.16));
  background: var(--bg-surface, #fff);
  color: var(--text-primary, #0f2a44);
}

.xy-series-controls input[type="number"] {
  width: 58px;
}

.xy-series-controls input[type="color"] {
  width: 30px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.16));
  border-radius: 6px;
  background: none;
  cursor: pointer;
}

@media (max-width: 860px) {
  .xy-picker-general {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Barras por hora (leituras do sistema / alarmes)
   ══════════════════════════════════════════════════════════════════════════ */
.hourly-bars-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px 10px;
}

.hourly-bars-nav {
  display: flex;
  gap: 6px;
  order: -1;
}

.hourly-bars-nav:empty {
  display: none;
}

/* .space-ranking-chip define display, então [hidden] sozinho não esconde. */
.hourly-bars-nav .space-ranking-chip[hidden] {
  display: none;
}

.hourly-bars-nav .space-ranking-chip:disabled {
  opacity: 0.45;
  cursor: default;
}

.hourly-bars-range {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-primary, #0f2a44);
  white-space: nowrap;
}

.hourly-bars-hint {
  font-size: 0.68rem;
  color: var(--text-muted, #6b7280);
  margin-left: auto;
}

.hourly-bars-plotly {
  flex: 1 1 auto;
  min-height: 160px;
  height: 100%;
  cursor: grab;
}

.hourly-bars-plotly:active {
  cursor: grabbing;
}

.is-card-compact .hourly-bars-hint {
  display: none;
}

/* ══════════════════════════════════════════════════════════════════════════
   Rosquinha de alarmes — rosquinha + legenda HTML lado a lado
   ══════════════════════════════════════════════════════════════════════════ */
.dashboard-alarm-donut {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.dashboard-alarm-donut-plot {
  flex: 0 1 auto;
  height: 100%;
  min-height: 88px;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  /* Teto de largura: em card alto a rosquinha parava de deixar espaço pra
     legenda, que aparecia com os nomes cortados ("Fecha..."). */
  max-width: min(46%, 220px);
  width: auto;
}

.dashboard-alarm-donut-legend {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  align-content: center;
}

.dashboard-alarm-donut-legend-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-secondary, #4b5563);
  padding: 3px 6px;
  border-radius: 8px;
}

.dashboard-alarm-donut-legend-item:hover {
  background: var(--bg-muted, rgba(15, 42, 68, 0.05));
}

.dashboard-alarm-donut-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.dashboard-alarm-donut-legend-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-alarm-donut-legend-item strong {
  font-size: 0.8rem;
  color: var(--text-primary, #0f2a44);
  font-variant-numeric: tabular-nums;
}

.dashboard-alarm-donut-legend-item small {
  min-width: 34px;
  text-align: right;
  font-size: 0.68rem;
  color: var(--text-muted, #6b7280);
  font-variant-numeric: tabular-nums;
}

.is-card-tiny .dashboard-alarm-donut-legend-item {
  font-size: 0.68rem;
  padding: 1px 4px;
  gap: 6px;
}

/* ══════════════════════════════════════════════════════════════════════════
   Grupo "Clima": mapa de chuva (radar), nuvens (satélite) e vento — Leaflet
   ══════════════════════════════════════════════════════════════════════════ */
.dashboard-widget-card-shell > [data-dashboard-weather-map-body] {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.weather-map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.weather-map-time {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 500;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--tooltip-bg, #fff);
  color: var(--tooltip-text, #0f2a44);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow);
}

.weather-map-time[hidden] {
  display: none;
}

.weather-map-time.is-forecast {
  color: var(--primary-accessible-text, #1f5a8b);
}

.weather-map-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 180px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-default, rgba(15, 42, 68, 0.1));
  background: var(--bg-soft, rgba(15, 42, 68, 0.04));
}

.weather-map-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.weather-map-canvas .dashboard-weather-empty {
  display: grid;
  place-items: center;
  height: 100%;
}

/* Fluxo do vento: <canvas> de partículas por cima do mapa (desenhado pelo JS). */
.weather-map-wind {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.weather-map-wind[hidden] {
  display: none;
}

/* Nuvens simuladas: manchas suaves que derivam no sentido do vento; a opacidade
   vem da cobertura de nuvens prevista (--cloud-opacity). */
.weather-map-clouds {
  position: absolute;
  inset: -45%;
  z-index: 2;
  pointer-events: none;
  opacity: var(--cloud-opacity, 0.4);
  background-image:
    radial-gradient(ellipse 120px 70px at 30% 40%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.55) 45%, transparent 70%),
    radial-gradient(ellipse 160px 90px at 75% 65%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.5) 45%, transparent 70%),
    radial-gradient(ellipse 100px 60px at 55% 15%, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.45) 45%, transparent 70%),
    radial-gradient(ellipse 140px 80px at 15% 80%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.5) 45%, transparent 70%);
  background-size: 420px 300px;
  transform: rotate(var(--wind-rotate, 0deg));
  animation: weather-map-cloud-drift var(--cloud-duration, 60s) linear infinite;
  filter: blur(9px);
}

:root[data-theme="dark"] .weather-map-clouds {
  /* No claro, branco puro sobre mapa claro já é discreto (o pedido original era
     até "mal dá pra ver"). No escuro, o mesmo branco contra o mapa escuro tinha
     contraste muito mais alto, e o filtro antigo (blur MENOR que o do claro,
     9px->6px) ainda deixava a borda mais nítida, piorando a sensação de mancha
     destacada. Aqui: opacidade geral reduzida (a dinâmica de --cloud-opacity
     por cobertura de nuvens continua, só com teto mais baixo), brilho bem mais
     baixo (branco vira cinza escuro) e blur maior que o do claro, pra manter a
     mesma discrição relativa nos dois temas. */
  opacity: calc(var(--cloud-opacity, 0.4) * 0.4);
  filter: blur(14px) brightness(0.5);
}

.weather-map-clouds[hidden] {
  display: none;
}

@keyframes weather-map-cloud-drift {
  from { background-position: 0 0; }
  to { background-position: 0 -300px; }
}

@keyframes weather-map-wind-flow {
  from { background-position: 0 0; }
  to { background-position: 0 -56px; }
}

.weather-map-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--tooltip-bg, #fff);
  color: var(--tooltip-text, #0f2a44);
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.weather-map-badge[hidden] {
  display: none;
}

.weather-map-rain {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 44px;
  flex: 0 0 auto;
}

.weather-map-rain:empty {
  display: none;
}

.weather-map-rain-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
  margin-right: 4px;
}

.weather-map-rain-bar {
  flex: 1 1 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: end;
  justify-items: center;
  gap: 2px;
  font-size: 0.58rem;
  color: var(--text-muted, #6b7280);
}

.weather-map-rain-bar i {
  display: block;
  width: 100%;
  border-radius: 3px 3px 0 0;
  background: var(--primary, #1f5a8b);
  opacity: 0.7;
}

.weather-map-rain-bar small {
  height: 10px;
  line-height: 10px;
}

.weather-map-note {
  margin: 0;
  font-size: 0.62rem;
}

.is-card-compact .weather-map-rain,
.is-card-compact .weather-map-note {
  display: none;
}

/* Leaflet dentro do tema */
.weather-map-canvas.leaflet-container {
  font-family: inherit;
  background: var(--bg-soft, rgba(15, 42, 68, 0.04));
}

/* Tema escuro: não existe servidor de tiles escuro sem chave, então os tiles
   do OpenStreetMap são invertidos por CSS (só o mapa base; radar e marcador
   ficam como estão). */
.weather-map-canvas.is-dark .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.82) contrast(0.92) saturate(0.7);
}

.weather-map-canvas.is-satellite .leaflet-tile-pane {
  filter: none;
}

.weather-map-canvas.is-dark .leaflet-tile-pane .leaflet-layer:not(:first-child) {
  filter: invert(1) hue-rotate(180deg) brightness(1.2) contrast(1.1) saturate(1.4);
}

.weather-map-canvas .leaflet-control-attribution {
  font-size: 9px;
  background: rgba(255, 255, 255, 0.7);
}

:root[data-theme="dark"] .weather-map-canvas .leaflet-control-attribution {
  background: rgba(15, 23, 42, 0.7);
  color: #cbd5e1;
}

:root[data-theme="dark"] .weather-map-canvas .leaflet-control-attribution a {
  color: #93c5fd;
}

.weather-map-canvas .leaflet-tooltip {
  font-size: 0.72rem;
  font-weight: 600;
}

/* ===== Tópicos do Broker (Administração) ===== */
.broker-topics-screen {
  display: grid;
  gap: 14px;
}

.broker-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.broker-summary-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--status-neutral, #8293a3);
  display: grid;
  gap: 2px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  color: inherit;
}

.broker-summary-card:hover { border-color: var(--border-strong); }
.broker-summary-card.is-active { box-shadow: 0 0 0 2px rgba(36, 192, 229, 0.35); }
.broker-summary-card.tone-ok { border-left-color: #1f9d55; }
.broker-summary-card.tone-critical { border-left-color: #d64545; }
.broker-summary-card.tone-warning { border-left-color: #e0a100; }
.broker-summary-card.tone-muted { border-left-color: #8293a3; }

.broker-summary-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
}

.broker-summary-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.broker-note {
  margin: -4px 4px 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.broker-select {
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  background: var(--bg-app);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.84rem;
  max-width: 240px;
}

.broker-point-read {
  width: 170px;
}

.broker-view-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.broker-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.broker-pending-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.broker-pending-summary.is-active {
  color: #8a6100;
  font-weight: 600;
}

:root[data-theme="dark"] .broker-pending-summary.is-active { color: #f2c667; }

.broker-selection-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.broker-selection-tools:empty { display: none; }

.broker-point-leaf.is-pending,
.broker-table tr.is-pending td {
  background: rgba(224, 161, 0, 0.08);
}

.broker-table tbody tr[data-broker-select] {
  cursor: pointer;
}

.broker-read-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.broker-folder-row {
  justify-content: space-between;
}

.broker-folder-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding-right: 8px;
}

.broker-folder-action {
  padding: 2px 10px;
  min-height: 26px;
  font-size: 0.74rem;
}

.broker-reason {
  display: block;
  color: #b23b3b;
  font-size: 0.74rem;
}

:root[data-theme="dark"] .broker-reason { color: #f08c8c; }

/* A tabela genérica dimensiona colunas por variáveis (--table-visible-slots);
   aqui as colunas têm largura própria pelo conteúdo. */
.broker-table {
  table-layout: auto;
  width: 100%;
  min-width: 100%;
}

.broker-table th,
.broker-table td {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  vertical-align: middle;
}

.broker-table th:first-child,
.broker-table td:first-child,
.broker-table th:nth-child(2),
.broker-table td:nth-child(2),
.broker-table th:nth-child(9),
.broker-table td:nth-child(9),
.broker-table th:last-child,
.broker-table td:last-child {
  white-space: nowrap;
}

.broker-table th:first-child,
.broker-table td:first-child {
  width: 36px !important;
}

.broker-pending-mark {
  color: #e0a100;
  font-weight: 700;
}

.broker-table .pill,
.broker-table th {
  white-space: nowrap;
}

.broker-table td:nth-child(3) {
  min-width: 240px !important;
}

.broker-table td:nth-child(3) .cell-title {
  word-break: break-word;
}

.broker-table tr.is-disabled-row .cell-title {
  color: var(--text-muted);
}

.nav-item-meta.is-alert {
  color: #d64545;
  font-weight: 600;
}

@media (max-width: 1180px) {
  .broker-point-read { width: 120px; }
  .broker-folder-tools { padding-right: 0; }
}

/* ===== Editor lateral: campos em grupos (tela Usuários) ===== */
.editor-group {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--border-default);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-surface) 92%, var(--bg-soft));
  min-width: 0;
}

.editor-group + .editor-group {
  margin-top: 2px;
}

.editor-group-title {
  display: grid;
  gap: 2px;
  padding: 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.editor-group-title small {
  font-weight: 400;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.editor-group-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  margin-top: 8px;
  min-width: 0;
}

.editor-group-grid [data-field-wrapper="phone"],
.editor-group-grid [data-field-wrapper="email"],
.editor-group-grid [data-field-wrapper="validation_code"],
.editor-group-grid [data-field-wrapper="group_ids"],
.editor-group-grid [data-field-wrapper="work_days"],
.editor-group-grid [data-field-wrapper="member_ids"] {
  grid-column: 1 / -1;
}

.editor-group-grid > .editor-inline-actions {
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: -2px;
}

.editor-group-grid > .editor-inline-actions .ghost-button {
  flex: 0 0 auto;
}

.editor-group-grid > .editor-inline-actions .ghost-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.editor-group-grid > .editor-inline-actions .editor-help {
  flex: 1 1 220px;
  min-width: 0;
}

.editor-group-grid [data-field-wrapper="work_days"] .editor-multiselect {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 4px 10px;
}

.editor-input[type="time"] {
  min-height: 40px;
}

@media (max-width: 760px) {
  .editor-group-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Cards do antigo popup de perfil que migraram para a tela Usuários (nome, turno, WhatsApp). */
#profileSettingsModal [data-legacy-profile-card] {
  display: none !important;
}

/* ── Monitoramento de equipamentos: configuração por classe/equipamento ── */
.dashboard-equipment-monitor-column-grid .dashboard-widget-field.is-class-field {
  grid-column: 1 / -1;
}
.dashboard-equipment-monitor-equipment-option {
  cursor: pointer;
}
.dashboard-equipment-monitor-equipment-option.is-partial .dashboard-widget-selection-copy span {
  color: var(--warning);
}
.dashboard-equipment-monitor-coverage {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.dashboard-equipment-monitor-coverage.is-full {
  color: var(--primary-accessible-text);
}
.equipment-monitor-name-copy .equipment-monitor-equipment-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}
.dashboard-manager-editbar [data-dashboard-layout-cancel] {
  white-space: nowrap;
}

/* ==========================================================================
   Mapa de chuva e vento no celular (10/09/2026)
   O card passou a ocupar a largura toda (2x4). A barra de ferramentas ainda
   quebrava em duas linhas e comia a altura do mapa: aqui ela vira uma linha só,
   com os botões menores, e o palco fica com o espaço que sobra.
   ========================================================================== */
@media (max-width: 768px) {
  .weather-map-toolbar {
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
  }
  .weather-map-toolbar .xy-chart-toolbar-group {
    display: flex;
    gap: 4px;
    min-width: 0;
  }
  .weather-map-toolbar .xy-chart-toolbar-group.is-right {
    margin-left: auto;
    flex: 0 0 auto;
  }
  .weather-map-toolbar .space-ranking-chip {
    padding: 5px 8px;
    font-size: 0.72rem;
    gap: 4px;
    white-space: nowrap;
  }
  .weather-map-toolbar .space-ranking-chip .space-ranking-chip-icon svg {
    width: 14px;
    height: 14px;
  }
  /* Zoom e "voltar ao site" viram botões quadrados de toque. */
  .weather-map-toolbar [data-weather-map-zoom],
  .weather-map-toolbar [data-weather-map-center] {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
  }
  .weather-map-stage {
    min-height: 150px;
  }
  /* Um dedo rola a página, dois mexem no mapa (weatherMapCooperativeGestures):
     o aviso do Leaflet não existe aqui, então a legenda diz a regra. */
  .weather-map-note {
    font-size: 0.68rem;
    line-height: 1.35;
  }
  /* O rótulo das barras de chuva é vertical (writing-mode) e cabia na altura de
     44 px do computador; no celular ele quebrava em três colunas de letras
     ("UVA / RÓXIMAS / ORAS"). Aqui ele volta a ser uma linha, acima das barras. */
  .weather-map-rain {
    flex-wrap: wrap;
    align-items: flex-end;
    height: auto;
    gap: 3px;
  }
  .weather-map-rain-title {
    writing-mode: horizontal-tb;
    transform: none;
    /* Linha inteira só para o rótulo; as 12 barras caem na linha de baixo. */
    flex: 1 0 100%;
    margin: 0 0 2px;
    font-size: 0.62rem;
  }
  .weather-map-rain-bar {
    height: 40px;
    min-width: 0;
  }
}

/* "Analisar período": leva o recorte da tela para o BMS Advisor. Destaca-se dos
   ghost-buttons vizinhos sem virar botão primário — fundo e traço da cor da
   marca, que o tema escuro já resolve pelas variáveis. */
/* No computador o botão fica ancorado no canto superior direito do cabeçalho,
   fora da faixa (dentro dela espremia Atualizar/Minimizar/Fechar). No celular
   ele volta ao fluxo e divide a linha com os ícones — ver mobile.css. */
.history-section-header {
  position: relative;
}
.history-section-actions .history-analyze-button {
  position: absolute;
  top: 0;
  right: 0;
}
.history-section-header > .history-section-actions {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
}
/* Ícone só existe no celular: no computador as ações continuam escritas. */
.history-section-actions .acao-icone {
  display: none;
}
.history-analyze-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}
.history-analyze-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}
.history-analyze-button:hover:not(:disabled) {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-dark, #fff);
}
.history-analyze-button:disabled {
  opacity: 0.55;
}

/* ===========================================================================
   Operação > Ações (11/09/2026)
   Cores sempre por variável de tema — o modo escuro vem de graça.
   =========================================================================== */
.actions-screen { display: flex; flex-direction: column; gap: 14px; }
.action-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.action-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.action-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px;
  border: 1px solid var(--border-default); border-radius: 999px; background: var(--bg-surface);
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-secondary); cursor: pointer;
}
.action-chip.is-on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.action-new { margin-left: auto; }
.action-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.action-column { background: var(--bg-soft); border-radius: 16px; padding: 11px; min-height: 160px; }
.action-column-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 9px; }
.action-column-head b { font-size: 13px; color: var(--text-primary); }
.action-column-head span {
  font-size: 11px; font-weight: 800; color: var(--text-secondary);
  background: var(--bg-surface); border-radius: 999px; padding: 2px 9px;
}
.action-column-empty { padding: 10px 4px; font-size: 12px; color: var(--text-muted); }
.action-list { display: flex; flex-direction: column; gap: 9px; }
.action-group {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-muted); margin: 6px 2px 0;
}
.action-card {
  background: var(--bg-surface); border: 1px solid var(--border-default); border-left: 3px solid var(--border-strong);
  border-radius: 13px; padding: 11px 12px; margin-bottom: 9px; cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease;
}
.action-card:hover { transform: translateY(-1px); border-color: var(--primary); }
.action-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.action-card.is-alta { border-left-color: var(--danger); }
.action-card.is-media { border-left-color: var(--warning); }
.action-card.is-baixa { border-left-color: var(--border-strong); }
.action-card.is-done { opacity: 0.72; }
.action-card h4 { margin: 0 0 6px; font-size: 13.5px; line-height: 1.3; color: var(--text-primary); overflow-wrap: anywhere; }
.action-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.action-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-soft); font-size: 10.5px; font-weight: 700; color: var(--text-secondary);
}
.action-tag.is-origin { background: var(--primary-soft); color: var(--primary); }
.action-tag.is-due.is-late { background: var(--danger-soft); color: var(--danger-accessible-text, var(--danger)); }
.action-tag.is-due.is-empty { font-style: italic; color: var(--text-muted); }
.action-who { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-secondary); }
.action-avatar {
  width: 20px; height: 20px; border-radius: 999px; background: var(--primary); color: var(--text-on-dark, #fff);
  font-size: 9.5px; font-weight: 800; display: grid; place-items: center;
}
.action-empty { padding: 26px; text-align: center; font-size: 13px; color: var(--text-secondary); background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 16px; }
.action-empty.is-error { color: var(--danger); }
/* Formulário */
.action-form { display: flex; flex-direction: column; gap: 12px; }
.action-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.action-form-grid:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.action-form-footer { display: flex; align-items: center; gap: 8px; }
.action-origin-box { padding: 10px 12px; border-radius: 12px; background: var(--bg-soft); font-size: 12px; color: var(--text-secondary); }
.action-origin-line { margin-top: 5px; overflow-wrap: anywhere; }
.action-origin-line b { color: var(--text-primary); }
/* Ação projetada no calendário: o prazo mora na ação, então aqui só se navega. */
.dashboard-calendar-tag.is-action { background: var(--primary-soft); color: var(--primary); cursor: pointer; }
.dashboard-calendar-tag.is-action.is-late { background: var(--danger-soft); color: var(--danger); }

/* Criar ação a partir de um alarme: destaque suave, sem competir com Reconhecer. */
.alarm-quick-chip.alarm-chip-action {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

/* Finalizar direto do card: alvo próprio, para não abrir a edição sem querer. */
.action-card { position: relative; }
.action-card .action-done {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-default);
  border-radius: 9px;
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.action-card .action-done svg { width: 16px; height: 16px; }
.action-card .action-done:hover {
  background: var(--success-soft, var(--primary-soft));
  border-color: var(--success, var(--primary));
  color: var(--success, var(--primary));
}
.action-card h4 { padding-right: 34px; }
.action-confirm { display: flex; flex-direction: column; gap: 8px; }
.action-confirm-question { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-primary); }
.action-confirm-target {
  margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--bg-soft);
  font-size: 13.5px; font-weight: 700; color: var(--text-primary);
}
.action-confirm-note { margin: 0 0 6px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }

/* Coluna Aviso na tabela de alarmes (12/09/2026). */
.alarm-notice { font-size: 0.8rem; line-height: 1.3; }
.alarm-notice.is-sent { color: var(--text); }
.alarm-notice.is-skipped, .alarm-notice.is-none, .alarm-notice.is-unknown { color: var(--muted); }
.alarm-notice.is-pending { color: var(--warning-accessible-text); }

/* Ações por equipe (12/09/2026): responsável em destaque, "você", só leitura. */
.action-line.is-primary { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.action-who.is-me { font-weight: 700; color: var(--primary); }
.action-who.is-me .action-avatar { background: var(--primary); color: #fff; }
.action-who.is-empty { color: var(--muted); font-style: italic; }
.action-who.is-empty .action-avatar { background: var(--bg-elevated); color: var(--muted); border: 1px dashed var(--line); }
.action-card.is-mine { border-left: 3px solid var(--primary); }
/* O botão ✓ é absoluto no canto superior direito: a primeira linha (responsável
   + prazo) reserva o espaço dele, senão "vence 15/09" fica por baixo (12/09/2026). */
.action-card.has-done .action-line.is-primary { padding-right: 40px; }
.action-assignee-fixed { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elevated); }
.action-assignee-fixed .action-avatar { width: 32px; height: 32px; font-size: 0.8rem; }
.action-assignee-fixed div { display: grid; gap: 2px; }
.action-assignee-fixed small { color: var(--muted); font-size: 0.76rem; }
.action-form.is-readonly .text-input, .action-form.is-readonly .editor-textarea { opacity: 0.75; }
.action-readonly-note { font-size: 0.78rem; color: var(--muted); align-self: center; margin-right: 8px; }

/* "+ Ação" num alarme que já tem ação: lista das existentes (12/09/2026). */
.action-existing-list { display: grid; gap: 8px; margin: 10px 0; }
.action-existing-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elevated); }
.action-existing-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.action-existing-main b { font-size: 0.9rem; color: var(--text); overflow-wrap: anywhere; }
.action-existing-main small { font-size: 0.76rem; color: var(--muted); }

/* Convite de WhatsApp na tela de Usuários (15/09/2026). */
.contact-invite-button { margin-left: 6px; padding: 2px 10px; font-size: 0.74rem; }
.access-request-banner { display: grid; gap: 8px; padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--warning); border-radius: 12px; background: var(--warning-soft); }
.access-request-banner h4 { margin: 0; font-size: 0.9rem; color: var(--text); }
.access-request-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 0.82rem; color: var(--text); }
.access-request-row b { font-weight: 700; }
.access-request-row small { color: var(--muted); overflow-wrap: anywhere; }
.access-request-row .ghost-button { margin-left: auto; padding: 2px 10px; font-size: 0.74rem; }

/* =====================================================================
   Financeiro — Visão geral, sub-páginas e Configurações "com cara de site"
   (15/09/2026). Abas em linha (estilo OpenRouter/Claude), cartões KPI,
   seções com cabeçalho + ação à direita, e Configurações em linhas
   "título · resumo | botão" cujo painel abre embaixo da linha.
   ===================================================================== */
.billing-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.billing-tabs::-webkit-scrollbar { display: none; }
.billing-tab {
  flex: 0 0 auto;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 10px 14px 11px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.billing-tab:hover { color: var(--text-primary); }
.billing-tab.is-active {
  color: var(--primary-accessible-text);
  border-bottom-color: var(--primary);
}

/* Sistema de Suporte (29/09/2026) — reaproveita .billing-screen/.billing-tabs
   como casca; só os campos de formulário e a lista de chamados são novos. */
.support-tab-body { min-width: 0; }

/* Cartão centralizado (25/09/2026 → refeito em 29/09/2026: o formulário
   nascia como campos soltos no canto superior esquerdo, boiando numa área
   vazia enorme — sem cartão, sem centralização, sem hierarquia visual). */
.support-form-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 24px;
}
.support-form-card {
  width: 100%;
  max-width: 640px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 18px;
  padding: 28px 30px 30px;
  box-shadow: var(--shadow-soft);
}
.support-form-intro {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0 0 24px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--border-default);
}
.support-form-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
}
.support-form-icon svg { width: 22px; height: 22px; fill: currentColor; }
.support-form-intro-copy strong {
  display: block;
  font-size: 1.05rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.support-form-intro-copy p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.support-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.support-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.support-field input,
.support-field textarea {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-soft);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 11px 13px;
  resize: vertical;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.support-field input:hover,
.support-field textarea:hover { border-color: var(--primary); }
.support-field input:focus,
.support-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.support-context-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-soft);
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-secondary);
}
.support-context-hint svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  fill: currentColor;
  opacity: 0.75;
}
.support-context-hint strong { color: var(--text-primary); font-weight: 600; }
.support-submit {
  align-self: flex-start;
  padding-left: 26px;
  padding-right: 26px;
}
@media (max-width: 600px) {
  .support-form-card { padding: 22px 18px 24px; }
  .support-submit { align-self: stretch; }
}
.support-ticket-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 860px;
}
.support-ticket-row {
  border: 1px solid var(--border-default);
  border-radius: 14px;
  box-shadow: var(--shadow-color-soft) 0 2px 10px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  background: var(--bg-surface);
  overflow: hidden;
}
.support-ticket-row:hover,
.support-ticket-row.is-expanded {
  border-color: var(--primary);
  box-shadow: var(--shadow-color-soft) 0 4px 16px;
}
.support-ticket-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.support-ticket-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.support-ticket-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.support-ticket-desc {
  margin: 4px 0 0;
  font-size: 0.86rem;
  color: var(--text-primary);
  white-space: pre-wrap;
}
.support-ticket-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.support-status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.support-status-pill.is-aberto { background: var(--warning-soft, rgba(240, 173, 78, 0.18)); color: var(--warning-accessible-text, var(--text-primary)); }
.support-status-pill.is-em_analise { background: var(--primary-soft); color: var(--primary-accessible-text); }
.support-status-pill.is-resolvido { background: var(--success-soft, rgba(70, 180, 120, 0.18)); color: var(--success-accessible-text, var(--text-primary)); }
.support-ticket-chevron {
  color: var(--text-secondary);
  font-size: 0.8rem;
}
.support-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 18px 18px;
  border-top: 1px solid var(--border-default);
  margin-top: 2px;
  padding-top: 14px;
}
.support-status-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg-soft);
}
.support-status-editor select,
.support-status-editor textarea {
  font: inherit;
  font-size: 0.86rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 7px 10px;
  resize: vertical;
}
.support-status-save { align-self: flex-start; padding-left: 18px; padding-right: 18px; }
.support-thread-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.support-message {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--bg-soft);
}
.support-message.is-admin {
  align-self: flex-end;
  background: var(--primary-soft);
}
.support-message-meta {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 3px;
}
.support-message-body {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-primary);
  white-space: pre-wrap;
}
.support-reply-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.support-reply-form textarea {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-size: 0.86rem;
  color: var(--text-primary);
  background: var(--bg-soft);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 8px 10px;
  resize: vertical;
}
.support-admin-filter { margin: 0 0 12px; }
.support-admin-filter select {
  font: inherit;
  font-size: 0.86rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 6px 10px;
}

/* Botões inline: nunca esticam pra largura toda (era a queixa da tela antiga). */
.billing-screen .billing-inline-button {
  width: auto;
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 7px 14px;
  font-size: 0.82rem;
  line-height: 1.2;
  text-decoration: none;
}
.billing-screen .billing-inline-button + .billing-inline-button { margin-left: 8px; }

.billing-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.billing-kpi {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.billing-kpi.is-primary { border-color: color-mix(in srgb, var(--primary) 36%, var(--line)); background-image: linear-gradient(180deg, color-mix(in srgb, var(--primary) 7%, transparent), transparent 70%); }
.billing-kpi.is-warning { border-color: var(--warning); background: var(--warning-soft); }
.billing-kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.billing-kpi-icon { color: var(--text-muted); font-size: 0.95rem; }
.billing-kpi-value {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.15;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 0;
}
.billing-kpi.is-primary .billing-kpi-value { color: var(--primary-accessible-text); }
.billing-kpi-model { display: inline-flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.billing-kpi-sub { margin: 0; font-size: 0.78rem; color: var(--muted); line-height: 1.35; }
.billing-kpi-warning { color: var(--warning-accessible-text); font-weight: 700; }
.billing-kpi-action { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.billing-meter.is-thin { height: 6px; margin: 6px 0 4px; }

.billing-model-logo {
  --size: 22px;
  width: var(--size);
  height: var(--size);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  vertical-align: middle;
}
.billing-model-logo img { width: 62%; height: 62%; object-fit: contain; }
.billing-model-logo.is-generic { background: var(--primary-soft); color: var(--primary-accessible-text); font-size: calc(var(--size) * 0.55); }

.billing-section { margin-bottom: 18px; }
.billing-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.billing-section-head h3 { margin: 0; }
.billing-section-head p { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted); }
.billing-section h4,
.billing-overview-ai h4,
.billing-overview-equipment h4 {
  margin: 0 0 8px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.billing-overview-ai-numbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px 24px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.billing-overview-ai-numbers .billing-hero-number { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
.billing-hero-number.is-money { color: var(--success-accessible-text, var(--success)); }
.billing-hero-number.is-small { font-size: 1.4rem; }
.billing-hero-money {
  margin-top: 2px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--success-accessible-text, var(--success));
  font-variant-numeric: tabular-nums;
}
.billing-overview-ai-body,
.billing-overview-equipment {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 860px) {
  .billing-overview-ai-body,
  .billing-overview-equipment { grid-template-columns: 1fr; }
}
.billing-cost-note { margin: 12px 0 0; font-size: 0.72rem; color: var(--muted); line-height: 1.35; }

.billing-model-rows { display: grid; gap: 6px; }
.billing-model-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) minmax(0, 1.3fr) minmax(60px, 0.9fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
}
.billing-model-row:last-child { border-bottom: none; }
.billing-model-rows.is-compact .billing-model-row { grid-template-columns: minmax(100px, 1fr) auto; }
.billing-model-rows.is-compact .billing-model-row-tokens { grid-column: 1; font-size: 0.72rem; margin-top: -4px; }
.billing-model-rows.is-compact .billing-model-row-bar { display: none; }
.billing-model-rows.is-compact .billing-model-row-cost { grid-row: 1 / span 2; }
.billing-model-row-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--text); font-weight: 600; }
.billing-model-row-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.billing-model-row-label small { color: var(--warning-accessible-text); font-weight: 700; }
.billing-model-row-tokens { color: var(--muted); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.billing-model-row-bar { display: block; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--line) 68%, transparent); overflow: hidden; }
.billing-model-row-bar span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.billing-model-row-cost { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.billing-user-cost { color: var(--muted); font-weight: 500; font-size: 0.78rem; margin-left: 4px; }

.billing-top-groups { display: grid; gap: 4px; }
.billing-top-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
}
.billing-top-group:last-child { border-bottom: none; }
.billing-top-group-label { display: grid; min-width: 0; color: var(--text); font-weight: 600; }
.billing-top-group-label small { color: var(--muted); font-weight: 500; font-size: 0.74rem; }
.billing-top-group strong { font-variant-numeric: tabular-nums; white-space: nowrap; }

.billing-subpage-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
}
.billing-subpage-head h3 { margin: 0; }
.billing-subpage-head p { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted); }
.billing-back-link {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.billing-back-link:hover { color: var(--primary-accessible-text); border-color: var(--primary); }

.billing-layout-side { display: grid; gap: 16px; align-content: start; }

.billing-invoice-rows { display: grid; }
.billing-invoice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
}
.billing-invoice-row:last-child { border-bottom: none; }
.billing-invoice-period { display: grid; min-width: 0; }
.billing-invoice-period strong { color: var(--text); }
.billing-invoice-period span { color: var(--muted); font-size: 0.78rem; }
.billing-invoice-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.billing-invoice-nopdf { font-size: 0.74rem; color: var(--muted); }
@media (max-width: 640px) {
  .billing-invoice-row { grid-template-columns: minmax(0, 1fr) auto; }
  .billing-invoice-row .nav-item-meta { grid-column: 1; }
  .billing-invoice-row .billing-invoice-download { grid-column: 2; justify-self: end; }
}

/* Configurações */
.billing-settings {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .billing-settings { grid-template-columns: 1fr; gap: 12px; }
}
.billing-settings-nav {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
@media (max-width: 900px) {
  .billing-settings-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
}
.billing-settings-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}
.billing-settings-nav a:hover { background: var(--table-row-hover); color: var(--text-primary); }
.billing-settings-sections { display: grid; gap: 26px; min-width: 0; }
.billing-settings-section > header { margin-bottom: 10px; }
.billing-settings-section > header h3 { margin: 0; font-size: 1.05rem; }
.billing-settings-section > header p { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted); }
.billing-settings-card { padding: 4px 20px; }
.billing-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.billing-settings-card > .billing-settings-row:last-child,
.billing-settings-card > .billing-settings-panel:last-child { border-bottom: none; }
.billing-settings-row-copy { display: grid; gap: 3px; min-width: 0; }
.billing-settings-row-copy strong { color: var(--text); font-size: 0.92rem; }
.billing-settings-row-copy span { color: var(--muted); font-size: 0.82rem; line-height: 1.4; overflow-wrap: anywhere; }
.billing-settings-row-copy small { font-size: 0.74rem; }
.billing-settings-model { display: inline-flex; align-items: center; gap: 6px; }
.billing-settings-row-control { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.billing-settings-row-control .billing-inline-button + .billing-inline-button { margin-left: 0; }
@media (max-width: 640px) {
  .billing-settings-row { flex-direction: column; align-items: stretch; }
  .billing-settings-row-control { justify-content: flex-start; }
  .billing-settings-card { padding: 4px 16px; }
}
.billing-settings-panel {
  padding: 4px 0 18px;
  border-bottom: 1px solid var(--line);
  animation: billing-panel-in 0.18s ease;
}
@keyframes billing-panel-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.billing-settings-panel .billing-limits-save { width: auto; }
.billing-settings-panel .billing-limits-grid { margin-top: 6px; }
.billing-settings-panel .ai-model-options { margin-top: 12px; }
.billing-settings-panel .billing-client-fields .ghost-button { grid-column: auto; width: auto; }
.billing-settings-panel .billing-client-fields { grid-template-columns: 1fr 1fr auto; }
@media (max-width: 640px) {
  .billing-settings-panel .billing-client-fields { grid-template-columns: 1fr 1fr; }
  .billing-settings-panel .billing-client-fields .ghost-button { grid-column: 1 / -1; }
}
.billing-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.billing-panel-actions .primary-button,
.billing-panel-actions .ghost-button { width: auto; }
.billing-settings-panel .billing-recipient-list { margin-top: 4px; }

/* =====================================================================
   Vínculo de Equipamentos — seleção múltipla (15/09/2026)
   ===================================================================== */
.eqgroup-screen { display: grid; gap: 12px; }
.eqgroup-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.eqgroup-selection-bar.has-selection {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  background: color-mix(in srgb, var(--primary) 6%, var(--bg-surface));
}
.eqgroup-selection-copy { display: grid; gap: 2px; min-width: 0; }
.eqgroup-selection-copy strong { font-size: 0.88rem; color: var(--text); }
.eqgroup-selection-copy small { font-size: 0.72rem; color: var(--text-muted); }
.eqgroup-selection-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eqgroup-selection-actions .primary-button,
.eqgroup-selection-actions .ghost-button { width: auto; padding: 7px 12px; font-size: 0.8rem; }
.eqgroup-selection-actions button:disabled { opacity: 0.5; cursor: not-allowed; }
.eqgroup-selection-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-secondary); }
.eqgroup-selection-link select {
  font: inherit;
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--text);
  max-width: 240px;
}
.eqgroup-check {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 0 2px 0 0;
  cursor: pointer;
  accent-color: var(--primary);
}
.eqgroup-check-space { margin-left: 2px; }
.htree-leaf { padding-left: 22px; }
.htree-leaf.is-selected {
  background: color-mix(in srgb, var(--primary) 14%, var(--bg-surface));
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 45%, transparent);
}
.htree-leaf.is-selected .htree-label-text { font-weight: 600; }
.htree-row.is-partially-selected > .htree-label .htree-label-text { color: var(--primary-accessible-text); font-weight: 600; }
.htree-row-draggable { cursor: grab; }
.eqgroup-drag-handle {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0 4px;
  opacity: 0.45;
  cursor: grab;
}
.htree-row:hover .eqgroup-drag-handle { opacity: 1; }
.eqgroup-drag-ghost {
  position: fixed;
  top: -1000px;
  left: -1000px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font: 600 0.8rem/1.2 system-ui, sans-serif;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999;
}
.history-builder-staging.has-selection .eqgroup-drop-target { cursor: pointer; border-style: solid; border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.history-builder-staging.has-selection .eqgroup-drop-target:hover { background: var(--primary-soft); border-color: var(--primary); }
.eqgroup-screen.is-dragging .eqgroup-drop-target { border-color: color-mix(in srgb, var(--primary) 55%, var(--line)); }
.history-staging-head small { display: block; font-weight: 500; font-size: 0.72rem; color: var(--text-muted); }

/* =====================================================================
   Tela Clientes (Administração, conta global) — cliente → prédios, e o
   formulário compartilhado com o atalho de Tópicos do Broker. 15/09/2026.
   ===================================================================== */
.clientsadm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.clientsadm-toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.clientsadm-inline-button { width: auto; flex: 0 0 auto; white-space: nowrap; padding: 7px 14px; font-size: 0.82rem; }
.clientsadm-list { display: grid; gap: 14px; }
.clientsadm-card { padding: 16px 18px; }
.clientsadm-card-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.clientsadm-toggle {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 8px;
  font-size: 0.8rem;
}
.clientsadm-card-copy { flex: 1 1 260px; min-width: 0; }
.clientsadm-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clientsadm-card-title strong { font-size: 1.02rem; color: var(--text); }
.clientsadm-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
}
.clientsadm-card-sub { margin: 4px 0 0; font-size: 0.82rem; color: var(--muted); }
.clientsadm-alert { color: var(--warning-accessible-text); font-weight: 600; }
.clientsadm-card-actions { flex: 0 0 auto; display: flex; gap: 8px; flex-wrap: wrap; }
.clientsadm-sites { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.clientsadm-site-head,
.clientsadm-site-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.clientsadm-site-head {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding-bottom: 4px;
}
.clientsadm-site-row { border-top: 1px solid var(--line); }
.clientsadm-site-main { display: grid; min-width: 0; }
.clientsadm-site-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clientsadm-site-code { color: var(--muted); font-size: 0.74rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.clientsadm-site-meta { font-size: 0.8rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) {
  .clientsadm-site-head { display: none; }
  .clientsadm-site-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .clientsadm-site-row .clientsadm-site-meta:nth-of-type(2) { grid-column: 1; }
}
.clientsadm-unknown { margin-bottom: 14px; border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); }
.clientsadm-unknown-note { margin: 6px 0 12px; font-size: 0.82rem; color: var(--muted); }
.clientsadm-unknown-list { display: grid; gap: 8px; }
.clientsadm-unknown-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Popup de cliente/prédio — o mesmo nas duas telas. */
.clientsadm-modal { position: fixed; inset: 0; z-index: 9200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.clientsadm-modal[hidden] { display: none; }
.clientsadm-modal-backdrop { position: absolute; inset: 0; background: var(--bg-overlay); backdrop-filter: blur(3px); }
.clientsadm-modal-dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 60px var(--shadow-color);
  overflow: hidden;
}
.clientsadm-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
}
.clientsadm-modal-head h3 { margin: 2px 0 0; }
.clientsadm-modal-body { padding: 16px 20px; overflow-y: auto; display: grid; gap: 14px; }
.clientsadm-modal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.clientsadm-field { display: grid; gap: 5px; min-width: 0; }
.clientsadm-field > span { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.clientsadm-req { font-style: normal; font-weight: 500; color: var(--muted); font-size: 0.72rem; }
.clientsadm-field input,
.clientsadm-field select,
.clientsadm-field textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--text);
}
.clientsadm-field textarea { resize: vertical; line-height: 1.45; font-size: 0.9rem; }
.clientsadm-field small { font-size: 0.74rem; color: var(--muted); line-height: 1.35; }
.clientsadm-field small code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; }
.clientsadm-modal-section { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 10px; }
.clientsadm-modal-section h4 { margin: 0; font-size: 0.86rem; }
.clientsadm-modal-note { margin: 0; font-size: 0.78rem; color: var(--muted); }
.clientsadm-modal-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger-accessible-text);
  font-size: 0.84rem;
}
.clientsadm-include-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--text);
  font-size: 0.84rem;
  cursor: pointer;
}
.clientsadm-include-row input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--primary); }
.clientsadm-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-surface);
}
.clientsadm-modal-foot-right { display: flex; gap: 8px; }
.clientsadm-modal-foot .ghost-button,
.clientsadm-modal-foot .primary-button { width: auto; }
.clientsadm-danger { color: var(--danger-accessible-text); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
body.has-clientsadm-modal { overflow: hidden; }

/* Faixa de clientes não cadastrados na tela Tópicos do Broker. */
.broker-unknown-clients { margin: 12px 0 0; border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); }
.broker-unknown-note { margin: 6px 0 12px; font-size: 0.82rem; color: var(--muted); }
.broker-unknown-list { display: grid; gap: 8px; }
.broker-unknown-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.broker-unknown-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning-accessible-text);
}
.broker-unknown-action { width: auto; flex: 0 0 auto; padding: 7px 14px; font-size: 0.82rem; }

/* Reiniciar leitura de um ramo (Tópicos do Broker, 15/09/2026): faixa de escuta
   com contagem regressiva enquanto os tópicos vivos voltam a se registrar. */
.broker-rescan-action { white-space: nowrap; }
.broker-rescan-banner {
  margin: 12px 0 0;
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}
.broker-rescan-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.broker-rescan-head strong { font-size: 0.95rem; color: var(--text); }
.broker-rescan-head p { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted); }
.broker-rescan-head > div { flex: 1 1 240px; min-width: 0; }
.broker-rescan-head .ghost-button { width: auto; flex: 0 0 auto; }
.broker-rescan-clock {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary-accessible-text);
}
.broker-rescan-pulse {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 60%, transparent);
  animation: broker-rescan-pulse 1.6s ease-out infinite;
}
@keyframes broker-rescan-pulse {
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.broker-rescan-note { margin: 10px 0 0; font-size: 0.76rem; color: var(--muted); }

/* Logotipo do cliente na tela Clientes (cartão e formulário) — 15/09/2026. */
.clientsadm-card-logo {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
  font-size: 1.1rem;
  border: 1px solid var(--line);
}
.clientsadm-card-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.clientsadm-logo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.clientsadm-logo-preview {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
  font-size: 1.6rem;
  border: 1px solid var(--line);
}
.clientsadm-logo-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.clientsadm-logo-copy { display: grid; gap: 4px; min-width: 0; }
.clientsadm-logo-copy strong { font-size: 0.9rem; color: var(--text); }
.clientsadm-logo-copy > span { font-size: 0.78rem; color: var(--muted); line-height: 1.35; }
.clientsadm-logo-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.clientsadm-logo-pick { display: inline-flex; align-items: center; cursor: pointer; }

/* Ambiente de teste (16/09/2026): dois dashboards dividem o mesmo banco. */
.sandbox-badge {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 9999;
  padding: 3px 14px 4px; border-radius: 8px 8px 0 0; pointer-events: none;
  background: var(--warning); color: #3a2a00; font-size: 0.66rem; font-weight: 800;
  letter-spacing: .08em; box-shadow: 0 -2px 10px rgba(0,0,0,.18);
}
body.is-sandbox { box-shadow: inset 0 0 0 2px var(--warning); }

/* Ferramentas Internas: "Uso e Navegação" + "Histórico de WhatsApp" (18/09/2026) —
   select de período com estilo próprio, ranking com barra proporcional (telas mais
   usadas, WhatsApp por cliente/usuário) e detalhe expansível por pessoa. */
.billing-cost-stat-value.is-text {
  font-size: 1.08rem;
  line-height: 1.25;
}
.billing-cost-stat-hint {
  font-size: 0.74rem;
  color: var(--muted);
}

.usage-view-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.usage-select-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.usage-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 30px 8px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  min-width: 128px;
  transition: border-color 0.15s ease;
}
.usage-select:hover { border-color: var(--primary); }
.usage-select:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.usage-select-wrap::after {
  content: "▾";
  position: absolute;
  right: 12px;
  bottom: 9px;
  font-size: 0.7rem;
  color: var(--muted);
  pointer-events: none;
}

/* grid-template-columns explícito em todo grid de 1 coluna abaixo: sem ele, a
   faixa "auto" cresce até o max-content do item mais largo (nome de cliente
   longo, número grande) em vez de respeitar a largura do cartão — é o mesmo
   estouro horizontal já corrigido em .usage-conversations-layout, só que
   dentro de uma lista em vez de um grid de 2 colunas. minmax(0, 1fr) força a
   faixa a nunca passar da largura disponível. */
.usage-ranked-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.usage-ranked-row { display: flex; align-items: flex-start; gap: 10px; }
.usage-ranked-rank {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.usage-ranked-main { flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
.usage-ranked-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.usage-ranked-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.usage-ranked-count { font-size: 0.78rem; font-weight: 700; color: var(--text-secondary); white-space: nowrap; }
.usage-ranked-bar-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}
.usage-ranked-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
}
.usage-ranked-secondary { font-size: 0.74rem; color: var(--muted); }

.usage-person-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.usage-person-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  overflow: hidden;
}
.usage-person-row.is-expanded { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-soft); }
.usage-person-row-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px 14px;
  text-align: left;
  font: inherit;
  color: var(--text);
}
.usage-person-row-toggle:hover { background: var(--table-row-hover); }
.usage-person-row-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.usage-person-chevron { flex: 0 0 auto; color: var(--muted); font-size: 0.78rem; }
.usage-person-name {
  flex: 0 1 auto;
  font-weight: 700;
  font-size: 0.88rem;
  min-width: 0;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.usage-person-summary { flex: 1 1 auto; font-size: 0.78rem; color: var(--muted); text-align: right; min-width: 0; }
.usage-person-detail {
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 16px;
}
.usage-person-detail-loading,
.usage-person-detail-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.usage-person-detail-client {
  display: inline-block;
  margin: 0 0 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.usage-person-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.usage-person-detail-card {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}
.usage-person-detail-card-wide { grid-column: 1 / -1; }
.usage-person-detail-card h4 {
  margin: 0 0 8px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.usage-person-detail-line { margin: 0; font-size: 0.84rem; color: var(--text); }
.usage-person-detail-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.usage-person-detail-list li {
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.4;
}
.usage-person-detail-list li:last-child { border-bottom: none; padding-bottom: 0; }

.usage-conversations-card { padding: 0; overflow: hidden; }
.usage-conversations-card .card-heading { padding: 18px 20px 4px; }
.usage-conversations-layout {
  display: grid;
  grid-template-columns: minmax(230px, 300px) 1fr;
  grid-template-rows: minmax(0, 1fr);
  height: 560px;
}
.usage-conversations-side {
  border-right: 1px solid var(--line);
  height: 100%;
  overflow-y: auto;
  padding: 8px;
}
.usage-conversations-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.usage-conversation-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text);
  transition: background-color 0.12s ease;
}
.usage-conversation-row:hover { background: var(--table-row-hover); }
.usage-conversation-row.is-active { background: var(--primary-soft); }
.usage-conversation-avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.usage-conversation-row.is-active .usage-conversation-avatar {
  background: var(--primary);
  color: var(--text-on-primary);
}
.usage-conversation-row-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; min-width: 0; flex: 1 1 auto; }
.usage-conversation-row-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.usage-conversation-row-client {
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.usage-conversation-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--muted);
}
.usage-conversation-row-meta .billing-channel-badge { padding: 1px 7px; font-size: 0.62rem; }

.usage-conversations-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  background: var(--surface-soft);
}
.usage-conversations-main .empty-state { margin: 20px; border: none; }
.usage-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--line);
}
.usage-message-header strong { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.usage-message-header-phone { font-size: 0.76rem; color: var(--muted); }
.usage-message-header-note {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.usage-message-header-note::before { content: "🔒"; font-size: 0.7rem; }
.usage-message-list {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 2px;
  padding: 18px 20px;
  overflow-y: auto;
}
.usage-message { display: flex; }
.usage-message + .usage-message { margin-top: 8px; }
.usage-message-bubble {
  max-width: 68%;
  padding: 8px 13px;
  border-radius: 14px;
  background: var(--surface-strong);
}
.usage-message-content {
  margin: 0 0 3px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
}
.usage-message-meta { font-size: 0.66rem; color: var(--text-muted); opacity: 0.75; }
/* Confiança (0-100) do turno agêntico (22/10/2026, ver app/agent/confidence.py
   no bms_advisor) -- só aparece em resposta da IA, nunca em mensagem de
   usuário/confirmação canônica (o backend já devolve null pra essas).
   Fica FORA de .usage-message-meta de propósito (irmão, não filho) -- esse
   span tem opacity:0.75, que lavaria a cor do selo; aqui a cor precisa ficar
   bem distinta, como pedido. */
.usage-message-confidence {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.usage-message-confidence.is-ok { background: var(--status-ok-soft); color: var(--success-accessible-text); }
.usage-message-confidence.is-warning { background: var(--status-warning-soft); color: var(--warning-accessible-text); }
.usage-message-confidence.is-critical { background: var(--status-critical-soft); color: var(--danger-accessible-text); }
.usage-message-user { justify-content: flex-start; }
.usage-message-user .usage-message-bubble { border-bottom-left-radius: 4px; }
.usage-message-assistant { justify-content: flex-end; }
.usage-message-assistant .usage-message-bubble { background: var(--primary-soft); border-bottom-right-radius: 4px; }
.usage-message-assistant .usage-message-content { color: var(--primary-accessible-text); }
.usage-message-system { justify-content: center; }
.usage-message-system .usage-message-bubble { background: none; padding: 2px 0; text-align: center; }
.usage-message-system .usage-message-meta { color: var(--muted); }

.usage-conversations-side::-webkit-scrollbar,
.usage-message-list::-webkit-scrollbar { width: 8px; }
.usage-conversations-side::-webkit-scrollbar-thumb,
.usage-message-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--scrollbar-radius);
}
.usage-conversations-side::-webkit-scrollbar-track,
.usage-message-list::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 720px) {
  .usage-conversations-layout { grid-template-columns: 1fr; height: auto; }
  .usage-conversations-side { border-right: none; border-bottom: 1px solid var(--line); height: 260px; }
  .usage-conversations-main { height: 480px; }
  .usage-person-row-toggle { flex-wrap: wrap; }
  .usage-person-name { max-width: 100%; }
  .usage-person-summary { text-align: left; }
  .usage-message-bubble { max-width: 90%; }
}

/* ── Histórico: legenda agrupada por equipamento (comparação) ─────────── */
.history-compact-group {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.history-compact-group:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* ── Largura de tablet (769–840px, Z Fold aberto sem "site para computador") ──
   Entre o celular e o computador o topo empilhava título centralizado, sino
   sozinho à esquerda e busca. Fica como no computador: título à esquerda,
   sino no canto direito e a busca ocupando a linha de baixo. */
@media (min-width: 769px) and (max-width: 840px) {
  .topbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
  }
  .topbar-title {
    flex: 1 1 auto;
    align-items: flex-start;
  }
  .topbar-side {
    width: auto;
    flex: 0 0 auto;
    justify-content: flex-end;
  }
  .topbar-actions {
    width: auto;
    justify-content: flex-end;
  }
  .global-ai-command {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }
}

/* ── Histórico em largura de tablet (769–900px) ────────────────────────────
   Com a árvore e a configuração empilhadas, a altura fixa do cartão fazia a
   árvore encolher até só a barra de botões assim que algo entrava na montagem,
   e o "Carregar histórico" saía da tela. Cada bloco passa a ter a própria
   altura: a árvore rola por dentro, a lista da montagem também, e o rodapé
   com o botão fica grudado embaixo (com folga para a entidade da IA). */
@media (min-width: 769px) and (max-width: 900px) {
  .history-screen.history-screen--picker-only {
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }
  .history-screen.history-screen--picker-only .history-selector-card {
    height: auto;
    max-height: none;
    overflow: visible;
    grid-template-rows: auto auto;
  }
  .history-screen.history-screen--picker-only .history-builder-tree {
    height: auto;
    max-height: 46vh;
  }
  .history-screen.history-screen--picker-only .history-builder-staging {
    height: auto;
    max-height: none;
  }
  .history-screen.history-screen--picker-only .history-staging-body {
    max-height: 50vh;
  }
  /* Barra fixa no pé da tela enquanto se monta o histórico: o sticky não
     serve aqui porque o body tem overflow-x: hidden e vira o contêiner de
     rolagem do sticky, que então nunca gruda na janela. A folga à direita é
     para a entidade da IA, que fica no canto; o padding-bottom do cartão evita
     que a barra cubra o fim da lista. */
  .history-screen.history-screen--picker-only {
    padding-bottom: 88px;
  }
  .history-screen.history-screen--picker-only .history-staging-footer {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 12px;
    z-index: 40;
    margin: 0;
    padding: 10px 84px 10px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--bg-elevated);
    box-shadow: var(--shadow);
  }
}

/* ── Histórico no celular: para qual gráfico cada ponto vai ─────────────── */
@media (max-width: 768px) {
  .hist-m-addbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--text-primary);
    font-size: 12.5px;
    line-height: 1.35;
  }
  .hist-m-addbar button {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
  }
  .hist-m-targetbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .hist-m-target {
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
  }
  .hist-m-target select {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 9px 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    background: var(--bg-surface);
    color: var(--text-primary);
  }
  .hist-m-presets {
    display: flex;
    gap: 8px;
    flex: 1 1 100%;
  }
  .hist-m-mini {
    flex: 1 1 auto;
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 8px 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
  }
  /* Número do gráfico no lugar do ✓ quando o ponto está marcado. */
  .hist-m-check.is-chart {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
  }
}


/* ===== Tela "Equipamentos" (substitui Spaces, 22/09/2026; revisada 22/09) =
   O cabeçalho clicável de sala/equipamento é um <div role="button"> (não um
   <button> de verdade) DE PROPÓSITO — ele precisa conter outros <button>
   reais (editar, excluir, playbook), e <button> não pode conter <button>
   (o navegador fecha o de fora ao achar o primeiro de dentro, quebrando o
   layout). Ver comentário maior no topo de spacesEquipment.js.
   Todo grid de 1 coluna abaixo já nasce com grid-template-columns:
   minmax(0,1fr) — lição do estouro horizontal no celular já corrigido em Uso
   e Navegação nesta mesma sessão. */
.spaces-equipment-screen { display: grid; gap: 16px; }

.speq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.speq-header-stats {
  display: flex;
  gap: 18px;
  font-size: 0.86rem;
  color: var(--text-secondary);
}
.speq-header-stats strong { color: var(--text-primary); font-size: 1rem; }
.speq-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.speq-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  min-width: 240px;
  transition: border-color 0.12s ease;
}
.speq-search:focus-within { border-color: var(--primary); }
.speq-search-icon { flex: 0 0 auto; font-size: 0.82rem; opacity: 0.7; }
.speq-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-size: 0.86rem;
  color: var(--text);
}
.speq-search input::placeholder { color: var(--muted); }
/* Some browsers add their own clear/search icons; mantém só o nosso. */
.speq-search input::-webkit-search-cancel-button { cursor: pointer; }

.speq-form-error {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger-accessible-text);
  font-size: 0.84rem;
}

.speq-new-space-form {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  display: grid;
  gap: 12px;
}
.speq-new-space-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.speq-new-space-fields label {
  display: grid;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.speq-new-space-fields input,
.speq-new-space-fields select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-strong);
  text-transform: none;
  letter-spacing: normal;
}
.speq-new-space-actions { display: flex; gap: 8px; }

.speq-space-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }

.speq-space-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  overflow: hidden;
}

/* Estado "selecionado" só existe no picker do card Monitoramento — a tela
   Equipamentos em si não seleciona uma sala, só expande/edita. */
.speq-space-card.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.speq-space-card.is-selected .speq-space-name { color: var(--primary-accessible-text); }

/* --- Cabeçalho de sala: <div> comum, nunca <button> (ver nota no topo) --- */
.speq-space-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
}
.speq-space-toggle {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  margin: -4px -6px;
}
.speq-space-toggle:hover { background: var(--table-row-hover); }
.speq-space-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.speq-space-chevron { flex: 0 0 auto; color: var(--muted); font-size: 0.85rem; }
.speq-space-main {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}
.speq-space-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.speq-space-location { font-size: 0.76rem; color: var(--muted); }
.speq-space-summary {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.speq-space-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.speq-space-body {
  padding: 6px 14px 14px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.speq-icon-btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.speq-icon-btn:hover { background: var(--primary-soft); color: var(--primary-accessible-text); }
.speq-icon-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.speq-icon-btn-danger:hover { background: var(--danger-soft); color: var(--danger-accessible-text); }

.speq-inline-edit {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.speq-inline-input {
  flex: 1 1 220px;
  min-width: 140px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.86rem;
  color: var(--text);
  background: var(--surface-strong);
}
.speq-space-delete-confirm {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--danger-accessible-text);
  white-space: nowrap;
}

/* --- Linha de equipamento: mesmo padrão do cabeçalho de sala, um nível
   abaixo. --- */
.speq-equipment-row {
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.speq-equipment-row.is-expanded { background: var(--surface-soft); }
.speq-equipment-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 8px 4px;
}
.speq-equipment-toggle {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  margin: -4px 0;
}
.speq-equipment-toggle:hover { background: var(--table-row-hover); }
.speq-equipment-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.speq-equipment-chevron { flex: 0 0 auto; color: var(--muted); font-size: 0.78rem; }
.speq-equipment-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.speq-equipment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.74rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.speq-equipment-class {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-accessible-text);
  font-weight: 600;
}
.speq-equipment-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.speq-equipment-body { padding: 4px 8px 10px 34px; }

.speq-points-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.speq-point-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--surface-strong);
  font-size: 0.8rem;
}
.speq-point-tag { color: var(--text); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.speq-point-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.speq-point-class { color: var(--text-secondary); }
.speq-point-status { white-space: nowrap; }
.speq-point-status.is-on { color: var(--success-accessible-text); }
.speq-point-status.is-off { color: var(--danger-accessible-text); }

@media (max-width: 640px) {
  .speq-header-actions { width: 100%; }
  .speq-search { flex: 1 1 auto; min-width: 0; }
  .speq-space-header { flex-wrap: wrap; }
  .speq-space-toggle { flex-wrap: wrap; }
  .speq-space-summary { white-space: normal; }
  .speq-equipment-toggle { flex-direction: column; align-items: flex-start; gap: 4px; }
  .speq-point-row { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   Perfis de cálculo de ICO/IEC (painel aberto da tela Equipamentos) — 24/09/2026.
   Três colunas: perfis do cliente | regra do perfil | efeito real nos equipamentos.
   ============================================================ */
.idxprof-modal { position: fixed; inset: 0; z-index: 9200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.idxprof-modal[hidden] { display: none; }
.idxprof-modal-backdrop { position: absolute; inset: 0; background: var(--bg-overlay); backdrop-filter: blur(3px); }
.idxprof-modal-dialog {
  position: relative; width: min(1500px, 100%); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; background: var(--surface, #fff); color: var(--text);
  border-radius: 16px; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28); overflow: hidden;
}
.idxprof-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px 10px; border-bottom: 1px solid var(--line); }
.idxprof-modal-head h3 { margin: 2px 0 0; }
.idxprof-modal-body { padding: 16px 20px 20px; overflow-y: auto; }
body.has-idxprof-modal { overflow: hidden; }
.idxprof-name { display: grid; gap: 4px; flex: 1 1 320px; font-size: 0.78rem; color: var(--text-secondary); }
.idxprof-name input { font: inherit; font-size: 0.98rem; font-weight: 600; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface, transparent); color: var(--text); }
.idxprof-new { display: grid; gap: 8px; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; }
.idxprof-new label { display: grid; gap: 3px; font-size: 0.74rem; color: var(--text-secondary); }
.idxprof-new input, .idxprof-new select { font: inherit; font-size: 0.82rem; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface, transparent); color: var(--text); }
.idxprof-new-actions { display: flex; gap: 6px; }
.idxprof-new-btn { width: 100%; }
.idxprof-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(360px, 1fr) minmax(360px, 1.15fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 1280px) {
  .idxprof-layout { grid-template-columns: minmax(200px, 240px) minmax(0, 1fr); }
  .idxprof-preview { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .idxprof-layout { grid-template-columns: minmax(0, 1fr); }
}

/* coluna dos tipos */
.idxprof-types { display: grid; gap: 10px; }
.idxprof-types-head { display: grid; gap: 2px; padding: 4px 6px 6px; }
.idxprof-types-head strong { font-size: 0.92rem; color: var(--text); }
.idxprof-types-head span { font-size: 0.74rem; color: var(--muted); }
.idxprof-type-group-title {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); padding: 6px 6px 4px;
}
.idxprof-type {
  width: 100%; display: grid; gap: 4px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface, transparent);
  padding: 8px 10px; color: var(--text); font: inherit;
}
.idxprof-type:hover { border-color: var(--primary); }
.idxprof-type.is-active { border-color: var(--primary); background: var(--primary-soft); }
.idxprof-type.is-empty .idxprof-type-name { color: var(--muted); }
.idxprof-type-name { font-weight: 600; font-size: 0.86rem; }
.idxprof-type-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 0.72rem; color: var(--muted); }
.idxprof-pill {
  font-size: 0.66rem; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--line) 60%, transparent); color: var(--text-muted);
}
.idxprof-pill.is-saved { background: var(--success-soft, var(--primary-soft)); color: var(--success-accessible-text, var(--primary-accessible-text)); }
.idxprof-pill.is-client { background: var(--primary-soft); color: var(--primary-accessible-text); }

/* editor da regra */
.idxprof-editor { display: grid; gap: 14px; min-width: 0; }
.idxprof-editor-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.idxprof-editor-head h3 { margin: 0; font-size: 1.05rem; }
.idxprof-source { margin: 4px 0 0; font-size: 0.78rem; color: var(--muted); }
.idxprof-source.is-default { color: var(--warning-accessible-text); }
.idxprof-source em { font-style: normal; font-weight: 700; color: var(--warning-accessible-text); }
.idxprof-note { margin: -4px 0 0; font-size: 0.8rem; color: var(--text-secondary); }
.idxprof-scope { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.idxprof-scope-btn {
  border: none; background: transparent; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 0.78rem;
  color: var(--text-secondary);
}
.idxprof-scope-btn.is-active { background: var(--primary); color: var(--on-primary, #fff); }
.idxprof-scope-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.idxprof-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface, transparent); }
.idxprof-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.idxprof-card-head > div { display: grid; gap: 1px; }
.idxprof-card-head strong { font-size: 0.98rem; }
.idxprof-card-head span { font-size: 0.74rem; color: var(--muted); }
.idxprof-mode { display: inline-flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text-secondary); }
.idxprof-mode select { font: inherit; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface, transparent); color: var(--text); }
.idxprof-help { margin: 8px 0 10px; font-size: 0.78rem; color: var(--muted); }
.idxprof-components { display: grid; gap: 8px; }
.idxprof-component {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
}
.idxprof-component.is-off { opacity: 0.62; }
.idxprof-component-main { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 200px; min-width: 0; cursor: pointer; }
.idxprof-component-label { font-weight: 600; font-size: 0.84rem; }
.idxprof-field { display: grid; gap: 2px; font-size: 0.7rem; color: var(--muted); }
.idxprof-field input {
  width: 84px; font: inherit; font-size: 0.82rem; padding: 4px 6px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface, transparent); color: var(--text);
}
.idxprof-field-weight input { width: 64px; }
.idxprof-field-note { align-self: center; font-size: 0.74rem; flex: 1 1 200px; }
.idxprof-weight-total { font-size: 0.76rem; color: var(--muted); text-align: right; padding-top: 2px; }
.idxprof-weight-total.is-off { color: var(--warning-accessible-text); font-weight: 600; }
.idxprof-advanced { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 10px; }
.idxprof-advanced label { display: grid; gap: 4px; font-size: 0.78rem; color: var(--text-secondary); }
.idxprof-advanced input { width: 110px; font: inherit; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface, transparent); color: var(--text); }
.idxprof-advanced small { font-size: 0.72rem; color: var(--muted); }
.idxprof-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.idxprof-actions .ghost-button.is-danger { color: var(--danger-accessible-text, var(--danger)); margin-left: auto; }

/* painel do efeito real */
.idxprof-preview { display: grid; gap: 12px; min-width: 0; }
.idxprof-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.idxprof-preview-head > div:first-child { display: grid; gap: 1px; }
.idxprof-preview-head strong { font-size: 0.98rem; }
.idxprof-preview-head > div:first-child span { font-size: 0.74rem; color: var(--muted); }
.idxprof-preview-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.idxprof-preview-controls select { font: inherit; font-size: 0.8rem; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface, transparent); color: var(--text); max-width: 240px; }
.idxprof-summary { display: flex; gap: 10px; flex-wrap: wrap; }
.idxprof-summary.is-loading, .idxprof-rows.is-loading { opacity: 0.55; transition: opacity 0.2s; }
.idxprof-summary-chip { display: grid; gap: 1px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; min-width: 150px; }
.idxprof-summary-chip strong { font-size: 1.02rem; }
.idxprof-summary-chip span { font-size: 0.72rem; color: var(--muted); }
.idxprof-warnings { margin: 0; padding: 10px 12px 10px 28px; border-radius: 10px; font-size: 0.8rem; color: var(--warning-accessible-text); background: color-mix(in srgb, var(--warning) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--line)); display: grid; gap: 4px; }
.idxprof-rows { display: grid; gap: 6px; }
.idxprof-row { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.idxprof-row.is-open { border-color: var(--primary); }
.idxprof-row-head {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto 16px; gap: 10px; align-items: center;
  padding: 8px 10px; border: none; background: transparent; cursor: pointer; text-align: left; font: inherit; color: var(--text);
}
.idxprof-row-head:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.idxprof-row-name { display: grid; gap: 1px; min-width: 0; }
.idxprof-row-name strong { font-size: 0.86rem; }
.idxprof-row-name span { font-size: 0.76rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idxprof-row-name small { font-size: 0.7rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idxprof-score {
  display: inline-grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 0.8rem; border: 1px solid transparent;
}
.idxprof-score small { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.04em; opacity: 0.85; }
.idxprof-score strong { font-size: 0.92rem; }
.idxprof-score em { grid-column: 1 / -1; font-style: normal; font-size: 0.6rem; opacity: 0.85; }
.idxprof-score.tone-ok { background: var(--success-soft, #e6f4ea); color: var(--success-accessible-text, #1e6b3a); }
.idxprof-score.tone-warning { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning-accessible-text); }
.idxprof-score.tone-critical { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger-accessible-text, var(--danger)); }
.idxprof-score.tone-offline { background: color-mix(in srgb, var(--line) 60%, transparent); color: var(--text-muted); }
.idxprof-score.is-partial { border-style: dashed; border-color: currentColor; }
.idxprof-row-flags { display: flex; gap: 4px; flex-wrap: wrap; }
.idxprof-flag { font-size: 0.64rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--line) 60%, transparent); color: var(--text-muted); }
.idxprof-flag.is-stale { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning-accessible-text); }
.idxprof-row-caret { color: var(--muted); font-size: 0.8rem; }
.idxprof-row-body { display: grid; gap: 12px; padding: 4px 12px 12px; border-top: 1px solid var(--line); }
.idxprof-breakdown-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin: 8px 0 6px; }
.idxprof-breakdown-head strong { font-size: 0.9rem; }
.idxprof-breakdown-head span { font-size: 0.74rem; color: var(--muted); }
.idxprof-breakdown-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.idxprof-breakdown-table th { text-align: left; white-space: nowrap; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 4px 6px; border-bottom: 1px solid var(--line); }
.idxprof-breakdown-table td { padding: 5px 6px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); vertical-align: top; }
.idxprof-breakdown-table td:nth-child(2), .idxprof-breakdown-table td:nth-child(3) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.idxprof-breakdown-table tr.is-missing td { color: var(--muted); }
.idxprof-points { font-size: 0.76rem; color: var(--text-secondary); display: grid; gap: 4px; }
.idxprof-points ul { margin: 0; padding: 0; list-style: none; display: flex; gap: 6px 12px; flex-wrap: wrap; }
.idxprof-points code { font-size: 0.72rem; }
.idxprof-points small { color: var(--muted); }
@media (max-width: 860px) {
  .idxprof-row-head { grid-template-columns: minmax(0, 1fr) auto auto; }
  .idxprof-row-flags, .idxprof-row-caret { display: none; }
}

/* ---- tela Equipamentos: índices por equipamento (24/09/2026) ---- */
.speq-header-stats .is-attention strong { color: var(--warning-accessible-text); }
.speq-view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.speq-view-toggle button { border: none; background: transparent; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 0.78rem; color: var(--text-secondary); }
.speq-view-toggle button.is-active { background: var(--primary); color: var(--on-primary, #fff); }
.speq-index-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 0 1 auto; min-width: 0; }
.speq-chips { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.speq-chip {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.02em; padding: 1px 6px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-accessible-text); white-space: nowrap;
}
.speq-chip.is-none { background: color-mix(in srgb, var(--line) 60%, transparent); color: var(--text-muted); font-weight: 600; }
.speq-profile-select {
  font: inherit; font-size: 0.76rem; padding: 3px 6px; border-radius: 6px; max-width: 260px;
  border: 1px solid var(--line); background: var(--surface, transparent); color: var(--text);
}
.speq-profile-select.is-empty { border-style: dashed; color: var(--warning-accessible-text); }
.speq-profile-label { font-size: 0.76rem; color: var(--text-secondary); }
.speq-profile-label.is-empty { color: var(--warning-accessible-text); }
.speq-suggestion {
  border: 1px dashed var(--primary); background: transparent; color: var(--primary-accessible-text);
  font: inherit; font-size: 0.7rem; padding: 2px 8px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.speq-suggestion:hover { background: var(--primary-soft); }
.speq-select { flex: 0 0 auto; width: 15px; height: 15px; margin: 0 2px 0 6px; accent-color: var(--primary); }
.speq-equipment-space { font-size: 0.74rem; color: var(--muted); white-space: nowrap; }
.speq-bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding: 8px 12px;
  border: 1px solid var(--primary); border-radius: 10px; background: var(--primary-soft); font-size: 0.82rem;
}
.speq-bulk-bar select { font: inherit; font-size: 0.8rem; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface, #fff); color: var(--text); }
.speq-profile-card.is-unassigned { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); }
.speq-explain { display: grid; gap: 10px; padding: 10px 12px 12px; margin: 0 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface, transparent); }
.speq-explain.is-empty { grid-template-columns: 1fr; gap: 2px; font-size: 0.8rem; color: var(--text-secondary); }
.speq-explain.is-empty strong { color: var(--warning-accessible-text); font-size: 0.82rem; }
.speq-explain.is-empty em { font-style: normal; font-weight: 600; }
.speq-explain.is-error { color: var(--danger-accessible-text, var(--danger)); font-size: 0.8rem; }
.speq-explain-loading { font-size: 0.8rem; color: var(--muted); }
.speq-explain-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.speq-explain-title { font-size: 0.8rem; color: var(--text-secondary); margin-right: auto; }
.speq-explain-title em { font-style: normal; font-weight: 600; color: var(--text); }
@media (max-width: 860px) {
  .speq-index-cell { flex-basis: 100%; }
}

/* ---- perfis por classe (25/09/2026): linha variável → referência ---- */
.idxprof-modal-sub { margin: 4px 0 0; font-size: 0.78rem; color: var(--muted); max-width: 720px; }
.idxprof-totals { display: flex; gap: 8px; flex-wrap: wrap; }
.idxprof-weight-total.is-empty { color: var(--text-muted); font-weight: 400; }
.idxprof-variables { display: grid; gap: 10px; margin-top: 10px; }
.idxprof-var { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 10px; display: grid; gap: 6px; }
.idxprof-var-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.idxprof-var-head > div { display: grid; gap: 1px; }
.idxprof-var-head strong { font-size: 0.88rem; }
.idxprof-var-head span { font-size: 0.72rem; color: var(--muted); }
.idxprof-var-remove { border: none; background: transparent; color: var(--danger-accessible-text, var(--danger)); font: inherit; font-size: 0.74rem; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.idxprof-var-remove:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.idxprof-ref { display: flex; flex-wrap: wrap; align-items: end; gap: 6px 10px; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--line) 35%, transparent); }
.idxprof-ref.is-off { opacity: 0.6; }
.idxprof-ref-main { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 170px; min-width: 0; cursor: pointer; align-self: center; }
.idxprof-ref-main span { font-weight: 600; font-size: 0.82rem; }
.idxprof-ref-main small { font-size: 0.68rem; color: var(--muted); }
.idxprof-ref-index { align-self: center; font-size: 0.72rem; font-weight: 700; color: var(--primary-accessible-text); white-space: nowrap; }
.idxprof-field-class select, .idxprof-field select { font: inherit; font-size: 0.8rem; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface, transparent); color: var(--text); max-width: 260px; }
.idxprof-add { display: grid; gap: 4px; margin-top: 12px; font-size: 0.78rem; color: var(--text-secondary); }
.idxprof-add select { font: inherit; font-size: 0.84rem; padding: 7px 10px; border-radius: 8px; border: 1px dashed var(--primary); background: var(--surface, transparent); color: var(--text); }
.idxprof-add small { font-size: 0.72rem; color: var(--muted); }
.idxprof-empty-vars { padding: 10px; border: 1px dashed var(--line); border-radius: 8px; }
.idxprof-breakdown-table code { font-size: 0.68rem; color: var(--muted); }

/* tela Equipamentos: cobertura, conjunto, aviso de classes */
.speq-chip.is-ok { background: var(--success-soft, #e6f4ea); color: var(--success-accessible-text, #1e6b3a); }
.speq-chip.is-warn { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning-accessible-text); }
.speq-index-cell.is-space { margin-left: auto; }
.speq-index-label { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.speq-space-card.is-set .speq-space-header { flex-wrap: wrap; }
.speq-set-row .speq-equipment-toggle { cursor: default; }
.speq-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-size: 0.8rem; color: var(--warning-accessible-text); background: color-mix(in srgb, var(--warning) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--line)); }
.speq-notice .ghost-button { flex: 0 0 auto; }
/* painel de perfis: cada coluna rola sozinha, a prévia fica sempre à vista */
.idxprof-modal-body { overflow: hidden; padding-bottom: 12px; }
.idxprof-modal-body .idxprof-layout { align-items: stretch; max-height: calc(100vh - 150px); }
.idxprof-modal-body .idxprof-layout > * { overflow-y: auto; max-height: calc(100vh - 150px); padding-right: 4px; align-content: start; }
@media (max-width: 1280px) {
  .idxprof-modal-body { overflow-y: auto; }
  .idxprof-modal-body .idxprof-layout, .idxprof-modal-body .idxprof-layout > * { max-height: none; overflow: visible; }
}
