/* ─────────────────────────────────────────────────────────────────────────
   AssessIQ — Navy & Bone
   Polished editorial palette: deep navy accent on warm off-white.
   Quiet, refined, serif for thinking and sans for working.
   ───────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,400;1,9..144,500&family=Inter:wght@400;500;600;700&display=swap');

/* ─── TOKENS ─────────────────────────────────────────────────────────────── */
:root {
  /* Paper palette — warm off-whites */
  --paper: #fafaf7;
  --paper-2: #f3f3ee;
  --paper-3: #ebebe4;
  --paper-edge: #dcdcd2;

  /* Ink — slate near-black */
  --ink: #0d1117;
  --ink-2: #2c313a;
  --ink-3: #65697a;
  --ink-4: #9ea2b1;

  /* Rules — quiet hairlines */
  --rule: #e3e3db;
  --rule-soft: #eeeee7;
  --rule-strong: #cdcdc4;

  /* Accent — AssessIQ navy (matches Tailwind --primary across the app).
     Source of truth: includes/head.php tailwind.config.theme.colors.primary (#002045). */
  --forest: #002045;
  --forest-deep: #001b3c;
  --forest-soft: #d6e3ff;
  --forest-wash: #eff4ff;
  --forest-glow: rgba(0, 32, 69, 0.18);

  /* Inked surface — used for the CTA band, dark cards, modals.
     Deep midnight, stays dark in both light and dark themes. */
  --inked: #0a0e1c;
  --inked-2: #131829;
  --inked-text: #f4f5fb;
  --inked-text-2: rgba(244, 245, 251, 0.74);

  /* Status — semantic colors, muted */
  --ok: #1f7a4a;
  --ok-soft: #e6f3eb;
  --warn: #a85f17;
  --warn-soft: #faecd2;
  --bad: #b13a2c;
  --bad-soft: #fae3df;

  /* Aliases for legacy class names already in views/ */
  --bg: var(--paper);
  --surface: #ffffff;
  --surface-2: var(--paper-2);
  --border: var(--rule);
  --text: var(--ink);
  --text-2: var(--ink-2);
  --text-3: var(--ink-3);
  --primary: var(--forest);
  --primary-text: #ffffff;
  --primary-light: var(--forest-soft);
  --accent: #1960a3;
  /* matches Tailwind --secondary */
  --success: var(--ok);
  --warning: var(--warn);
  --danger: var(--bad);

  /* Geometry */
  --r-1: 6px;
  --r-2: 10px;
  --r-3: 14px;
  --r-4: 20px;
  --radius: var(--r-2);
  --radius-lg: var(--r-4);

  /* Shadows — warm, never blue */
  --shadow-1: 0 1px 0 rgba(26, 31, 26, 0.04), 0 1px 2px rgba(60, 55, 30, 0.05);
  --shadow-2: 0 1px 0 rgba(26, 31, 26, 0.04), 0 8px 20px -8px rgba(60, 55, 30, 0.14);
  --shadow-3: 0 1px 0 rgba(26, 31, 26, 0.04), 0 22px 50px -18px rgba(60, 55, 30, 0.22);
  --shadow-stamp: inset 0 -2px 0 rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  --shadow-sm: var(--shadow-1);
  --shadow-md: var(--shadow-2);
  --shadow-lg: var(--shadow-3);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 160ms var(--ease);
  --t: 240ms var(--ease);
  --t-slow: 420ms var(--ease-out);
  --transition: var(--t);

  /* Type */
  --font-serif: 'Fraunces', 'Tiempos', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --paper: #0b0e16;
  --paper-2: #14182a;
  --paper-3: #1d223a;
  --paper-edge: #2a304b;

  --ink: #f4f5fb;
  --ink-2: #c6cad8;
  --ink-3: #8a8fa2;
  --ink-4: #5d6178;

  --rule: #232844;
  --rule-soft: #1c2038;
  --rule-strong: #353c5c;

  --forest: #6f8ae6;
  --forest-deep: #93a8ee;
  --forest-soft: #1a2348;
  --forest-wash: #131b3c;
  --forest-glow: rgba(111, 138, 230, 0.22);

  --ok-soft: #14301f;
  --warn-soft: #3a2614;
  --bad-soft: #3a1d1a;

  --bg: var(--paper);
  --surface: var(--paper-2);
  --surface-2: var(--paper-3);
  --border: var(--rule);
  --primary-light: var(--forest-soft);
  --primary: var(--forest);

  --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 1px 0 rgba(0, 0, 0, 0.4), 0 12px 28px -10px rgba(0, 0, 0, 0.55);
  --shadow-3: 0 1px 0 rgba(0, 0, 0, 0.4), 0 30px 60px -20px rgba(0, 0, 0, 0.7);
  --shadow-stamp: inset 0 -2px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11", "kern";
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--forest-glow);
  color: var(--ink);
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: 100px;
  border: 3px solid var(--paper);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--rule-strong);
}

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

button {
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
}

img,
svg {
  max-width: 100%;
  display: block;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 24px 0;
}

/* ─── TYPOGRAPHY ─────────────────────────────────────────────────────────── */
h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.018em;
  color: var(--ink);
  font-variation-settings: "opsz" 96;
}

