:root {
  --bg: #07101f;
  --bg-soft: #0b1628;
  --sidebar: #081322;
  --panel: rgba(15, 29, 49, 0.92);
  --panel-strong: #12233b;
  --panel-hover: #172a45;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #f4f7fb;
  --text-soft: #aebbd0;
  --text-muted: #75849d;
  --primary: #8b7cf6;
  --primary-strong: #7666ec;
  --primary-soft: rgba(139, 124, 246, 0.14);
  --cyan: #40d7cf;
  --green: #3dd598;
  --amber: #ffbd5c;
  --red: #ff6b7d;
  --blue: #5b9cf5;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 82% -10%, rgba(91, 156, 245, 0.13), transparent 34%),
    radial-gradient(circle at 42% 0%, rgba(139, 124, 246, 0.11), transparent 26%),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.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;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px 20px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(8, 19, 34, 0.98), rgba(7, 16, 31, 0.98));
  border-right: 1px solid var(--border);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 28px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(139, 124, 246, 0.22), rgba(64, 215, 207, 0.09));
  border: 1px solid rgba(139, 124, 246, 0.3);
}

.brand-mark img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.brand strong,
.brand-eyebrow {
  display: block;
}

.brand strong {
  margin-top: 3px;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-eyebrow,
.page-kicker,
.section-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.side-nav {
  display: grid;
  gap: 7px;
}

.tab-btn {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 9px;
  color: var(--text-soft);
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.tab-btn.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(139, 124, 246, 0.16), rgba(139, 124, 246, 0.07));
  border-color: rgba(139, 124, 246, 0.24);
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active .nav-icon {
  color: #c9c2ff;
  background: rgba(139, 124, 246, 0.17);
}

.nav-count,
.count-badge,
.step-badge {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  display: inline-grid;
  place-items: center;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.nav-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 0 4px rgba(117, 132, 157, 0.1);
}

.nav-status.healthy {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(61, 213, 152, 0.11);
}

.nav-status.warning {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 189, 92, 0.11);
}

.nav-status.critical {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 107, 125, 0.11);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.account-card {
  padding: 12px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.account-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #d8d3ff;
  font-size: 13px;
  font-weight: 800;
  border-radius: 50%;
  background: var(--primary-soft);
  border: 1px solid rgba(139, 124, 246, 0.28);
}

.account-card strong,
.account-card span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card strong {
  font-size: 12px;
}

.account-card div > span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.main-content {
  width: 100%;
  max-width: 1540px;
  min-width: 0;
  margin: 0 auto;
  padding: 0 36px 56px;
}

.topbar {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.topbar-actions,
.monitor-actions,
.toolbar-meta,
.form-actions,
.dialog-actions,
.chart-legend {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}

.status-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-healthy .status-dot,
.status-healthy.nav-status {
  background: var(--green);
}

.status-warning .status-dot,
.status-warning.nav-status {
  background: var(--amber);
}

.status-critical .status-dot,
.status-critical.nav-status {
  background: var(--red);
}

.status-healthy {
  border-color: rgba(61, 213, 152, 0.24) !important;
  background: rgba(61, 213, 152, 0.075) !important;
}

.status-warning {
  border-color: rgba(255, 189, 92, 0.25) !important;
  background: rgba(255, 189, 92, 0.075) !important;
}

.status-critical {
  border-color: rgba(255, 107, 125, 0.26) !important;
  background: rgba(255, 107, 125, 0.075) !important;
}

.icon-button,
.dialog-close {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: var(--text-soft);
  font-size: 20px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.icon-button:hover,
.dialog-close:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
}

.loading-banner {
  margin: 18px 0;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 12px;
  border: 1px solid rgba(91, 156, 245, 0.18);
  border-radius: 12px;
  background: rgba(91, 156, 245, 0.06);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.tab-content {
  padding-top: 28px;
}

.hero-card {
  min-height: 210px;
  padding: 38px 40px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(139, 124, 246, 0.22);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(110deg, rgba(139, 124, 246, 0.16), rgba(64, 215, 207, 0.055)),
    var(--panel);
  box-shadow: var(--shadow);
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -110px;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(139, 124, 246, 0.12);
  border-radius: 50%;
  box-shadow:
    0 0 0 48px rgba(139, 124, 246, 0.035),
    0 0 0 96px rgba(64, 215, 207, 0.02);
}

.hero-card > * {
  position: relative;
  z-index: 1;
}

.hero-card h2,
.section-header h2,
.panel-heading h2,
.maintenance-panel h2,
.dialog-heading h2 {
  margin: 6px 0 0;
  letter-spacing: -0.035em;
}

.hero-card h2 {
  max-width: 670px;
  font-size: clamp(29px, 3vw, 42px);
  line-height: 1.08;
}

.hero-card p,
.section-header p,
.maintenance-panel p {
  max-width: 650px;
  margin: 13px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
}

.button {
  min-height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 10px 28px rgba(118, 102, 236, 0.22);
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #9a8cfa, #7f6ff0);
}

.button-secondary {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.045);
}

.button-secondary:hover:not(:disabled),
.button-ghost:hover:not(:disabled) {
  border-color: rgba(139, 124, 246, 0.33);
  background: rgba(139, 124, 246, 0.08);
}

.button-ghost {
  color: var(--text-soft);
  border-color: var(--border);
  background: transparent;
}

.button-danger {
  color: #ffb3bd;
  border-color: rgba(255, 107, 125, 0.22);
  background: rgba(255, 107, 125, 0.08);
}

.button-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 11px;
}

