/* ── Tokens ──────────────────────────────────────────────── */
:root {
  /* Warm off-white academic canvas */
  --canvas: #f5f1ea;
  --paper: #fbf8f3;
  --surface: #ffffff;
  --ink: #1a1815;
  --ink-2: #3a352e;
  --ink-3: #6b6358;
  --ink-4: #9a9085;
  --line: #e4ddd0;
  --line-strong: #cdc3b3;
  --line-soft: #efeade;

  /* Accent: deep plum + warm gold */
  --accent: #6b2d5c;
  --accent-h: #54234a;
  --accent-soft: #f3e8ef;
  --gold: #b88729;
  --gold-soft: #f5ecd7;

  /* Status */
  --success: #2f6a4a;
  --success-soft: #e6efe8;
  --warn: #9a6a17;
  --warn-soft: #f7ecd2;
  --danger: #a33027;
  --danger-soft: #f5e3e1;
  --info: #2b5684;
  --info-soft: #e5ecf4;

  /* Lesson types — refined, less saturated */
  --lec-bg: #e8ecf5;
  --lec-border: #4a6aa8;
  --lec-text: #304b80;
  --prac-bg: #e5efe6;
  --prac-border: #5a8a62;
  --prac-text: #345938;
  --lab-bg: #efe4ec;
  --lab-border: #8e4e7d;
  --lab-text: #63324f;
  --sem-bg: #f5e8d3;
  --sem-border: #b08437;
  --sem-text: #7a5914;
  --other-bg: #eae5db;
  --other-border: #7a7266;
  --other-text: #4c463d;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 0 rgba(26, 24, 21, 0.04), 0 1px 2px rgba(26, 24, 21, 0.06);
  --shadow-md: 0 4px 12px rgba(26, 24, 21, 0.06), 0 1px 3px rgba(26, 24, 21, 0.08);
  --shadow-lg: 0 12px 36px rgba(26, 24, 21, 0.12), 0 2px 8px rgba(26, 24, 21, 0.06);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body, #root {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--canvas);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
}
button:disabled { cursor: not-allowed; opacity: 0.5; }

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

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

/* ── App shell ───────────────────────────────────────────── */
.appShell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--canvas);
}

/* ── Header ──────────────────────────────────────────────── */
.appHeader {
  display: flex;
  align-items: stretch;
  height: 56px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-right: 24px;
  border-right: 1px solid var(--line);
  margin-right: 24px;
}
.brand__mark {
  font-family: var(--font-serif);
  font-size: 28px;
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  align-self: center;
}
.brand__name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  align-self: center;
  white-space: nowrap;
}
.brand { white-space: nowrap; }
.brand__meta {
  font-size: 11px;
  color: var(--ink-3);
  align-self: center;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.tabNav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.tabNav__item {
  position: relative;
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  transition: color 0.12s;
}
.tabNav__item:hover { color: var(--ink); }
.tabNav__item.is-active { color: var(--ink); }
.tabNav__item.is-active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2px;
  background: var(--accent);
}
.tabNav__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-4);
}
.tabNav__item.is-active .tabNav__dot { background: var(--accent); }
.tabNav__count {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--danger-soft);
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

.headerRight {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}
.user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user__avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
}
.user__name {
  font-size: 13px;
  font-weight: 500;
}
.user__role {
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.iconBtn {
  width: 30px; height: 30px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  transition: background 0.12s, color 0.12s;
}
.iconBtn:hover { background: var(--line-soft); color: var(--ink); }

/* ── Status bar (below header) ───────────────────────────── */
.statusBar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}
.statusBar__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}
.statusBar__dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.statusBar__dot.danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.statusBar__sep {
  width: 1px; height: 14px; background: var(--line-strong);
}
.statusBar__item {
  display: flex; align-items: center; gap: 6px;
}
.statusBar__label { color: var(--ink-4); }
.statusBar__value { color: var(--ink); font-weight: 500; }