h1 {
  font-size: clamp(2.4rem, 4.8vw, 4rem);
  font-weight: 400;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  font-weight: 400;
  letter-spacing: -0.022em;
}

h3 {
  font-size: 1.35rem;
}

h4 {
  font-size: 1.1rem;
}

p {
  color: var(--ink-2);
}

em,
i {
  font-style: italic;
}

strong,
b {
  font-weight: 600;
  color: var(--ink);
}

.prose a,
a.link {
  color: var(--ink);
  border-bottom: 1px solid var(--rule-strong);
  transition: border-color var(--t-fast), color var(--t-fast);
}

.prose a:hover,
a.link:hover {
  color: var(--forest-deep);
  border-bottom-color: var(--forest);
}

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

code:not(pre code) {
  padding: 1px 6px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 5px;
  color: var(--ink);
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #fff;
  }
}

/* ─── PAPER-GRAIN BACKGROUND ─────────────────────────────────────────────── */
.paper-bg {
  background:
    radial-gradient(1100px 600px at 88% -10%, var(--forest-soft), transparent 60%),
    radial-gradient(900px 520px at -10% 110%, var(--paper-3), transparent 55%),
    var(--paper);
}

/* ─── APP LAYOUT ─────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background: var(--paper);
}

/* SIDEBAR */
.sidebar {
  width: 268px;
  flex: 0 0 268px;
  background: var(--paper-2);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  padding: 26px 16px;
  border-right: 1px solid var(--rule);
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding: 0 8px;
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--forest);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-stamp);
  font-variation-settings: "opsz" 24;
}

.sidebar-logo h1 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
}

.sidebar-logo span {
  font-size: 0.72rem;
  color: var(--ink-3);
  display: block;
  margin-top: 3px;
  font-style: italic;
  font-family: var(--font-serif);
}

.sidebar-section {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  margin: 22px 12px 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--ink-2);
  position: relative;
  transition: background var(--t-fast), color var(--t-fast);
}

.nav-item:hover {
  background: var(--paper);
  color: var(--ink);
}

.nav-item.active {
  background: var(--paper);
  color: var(--forest-deep);
  font-weight: 600;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--forest);
  border-radius: 2px;
}

.nav-icon {
  font-size: 1rem;
  opacity: 0.9;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: var(--shadow-stamp);
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.user-role {
  font-size: 0.68rem;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.btn-logout {
  color: var(--ink-3);
  transition: color var(--t-fast);
  font-size: 1rem;
  padding: 6px;
}

.btn-logout:hover {
  color: var(--forest);
}

/* MAIN CONTENT */
.main-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--paper);
  min-width: 0;
}

.top-header {
  height: 72px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  flex-shrink: 0;
}

.header-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.018em;
  line-height: 1.1;
  font-variation-settings: "opsz" 36;
}

.header-sub {
  font-size: 0.85rem;
  color: var(--ink-3);
  margin-top: 3px;
  font-style: italic;
  font-family: var(--font-serif);
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  background: var(--paper);
}

.content-area {
  padding: 40px;
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
}

/* ─── DASHBOARD COMPONENTS ───────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 36px;
  width: 100%;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 22px 24px;
  border-radius: var(--r-3);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--rule-strong);
}

.stat-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--forest);
  opacity: 0;
  transition: opacity var(--t);
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-icon {
  width: 40px;
  height: 40px;
  background: var(--forest-soft);
  color: var(--forest-deep);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 72;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 22px;
  width: 100%;
}

@media (max-width: 1100px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 26px 28px;
  border-radius: var(--r-3);
  box-shadow: var(--shadow-1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule-soft);
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.012em;
  font-variation-settings: "opsz" 32;
}

.card-sub {
  font-size: 0.85rem;
  color: var(--ink-3);
  font-style: italic;
  font-family: var(--font-serif);
}

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-2);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  transition:
    transform var(--t-fast),
    background var(--t-fast),
    border-color var(--t-fast),
    box-shadow var(--t-fast),
    color var(--t-fast);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--forest);
  color: #fff;
  border-color: var(--forest-deep);
  box-shadow: var(--shadow-stamp);
}

.btn-primary:hover {
  background: var(--forest-deep);
  border-color: var(--forest-deep);
  transform: translateY(-1px);
  box-shadow: var(--shadow-stamp), 0 6px 18px var(--forest-glow);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-stamp);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--rule);
  box-shadow: var(--shadow-1);
}

.btn-secondary:hover {
  background: var(--paper-2);
  border-color: var(--rule-strong);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--forest-deep);
  border-color: transparent;
  padding: 8px 12px;
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--forest-soft);
}

.btn-ink {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn-ink:hover {
  background: #000;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-lg {
  padding: 13px 24px;
  font-size: 0.95rem;
  border-radius: var(--r-2);
}

.w-full {
  width: 100%;
}

/* ─── FORMS ──────────────────────────────────────────────────────────────── */
.form-input,
.form-textarea,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  border-radius: var(--r-2);
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font-sans);
  min-height: 44px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

textarea,
textarea.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.55;
  padding: 14px;
  font-family: var(--font-serif);
  font-size: 1rem;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 4px var(--forest-glow);
  background: var(--surface);
}

.form-input:hover:not(:focus),
input:hover:not(:focus),
textarea:hover:not(:focus),
select:hover:not(:focus) {
  border-color: var(--rule-strong);
}

