:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --brand: #129c49;
  --brand-dark: #0a5f2c;
  --navy: #1a2744;
  --navy-light: #243456;
  --sidebar: #1e2d4a;
  --bg: #eef1f6;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --line: #dbe3ef;
  --warning: #f59e0b;
  --critical: #ef4444;
  --normal: #129c49;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.suite-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.suite-topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  height: 56px;
  background: linear-gradient(90deg, #152238, #1a2744);
  color: #fff;
  border-bottom: 3px solid var(--brand);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 280px;
}

.foex-logo {
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--brand);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.suite-topbar h1 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.topbar-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}

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

.topbar-right .live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(18, 156, 73, 0.2);
  color: #b8f5cf;
  font-size: 0.85rem;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.suite-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  min-height: 0;
}

.suite-sidebar {
  background: var(--sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 4px;
}

.sidebar-header strong { font-size: 0.9rem; }
.sidebar-header small { color: #94a3b8; font-size: 0.78rem; }

.role-badge {
  display: inline-block;
  width: fit-content;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(18, 156, 73, 0.25);
  color: #86efac;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.asset-tree {
  flex: 1;
  overflow: auto;
  padding: 12px;
}

.tree-site { margin-bottom: 12px; }

.tree-node {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}

.site-node {
  font-weight: 700;
  color: #f8fafc;
  cursor: default;
}

.asset-node:hover,
.asset-node.selected {
  background: rgba(255, 255, 255, 0.1);
}

.tree-children {
  padding-left: 12px;
  display: grid;
  gap: 2px;
}

.tree-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tree-status.normal { background: var(--normal); }
.tree-status.warning { background: var(--warning); }
.tree-status.critical { background: var(--critical); }

.tree-empty {
  color: #94a3b8;
  font-size: 0.82rem;
  padding: 4px 10px;
}

.tree-search {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
}

.tree-search input {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  border-radius: 6px;
  padding: 8px 10px;
}

.suite-main {
  overflow: auto;
  padding: 20px;
  color-scheme: light;
}

.suite-main input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
.suite-main select,
.suite-main textarea {
  background: #fff;
  color: var(--text);
  border: 1px solid #cbd5e1;
}

.suite-main input::placeholder,
.suite-main textarea::placeholder {
  color: #94a3b8;
  opacity: 1;
}

.suite-main input:not([type="hidden"]):focus,
.suite-main select:focus,
.suite-main textarea:focus {
  outline: 2px solid rgba(18, 156, 73, 0.28);
  outline-offset: 0;
  border-color: var(--brand);
}

.view-panel { display: none; }
.view-panel.active { display: block; }

.warning-banners {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.warning-card {
  border-radius: 10px;
  padding: 18px 20px;
  color: #fff;
  min-height: 100px;
}

.warning-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
  margin: 8px 0 4px;
}

.warning-card small { opacity: 0.85; }

.warning-card.asset-mgmt { background: linear-gradient(135deg, #ea580c, #c2410c); }
.warning-card.inspection { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.warning-card.iot { background: linear-gradient(135deg, #dc2626, #991b1b); }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.6rem;
  color: var(--navy);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--navy);
}

.period-picker { display: flex; gap: 4px; }

.period-btn {
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
}

.period-btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.condition-summary {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: end;
}

.condition-donut {
  display: grid;
  gap: 8px;
}

.donut-ring {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: #ecfdf3;
  border-left: 4px solid var(--normal);
}

.donut-ring.warning {
  background: #fffbeb;
  border-left-color: var(--warning);
}

.donut-ring.critical {
  background: #fef2f2;
  border-left-color: var(--critical);
}

.donut-ring span { font-size: 1.4rem; font-weight: 700; }
.donut-ring small { color: var(--muted); }

.timeline-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 120px;
  padding: 8px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.timeline-bar {
  flex: 1;
  display: flex;
  align-items: flex-end;
  height: 100px;
}

.timeline-bar span {
  display: block;
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--normal);
}

.timeline-bar.warning span { background: var(--warning); }
.timeline-bar.critical span { background: var(--critical); }

.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 600;
}

tr.selected { background: #ecfdf3; }
tr.asset-row { cursor: pointer; }
tr.asset-row:hover { background: #f1f5f9; }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.normal { background: #dcfce7; color: #166534; }
.status-badge.warning { background: #fef3c7; color: #92400e; }
.status-badge.critical { background: #fee2e2; color: #991b1b; }

.asset-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.asset-detail-header h2 { margin: 0; color: var(--navy); }
.muted { color: var(--muted); font-size: 0.85rem; }

.condition-badge {
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  font-family: inherit;
}

.condition-badge.interactive {
  cursor: pointer;
}

.condition-badge.interactive:not(:disabled):hover {
  filter: brightness(0.97);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.condition-badge:disabled {
  cursor: default;
  opacity: 1;
}

.condition-popover {
  width: 400px;
}

.condition-section {
  margin-top: 14px;
}

.condition-section h4 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--navy);
}

.condition-cause-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.condition-cause-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}

.condition-cause-item.warning { background: #fffbeb; border-color: #fde68a; }
.condition-cause-item.critical { background: #fef2f2; border-color: #fecaca; }

.condition-cause-item p {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.condition-rule {
  margin: 0 0 6px;
  font-size: 0.82rem;
  line-height: 1.45;
}

.condition-voting {
  margin: 0;
  font-size: 0.78rem;
}

.condition-badge.normal { background: #dcfce7; color: #166534; }
.condition-badge.warning { background: #fef3c7; color: #92400e; }
.condition-badge.critical { background: #fee2e2; color: #991b1b; }
.condition-badge.idle { background: #f1f5f9; color: var(--muted); }

.terminal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.terminal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  display: grid;
  gap: 4px;
}

.terminal-card.warning { border-color: #fcd34d; }
.terminal-card.critical { border-color: #fca5a5; }

.terminal-number {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

.terminal-card strong { font-size: 1.5rem; color: var(--navy); }

.graphs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.graph-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fafbfc;
}

.graph-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.graph-heading-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.graph-latest {
  font-size: 0.92rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.graph-latest.normal { color: #16a34a; }
.graph-latest.warning { color: #d97706; }
.graph-latest.critical { color: #dc2626; }
.graph-latest.idle { color: var(--muted); }

.graph-heading-meta small {
  color: var(--muted);
  font-size: 0.72rem;
}

.sparkline {
  width: 100%;
  height: 136px;
  display: block;
}

.sparkline-wrap {
  position: relative;
}

.sparkline-hit {
  fill: transparent;
  cursor: crosshair;
}

.sparkline-point.hover .sparkline-dot {
  stroke: #fff;
  stroke-width: 2;
  filter: drop-shadow(0 0 2px rgba(15, 23, 42, 0.35));
}

.sparkline-tooltip {
  position: absolute;
  z-index: 6;
  transform: translate(-50%, calc(-100% - 10px));
  min-width: 88px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
  pointer-events: none;
  display: grid;
  gap: 3px;
  text-align: center;
}

.sparkline-tooltip[hidden] {
  display: none !important;
}

.sparkline-tooltip-time {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sparkline-tooltip-value {
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.sparkline-tooltip-value.normal { color: #16a34a; }
.sparkline-tooltip-value.warning { color: #d97706; }
.sparkline-tooltip-value.critical { color: #dc2626; }

.sparkline-tooltip-sev {
  justify-self: center;
}

.sparkline-grid {
  stroke: #e2e8f0;
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.sparkline-axis-label {
  fill: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.threshold-line {
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.threshold-line.warning { stroke: #d97706; opacity: 0.75; }
.threshold-line.critical { stroke: #dc2626; opacity: 0.85; }

.threshold-label {
  font-size: 8.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.threshold-label.warning { fill: #b45309; }
.threshold-label.critical { fill: #b91c1c; }

.sparkline-latest-tag {
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sparkline-latest-tag.normal { fill: #16a34a; }
.sparkline-latest-tag.warning { fill: #d97706; }
.sparkline-latest-tag.critical { fill: #dc2626; }

.sparkline-segment {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline-segment.normal { stroke: #16a34a; }
.sparkline-segment.warning { stroke: #d97706; }
.sparkline-segment.critical { stroke: #dc2626; }
.sparkline-segment.idle { stroke: #94a3b8; }

.sparkline-dot {
  stroke: #fff;
  stroke-width: 1;
}

.sparkline-dot.normal { fill: #16a34a; }
.sparkline-dot.warning { fill: #d97706; }
.sparkline-dot.critical { fill: #dc2626; }
.sparkline-dot.idle { fill: #94a3b8; }

.sparkline-legend {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}

.legend-item::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 3px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.legend-item.normal::before { background: #16a34a; }
.legend-item.warning::before { background: #d97706; }
.legend-item.critical::before { background: #dc2626; }

.legend-thresholds {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.empty-graph {
  height: 136px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.events-list {
  display: block;
}

.events-empty {
  padding: 20px 12px;
  text-align: center;
  font-size: 0.88rem;
}

.events-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.events-table thead th {
  padding: 8px 12px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: #f4f6f8;
  border-bottom: 1px solid var(--line);
}

.events-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

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

.event-row,
.telemetry-row {
  cursor: pointer;
  transition: background 0.12s ease;
}

.event-row:hover,
.event-row.active,
.telemetry-row:hover,
.telemetry-row.active {
  background: #eef4ff;
}

.event-row.warning:hover,
.event-row.warning.active,
.telemetry-row.warning:hover,
.telemetry-row.warning.active {
  background: #fff8eb;
}

.event-row.critical:hover,
.event-row.critical.active,
.telemetry-row.critical:hover,
.telemetry-row.critical.active {
  background: #fef2f2;
}

.event-row.idle:hover,
.event-row.idle.active,
.telemetry-row.idle:hover,
.telemetry-row.idle.active {
  background: #f8fafc;
}

.telemetry-list {
  display: block;
}

.event-time {
  white-space: nowrap;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  width: 1%;
}

.event-summary {
  color: var(--navy);
  font-weight: 500;
}

.status-badge.compact {
  min-width: 1.6rem;
  padding: 2px 6px;
  font-size: 0.72rem;
  text-align: center;
}

.panel-heading-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.event-popover {
  position: fixed;
  z-index: 1000;
  width: 320px;
  max-width: calc(100vw - 24px);
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}

.event-popover-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.event-popover-close:hover {
  background: #f1f5f9;
  color: var(--navy);
}

.event-popover-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 28px;
  margin-bottom: 12px;
}

.event-popover-header strong {
  font-size: 0.92rem;
  line-height: 1.35;
}

.event-detail-grid {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 6px 10px;
  margin: 0;
  font-size: 0.82rem;
}

.event-detail-grid dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.event-detail-grid dd {
  margin: 0;
  color: var(--navy);
  word-break: break-word;
}

.event-detail-grid code {
  font-size: 0.78rem;
}

.event-message {
  line-height: 1.45;
}

.telemetry-popover {
  width: 440px;
}

.telemetry-meta-grid {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.telemetry-channels-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.telemetry-channels-table {
  width: 100%;
  font-size: 0.8rem;
}

.telemetry-channels-table th,
.telemetry-channels-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}

.telemetry-channels-table tr:last-child td {
  border-bottom: none;
}

.telemetry-channel-row.warning td:last-child {
  color: #b45309;
  font-weight: 600;
}

.telemetry-channel-row.critical td:last-child {
  color: #b91c1c;
  font-weight: 600;
}

.simulator-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.simulator-picker {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
}

.simulator-picker select {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--text);
}

.card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
}

.card .label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

button {
  border: 0;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

button:hover { background: var(--brand-dark); }
button.danger { background: #dc2626; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination button {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.placeholder-panel {
  min-height: 240px;
  display: grid;
  place-content: center;
  text-align: center;
}

.error {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #fee2e2;
  color: #991b1b;
}

.setup-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.setup-page-header h2 {
  margin: 4px 0;
  color: var(--navy);
  font-size: 1.35rem;
}

.setup-toast {
  flex-shrink: 0;
  max-width: 320px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #ecfdf3;
  color: #166534;
  font-size: 0.85rem;
  border: 1px solid #bbf7d0;
}

.setup-toast.error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.setup-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  background: #e8edf4;
  border-radius: 10px;
  width: fit-content;
}

.setup-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 8px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.setup-tab:hover { color: var(--navy); }

.setup-tab.active {
  background: var(--surface);
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.setup-tab-panel { display: none; }
.setup-tab-panel.active { display: block; }

.setup-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.setup-card h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--navy);
}

.setup-card .panel-heading {
  margin-bottom: 12px;
}

.setup-hint {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.setup-table-wrap {
  max-height: 220px;
  margin-bottom: 12px;
}

.setup-table {
  width: 100%;
  font-size: 0.85rem;
}

.setup-table .empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 24px 12px;
}

.setup-table code {
  font-size: 0.78rem;
  color: var(--muted);
}

.setup-fold {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.setup-fold summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand);
  list-style: none;
}

.setup-fold summary::-webkit-details-marker { display: none; }

.setup-inline-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.setup-inline-form input {
  flex: 1;
  min-width: 140px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.setup-inline-form input::placeholder {
  color: #94a3b8;
}

.setup-inline-form button {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.setup-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.setup-toolbar h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: var(--navy);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--navy);
  border: 1px solid var(--line);
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn-secondary:hover { background: #e2e8f0; }

.setup-form-rows {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.setup-form-rows label {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.setup-form-rows input,
.setup-form-rows select {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.setup-form-rows input::placeholder {
  color: #94a3b8;
}

.setup-form-rows input:focus,
.setup-form-rows select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(18, 156, 73, 0.15);
}

.setup-form-rows input.readonly,
.setup-form-rows select:disabled {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
  box-shadow: none;
  cursor: not-allowed;
}

.setup-form-rows input.readonly {
  color: #64748b;
}

.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
}

.form-actions button {
  padding: 10px 20px;
  font-size: 0.88rem;
}

.sensors-table-wrap .setup-table input,
.sensors-table-wrap .setup-table select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font: inherit;
  font-size: 0.85rem;
  background: #fff;
  color: var(--text);
}

.sensors-table-wrap .setup-table input::placeholder {
  color: #94a3b8;
}

.sensors-table-wrap .btn-sm {
  padding: 5px 12px;
  font-size: 0.78rem;
}

.sensors-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.sensors-empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--navy);
}

.nodes-topology-banner {
  margin-bottom: 20px;
  padding: 16px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f0fdf4, #eff6ff);
  border: 1px solid #dbeafe;
}

.topology-chain {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.topology-box {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
}

.topology-box.site { border-color: #bfdbfe; background: #eff6ff; }
.topology-box.asset { border-color: #bbf7d0; background: #f0fdf4; }
.topology-box.node { border-color: #86efac; background: #dcfce7; color: #166534; }

.topology-arrow {
  color: var(--muted);
  font-weight: 700;
}

.topology-pill {
  margin-left: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.nodes-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.nodes-empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--navy);
}

.node-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  display: grid;
  gap: 10px;
}

.node-card.unlinked {
  border-color: #fcd34d;
  background: #fffbeb;
}

.node-card.linked {
  border-color: #bbf7d0;
}

.node-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.node-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.comm-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.comm-badge.normal { background: #dcfce7; color: #166534; }
.comm-badge.delayed { background: #fef3c7; color: #92400e; }
.comm-badge.offline { background: #f1f5f9; color: #64748b; }

.node-card-title {
  margin: 0;
  font-size: 0.95rem;
  color: var(--navy);
}

.node-link-visual {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: stretch;
}

.node-visual-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
  display: grid;
  gap: 4px;
  min-height: 72px;
}

.node-visual-box.asset { border-color: #bbf7d0; background: #f0fdf4; }
.node-visual-box.node.active { border-color: #86efac; background: #ecfdf5; }
.node-visual-box.orphan { border-color: #fcd34d; background: #fffbeb; }
.node-visual-box.ghost {
  border-style: dashed;
  border-color: #cbd5e1;
  background: #f8fafc;
  color: var(--muted);
}

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

.node-visual-box strong {
  font-size: 0.88rem;
  color: var(--navy);
}

.node-visual-box code {
  font-size: 0.78rem;
  word-break: break-all;
}

.node-visual-box small {
  font-size: 0.72rem;
  color: var(--muted);
}

.visual-site {
  color: #64748b;
}

.node-visual-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 36px;
}

.connector-line {
  display: block;
  width: 2px;
  height: 14px;
  background: #94a3b8;
}

.connector-line.dashed {
  background: transparent;
  border-left: 2px dashed #cbd5e1;
  width: 0;
}

.connector-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
}

.connector-pill.muted {
  background: #e2e8f0;
  color: #64748b;
}

.node-open-btn {
  justify-self: start;
}

.node-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.delivery-banner {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #93c5fd;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
}

.delivery-banner strong {
  display: block;
  margin-bottom: 0.25rem;
}

.mqtt-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: min(520px, calc(100vw - 2rem));
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.mqtt-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.mqtt-dialog-body {
  padding: 1.25rem;
}

.mqtt-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.mqtt-dialog-fields {
  display: grid;
  gap: 0.65rem;
  margin: 0 0 1rem;
}

.mqtt-dialog-fields div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.75rem;
  align-items: start;
}

.mqtt-dialog-fields dt {
  margin: 0;
  color: var(--muted, #64748b);
  font-size: 0.9rem;
}

.mqtt-dialog-fields dd {
  margin: 0;
  word-break: break-all;
}

.mqtt-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
  font-size: 0.75rem;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.link-btn {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.link-btn:hover {
  background: #ecfdf3;
}

@media (max-width: 1100px) {
  .suite-body { grid-template-columns: 1fr; }
  .suite-sidebar { max-height: 220px; }
  .dashboard-grid,
  .warning-banners,
  .stats-row,
  .terminal-grid,
  .graphs-grid,
  .nodes-grid,
  .form-row {
    grid-template-columns: 1fr;
  }
  .setup-page-header { flex-direction: column; }
  .setup-toast { max-width: none; }
  .condition-summary { grid-template-columns: 1fr; }
}

.suite-body.ncd-focus {
  grid-template-columns: 1fr;
}

.suite-body.ncd-focus .suite-sidebar {
  display: none;
}

.suite-body.ncd-focus .suite-main {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.ncd-metric-card.warning {
  border-color: #fbbf24;
  background: #fffbeb;
}

.ncd-metric-card.critical {
  border-color: #f87171;
  background: #fef2f2;
}

.ncd-offline-banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

/* display:flex above overrides the HTML hidden attribute without this rule */
.ncd-offline-banner[hidden] {
  display: none !important;
}

.ncd-offline-banner strong {
  font-size: 0.92rem;
}

.ncd-offline-banner span {
  font-size: 0.85rem;
  color: #b91c1c;
}

.ncd-is-offline .ncd-metric-card {
  opacity: 0.72;
}

.ncd-device-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.ncd-device-select {
  min-width: 180px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.ncd-alerts-hint {
  margin: 2px 0 0;
  font-size: 0.82rem;
}

.ncd-threshold-line {
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.ncd-threshold-line.warning {
  stroke: #f59e0b;
}

.ncd-threshold-line.critical {
  stroke: #ef4444;
}

.ncd-threshold-label {
  font-size: 9px;
  font-weight: 600;
}

.ncd-threshold-label.warning {
  fill: #d97706;
}

.ncd-threshold-label.critical {
  fill: #dc2626;
}

.ncd-panel-heading {
  align-items: flex-start;
  gap: 16px;
}

.ncd-panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ncd-drawer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
}

.ncd-drawer.open {
  pointer-events: auto;
}

.ncd-drawer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  margin: 0;
  padding: 0;
  border-radius: 0;
  font: inherit;
  font-weight: normal;
  color: transparent;
  background: rgba(15, 23, 42, 0.42);
  opacity: 0;
  transition: opacity 0.22s ease;
  cursor: pointer;
}

.ncd-drawer-backdrop:hover,
.ncd-drawer-backdrop:focus-visible {
  background: rgba(15, 23, 42, 0.42);
}

.ncd-drawer.open .ncd-drawer-backdrop {
  opacity: 1;
}

.ncd-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100%;
  background: #fff;
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
  transform: translateX(100%);
  transition: transform 0.24s ease;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
}

.ncd-drawer.open .ncd-drawer-panel {
  transform: translateX(0);
}

body.ncd-drawer-open {
  overflow: hidden;
}

.ncd-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.ncd-drawer-header h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.ncd-drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #475569;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
}

.ncd-drawer-close:hover {
  background: #e2e8f0;
}

.ncd-threshold-form {
  display: grid;
  gap: 16px;
}

.ncd-threshold-cards {
  display: grid;
  gap: 14px;
}

.ncd-threshold-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.ncd-threshold-card h4 {
  margin: 0;
  font-size: 1rem;
}

.ncd-threshold-card .muted {
  margin: 2px 0 12px;
  font-size: 0.82rem;
}

.ncd-threshold-card label {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.ncd-threshold-card label:last-child {
  margin-bottom: 0;
}

.ncd-threshold-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
}

.ncd-drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.ncd-alerts-panel {
  margin-bottom: 1rem;
}

.ncd-threshold-hint {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.ncd-threshold-message {
  margin: 0;
  font-size: 0.85rem;
  color: #166534;
}

.ncd-threshold-message.error {
  color: #b91c1c;
}

.ncd-status-row .condition-badge {
  font-size: 0.8rem;
}

@media (max-width: 720px) {
  .ncd-drawer-panel {
    width: 100vw;
  }

  .ncd-panel-actions {
    width: 100%;
    justify-content: space-between;
  }
}

.ncd-monitor-panel .panel-heading {
  align-items: flex-start;
}

.ncd-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.ncd-device-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.ncd-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.ncd-metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.ncd-metric-card .label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.ncd-metric-card strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1.1;
}

.ncd-info-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.ncd-info-grid div {
  display: grid;
  gap: 4px;
}

.ncd-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.ncd-chart-card {
  padding: 16px;
}

.ncd-chart-card h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.ncd-chart,
.ncd-line-chart {
  width: 100%;
  height: auto;
}

.ncd-chart-axis {
  stroke: #cbd5e1;
}

.ncd-chart-label,
.ncd-chart-value {
  fill: #64748b;
  font-size: 11px;
}

.ncd-chart-empty {
  margin: 24px 0;
  text-align: center;
}

.ncd-empty {
  padding: 48px 16px;
  text-align: center;
}

.ncd-log-panel {
  padding-top: 8px;
}

.ncd-verify-panel {
  margin-bottom: 16px;
}

.ncd-verify-checks {
  margin-bottom: 12px;
}

.ncd-check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ncd-check-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.ncd-check-item.pass {
  border-color: #86efac;
  background: #f0fdf4;
}

.ncd-check-item.fail {
  border-color: #fca5a5;
  background: #fef2f2;
}

.ncd-check-label {
  font-weight: 600;
}

.ncd-check-status {
  font-size: 0.82rem;
  font-weight: 600;
}

.ncd-check-item.pass .ncd-check-status { color: #15803d; }
.ncd-check-item.fail .ncd-check-status { color: #b91c1c; }

.ncd-check-detail {
  grid-column: 1 / -1;
  font-size: 0.82rem;
}

.ncd-raw-details {
  margin: 12px 0;
}

.ncd-raw-json {
  margin: 8px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.78rem;
  overflow: auto;
  max-height: 220px;
}

.ncd-reference-form {
  margin-top: 12px;
}

.ncd-reference-hint {
  margin: 0 0 10px;
  font-size: 0.88rem;
}

.ncd-reference-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.ncd-reference-fields label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
}

.ncd-reference-fields input,
.ncd-reference-fields select {
  width: 100%;
}

.ncd-reference-delta {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.ncd-delta-row {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
}

.ncd-delta-row.ok {
  background: #ecfdf5;
  color: #047857;
}

.ncd-delta-row.warn {
  background: #fff7ed;
  color: #c2410c;
}

.ncd-cross-check-hints {
  margin: 12px 0 0;
  padding-left: 18px;
  font-size: 0.86rem;
  color: var(--muted);
}

.ncd-cli-hint {
  display: block;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f1f5f9;
  font-size: 0.78rem;
  word-break: break-all;
}

.ncd-log-panel .panel-heading {
  align-items: center;
}

@media (max-width: 1100px) {
  .ncd-metric-grid,
  .ncd-info-grid,
  .ncd-charts {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .ncd-metric-grid,
  .ncd-info-grid,
  .ncd-charts {
    grid-template-columns: 1fr;
  }

  .ncd-reference-fields {
    grid-template-columns: 1fr;
  }
}

.storage-page-header .storage-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.storage-stats-row {
  margin-bottom: 16px;
}

.storage-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  margin-bottom: 16px;
}

.storage-retention-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-top: 12px;
}

.storage-retention-form label {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}

.storage-retention-form input {
  width: 140px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.storage-cutoff {
  margin-top: 10px;
}

.storage-actions {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.storage-action-hint {
  font-size: 0.82rem;
}

.storage-meta-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.storage-meta-list div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: baseline;
}

.storage-meta-list dt {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
}

.storage-meta-list dd {
  margin: 0;
  font-size: 0.9rem;
  color: var(--navy);
}

.storage-table code {
  font-size: 0.82rem;
}

.storage-status-banner {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.storage-status-banner.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.storage-status-banner.critical {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.storage-status-banner strong {
  font-size: 0.92rem;
}

.storage-status-banner span {
  font-size: 0.85rem;
}

.storage-span-panel {
  margin-bottom: 16px;
}

.storage-span-bar {
  height: 12px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.storage-span-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: #22c55e;
  transition: width 0.3s ease;
}

.storage-span-fill.warning {
  background: #f59e0b;
}

.storage-span-fill.critical {
  background: #ef4444;
}

.storage-auto-purge-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.storage-auto-purge-form label {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}

.storage-auto-purge-form input[type="number"] {
  width: 88px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.storage-checkbox {
  display: flex !important;
  align-items: center;
  gap: 8px;
  min-width: 240px;
}

.storage-checkbox input {
  width: auto;
}

.storage-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.storage-backup-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.storage-backup-row code {
  font-size: 0.78rem;
  word-break: break-all;
}

.storage-purge-dialog {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.45);
}

.storage-purge-dialog[hidden] {
  display: none !important;
}

.storage-purge-dialog-panel {
  width: min(460px, calc(100vw - 32px));
  padding: 20px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

.storage-purge-dialog-panel h3 {
  margin: 0 0 8px;
}

.storage-purge-confirm-label {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.85rem;
}

.storage-purge-confirm-label input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.storage-purge-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.stat-card small {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
}

@media (max-width: 1100px) {
  .storage-grid {
    grid-template-columns: 1fr;
  }

  .storage-breakdown-grid {
    grid-template-columns: 1fr;
  }
}

.login-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
}

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

#suiteApp[hidden] {
  display: none !important;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.login-logo {
  margin-bottom: 10px;
}

.login-card h2 {
  margin: 0 0 6px;
  color: var(--navy);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.login-form label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.login-form input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-form button {
  margin-top: 4px;
}

.login-message {
  margin: 0;
  font-size: 0.85rem;
  color: #166534;
}

.login-message.error {
  color: #b91c1c;
}

.login-hint {
  margin: 14px 0 0;
  font-size: 0.8rem;
}
