:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #0d0d0f;
  --surface-soft: #141417;
  --surface-strong: #1b1b1f;
  --text: #fffef8;
  --muted: #c2c2ba;
  --line: rgba(255, 255, 255, 0.18);
  --accent: #b8ff6b;
  --accent-strong: #d7ffab;
  --danger: #ff7676;
  --shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
  --font-ui: "IBM Plex Sans", "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f3eb;
  --surface: #fffef8;
  --surface-soft: #f0ebdd;
  --surface-strong: #e7e0cf;
  --text: #121212;
  --muted: #5d5b57;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #b8ff6b;
  --accent-strong: #b8ff6b;
  --danger: #a12929;
  --shadow: 0 18px 60px rgba(31, 23, 8, 0.10);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(184, 255, 107, 0.12), transparent 24%),
    radial-gradient(circle at bottom right, rgba(184, 255, 107, 0.08), transparent 20%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
}

body {
  min-height: 100vh;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.auth-shell,
.app-shell {
  min-height: 100vh;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 9;
}

body[data-drawer-open] .drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.auth-shell {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card,
.hero-card,
.stat-card,
.panel-card,
.drawer,
.topbar {
  backdrop-filter: blur(14px);
}

.auth-card {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  background: rgba(14, 14, 15, 0.78);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px;
}

:root[data-theme="light"] .auth-card,
:root[data-theme="light"] .hero-card,
:root[data-theme="light"] .stat-card,
:root[data-theme="light"] .panel-card,
:root[data-theme="light"] .drawer,
:root[data-theme="light"] .topbar {
  background: rgba(255, 254, 248, 0.86);
}

.brand-row,
.topbar,
.topbar-left,
.topbar-actions,
.drawer-head,
.section-head,
.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(184, 255, 107, 0.24), rgba(184, 255, 107, 0.04));
  border: 1px solid var(--line);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
  fill: var(--accent);
}

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

h1,
h2,
h3,
.stat-value {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.lead,
.hero-copy,
.stat-label,
.simple-list,
label span {
  color: var(--muted);
}

.lead {
  margin: 18px 0 24px;
  line-height: 1.6;
}

.auth-form,
.simple-list {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(184, 255, 107, 0.55);
  box-shadow: 0 0 0 4px rgba(184, 255, 107, 0.08);
}

.primary-button,
.ghost-button {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 12px 16px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.primary-button {
  background: var(--accent);
  color: #111111;
  border-color: transparent;
  font-weight: 600;
}

.ghost-button {
  background: transparent;
  color: var(--text);
}

.primary-button:hover,
.ghost-button:hover,
.nav-link:hover {
  transform: translateY(-1px);
}

.error-text {
  margin: -4px 0 0;
  color: var(--danger);
}

.app-shell {
  min-height: 100vh;
}

.drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(82vw, 320px);
  transform: translateX(-103%);
  transition: transform 180ms ease;
  z-index: 10;
  overflow-y: auto;
  min-height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(14, 14, 15, 0.84);
}

body[data-drawer-open] .drawer {
  transform: translateX(0);
}

.drawer-nav {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.drawer-footer {
  display: grid;
  gap: 10px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.drawer-button {
  width: 100%;
  justify-content: center;
}

.nav-link {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  color: var(--muted);
}

.nav-link:hover {
  border-color: var(--line);
  color: var(--text);
  background: var(--surface-soft);
}

.nav-link.is-active {
  border-color: rgba(184, 255, 107, 0.24);
  color: var(--text);
  background: rgba(184, 255, 107, 0.10);
}

.main-panel {
  padding: 24px;
}

.topbar {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(14, 14, 15, 0.78);
}

.hero-card,
.panel-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(14, 14, 15, 0.74);
}

.hero-card {
  margin-top: 20px;
  padding: 28px;
}

.hero-copy {
  max-width: 58ch;
  line-height: 1.7;
}

.stats-grid,
.content-grid {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

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

.stat-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  background: rgba(14, 14, 15, 0.74);
}

.stat-label {
  margin: 0 0 10px;
}

.stat-value {
  font-size: clamp(2rem, 5vw, 3rem);
}

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

.panel-card {
  padding: 24px;
}

.panel-spacer {
  margin-top: 20px;
}

.split-card,
.chip-row,
.field-grid {
  display: grid;
  gap: 16px;
}

.split-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.chip-row {
  grid-auto-flow: row;
  align-content: end;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(184, 255, 107, 0.24);
  background: rgba(184, 255, 107, 0.10);
  color: var(--text);
}

.record-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.compact-field {
  min-width: 220px;
}

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

.blocks-grid {
  grid-template-columns: minmax(320px, 520px) minmax(0, 1fr);
}

.table-card {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  margin-top: 18px;
}

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

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table thead th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.data-table tbody td,
.hero-copy,
.lead,
.simple-list,
label span,
.stat-label {
  color: var(--text);
}

.eyebrow {
  color: var(--muted);
  font-weight: 600;
}

h1,
h2,
h3,
.stat-value,
.nav-link,
.ghost-button,
.primary-button {
  font-weight: 700;
}

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

.success-text {
  margin: 12px 0 0;
  color: var(--accent);
}

.stack-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.list-row p {
  margin: 4px 0 0;
  color: var(--muted);
}

.chart-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.range-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.range-tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.range-tab:hover {
  transform: translateY(-1px);
}

.range-tab.is-active {
  border-color: rgba(184, 255, 107, 0.24);
  background: rgba(184, 255, 107, 0.10);
}

.refresh-note {
  margin: 0;
  color: var(--muted);
}

.live-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.mini-stat {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.mini-stat p {
  margin: 0 0 8px;
  color: var(--muted);
}

.mini-stat strong {
  font-size: 1.25rem;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.chart-head span {
  color: var(--muted);
}

.trend-chart {
  width: 100%;
  height: 220px;
  display: block;
  margin-top: 14px;
  color: var(--text);
}

.chart-gridline {
  stroke: rgba(255, 255, 255, 0.10);
  stroke-width: 1;
}

.chart-area {
  fill: rgba(184, 255, 107, 0.10);
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.simple-list {
  padding-left: 18px;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .topbar,
  .topbar-left,
  .topbar-actions,
  .brand-row,
  .split-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .live-stats,
  .chart-grid,
  .field-grid,
  .blocks-grid,
  .stats-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }
}