.form-input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--ink-4);
  opacity: 1;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 7px;
  letter-spacing: 0.005em;
}

.form-hint {
  display: block;
  font-size: 0.78rem;
  font-style: italic;
  font-family: var(--font-serif);
  color: var(--ink-3);
  margin-top: 6px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%236b716a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ─── TABLES ─────────────────────────────────────────────────────────────── */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r-3);
  background: var(--surface);
}

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

.data-table th {
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
}

.data-table td {
  padding: 14px 16px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--rule-soft);
  font-weight: 500;
  color: var(--ink-2);
  vertical-align: top;
}

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

.data-table tbody tr {
  transition: background var(--t-fast);
}

.data-table tbody tr:hover td {
  background: var(--paper-2);
}

/* ─── BADGES ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  border: 1px solid transparent;
}

.badge-success {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: rgba(31, 122, 74, 0.20);
}

.badge-warning {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(168, 95, 23, 0.22);
}

.badge-danger {
  background: var(--bad-soft);
  color: var(--bad);
  border-color: rgba(177, 58, 44, 0.20);
}

.badge-forest {
  background: var(--forest-soft);
  color: var(--forest-deep);
  border-color: rgba(30, 58, 138, 0.20);
}

.badge-quiet {
  background: var(--paper-2);
  color: var(--ink-2);
  border-color: var(--rule);
}

/* ─── ALERTS ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--r-2);
  margin-bottom: 18px;
  border: 1px solid;
  line-height: 1.45;
}

.alert strong {
  color: inherit;
}

.alert-error {
  background: var(--bad-soft);
  border-color: #f0c4be;
  color: var(--bad);
}

.alert-success {
  background: var(--ok-soft);
  border-color: #c4dfcd;
  color: var(--ok);
}

.alert-warning {
  background: var(--warn-soft);
  border-color: #ecd49a;
  color: var(--warn);
}

.alert-info {
  background: var(--forest-soft);
  border-color: #c2cfeb;
  color: var(--forest-deep);
}

/* ─── DIVIDER ────────────────────────────────────────────────────────────── */
.divider {
  margin: 18px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.divider span {
  font-size: 0.85rem;
  color: var(--ink-3);
  font-style: italic;
  font-family: var(--font-serif);
}

/* ─── ANIM ───────────────────────────────────────────────────────────────── */
.fade-in {
  animation: fadeIn var(--t-slow) both;
}

.rise-in {
  animation: riseIn 600ms var(--ease-out) both;
}

.settle-in {
  animation: settleIn 700ms var(--ease-out) both;
}

.stagger-1 {
  animation: riseIn 500ms var(--ease-out) both;
  animation-delay: 0.05s;
}

.stagger-2 {
  animation: riseIn 500ms var(--ease-out) both;
  animation-delay: 0.12s;
}

.stagger-3 {
  animation: riseIn 500ms var(--ease-out) both;
  animation-delay: 0.20s;
}

.stagger-4 {
  animation: riseIn 500ms var(--ease-out) both;
  animation-delay: 0.28s;
}

.stagger-5 {
  animation: riseIn 500ms var(--ease-out) both;
  animation-delay: 0.36s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes settleIn {
  from {
    opacity: 0;
    transform: translateY(2px) scale(0.99);
    filter: blur(4px);
  }

  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* ─── SCROLL REVEAL (IntersectionObserver) ───────────────────────────────── */
.reveal-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease-out, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── SMOOTH LOGIN CARD ENTRANCE ─────────────────────────────────────────── */
.login-card {
  animation: cardSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-card .brand-mark,
.login-card .brand,
.login-card .role-tabs,
.login-card form,
.login-card>div:last-child {
  opacity: 0;
  animation: fadeUpStagger 0.6s ease-out forwards;
}

.login-card .brand-mark {
  animation-delay: 0.05s;
}

.login-card .brand {
  animation-delay: 0.12s;
}

.login-card .role-tabs {
  animation-delay: 0.20s;
}

.login-card form {
  animation-delay: 0.28s;
}

.login-card>div:last-child {
  animation-delay: 0.36s;
}

@keyframes fadeUpStagger {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── INPUT SHIMMER ON FOCUS ─────────────────────────────────────────────── */
.form-input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 4px var(--forest-glow);
  background: var(--surface);
  animation: inputGlow 1.2s ease-in-out infinite;
}

@keyframes inputGlow {

  0%,
  100% {
    box-shadow: 0 0 0 4px var(--forest-glow);
  }

  50% {
    box-shadow: 0 0 0 6px var(--forest-glow), 0 0 20px rgba(0, 32, 69, 0.10);
  }
}

/* ─── ROLE TAB SLIDE-IN HINT ─────────────────────────────────────────────── */
.role-tab.active {
  background: var(--surface);
  color: var(--forest-deep);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  position: relative;
}

.role-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 20px;
  height: 2px;
  background: var(--forest);
  border-radius: 2px;
  transform: translateX(-50%);
  opacity: 0.5;
}

/* ─── BUTTON PRESS RIPPLE ────────────────────────────────────────────────── */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255, 255, 255, 0.3) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.btn:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* ─── NOTIFICATION TOAST SLIDE ───────────────────────────────────────────── */
@keyframes toastSlideIn {
  from {
    transform: translateX(calc(100% + 40px));
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(calc(100% + 40px));
    opacity: 0;
  }
}

/* ─── FORM FIELD SUCCESS/ERROR SHAKE ─────────────────────────────────────── */
@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-6px);
  }

  40% {
    transform: translateX(6px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

.shake {
  animation: shake 0.4s ease;
}

/* ─── CELEBRATION OVERLAY ENTRANCE ───────────────────────────────────────── */
@keyframes celebratePop {
  from {
    opacity: 0;
    transform: scale(0.85);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.celebrate-overlay {
  animation: celebratePop 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ─── THEME TOGGLE ───────────────────────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  box-shadow: var(--shadow-2);
  font-size: 0.95rem;
  transition: transform var(--t), border-color var(--t), color var(--t);
}

.theme-toggle:hover {
  transform: scale(1.06) rotate(-12deg);
  border-color: var(--forest);
  color: var(--forest);
}

/* ─── MARKETING (index) ──────────────────────────────────────────────────── */
.site-nav {
  width: 100%;
  padding: 20px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: rgba(250, 250, 247, 0.85);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  z-index: 50;
  border-bottom: 1px solid var(--rule);
}

[data-theme="dark"] .site-nav {
  background: rgba(11, 14, 22, 0.85);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.3rem;
  letter-spacing: -0.022em;
  color: var(--ink);
  font-variation-settings: "opsz" 24;
}

.brand-mark .dot {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--forest);
  box-shadow: var(--shadow-stamp);
  position: relative;
  flex-shrink: 0;
}

.brand-mark .dot::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1.4px solid #fff;
  border-radius: 3px;
  opacity: 0.95;
}

.site-nav .links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.site-nav .links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: color var(--t-fast);
}

.site-nav .links a:hover {
  color: var(--ink);
}

.hero {
  width: 100%;
  padding: 120px 48px 80px;
  max-width: 1240px;
  margin: 0 auto;
  position: relative;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border-radius: 100px;
  background: var(--forest-soft);
  color: var(--forest-deep);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 28px;
  border: 1px solid rgba(30, 58, 138, 0.18);
}

.eyebrow .pulse {
  width: 6px;
  height: 6px;
  background: var(--forest);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--forest-glow);
  animation: pulse 2.4s var(--ease-out) infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 0 4px var(--forest-glow);
  }

  50% {
    box-shadow: 0 0 0 7px transparent;
  }
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 7.5vw, 6.5rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.038em;
  margin-bottom: 28px;
  color: var(--ink);
  max-width: 14ch;
  font-variation-settings: "opsz" 144;
}

