:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fb;
  --sidebar-bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #eef3f8;
  --panel-3: #f7faff;
  --input: #ffffff;
  --border: #d5dfeb;
  --border-soft: #e5edf6;
  --text: #081425;
  --muted: #64758b;
  --accent: #2d8cff;
  --accent-soft: #e8f2ff;
  --accent-text: #ffffff;
  --danger: #d93030;
  --success: #138a5b;
  --shadow: 0 12px 30px rgba(26, 46, 74, 0.07);
  --font: "Segoe UI", Arial, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #201e1e;
  --sidebar-bg: #181617;
  --panel: #272323;
  --panel-2: #312b2d;
  --panel-3: #241f20;
  --input: #201e1e;
  --border: #4a333b;
  --border-soft: #382a30;
  --text: #f7edf1;
  --muted: #b99aaa;
  --accent: #940c3d;
  --accent-soft: #371623;
  --accent-text: #ffffff;
  --danger: #ff7a7a;
  --success: #6ed9ad;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

[data-theme="terminal"] {
  color-scheme: dark;
  --bg: #050505;
  --sidebar-bg: #0b0b0b;
  --panel: #0f0f0f;
  --panel-2: #141414;
  --panel-3: #0b0b0b;
  --input: #050505;
  --border: #232323;
  --border-soft: #1a1a1a;
  --text: #f5f5f5;
  --muted: #8a8a8a;
  --accent: #ffd500;
  --accent-soft: #171400;
  --accent-text: #000000;
  --danger: #ff5c5c;
  --success: #7ee787;
  --shadow: none;
  --font: Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex: 0 0 250px;
  flex-direction: column;
  width: 250px;
  height: 100vh;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
}

.sidebar-brand-row,
.sidebar-brand {
  display: flex;
  align-items: center;
}

.sidebar-brand-row {
  justify-content: space-between;
  gap: 10px;
}

.sidebar-brand {
  min-width: 0;
  gap: 11px;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 800;
}

.brand-mark {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

.brand-copy strong,
.brand-copy small {
  display: block;
}

.brand-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  white-space: nowrap;
}

.brand-copy b {
  color: var(--accent);
}

.brand-copy small {
  color: var(--muted);
  font-size: 11px;
}

.sidebar-last-update {
  display: grid;
  gap: 4px;
  margin-top: 22px;
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
}

.sidebar-last-update span {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar-last-update time {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.sidebar-last-update:hover {
  background: var(--panel-2);
  color: var(--accent);
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  gap: 6px;
  margin-top: 18px;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.nav-link:hover {
  border-color: var(--border);
  background: var(--panel-2);
  color: var(--text);
}

.nav-link.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.sidebar-footer {
  display: grid;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
}

.sidebar-logout {
  margin: 0;
}

.sidebar-logout button {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.sidebar-logout button:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.workspace {
  flex: 1;
  min-width: 0;
}

.workspace-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 116px;
  gap: 24px;
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.page-context,
.section-kicker,
.metric-label {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 3px 0 2px;
  font-size: 28px;
  line-height: 1.2;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.header-status {
  display: flex;
  align-items: center;
  min-height: 34px;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
}

.page-content {
  width: min(1180px, 100%);
  padding: 30px 32px 48px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.menu-button,
.sidebar-close,
.sidebar-scrim {
  display: none;
}

@media (max-width: 840px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 10;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.55);
  }

  body.sidebar-open .sidebar-scrim,
  .menu-button,
  .sidebar-close {
    display: grid;
  }

  .workspace-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 104px;
    padding: 20px 22px;
  }

  .menu-icon {
    display: grid;
    gap: 4px;
  }

  .menu-icon i {
    display: block;
    width: 17px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
  }

  .page-content {
    padding: 24px 22px 40px;
  }
}

@media (max-width: 680px) {
  .workspace-header {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .header-status {
    display: none;
  }

  .page-heading h1 {
    font-size: 22px;
  }

  .page-heading p {
    display: none;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