/* ── Main content ────────────────────────────────────────── */
.appMain {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
  border: 1px solid transparent;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover:not(:disabled) { background: var(--accent-h); }

.btn--ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn--ghost:hover:not(:disabled) { background: var(--line-soft); }

.btn--subtle {
  background: transparent;
  color: var(--ink-2);
}
.btn--subtle:hover:not(:disabled) { background: var(--line-soft); }

.btn--danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--line-strong);
}
.btn--danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }

.btn--lg { padding: 10px 18px; font-size: 14px; }
.btn--sm { padding: 4px 10px; font-size: 12px; }

.btn--gold {
  background: var(--ink);
  color: var(--paper);
}
.btn--gold:hover:not(:disabled) { background: #000; }

/* ── Form controls ───────────────────────────────────────── */
.input, .select {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--ink-4); }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.field__hint {
  font-size: 12px;
  color: var(--ink-3);
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.card__title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card__title .num {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
}
.card__body { padding: 20px 22px; }
.card__footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  background: var(--line-soft);
  color: var(--ink-2);
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--accent { background: var(--accent-soft); color: var(--accent); }

/* Lesson type pill */
.ltype {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  border: 1px solid;
}
.ltype--lec { background: var(--lec-bg); color: var(--lec-text); border-color: var(--lec-border); }
.ltype--prac { background: var(--prac-bg); color: var(--prac-text); border-color: var(--prac-border); }
.ltype--lab { background: var(--lab-bg); color: var(--lab-text); border-color: var(--lab-border); }
.ltype--sem { background: var(--sem-bg); color: var(--sem-text); border-color: var(--sem-border); }
.ltype--other { background: var(--other-bg); color: var(--other-text); border-color: var(--other-border); }

/* ── Section header (inside screens) ─────────────────────── */
.sectionHeader {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}
.sectionHeader__title {
  font-family: var(--font-serif);
  font-size: 40px;
  font-weight: 400;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.sectionHeader__title em {
  font-style: italic;
  color: var(--accent);
}
.sectionHeader__sub {
  font-size: 13px;
  color: var(--ink-3);
  max-width: 460px;
  line-height: 1.5;
  margin-top: 6px;
}
.sectionHeader__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Kbd ─────────────────────────────────────────────────── */
.kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  box-shadow: 0 1px 0 var(--line-strong);
}

/* ── Tweaks panel ────────────────────────────────────────── */
.tweaksPanel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  font-size: 13px;
}
.tweaksPanel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.tweaksPanel__title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 18px;
  color: var(--ink);
}
.tweaksPanel__body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tweakRow {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tweakRow__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.tweakChips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tweakChip {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 11px;
  color: var(--ink-2);
}
.tweakChip.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ── Density modes ───────────────────────────────────────── */
.density-compact { font-size: 13px; }
.density-cozy { font-size: 14px; }

/* ── Dark mode ───────────────────────────────────────────── */
.theme-dark {
  --canvas: #17161a;
  --paper: #1e1d22;
  --surface: #242328;
  --ink: #f0ebe0;
  --ink-2: #c8c2b5;
  --ink-3: #8c867a;
  --ink-4: #60594d;
  --line: #2e2c32;
  --line-strong: #3a3740;
  --line-soft: #26252a;
  --accent: #d89acb;
  --accent-h: #e8b4dd;
  --accent-soft: #3a2a35;
  --gold: #d6aa56;
  --gold-soft: #3a301a;
  --success-soft: #1e2a22;
  --warn-soft: #2a2418;
  --danger-soft: #2e1e1d;
  --info-soft: #1a2434;

  --lec-bg: #20242e;
  --lec-border: #6688cc;
  --lec-text: #a4bde6;
  --prac-bg: #1e2620;
  --prac-border: #77aa81;
  --prac-text: #a8d1b0;
  --lab-bg: #2a222a;
  --lab-border: #b06fa0;
  --lab-text: #d8a9c6;
  --sem-bg: #2a2418;
  --sem-border: #c79a4a;
  --sem-text: #e5c589;
  --other-bg: #242220;
  --other-border: #8c8478;
  --other-text: #b0a99b;
}