.hero h1 em {
  font-style: italic;
  color: var(--forest);
  font-weight: 400;
}

.hero .lede {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 56ch;
  margin-bottom: 40px;
  font-weight: 400;
  font-variation-settings: "opsz" 14;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-meta {
  margin-top: 72px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
  padding-top: 24px;
}

.hero-meta .item {
  padding: 4px 24px 4px 0;
  border-right: 1px solid var(--rule);
}

.hero-meta .item:last-child {
  border-right: none;
}

.hero-meta .num {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 36;
  display: block;
}

.hero-meta .lbl {
  font-size: 0.78rem;
  color: var(--ink-3);
  margin-top: 3px;
  display: block;
  font-style: italic;
  font-family: var(--font-serif);
}

.section {
  padding: 96px 48px;
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
}

.section-deep {
  background: var(--paper-2);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  width: 100%;
}

.section-deep>.inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 96px 48px;
  width: 100%;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 400;
  letter-spacing: -0.028em;
  line-height: 1.05;
  max-width: 22ch;
  margin-bottom: 22px;
  font-variation-settings: "opsz" 96;
}

.section-title em {
  color: var(--forest);
  font-style: italic;
}

.section-lede {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--ink-2);
  max-width: 60ch;
  margin-bottom: 48px;
  line-height: 1.55;
  font-variation-settings: "opsz" 14;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--r-3);
  overflow: hidden;
}

.feature-cell {
  background: var(--surface);
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: background var(--t);
}

.feature-cell:hover {
  background: var(--paper);
}

.feature-num {
  font-family: var(--font-serif);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--forest);
  letter-spacing: 0.04em;
  font-style: italic;
}

.feature-cell h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.012em;
  font-variation-settings: "opsz" 32;
}

.feature-cell p {
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1.55;
}

.quote-block {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-3);
  padding: 52px 44px 40px;
  position: relative;
  box-shadow: var(--shadow-1);
}

.quote-block::before {
  content: "\201C";
  position: absolute;
  top: 12px;
  left: 28px;
  font-family: var(--font-serif);
  font-size: 5.5rem;
  line-height: 1;
  color: var(--forest);
  opacity: 0.5;
  font-style: italic;
}

.quote-block blockquote {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 400;
  font-style: italic;
  line-height: 1.42;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin-bottom: 26px;
  padding-top: 14px;
  font-variation-settings: "opsz" 24;
}

.quote-attrib {
  display: flex;
  align-items: center;
  gap: 14px;
}

.quote-attrib .av {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--forest), #3b5db8);
  box-shadow: var(--shadow-stamp);
  flex-shrink: 0;
}

.quote-attrib .who {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
}

