:root {
  --bg: #09111d;
  --bg-soft: rgba(10, 25, 42, 0.82);
  --panel: rgba(11, 22, 36, 0.88);
  --panel-strong: rgba(13, 29, 48, 0.96);
  --border: rgba(120, 167, 206, 0.22);
  --text: #eff6ff;
  --muted: rgba(218, 230, 248, 0.7);
  --accent: #8de1ff;
  --warm: #f4ba76;
  --danger: #ff7d7d;
  --success: #6fe4a8;
  --shadow: 0 22px 52px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(141, 225, 255, 0.18), transparent 38%),
    radial-gradient(circle at top right, rgba(244, 186, 118, 0.18), transparent 32%),
    linear-gradient(180deg, #08101b 0%, #09131f 48%, #0b1321 100%);
  color: var(--text);
}

body {
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 42px 42px;
  pointer-events: none;
  opacity: 0.34;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0, transparent 50%);
  opacity: 0.1;
  mix-blend-mode: screen;
}

.shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 48px;
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 0.9fr);
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.hero-copy h1,
.panel-head h2,
.inventory-group-head h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  letter-spacing: 0.02em;
}

.hero-copy h1 {
  font-size: clamp(2.7rem, 5vw, 4.6rem);
  line-height: 0.98;
  max-width: 9ch;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.lede {
  color: var(--muted);
  max-width: 58ch;
  font-size: 1.02rem;
  line-height: 1.7;
}

.signal-card,
.panel,
.metric-card {
  background: linear-gradient(180deg, rgba(14, 28, 46, 0.95), rgba(8, 19, 32, 0.88));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.signal-card {
  border-radius: 22px;
  padding: 22px;
  display: grid;
  gap: 10px;
}

.signal-label,
.status-label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pill,
.badge,
.action-button,
.mode-button {
  font-family: "Lucida Console", "Cascadia Mono", monospace;
}

.pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(244, 186, 118, 0.34);
  color: var(--warm);
  background: rgba(244, 186, 118, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  border-radius: 20px;
  padding: 18px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-card span {
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.73rem;
}

.metric-card strong {
  font-size: 2.3rem;
  line-height: 1;
}

.panel {
  border-radius: 24px;
  padding: 22px;
  margin-bottom: 20px;
}

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

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 54ch;
  line-height: 1.7;
}

.controls-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

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

.mode-button,
.action-button {
  border: 1px solid rgba(141, 225, 255, 0.24);
  background: rgba(18, 31, 48, 0.88);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.mode-button:hover,
.action-button:hover {
  transform: translateY(-1px);
  border-color: rgba(141, 225, 255, 0.42);
}

.mode-button[data-active="true"] {
  background: linear-gradient(135deg, rgba(87, 196, 242, 0.22), rgba(244, 186, 118, 0.16));
  border-color: rgba(244, 186, 118, 0.42);
}

.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.action-button-primary {
  background: linear-gradient(135deg, rgba(87, 196, 242, 0.28), rgba(11, 31, 55, 0.9));
}

.status-bar {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.toast {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px dashed rgba(141, 225, 255, 0.25);
  background: rgba(11, 20, 30, 0.56);
  min-height: 48px;
}

.toast[data-tone="success"] {
  border-color: rgba(111, 228, 168, 0.38);
  color: var(--success);
}

.toast[data-tone="danger"] {
  border-color: rgba(255, 125, 125, 0.38);
  color: var(--danger);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

label span {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

input,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(141, 225, 255, 0.16);
  background: rgba(7, 14, 24, 0.92);
  color: var(--text);
  padding: 12px 13px;
  font: inherit;
}

.inventory-groups {
  display: grid;
  gap: 16px;
}

.inventory-group {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(8, 17, 29, 0.74);
}

.inventory-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

th {
  font-size: 0.76rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.cell-primary {
  font-weight: 600;
}

.cell-secondary,
.log-path {
  margin-top: 4px;
  font-size: 0.86rem;
  color: var(--muted);
  word-break: break-word;
}

.badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.78rem;
}

.badge-plan {
  color: var(--warm);
}

.badge-plan-free {
  color: var(--accent);
}

.badge-plan-plus {
  color: var(--warm);
}

.badge-priority,
.badge-target {
  color: var(--accent);
}

.badge-status {
  color: var(--text);
}

.quota-cell {
  min-width: 320px;
}

.quota-stack {
  display: grid;
  gap: 10px;
}

.quota-window {
  display: grid;
  gap: 6px;
}

.quota-window-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  font-size: 0.84rem;
}

.quota-window-head span:last-child {
  color: var(--muted);
  font-size: 0.8rem;
}

.quota-window-head strong {
  font-size: 0.84rem;
}

.quota-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.quota-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1dd1a1 0%, #2fe8b5 100%);
}

.quota-meta,
.quota-empty {
  font-size: 0.82rem;
  color: var(--muted);
}

.quota-meta-error,
.quota-empty-error {
  color: var(--danger);
}

.row-status-in-sync {
  background: linear-gradient(90deg, rgba(111, 228, 168, 0.06), transparent 58%);
}

.row-status-drifted {
  background: linear-gradient(90deg, rgba(244, 186, 118, 0.08), transparent 58%);
}

.row-status-unmanaged-plan,
.row-status-unsupported-provider {
  background: linear-gradient(90deg, rgba(141, 225, 255, 0.05), transparent 58%);
}

.row-status-error {
  background: linear-gradient(90deg, rgba(255, 125, 125, 0.08), transparent 58%);
}

.logs-list {
  display: grid;
  gap: 12px;
}

.log-entry {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(8, 18, 30, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.log-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.badge-log-level {
  color: var(--accent);
}

.log-message {
  line-height: 1.7;
}

.empty-state {
  padding: 22px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: var(--muted);
  text-align: center;
}

body[data-busy="true"] .action-button,
body[data-busy="true"] .mode-button {
  opacity: 0.62;
  cursor: progress;
}

@media (max-width: 1200px) {
  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 860px) {
  .shell {
    width: min(100%, calc(100% - 24px));
    padding-top: 20px;
  }

  .hero,
  .controls-grid,
  .status-bar,
  .filters-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
  }
}