.button-full {
  width: 100%;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.overview-metrics,
.monitoring-metrics {
  margin-top: 18px;
}

.metric-card {
  min-height: 132px;
  padding: 19px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.metric-label,
.metric-note {
  color: var(--text-muted);
  font-size: 11px;
}

.metric-label {
  font-weight: 700;
}

.metric-value {
  display: block;
  margin: 10px 0 7px;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.045em;
}

.metric-note {
  line-height: 1.45;
}

.overview-layout,
.monitoring-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.monitoring-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel-heading,
.section-header,
.maintenance-panel,
.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.panel-heading {
  margin-bottom: 22px;
}

.panel-heading.compact {
  align-items: center;
  margin-bottom: 18px;
}

.panel-heading h2,
.maintenance-panel h2,
.dialog-heading h2 {
  font-size: 18px;
}

.section-header {
  margin-bottom: 18px;
  align-items: flex-end;
}

.section-header h2 {
  font-size: 27px;
}

.step-badge {
  color: #bdb5ff;
  background: var(--primary-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  margin-bottom: 17px;
  display: grid;
  gap: 8px;
}

.field > span {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
}

.field small {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.45;
}

.field input,
.search-field input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 13px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(4, 12, 24, 0.54);
  transition: border-color 150ms ease, background 150ms ease;
}

.field input::placeholder,
.search-field input::placeholder {
  color: #566681;
}

.field input:focus,
.search-field input:focus {
  border-color: rgba(139, 124, 246, 0.55);
  background: rgba(7, 16, 31, 0.8);
}

.input-prefix {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(4, 12, 24, 0.54);
  overflow: hidden;
}

.input-prefix > span {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 13px;
  border-right: 1px solid var(--border);
}

.input-prefix input {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.drop-zone {
  width: 100%;
  min-height: 90px;
  padding: 14px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  text-align: left;
  border: 1px dashed var(--border-strong);
  border-radius: 13px;
  background: rgba(4, 12, 24, 0.38);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: rgba(139, 124, 246, 0.65);
  background: rgba(139, 124, 246, 0.06);
}

.drop-zone-preview {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
}

.drop-zone-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.drop-zone-copy strong,
.drop-zone-copy small {
  display: block;
}

.drop-zone-copy strong {
  font-size: 12px;
}

.drop-zone-copy small {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10px;
}

.form-status {
  color: var(--text-soft);
  font-size: 11px;
}

.readiness-list,
.alert-list,
.config-list,
.function-list,
.queue-list {
  display: grid;
  gap: 10px;
}

.readiness-list {
  margin-bottom: 18px;
}

.readiness-item,
.config-item,
.function-item,
.queue-item,
.alert-item {
  min-height: 54px;
  padding: 12px 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.022);
}

.readiness-indicator,
.config-indicator,
.function-indicator,
.queue-indicator,
.alert-indicator {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-muted);
}

.indicator-healthy { background: var(--green); }
.indicator-warning { background: var(--amber); }
.indicator-critical { background: var(--red); }
.indicator-idle { background: var(--blue); }

.readiness-item div,
.config-item div,
.function-item div,
.queue-item div,
.alert-item div {
  min-width: 0;
}

.readiness-item strong,
.readiness-item span,
.config-item strong,
.config-item span,
.function-item strong,
.function-item span,
.queue-item strong,
.queue-item span,
.alert-item strong,
.alert-item span {
  display: block;
}

.readiness-item strong,
.config-item strong,
.function-item strong,
.queue-item strong,
.alert-item strong {
  font-size: 11px;
}

.readiness-item span,
.config-item span,
.function-item span,
.queue-item span,
.alert-item span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.4;
}