.quote-attrib .role {
  font-size: 0.78rem;
  color: var(--ink-3);
  font-style: italic;
  font-family: var(--font-serif);
  margin-top: 1px;
}

.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}

@media (max-width: 980px) {
  .split-2 {
    grid-template-columns: 1fr;
    gap: 56px;
  }
}

.cta-band {
  background: var(--inked);
  background-image:
    radial-gradient(circle at 100% -20%, rgba(30, 58, 138, 0.45), transparent 55%),
    radial-gradient(circle at 0% 120%, rgba(30, 58, 138, 0.28), transparent 50%),
    linear-gradient(180deg, var(--inked-2), var(--inked));
  color: var(--inked-text);
  border-radius: 24px;
  padding: 64px 52px;
  margin: 0 auto 96px;
  max-width: 1240px;
  width: calc(100% - 96px);
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(20, 25, 26, 0.45);
}

.cta-band::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(140, 165, 230, 0.22), transparent 70%);
  pointer-events: none;
}

@media (max-width: 880px) {
  .cta-band {
    grid-template-columns: 1fr;
    padding: 44px 32px;
    width: calc(100% - 44px);
  }
}

.cta-band h2 {
  font-family: var(--font-serif);
  color: var(--inked-text);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 400;
  letter-spacing: -0.022em;
  line-height: 1.08;
  font-variation-settings: "opsz" 72;
}

.cta-band p {
  color: var(--inked-text-2);
  font-size: 1rem;
  margin-top: 14px;
  font-family: var(--font-serif);
  font-style: italic;
  font-variation-settings: "opsz" 14;
}

.cta-band .btn-primary {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
}

.cta-band .btn-primary:hover {
  background: var(--forest-deep);
  border-color: var(--forest-deep);
}

.cta-band .btn-secondary {
  background: transparent;
  color: var(--inked-text);
  border-color: rgba(245, 245, 245, 0.24);
  box-shadow: none;
}

.cta-band .btn-secondary:hover {
  background: rgba(245, 245, 245, 0.08);
  border-color: rgba(245, 245, 245, 0.52);
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 56px 48px 36px;
  background: var(--paper);
  width: 100%;
}

.site-footer .inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: space-between;
  align-items: flex-start;
}

.site-footer .brand-mark {
  font-size: 1.2rem;
}

.site-footer nav {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}

.site-footer a {
  font-size: 0.88rem;
  color: var(--ink-3);
  transition: color var(--t-fast);
}

.site-footer a:hover {
  color: var(--ink);
}

.site-footer .fine {
  width: 100%;
  padding-top: 24px;
  margin-top: 24px;
  border-top: 1px solid var(--rule-soft);
  font-size: 0.82rem;
  color: var(--ink-3);
  font-style: italic;
  font-family: var(--font-serif);
}

/* ─── AUTH PAGES ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 600px at 90% -10%, var(--forest-soft), transparent 65%),
    radial-gradient(700px 500px at -10% 110%, var(--paper-3), transparent 55%),
    var(--paper);
}

.login-card {
  width: 100%;
  max-width: 460px;
  padding: 40px;
  border-radius: 20px;
  border: 1px solid var(--rule);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  position: relative;
}

.login-card .brand-mark {
  font-size: 1.05rem;
  margin-bottom: 28px;
}

.login-card .brand-mark .dot {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.login-card .brand-mark .dot::after {
  inset: 5px;
  border-width: 1.2px;
}

.brand h1 {
  font-family: var(--font-serif);
  font-size: 1.9rem;
  font-weight: 500;
  letter-spacing: -0.022em;
  margin-bottom: 6px;
  color: var(--ink);
  text-transform: none;
  font-variation-settings: "opsz" 48;
}

.login-subtitle {
  color: var(--ink-3);
  font-size: 0.95rem;
  margin-bottom: 26px;
  font-style: italic;
  font-family: var(--font-serif);
}

.role-tabs {
  display: flex;
  padding: 4px;
  background: var(--paper-2);
  margin-bottom: 22px;
  border-radius: 100px;
  border: 1px solid var(--rule);
}

.role-tab {
  flex: 1;
  padding: 8px;
  border-radius: 100px;
  color: var(--ink-3);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--t-fast);
  cursor: pointer;
  font-family: inherit;
}

.role-tab.active {
  background: var(--surface);
  color: var(--forest-deep);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.role-tab:hover:not(.active) {
  color: var(--ink-2);
}

.btn-google {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  box-shadow: var(--shadow-1);
}

.btn-google:hover {
  background: var(--paper-2);
  border-color: var(--rule-strong);
}

/* ─── EMPTY STATE ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-3);
}

.empty-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-state h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 8px;
  letter-spacing: -0.012em;
}

.empty-state p {
  color: var(--ink-3);
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 0.95rem;
}

/* ─── PROSE ──────────────────────────────────────────────────────────────── */
.prose {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 68ch;
  font-variation-settings: "opsz" 14;
}

.prose h2 {
  margin-top: 2.2em;
  margin-bottom: 0.6em;
  font-size: 1.7rem;
}

.prose h3 {
  margin-top: 1.8em;
  margin-bottom: 0.4em;
  font-size: 1.25rem;
}

.prose p+p {
  margin-top: 1em;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
  margin: 1em 0;
}

