/* Geist and Geist Mono (SIL Open Font License, see fonts/OFL.txt), self-hosted. */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/geist-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/geist-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --surface-0: #f6f6fb;
  --surface-1: #ffffff;
  --border: #e4e3ee;
  --border-strong: #c9c7d8;
  --text-primary: #17142b;
  --text-secondary: #4b4863;
  --text-muted: #6e6b85;
  --accent: #5b3df5;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(91, 61, 245, 0.1);
  --series-1: #5b3df5;
  --danger: #c42b4b;
  --live: #16a34a;
  --status-under: #a86a10;
  --status-under-soft: rgba(214, 158, 46, 0.16);
  --status-good: #12a96f;
  --status-good-soft: rgba(18, 169, 111, 0.12);
  --status-over: #e0352f;
  --status-over-soft: rgba(240, 69, 63, 0.12);
  --status-barely: #5f5e5a;
  --status-barely-soft: rgba(95, 94, 90, 0.12);
  --status-used: #3b6d11;
  --status-used-soft: rgba(99, 153, 34, 0.12);
  --status-maxed: #ffffff;
  --status-maxed-soft: #12a96f;
  --status-learning: #3c3489;
  --status-learning-soft: rgba(91, 61, 245, 0.1);

  --font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-strong: 600;
  --radius: 12px;
  --radius-small: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --content-width: 1120px;
}

/* Dark theme: chosen with the theme switch (cookie "theme"). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #0f0d1a;
  --surface-1: #181527;
  --border: #2a2640;
  --border-strong: #423d5c;
  --text-primary: #f1effa;
  --text-secondary: #c4c0d9;
  --text-muted: #9a96b3;
  --accent: #8b76ff;
  --accent-contrast: #120e24;
  --accent-soft: rgba(139, 118, 255, 0.18);
  --series-1: #8b76ff;
  --danger: #f06a84;
  --live: #22c55e;
  --status-under: #f0b44c;
  --status-under-soft: rgba(240, 180, 76, 0.16);
  --status-good: #34d399;
  --status-good-soft: rgba(52, 211, 153, 0.14);
  --status-over: #f87171;
  --status-over-soft: rgba(248, 113, 113, 0.14);
  --status-barely: #c4c0d9;
  --status-barely-soft: rgba(196, 192, 217, 0.12);
  --status-used: #a3d977;
  --status-used-soft: rgba(163, 217, 119, 0.12);
  --status-maxed: #0f0d1a;
  --status-maxed-soft: #34d399;
  --status-learning: #c4b8ff;
  --status-learning-soft: rgba(139, 118, 255, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--surface-0);
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-weight: var(--weight-strong);
  letter-spacing: -0.015em;
}

a {
  color: inherit;
}

/* Shared UI conventions */

.ui-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ui-label {
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.ui-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.ui-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.ui-button {
  padding: var(--space-2) var(--space-4);
  font: inherit;
  font-weight: var(--weight-medium);
  color: var(--accent-contrast);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-small);
  cursor: pointer;
}

.ui-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

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

.ui-button-ghost:hover {
  color: var(--text-primary);
}

.ui-button-danger {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

[data-theme="dark"] .ui-button-danger {
  color: #120e24;
}

.ui-error {
  color: var(--danger);
  font-size: 14px;
}

.ui-error:empty {
  display: none;
}

.ui-muted {
  color: var(--text-muted);
}

/* Page layout shared by every view */

.ui-page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-2) var(--space-5) var(--space-6);
}

.ui-page-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-5);
}

.ui-page-title {
  font-size: 24px;
  letter-spacing: -0.02em;
}

.ui-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.ui-section-title {
  font-size: 18px;
}

.ui-back {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
}

.ui-back:hover {
  color: var(--text-primary);
}

.ui-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ui-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

@media (max-width: 600px) {
  .ui-page {
    padding: var(--space-2) var(--space-4) var(--space-5);
  }
}