.skeleton-row {
  overflow: hidden;
  position: relative;
}

.skeleton-row::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.055), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-toolbar {
  min-height: 72px;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--border);
}

.search-field {
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(4, 12, 24, 0.44);
}

.search-field > span {
  display: grid;
  place-items: center;
}

.search-field input {
  height: 38px;
  padding-left: 0;
  border: 0;
  background: transparent;
}

.toolbar-meta {
  color: var(--text-muted);
  font-size: 10px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(4, 12, 24, 0.28);
}

td {
  color: var(--text-soft);
  font-size: 11px;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.022);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.align-right {
  text-align: right;
}

.client-identity {
  min-width: 190px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
}

.client-logo {
  width: 38px;
  height: 38px;
  padding: 4px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.client-identity strong,
.client-identity span {
  display: block;
}

.client-identity strong {
  color: var(--text);
  font-size: 12px;
}

.client-identity span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 9px;
}

.admin-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 300px;
}

.admin-chip,
.state-chip,
.queue-chip {
  min-height: 23px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}

.state-chip.active {
  color: #8cebc3;
  border-color: rgba(61, 213, 152, 0.2);
  background: rgba(61, 213, 152, 0.065);
}

.state-chip.disabled {
  color: #ff9dac;
  border-color: rgba(255, 107, 125, 0.21);
  background: rgba(255, 107, 125, 0.065);
}