.prose li+li {
  margin-top: 0.4em;
}

.prose blockquote {
  border-left: 2px solid var(--forest);
  padding: 4px 0 4px 20px;
  margin: 1.4em 0;
  font-style: italic;
  color: var(--ink-2);
}

/* ─── UTILS ──────────────────────────────────────────────────────────────── */
.muted {
  color: var(--ink-3);
}

.serif {
  font-family: var(--font-serif);
}

.sans {
  font-family: var(--font-sans);
}

.mono {
  font-family: var(--font-mono);
}

.italic {
  font-style: italic;
}

.text-forest {
  color: var(--forest);
}

.text-ink {
  color: var(--ink);
}

.text-sm {
  font-size: 0.85rem;
}

.text-xs {
  font-size: 0.78rem;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

.mt-6 {
  margin-top: 24px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mb-6 {
  margin-bottom: 24px;
}

/* ─── TOAST NOTIFICATIONS ────────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  z-index: 9999;
  width: min(440px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--forest);
  border-radius: var(--r-2);
  padding: 13px 16px 13px 14px;
  box-shadow: var(--shadow-3);
  font-size: 0.92rem;
  color: var(--ink);
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-family: var(--font-sans);
  animation: toastIn 380ms var(--ease-out) both;
  position: relative;
  overflow: hidden;
}

.toast.is-leaving {
  animation: toastOut 280ms var(--ease) forwards;
}

.toast .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-top: 1px;
}

.toast .body {
  flex: 1;
  line-height: 1.45;
}

.toast .body strong {
  font-weight: 600;
}

.toast .close {
  background: none;
  border: none;
  color: var(--ink-3);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 1rem;
  line-height: 1;
  align-self: flex-start;
  transition: color var(--t-fast);
}

.toast .close:hover {
  color: var(--ink);
}

.toast .progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--forest);
  opacity: 0.45;
  animation: toastProgress var(--toast-dur, 4s) linear forwards;
}

.toast.toast-success {
  border-left-color: var(--ok);
}

.toast.toast-success .icon {
  background: var(--ok-soft);
  color: var(--ok);
}

.toast.toast-success .progress {
  background: var(--ok);
}

.toast.toast-error {
  border-left-color: var(--bad);
}

.toast.toast-error .icon {
  background: var(--bad-soft);
  color: var(--bad);
}

.toast.toast-error .progress {
  background: var(--bad);
}

.toast.toast-warning {
  border-left-color: var(--warn);
}

.toast.toast-warning .icon {
  background: var(--warn-soft);
  color: var(--warn);
}

.toast.toast-warning .progress {
  background: var(--warn);
}

.toast.toast-info {
  border-left-color: var(--forest);
}

.toast.toast-info .icon {
  background: var(--forest-soft);
  color: var(--forest-deep);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    border-width: 0;
  }
}

@keyframes toastProgress {
  from {
    width: 100%;
  }

  to {
    width: 0%;
  }
}

/* ─── CELEBRATION OVERLAY (signup/login success) ─────────────────────────── */
.celebrate {
  position: fixed;
  inset: 0;
  background: rgba(250, 250, 247, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  animation: celebrateIn 380ms var(--ease-out) forwards;
}

[data-theme="dark"] .celebrate {
  background: rgba(11, 14, 22, 0.78);
}

.celebrate.is-leaving {
  animation: celebrateOut 480ms var(--ease) forwards;
}

.celebrate-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 22px;
  padding: 48px 44px 40px;
  max-width: 420px;
  width: calc(100% - 32px);
  text-align: center;
  box-shadow: var(--shadow-3);
  position: relative;
  transform: translateY(8px) scale(0.97);
  opacity: 0;
  animation: celebrateCardIn 540ms cubic-bezier(0.18, 0.9, 0.3, 1.1) 80ms forwards;
}

.celebrate-mark {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--forest-soft);
  margin: 0 auto 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 0 0 var(--forest-glow);
  animation: markPulse 1.6s var(--ease-out) 240ms 1;
}

.celebrate-mark svg {
  width: 42px;
  height: 42px;
}

.celebrate-mark svg path {
  fill: none;
  stroke: var(--forest-deep);
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: drawCheck 520ms var(--ease-out) 320ms forwards;
}

.celebrate-card h2 {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 500;
  letter-spacing: -0.018em;
  margin-bottom: 8px;
  color: var(--ink);
}

.celebrate-card h2 em {
  font-style: italic;
  color: var(--forest);
}

.celebrate-card p {
  color: var(--ink-3);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  font-variation-settings: "opsz" 14;
}

.celebrate-card .next {
  margin-top: 22px;
  font-size: 0.82rem;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.celebrate-card .next .dotty {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--forest);
  animation: dotty 1s ease-in-out infinite;
}

.celebrate-card .next .dotty:nth-child(2) {
  animation-delay: 150ms;
}

.celebrate-card .next .dotty:nth-child(3) {
  animation-delay: 300ms;
}

@keyframes celebrateIn {
  to {
    opacity: 1;
  }
}

@keyframes celebrateOut {
  to {
    opacity: 0;
  }
}

@keyframes celebrateCardIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes drawCheck {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes markPulse {
  0% {
    box-shadow: 0 0 0 0 var(--forest-glow);
  }

  60% {
    box-shadow: 0 0 0 18px transparent;
  }

  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@keyframes dotty {

  0%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ─── PRICING PAGE (teacher read-only + admin) ───────────────────────────── */
.plan-hero {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-4);
  padding: 32px 36px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-1);
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.plan-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--forest), var(--forest-deep));
}