.queue-chip.waiting {
  color: #ffd08a;
  border-color: rgba(255, 189, 92, 0.2);
  background: rgba(255, 189, 92, 0.06);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.row-action {
  min-height: 30px;
  padding: 0 9px;
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 750;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.row-action:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.row-action.danger {
  color: #ff9dac;
}

.empty-state {
  min-height: 260px;
  display: grid;
  place-content: center;
  gap: 7px;
  color: var(--text-soft);
  text-align: center;
}

.empty-state span {
  color: var(--text-muted);
  font-size: 11px;
}

.monitoring-header {
  align-items: flex-end;
}

.auto-refresh-control {
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.auto-refresh-control input {
  accent-color: var(--primary);
}

.system-banner {
  min-height: 116px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.system-banner-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
}

.system-banner-icon .status-dot {
  width: 11px;
  height: 11px;
  box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.035);
}

.system-banner h3 {
  margin: 4px 0 0;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.system-banner p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 11px;
}

.system-banner-time {
  text-align: right;
}

.system-banner-time span,
.system-banner-time strong {
  display: block;
}

.system-banner-time span {
  color: var(--text-muted);
  font-size: 9px;
}

.system-banner-time strong {
  margin-top: 5px;
  font-size: 11px;
}

.alert-item,
.config-item,
.function-item,
.queue-item {
  justify-content: space-between;
}

.alert-item > div:first-of-type,
.config-item > div:first-of-type,
.function-item > div:first-of-type,
.queue-item > div:first-of-type {
  flex: 1;
}

.alert-area,
.function-state,
.queue-value {
  color: var(--text-muted);
  font-size: 9px;
  white-space: nowrap;
}

.chart-panel {
  margin-top: 18px;
}

.chart-legend {
  color: var(--text-muted);
  font-size: 9px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-legend i {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 2px;
}

.legend-submitted { background: var(--blue); }
.legend-approved { background: var(--green); }
.legend-rejected { background: var(--red); }

.traffic-chart {
  height: 220px;
  padding-top: 12px;
  display: grid;
  grid-template-columns: repeat(24, minmax(5px, 1fr));
  align-items: end;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  background-image: linear-gradient(to top, var(--border) 1px, transparent 1px);
  background-size: 100% 25%;
}

.chart-hour {
  height: 100%;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  position: relative;
}

.chart-bar {
  min-height: 2px;
  flex: 1;
  border-radius: 3px 3px 0 0;
  transition: opacity 120ms ease;
}

.chart-hour:hover .chart-bar {
  opacity: 0.72;
}

.chart-bar.submitted { background: var(--blue); }
.chart-bar.approved { background: var(--green); }
.chart-bar.rejected { background: var(--red); }

.chart-tooltip {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  min-width: 112px;
  padding: 8px;
  transform: translateX(-50%);
  color: var(--text-soft);
  font-size: 9px;
  line-height: 1.5;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #0b1728;
  box-shadow: var(--shadow);
  z-index: 5;
  pointer-events: none;
}

.chart-hour:hover .chart-tooltip {
  display: block;
}

.maintenance-panel {
  margin-top: 18px;
  align-items: center;
}

.client-dialog {
  width: min(540px, calc(100vw - 28px));
  padding: 0;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: #0d1a2d;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.55);
}

.client-dialog::backdrop {
  background: rgba(3, 8, 17, 0.76);
  backdrop-filter: blur(5px);
}

.delivery-dialog { width: min(820px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.delivery-content { padding: 28px; }
.delivery-dialog .dialog-heading > div { min-width: 0; }
.delivery-dialog h2 { overflow-wrap: anywhere; }
.delivery-description, .delivery-link-sections p, .delivery-status { color: var(--text-soft); font-size: 12px; line-height: 1.8; }
.delivery-description { margin: -8px 0 24px; }
.delivery-grid { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; }
.delivery-qr-section { text-align: center; }
.delivery-qr { aspect-ratio: 1; padding: 0; margin-bottom: 16px; border-radius: 10px; background: transparent; overflow: hidden; }
.delivery-qr canvas { display: block; width: 100%; height: auto; }
.delivery-qr-section p { color: var(--text-muted); font-size: 10px; }
.delivery-link-sections { display: grid; gap: 24px; min-width: 0; }
.delivery-link-sections h3 { margin: 0 0 12px; font-size: 13px; }
.delivery-link-sections input { width: 100%; padding: 11px; color: var(--text); background: rgba(3, 10, 23, 0.4); border: 1px solid var(--border-strong); border-radius: 8px; font-size: 11px; }
.delivery-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.delivery-status { min-height: 22px; margin: 24px 0 0; }
.delivery-dialog a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.delivery-dialog a[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
@media (max-width: 620px) { .delivery-content { padding: 22px; } .delivery-grid { grid-template-columns: 1fr; } .delivery-qr-section { width: min(210px, 100%); margin: 0 auto; } }

.client-dialog form {
  padding: 26px;
}

.dialog-heading {
  margin-bottom: 24px;
}

.dialog-close {
  border: 0;
  background: transparent;
}

.dialog-actions {
  margin-top: 24px;
  justify-content: flex-end;
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: min(360px, calc(100vw - 32px));
  display: grid;
  gap: 9px;
  z-index: 100;
}

.toast {
  padding: 13px 14px;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: #102039;
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease-out;
}

.toast::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.toast.success::before { background: var(--green); }
.toast.warning::before { background: var(--amber); }
.toast.error::before { background: var(--red); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-layout,
  .monitoring-grid,
  .monitoring-grid-wide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    height: auto;
    padding: 12px 18px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    padding: 0;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand strong,
  .brand-eyebrow {
    display: none;
  }

  .side-nav {
    display: flex;
    justify-content: center;
  }

  .tab-btn {
    width: auto;
    min-height: 40px;
    grid-template-columns: 1fr auto;
    padding: 0 13px;
  }

  .nav-icon,
  .nav-count {
    display: none;
  }

  .sidebar-footer {
    margin: 0;
    display: block;
  }

  .account-card {
    display: none;
  }

  .sidebar-footer .button {
    min-height: 36px;
    width: auto;
    padding: 0 12px;
  }

  .main-content {
    padding: 0 22px 44px;
  }
}

@media (max-width: 720px) {
  .sidebar {
    grid-template-columns: auto 1fr;
  }

  .side-nav {
    justify-content: flex-end;
  }

  .tab-btn {
    padding: 0 10px;
    font-size: 11px;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    padding: 0 14px 34px;
  }

  .topbar {
    min-height: 78px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .status-pill {
    display: none;
  }

  .hero-card {
    min-height: auto;
    padding: 28px 24px;
    display: grid;
  }

  .hero-card h2 {
    font-size: 29px;
  }

  .metric-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .system-banner {
    padding: 19px;
  }

  .section-header,
  .panel-heading,
  .maintenance-panel,
  .monitoring-header {
    display: grid;
  }

  .monitor-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .auto-refresh-control {
    width: 100%;
  }

  .system-banner {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .system-banner-time {
    grid-column: 2;
    text-align: left;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field {
    width: 100%;
  }

  .toolbar-meta {
    justify-content: space-between;
  }

  th,
  td {
    padding: 12px 14px;
  }

  .drop-zone {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .drop-zone .button {
    display: none;
  }

  .chart-legend {
    flex-wrap: wrap;
  }

  .traffic-chart {
    gap: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