@media (max-width: 760px) {
  .plan-hero {
    grid-template-columns: 1fr;
    padding: 26px 24px;
  }
}

.plan-hero .label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.plan-hero .plan-name {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.022em;
  color: var(--ink);
  font-variation-settings: "opsz" 96;
  line-height: 1;
}

.plan-hero .plan-name em {
  font-style: italic;
  color: var(--forest);
}

.plan-hero .plan-status {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-2);
  font-size: 1rem;
  margin-top: 10px;
}

.plan-hero .plan-status .ok-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--ok);
  border-radius: 50%;
  margin-right: 7px;
  transform: translateY(-2px);
  box-shadow: 0 0 0 4px var(--ok-soft);
}

.plan-hero .plan-status .warn-dot {
  background: var(--warn);
  box-shadow: 0 0 0 4px var(--warn-soft);
}

.plan-hero .plan-status .bad-dot {
  background: var(--bad);
  box-shadow: 0 0 0 4px var(--bad-soft);
}

.usage-list {
  display: grid;
  gap: 14px;
}

.usage-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 16px;
  align-items: baseline;
}

.usage-row .name {
  font-size: 0.85rem;
  color: var(--ink-2);
  font-weight: 500;
}

.usage-row .vals {
  font-size: 0.85rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.usage-row .bar {
  grid-column: 1 / -1;
  height: 6px;
  background: var(--paper-2);
  border-radius: 100px;
  overflow: hidden;
  border: 1px solid var(--rule-soft);
}

.usage-row .bar>span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--forest), #3b5db8);
  border-radius: 100px;
  transition: width 600ms var(--ease-out);
}

.usage-row.is-warn .bar>span {
  background: linear-gradient(90deg, var(--warn), #d68a40);
}

.usage-row.is-danger .bar>span {
  background: linear-gradient(90deg, var(--bad), #d4604f);
}

.contact-admin {
  margin-top: 24px;
  padding: 24px 28px;
  background: var(--forest-wash);
  border: 1px solid var(--forest-soft);
  border-radius: var(--r-3);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
}

@media (max-width: 760px) {
  .contact-admin {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.contact-admin .glyph {
  width: 44px;
  height: 44px;
  background: var(--forest);
  color: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  box-shadow: var(--shadow-stamp);
  margin: 0 auto;
}

.contact-admin .copy h4 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 3px;
  letter-spacing: -0.012em;
}

.contact-admin .copy p {
  font-size: 0.92rem;
  color: var(--ink-2);
  font-family: var(--font-serif);
  font-style: italic;
  font-variation-settings: "opsz" 14;
}

.contact-admin .copy .who {
  color: var(--forest-deep);
  font-style: normal;
  font-weight: 500;
}

/* Plan benefits list (info card) */
.plan-benefits {
  display: grid;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.plan-benefits li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--ink-2);
}

.plan-benefits li .tick {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--forest-soft);
  color: var(--forest-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.plan-benefits li.off {
  color: var(--ink-3);
}

.plan-benefits li.off .tick {
  background: var(--paper-2);
  color: var(--ink-3);
}

/* ─── MODAL (Confirm/Alert) ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 28, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
  opacity: 0;
  animation: modalOverlayIn 220ms var(--ease-out) forwards;
}

.modal-overlay.is-leaving {
  animation: modalOverlayOut 200ms var(--ease) forwards;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 18px;
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 28px;
  text-align: center;
  box-shadow: var(--shadow-3);
  transform: translateY(10px) scale(0.97);
  opacity: 0;
  animation: modalCardIn 320ms cubic-bezier(0.18, 0.9, 0.3, 1.05) 60ms forwards;
}

.modal-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  position: relative;
}

.modal-mark-forest {
  background: var(--forest-soft);
  color: var(--forest-deep);
}

.modal-mark-danger {
  background: var(--bad-soft);
  color: var(--bad);
}

.modal-mark-warning {
  background: var(--warn-soft);
  color: var(--warn);
}

.modal-mark::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0.18;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.014em;
  color: var(--ink);
  margin-bottom: 8px;
  font-variation-settings: "opsz" 32;
}

.modal-title em {
  font-style: italic;
  color: var(--forest);
}

.modal-message {
  color: var(--ink-2);
  font-family: var(--font-serif);
  font-size: 0.98rem;
  line-height: 1.5;
  font-variation-settings: "opsz" 14;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.modal-actions .btn {
  min-width: 110px;
}

.modal-actions .modal-cancel {
  flex: 0 1 auto;
}

.modal-actions .modal-confirm {
  flex: 0 1 auto;
}

.btn-danger {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
  box-shadow: var(--shadow-stamp);
}

.btn-danger:hover {
  background: #8e2c20;
  border-color: #8e2c20;
  transform: translateY(-1px);
  box-shadow: var(--shadow-stamp), 0 6px 18px rgba(177, 58, 44, 0.22);
}

.btn-warning {
  background: var(--warn);
  color: #fff;
  border-color: var(--warn);
  box-shadow: var(--shadow-stamp);
}

.btn-warning:hover {
  background: #884c12;
  border-color: #884c12;
  transform: translateY(-1px);
}

@keyframes modalOverlayIn {
  to {
    opacity: 1;
  }
}

@keyframes modalOverlayOut {
  to {
    opacity: 0;
  }
}

@keyframes modalCardIn {
  to {
    transform: none;
    opacity: 1;
  }
}

/* ─── PAGE HEADER (used inside dashboard views) ──────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 1.9rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
  font-variation-settings: "opsz" 48;
}

.page-subtitle {
  color: var(--ink-3);
  font-size: 0.95rem;
  margin-top: 4px;
  font-style: italic;
  font-family: var(--font-serif);
  font-variation-settings: "opsz" 14;
}

.page-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ─── CARD VARIANTS ──────────────────────────────────────────────────────── */
.card-pad {
  padding: 28px;
}

.card-body {
  padding-top: 4px;
}

.card-link {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-3);
  padding: 22px 24px;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
  position: relative;
  overflow: hidden;
}

.card-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--forest);
  opacity: 0;
  transition: opacity var(--t);
}

.card-link:hover {
  transform: translateY(-2px);
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-2);
}

.card-link:hover::before {
  opacity: 1;
}

.card-link h4 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.012em;
  margin-bottom: 4px;
  color: var(--ink);
}

.card-link p {
  font-size: 0.85rem;
  color: var(--ink-3);
  font-family: var(--font-serif);
  font-style: italic;
  font-variation-settings: "opsz" 14;
}

/* ─── STAT CARD COLOR HUES (botanical palette) ───────────────────────────── */
.stat-card.forest .stat-icon {
  background: var(--forest-soft);
  color: var(--forest-deep);
}

.stat-card.sage .stat-icon {
  background: var(--forest-soft);
  color: var(--forest-deep);
}

.stat-card.wheat .stat-icon {
  background: var(--warn-soft);
  color: var(--warn);
}

.stat-card.clay .stat-icon {
  background: var(--bad-soft);
  color: var(--bad);
}

.stat-card.oat .stat-icon {
  background: var(--paper-2);
  color: var(--ink-2);
}

.stat-card.forest .stat-value {
  color: var(--forest-deep);
}

.stat-card.sage .stat-value {
  color: var(--forest-deep);
}

.stat-card.wheat .stat-value {
  color: var(--warn);
}

.stat-card.clay .stat-value {
  color: var(--bad);
}

.stat-card.oat .stat-value {
  color: var(--ink);
}

/* ─── BADGES (extras) ────────────────────────────────────────────────────── */
.badge-primary {
  background: var(--forest-soft);
  color: var(--forest-deep);
  border-color: rgba(30, 58, 138, 0.20);
}

.badge-info {
  background: var(--paper-2);
  color: var(--ink-2);
  border-color: var(--rule);
}

/* ─── ASSIGNMENT CARD (student dashboard) ────────────────────────────────── */
.assignment-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-3);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}

.assignment-card:hover {
  transform: translateY(-2px);
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-2);
}

.assignment-card-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  font-variation-settings: "opsz" 32;
}

.assignment-card-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.meta-item {
  font-size: 0.82rem;
  color: var(--ink-3);
  font-family: var(--font-serif);
  font-style: italic;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* ─── Q-BANK QUICK ACTION TILES ──────────────────────────────────────────── */
.qbank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.qbank-item {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  background: var(--paper-2);
  text-decoration: none;
  transition: background var(--t), border-color var(--t);
}

.qbank-item:hover {
  background: var(--paper);
  border-color: var(--rule-strong);
}

.qbank-type-chip {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--forest-soft);
  color: var(--forest-deep);
  margin-bottom: 8px;
}

.qbank-prompt {
  font-size: 0.92rem;
  color: var(--ink);
  font-family: var(--font-serif);
  letter-spacing: -0.005em;
}

/* ─── GENERIC HELPERS ────────────────────────────────────────────────────── */
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.text-bold {
  font-weight: 600;
  color: var(--ink);
}

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

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mt-16 {
  margin-top: 16px;
}

.w-full {
  width: 100%;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .hero {
    padding: 96px 32px 64px;
  }

  .section,
  .section-deep>.inner {
    padding: 72px 32px;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  .site-nav {
    padding: 16px 22px;
  }

  .site-nav .links {
    gap: 14px;
  }

  .site-nav .links a:not(.btn) {
    display: none;
  }

  .hero {
    padding: 72px 22px 56px;
  }

  .hero-meta {
    margin-top: 48px;
    gap: 14px;
  }

  .hero-meta .item {
    border-right: none;
    padding-right: 0;
  }

  .section,
  .section-deep>.inner {
    padding: 56px 22px;
  }

  .cta-band {
    margin: 0 22px 56px;
    padding: 36px 26px;
    width: calc(100% - 44px);
  }

  .content-area {
    padding: 24px 18px;
  }

  .top-header {
    padding: 0 18px;
    height: 64px;
  }

  .login-card {
    padding: 28px 22px;
  }

  .app-shell {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    overflow: visible;
  }

  .main-content {
    overflow: visible;
  }

  .content-scroll {
    overflow: visible;
  }

  .site-footer {
    padding: 40px 22px 30px;
  }
}