/* ==========================================================================
   AWP Interns — design system
   One stylesheet for the whole portal. Every class is documented at /designsystem.
   Order: tokens → base → type → layout → components → domain patterns → shell.
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  /* Brand (from the AWP logo) */
  --awp-green: #00AF50;
  --awp-red: #EF4537;
  --awp-blue: #427FC1;
  --awp-ink: #1D1D1B;

  /* Scales */
  --green-50: #E6F7EE; --green-100: #C2EDD4; --green-200: #8FDDB0; --green-300: #52C985; --green-400: #1FB966;
  --green-500: #00AF50; --green-600: #009544; --green-700: #007A38; --green-800: #005F2C; --green-900: #0A4424;

  --red-50: #FDECEA; --red-100: #FBD0CC; --red-200: #F7A59D; --red-300: #F37A6E; --red-400: #F15A4D;
  --red-500: #EF4537; --red-600: #D4362A; --red-700: #B02A20; --red-800: #8A2119; --red-900: #641A14;

  --blue-50: #ECF3FA; --blue-100: #D2E2F3; --blue-200: #A9C7E8; --blue-300: #7BA8DA; --blue-400: #5A92CD;
  --blue-500: #427FC1; --blue-600: #3569A6; --blue-700: #2A5487; --blue-800: #204068; --blue-900: #172E4B;

  --amber-50: #FEF6E7; --amber-100: #FDE8BF; --amber-200: #FBD48A; --amber-300: #F8C35A; --amber-400: #F5B435;
  --amber-500: #F2A516; --amber-600: #D18A0A; --amber-700: #A66C08; --amber-800: #7F5306; --amber-900: #5C3C05;

  --violet-50: #F2EEFA; --violet-100: #E0D7F3; --violet-300: #A98FDD; --violet-500: #7C5CC4; --violet-700: #5B3FA0; --violet-900: #34245C;

  --gray-0: #FFFFFF; --gray-25: #FBFBFA; --gray-50: #F6F6F4; --gray-100: #EDEDEA; --gray-200: #DEDEDA;
  --gray-300: #C6C6C1; --gray-400: #A1A19B; --gray-500: #7A7A74; --gray-600: #5C5C57; --gray-700: #44443F;
  --gray-800: #2D2D2A; --gray-900: #1D1D1B; --gray-950: #121211;

  /* Semantic — light */
  --bg: var(--gray-50);
  --surface: var(--gray-0);
  --surface-2: var(--gray-25);
  --surface-3: var(--gray-100);
  --border: var(--gray-200);
  --border-strong: var(--gray-300);
  --text: var(--gray-900);
  --text-2: var(--gray-600);
  --text-3: #686862; /* gray-500 is 4.3:1 on white — under AA for small text */
  --text-inverse: var(--gray-0);

  --primary: var(--blue-600);
  --primary-hover: var(--blue-700);
  --primary-soft: var(--blue-50);
  --primary-text: var(--blue-700);
  --focus: color-mix(in srgb, var(--blue-500) 45%, transparent);

  --success: var(--green-700);   --success-solid: var(--green-700); --success-soft: var(--green-50);  --success-line: var(--green-200);
  --danger: var(--red-700);      --danger-solid: var(--red-600);    --danger-soft: var(--red-50);    --danger-line: var(--red-200);
  --warning: var(--amber-800);   --warning-solid: var(--amber-500); --warning-soft: var(--amber-50); --warning-line: var(--amber-200);
  --info: var(--blue-700);       --info-solid: var(--blue-600);     --info-soft: var(--blue-50);     --info-line: var(--blue-200);
  --violet: var(--violet-700);   --violet-solid: var(--violet-500); --violet-soft: var(--violet-50); --violet-line: var(--violet-100);
  --neutral: var(--gray-700);    --neutral-solid: var(--gray-600);  --neutral-soft: var(--gray-100); --neutral-line: var(--gray-200);

  /* Type */
  --font-display: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --text-xs: .75rem; --text-sm: .8125rem; --text-base: .9375rem; --text-md: 1.0625rem;
  --text-lg: 1.25rem; --text-xl: 1.5rem; --text-2xl: 1.875rem; --text-3xl: 2.375rem; --text-4xl: 3rem;

  /* Space (4px grid) */
  --s-0: 0; --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.25rem;
  --s-6: 1.5rem; --s-8: 2rem; --s-10: 2.5rem; --s-12: 3rem; --s-16: 4rem; --s-20: 5rem;

  /* Radius — "leaf" is the green drop from the logo: three round corners, one square */
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-full: 999px;
  --r-leaf: var(--r-xl) var(--r-xl) 0 var(--r-xl);
  --r-leaf-full: 999px 999px 0 999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgb(29 29 27 / .06);
  --shadow-sm: 0 1px 3px rgb(29 29 27 / .08), 0 1px 2px rgb(29 29 27 / .04);
  --shadow-md: 0 4px 12px rgb(29 29 27 / .08), 0 2px 4px rgb(29 29 27 / .04);
  --shadow-lg: 0 12px 32px rgb(29 29 27 / .12), 0 4px 8px rgb(29 29 27 / .06);
  --shadow-xl: 0 24px 64px rgb(29 29 27 / .18);

  /* Motion & layers */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms;
  --z-sticky: 10; --z-dropdown: 30; --z-overlay: 40; --z-toast: 50; --z-tooltip: 60;

  --sidebar-w: 248px;
  --topbar-h: 60px;

  color-scheme: light;
}

/* Semantic — dark. app.js sets data-theme on <html> before first paint
   (saved choice, else the OS preference), so one block covers both cases. */
:root[data-theme="dark"] {
  --bg: var(--gray-950);
  --surface: #1A1A18;
  --surface-2: #20201E;
  --surface-3: #2A2A27;
  --border: #33332F;
  --border-strong: #46463F;
  --text: var(--gray-100);
  --text-2: var(--gray-400);
  --text-3: #8E8E88;

  --primary: var(--blue-500);
  --primary-hover: var(--blue-400);
  --primary-soft: color-mix(in srgb, var(--blue-500) 16%, transparent);
  --primary-text: var(--blue-300);

  --success: var(--green-300);  --success-solid: var(--green-600); --success-soft: color-mix(in srgb, var(--green-500) 14%, transparent); --success-line: color-mix(in srgb, var(--green-500) 35%, transparent);
  --danger: var(--red-300);     --danger-solid: var(--red-600);    --danger-soft: color-mix(in srgb, var(--red-500) 14%, transparent);   --danger-line: color-mix(in srgb, var(--red-500) 35%, transparent);
  --warning: var(--amber-300);  --warning-solid: var(--amber-500); --warning-soft: color-mix(in srgb, var(--amber-500) 14%, transparent); --warning-line: color-mix(in srgb, var(--amber-500) 35%, transparent);
  --info: var(--blue-300);      --info-solid: var(--blue-500);     --info-soft: color-mix(in srgb, var(--blue-500) 16%, transparent);  --info-line: color-mix(in srgb, var(--blue-500) 35%, transparent);
  --violet: var(--violet-300);  --violet-solid: var(--violet-500); --violet-soft: color-mix(in srgb, var(--violet-500) 18%, transparent); --violet-line: color-mix(in srgb, var(--violet-500) 35%, transparent);
  --neutral: var(--gray-300);   --neutral-solid: var(--gray-600);  --neutral-soft: color-mix(in srgb, var(--gray-400) 14%, transparent); --neutral-line: var(--border-strong);

  --shadow-xs: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-sm: 0 1px 3px rgb(0 0 0 / .45);
  --shadow-md: 0 4px 12px rgb(0 0 0 / .45);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / .55);
  --shadow-xl: 0 24px 64px rgb(0 0 0 / .65);
  color-scheme: dark;
}

/* ---------- 2. Base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
svg.lucide { display: inline-block; width: 1.15em; height: 1.15em; stroke-width: 2; flex-shrink: 0; vertical-align: -0.2em; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary-text); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
::selection { background: color-mix(in srgb, var(--awp-blue) 25%, transparent); }
hr, .divider { border: 0; border-top: 1px solid var(--border); margin: var(--s-6) 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- 3. Typography ----------------------------------------------- */
h1, h2, h3, h4, h5, h6, .display, .h1, .h2, .h3, .h4, .h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.015em;
  color: var(--text);
}
.display { font-size: var(--text-4xl); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
h1, .h1 { font-size: var(--text-3xl); letter-spacing: -.025em; }
h2, .h2 { font-size: var(--text-2xl); }
h3, .h3 { font-size: var(--text-xl); }
h4, .h4 { font-size: var(--text-lg); font-weight: 600; }
h5, .h5 { font-size: var(--text-md); font-weight: 600; }
h6 { font-size: var(--text-base); font-weight: 600; }
.eyebrow { font-family: var(--font-display); font-size: var(--text-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.lead { font-size: var(--text-md); color: var(--text-2); line-height: 1.6; }
.small, small { font-size: var(--text-sm); }
.xs { font-size: var(--text-xs); }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.strong { font-weight: 600; }
.mono { font-family: var(--font-mono); font-size: .9em; }
.num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); } .text-info { color: var(--info); }
code { font-family: var(--font-mono); font-size: .86em; background: var(--surface-3); color: var(--text); padding: .12em .4em; border-radius: var(--r-xs); }
kbd { font-family: var(--font-mono); font-size: var(--text-xs); padding: .1em .45em; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: var(--r-xs); background: var(--surface); color: var(--text-2); }
mark { background: var(--amber-100); color: var(--gray-900); padding: 0 .15em; border-radius: 3px; }

/* ---------- 4. Layout primitives --------------------------------------- */
.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: var(--s-4); }
.container-sm { max-width: 760px; }
.stack { display: flex; flex-direction: column; gap: var(--gap, var(--s-4)); }
.row { display: flex; align-items: center; gap: var(--gap, var(--s-3)); }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.center { justify-content: center; align-items: center; }
.top { align-items: flex-start; }
.grow { flex: 1 1 0; min-width: 0; }
.grid { display: grid; gap: var(--gap, var(--s-4)); grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
.grid-auto { display: grid; gap: var(--gap, var(--s-4)); grid-template-columns: repeat(auto-fill, minmax(var(--min, 220px), 1fr)); }
.gap-1 { --gap: var(--s-1); } .gap-2 { --gap: var(--s-2); } .gap-3 { --gap: var(--s-3); } .gap-4 { --gap: var(--s-4); }
.gap-6 { --gap: var(--s-6); } .gap-8 { --gap: var(--s-8); }
.w-full { width: 100%; }
@media (max-width: 900px) { .grid { --cols: 2 !important; } }
@media (max-width: 600px) { .grid { --cols: 1 !important; } .hide-sm { display: none !important; } }
@media (min-width: 901px) { .hide-desktop { display: none !important; } }

/* ---------- 5. Buttons -------------------------------------------------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-border: var(--border-strong); --btn-hover: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: 38px; padding: 0 var(--s-4);
  font-size: var(--text-sm); font-weight: 600; line-height: 1; white-space: nowrap;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-border); border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1), transform var(--dur-1), box-shadow var(--dur-1);
  text-decoration: none !important; user-select: none;
}
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; box-shadow: none; }
.btn-primary { --btn-bg: var(--primary); --btn-fg: #fff; --btn-border: transparent; --btn-hover: var(--primary-hover); }
.btn-ink { --btn-bg: var(--awp-ink); --btn-fg: #fff; --btn-border: transparent; --btn-hover: var(--gray-700); }
:root[data-theme="dark"] .btn-ink { --btn-bg: var(--gray-100); --btn-fg: var(--gray-900); --btn-hover: var(--gray-0); }
.btn-success { --btn-bg: var(--success-solid); --btn-fg: #fff; --btn-border: transparent; --btn-hover: var(--green-800); }
.btn-danger { --btn-bg: var(--danger-solid); --btn-fg: #fff; --btn-border: transparent; --btn-hover: var(--red-700); }
.btn-soft { --btn-bg: var(--primary-soft); --btn-fg: var(--primary-text); --btn-border: transparent; --btn-hover: color-mix(in srgb, var(--primary) 18%, transparent); box-shadow: none; }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--text-2); box-shadow: none; }
.btn-ghost:hover { color: var(--text); }
.btn-danger-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--danger); --btn-hover: var(--danger-soft); box-shadow: none; }
.btn-link { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--primary-text); --btn-hover: transparent; box-shadow: none; padding: 0; height: auto; }
.btn-link:hover { text-decoration: underline !important; }
.btn-xs { height: 26px; padding: 0 var(--s-2); font-size: var(--text-xs); border-radius: var(--r-sm); gap: var(--s-1); }
.btn-sm { height: 32px; padding: 0 var(--s-3); border-radius: var(--r-sm); }
.btn-lg { height: 46px; padding: 0 var(--s-6); font-size: var(--text-base); border-radius: var(--r-lg); }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; } .btn-icon.btn-xs { width: 26px; } .btn-icon.btn-lg { width: 46px; }
.btn-leaf { border-radius: var(--r-leaf-full); }
.btn.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid var(--btn-fg); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }

/* ---------- 6. Forms ---------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.label { font-size: var(--text-sm); font-weight: 600; color: var(--text); display: flex; align-items: center; gap: var(--s-1); }
.label .req { color: var(--danger); }
.label .opt { color: var(--text-3); font-weight: 400; }
.hint { font-size: var(--text-xs); color: var(--text-3); }
.error-text { font-size: var(--text-xs); color: var(--danger); display: flex; gap: var(--s-1); align-items: center; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 var(--s-3);
  font-size: var(--text-base); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
  appearance: none;
}
.textarea { height: auto; min-height: 96px; padding: var(--s-2) var(--s-3); resize: vertical; line-height: 1.5; }
.select {
  padding-right: var(--s-8); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237A7A74' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--gray-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; }
.input[readonly] { background: var(--surface-2); }
.is-invalid { border-color: var(--danger-solid) !important; }
.is-invalid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--red-500) 30%, transparent) !important; }
.is-valid { border-color: var(--success-solid) !important; }
.input-sm { height: 32px; font-size: var(--text-sm); border-radius: var(--r-sm); }
.input-lg { height: 48px; font-size: var(--text-md); border-radius: var(--r-lg); }
.input[type="date"], .input[type="time"], .input[type="month"] { padding-right: var(--s-2); }
.input-group { display: flex; align-items: stretch; }
.input-group > .input { border-radius: 0; flex: 1; min-width: 0; }
.input-group > :first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.input-group > :last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.input-group > * + * { margin-left: -1px; }
.input-addon { display: flex; align-items: center; padding: 0 var(--s-3); background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text-2); font-size: var(--text-sm); white-space: nowrap; }
.input-icon { position: relative; }
.input-icon > svg, .input-icon > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon > .input { padding-left: 38px; }
.check, .radio { display: inline-flex; align-items: flex-start; gap: var(--s-2); cursor: pointer; font-size: var(--text-base); line-height: 1.4; }
.check input, .radio input {
  appearance: none; width: 18px; height: 18px; margin-top: 1px; flex-shrink: 0;
  border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer;
  display: grid; place-content: center; transition: background var(--dur-1), border-color var(--dur-1);
}
.check input { border-radius: 5px; }
.radio input { border-radius: 50%; }
.check input::after { content: ""; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform var(--dur-1) var(--ease); }
.radio input::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform var(--dur-1) var(--ease); }
.check input:checked, .radio input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.radio input:checked::after { transform: scale(1); }
.check input:indeterminate { background: var(--primary); border-color: var(--primary); }
.check input:indeterminate::after { width: 8px; height: 0; border-left: 0; transform: none; }
.check input:disabled, .radio input:disabled { opacity: .5; cursor: not-allowed; }
.switch { display: inline-flex; align-items: center; gap: var(--s-3); cursor: pointer; }
.switch input {
  appearance: none; width: 38px; height: 22px; border-radius: var(--r-full); background: var(--gray-300); position: relative; cursor: pointer; flex-shrink: 0; transition: background var(--dur-2);
}
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-2) var(--ease); }
.switch input:checked { background: var(--success-solid); }
.switch input:checked::after { transform: translateX(16px); }
:root[data-theme="dark"] .switch input:not(:checked) { background: var(--gray-700); }
.range { width: 100%; accent-color: var(--primary); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2); text-align: center;
  padding: var(--s-8) var(--s-4); border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface-2); color: var(--text-2); cursor: pointer; transition: border-color var(--dur-1), background var(--dur-1);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input { display: none; }
.fieldset { border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5); }
.fieldset legend { padding: 0 var(--s-2); font-weight: 600; font-size: var(--text-sm); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4) var(--s-5); }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.otp { display: flex; gap: var(--s-2); }
.otp .input { width: 46px; height: 52px; text-align: center; font-size: var(--text-xl); font-family: var(--font-mono); padding: 0; }

/* ---------- 7. Badges, status, chips ----------------------------------- */
.badge {
  --b-fg: var(--neutral); --b-bg: var(--neutral-soft); --b-line: var(--neutral-line);
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  font-size: var(--text-xs); font-weight: 600; line-height: 1; white-space: nowrap;
  color: var(--b-fg); background: var(--b-bg); border: 1px solid var(--b-line); border-radius: var(--r-full);
}
.badge svg.lucide { width: 12px; height: 12px; }
.badge-success { --b-fg: var(--success); --b-bg: var(--success-soft); --b-line: var(--success-line); }
.badge-danger  { --b-fg: var(--danger);  --b-bg: var(--danger-soft);  --b-line: var(--danger-line); }
.badge-warning { --b-fg: var(--warning); --b-bg: var(--warning-soft); --b-line: var(--warning-line); }
.badge-info    { --b-fg: var(--info);    --b-bg: var(--info-soft);    --b-line: var(--info-line); }
.badge-violet  { --b-fg: var(--violet);  --b-bg: var(--violet-soft);  --b-line: var(--violet-line); }
.badge-solid { --b-fg: #fff; --b-bg: var(--awp-ink); --b-line: transparent; }
.badge-solid.badge-success { --b-bg: var(--success-solid); } .badge-solid.badge-danger { --b-bg: var(--danger-solid); }
.badge-solid.badge-info { --b-bg: var(--info-solid); } .badge-solid.badge-warning { --b-bg: var(--warning-solid); --b-fg: var(--gray-900); }
.badge-solid.badge-violet { --b-bg: var(--violet-solid); }
.badge-square { border-radius: var(--r-xs); }
.badge-lg { height: 28px; padding: 0 12px; font-size: var(--text-sm); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; flex-shrink: 0; }
.dot-pulse { position: relative; }
.dot-pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-out infinite; }
.count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full); background: var(--danger-solid); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.chip {
  display: inline-flex; align-items: center; gap: var(--s-2); height: 30px; padding: 0 var(--s-3);
  border: 1px solid var(--border-strong); border-radius: var(--r-full); background: var(--surface);
  font-size: var(--text-sm); color: var(--text-2); cursor: pointer; transition: all var(--dur-1);
}
.chip:hover { border-color: var(--gray-400); color: var(--text); }
.chip.is-active, .chip[aria-pressed="true"] { background: var(--awp-ink); border-color: var(--awp-ink); color: #fff; }
:root[data-theme="dark"] .chip.is-active, :root[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--gray-100); color: var(--gray-900); border-color: var(--gray-100); }
.chip .x { border: 0; background: none; padding: 0; color: inherit; opacity: .6; display: inline-flex; }
.chip .x:hover { opacity: 1; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-xs); background: var(--surface-3); color: var(--text-2); font-size: var(--text-xs); font-weight: 500; font-family: var(--font-mono); }

/* Attendance statuses — one class per status, used everywhere a day shows up */
.st-present  { --b-fg: var(--success); --b-bg: var(--success-soft); --b-line: var(--success-line); --st: var(--green-500); }
.st-late     { --b-fg: var(--warning); --b-bg: var(--warning-soft); --b-line: var(--warning-line); --st: var(--amber-500); }
.st-halfday  { --b-fg: var(--warning); --b-bg: var(--warning-soft); --b-line: var(--warning-line); --st: var(--amber-300); }
.st-wfh      { --b-fg: var(--info);    --b-bg: var(--info-soft);    --b-line: var(--info-line);    --st: var(--blue-500); }
.st-leave    { --b-fg: var(--violet);  --b-bg: var(--violet-soft);  --b-line: var(--violet-line);  --st: var(--violet-500); }
.st-absent   { --b-fg: var(--danger);  --b-bg: var(--danger-soft);  --b-line: var(--danger-line);  --st: var(--red-500); }
.st-holiday  { --b-fg: var(--neutral); --b-bg: var(--neutral-soft); --b-line: var(--neutral-line); --st: var(--gray-300); }

/* ---------- 8. Alerts & callouts --------------------------------------- */
.alert {
  --a-fg: var(--info); --a-bg: var(--info-soft); --a-line: var(--info-line);
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3) var(--s-4); border: 1px solid var(--a-line); border-radius: var(--r-md);
  background: var(--a-bg); color: var(--text); font-size: var(--text-sm);
}
.alert > svg.lucide:first-child, .alert > i:first-child { color: var(--a-fg); margin-top: 2px; }
.alert-title { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.alert .grow { color: var(--text-2); }
.alert-success { --a-fg: var(--success); --a-bg: var(--success-soft); --a-line: var(--success-line); }
.alert-warning { --a-fg: var(--warning); --a-bg: var(--warning-soft); --a-line: var(--warning-line); }
.alert-danger  { --a-fg: var(--danger);  --a-bg: var(--danger-soft);  --a-line: var(--danger-line); }
.alert-close { margin-left: auto; background: none; border: 0; color: var(--text-3); padding: 2px; display: inline-flex; border-radius: var(--r-xs); }
.alert-close:hover { color: var(--text); }
.banner { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-4); background: var(--awp-ink); color: #fff; font-size: var(--text-sm); }
.banner a { color: #fff; text-decoration: underline; }
.callout { border-left: 3px solid var(--c, var(--awp-blue)); background: var(--surface-2); padding: var(--s-3) var(--s-4); border-radius: 0 var(--r-md) var(--r-md) 0; font-size: var(--text-sm); }
.callout-title { display: flex; align-items: center; gap: var(--s-2); font-weight: 700; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--c, var(--awp-blue)); margin-bottom: var(--s-1); }
.callout-tip { --c: var(--green-600); } .callout-warn { --c: var(--amber-600); } .callout-danger { --c: var(--red-600); } .callout-awp { --c: var(--awp-ink); }
:root[data-theme="dark"] .callout-awp { --c: var(--gray-300); }

/* ---------- 9. Cards ---------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card-body { padding: var(--s-5); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.card-header h3, .card-header h4, .card-title { font-size: var(--text-md); font-weight: 700; font-family: var(--font-display); }
.card-footer { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-link { transition: border-color var(--dur-2), box-shadow var(--dur-2), transform var(--dur-2); color: inherit; display: block; }
.card-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.card-leaf { border-radius: var(--r-leaf); }
.card-flat { box-shadow: none; background: var(--surface-2); }
.card-ink { background: var(--awp-ink); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .card-ink { border-color: var(--border-strong); }
.card-ink .muted, .card-ink .subtle { color: var(--gray-400); }
.card-ink h1, .card-ink h2, .card-ink h3, .card-ink h4 { color: #fff; }
.stat { display: flex; flex-direction: column; gap: var(--s-1); }
.stat-label { font-size: var(--text-sm); color: var(--text-2); display: flex; align-items: center; gap: var(--s-2); }
.stat-value { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-value small { font-size: var(--text-base); color: var(--text-3); font-weight: 600; }
.trend { display: inline-flex; align-items: center; gap: 2px; font-size: var(--text-xs); font-weight: 600; }
.trend-up { color: var(--success); } .trend-down { color: var(--danger); } .trend-flat { color: var(--text-3); }
.icon-tile {
  --t: var(--awp-blue);
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: var(--r-leaf-full); background: color-mix(in srgb, var(--t) 14%, transparent); color: var(--t);
}
.icon-tile.green { --t: var(--green-600); } .icon-tile.red { --t: var(--red-500); } .icon-tile.amber { --t: var(--amber-600); } .icon-tile.violet { --t: var(--violet-500); } .icon-tile.ink { --t: var(--text); }
.icon-tile-lg { width: 52px; height: 52px; }

/* ---------- 10. Avatars ------------------------------------------------- */
.avatar {
  --av: 36px;
  width: var(--av); height: var(--av); flex-shrink: 0; display: inline-grid; place-items: center; overflow: hidden;
  border-radius: 50%; background: var(--av-bg, var(--blue-100)); color: var(--av-fg, var(--blue-800));
  font-family: var(--font-display); font-weight: 700; font-size: calc(var(--av) * .38); letter-spacing: -.02em; position: relative;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-leaf { border-radius: var(--r-leaf-full); }
.avatar-xs { --av: 22px; } .avatar-sm { --av: 28px; } .avatar-lg { --av: 48px; } .avatar-xl { --av: 72px; }
.avatar.green { --av-bg: var(--green-100); --av-fg: var(--green-800); }
.avatar.red { --av-bg: var(--red-100); --av-fg: var(--red-800); }
.avatar.amber { --av-bg: var(--amber-100); --av-fg: var(--amber-900); }
.avatar.violet { --av-bg: var(--violet-100); --av-fg: var(--violet-700); }
.avatar.ink { --av-bg: var(--awp-ink); --av-fg: #fff; }
.avatar-wrap { position: relative; display: inline-flex; }
.avatar-wrap .presence { position: absolute; right: 0; bottom: 0; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface); background: var(--gray-400); }
.presence.on { background: var(--green-500); }
.avatar-group { display: inline-flex; }
.avatar-group .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-group .avatar + .avatar { margin-left: -8px; }
.person { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.person-name { font-weight: 600; line-height: 1.3; }
.person-meta { font-size: var(--text-xs); color: var(--text-3); }

/* ---------- 11. Progress ----------------------------------------------- */
.progress { --p: 0%; --pc: var(--primary); height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--p); background: var(--pc); border-radius: inherit; transition: width var(--dur-3) var(--ease); }
.progress-sm { height: 4px; } .progress-lg { height: 12px; }
.progress.green { --pc: var(--green-500); } .progress.red { --pc: var(--red-500); } .progress.amber { --pc: var(--amber-500); } .progress.ink { --pc: var(--text); }
.progress-brand > span { background: linear-gradient(90deg, var(--awp-green), var(--awp-blue)); }
.progress-stacked { display: flex; height: 10px; border-radius: var(--r-full); overflow: hidden; background: var(--surface-3); gap: 2px; }
.progress-stacked > span { height: 100%; width: var(--p); background: var(--st, var(--primary)); }
.ring {
  --p: 0; --size: 72px; --thick: 8px; --rc: var(--primary);
  width: var(--size); height: var(--size); border-radius: 50%; display: inline-grid; place-items: center; position: relative; flex-shrink: 0;
  background: conic-gradient(var(--rc) calc(var(--p) * 1%), var(--surface-3) 0);
}
.ring::before { content: ""; position: absolute; inset: var(--thick); border-radius: 50%; background: var(--surface); }
.ring > * { position: relative; font-family: var(--font-display); font-weight: 700; font-size: calc(var(--size) * .24); font-variant-numeric: tabular-nums; }
.ring.green { --rc: var(--green-500); } .ring.red { --rc: var(--red-500); } .ring.amber { --rc: var(--amber-500); }
.ring-sm { --size: 44px; --thick: 5px; } .ring-lg { --size: 120px; --thick: 12px; }
.steps { display: flex; counter-reset: step; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--s-2); position: relative; text-align: center; font-size: var(--text-xs); color: var(--text-3); }
.step::before { counter-increment: step; content: counter(step); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); background: var(--surface); font-weight: 700; color: var(--text-3); position: relative; z-index: 1; }
.step + .step::after { content: ""; position: absolute; top: 14px; right: 50%; width: 100%; height: 2px; background: var(--border-strong); }
.step.is-done::before { content: "✓"; background: var(--success-solid); border-color: var(--success-solid); color: #fff; }
.step.is-done + .step::after, .step.is-done + .step.is-current::after { background: var(--success-solid); }
.step.is-current::before { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.step.is-current { color: var(--text); font-weight: 600; }
.step.is-done { color: var(--text-2); }

/* ---------- 12. Tables -------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th {
  text-align: left; font-weight: 600; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); background: var(--surface-2); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-1); }
.table-hover tbody tr:hover { background: var(--surface-2); }
.table .person-name, .table .person-meta { white-space: nowrap; }
.table tr.is-selected { background: var(--primary-soft) !important; }
.table .num, .table .right { text-align: right; }
.table-compact td, .table-compact th { padding: var(--s-2) var(--s-3); }
.table-striped tbody tr:nth-child(even) { background: var(--surface-2); }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--text); }
.table th[data-sort]::after { content: "↕"; margin-left: 4px; opacity: .4; }
.table th[aria-sort="ascending"]::after { content: "↑"; opacity: 1; }
.table th[aria-sort="descending"]::after { content: "↓"; opacity: 1; }
.table-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-2); flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-6); font-size: var(--text-sm); }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; font-weight: 500; }

/* ---------- 13. Navigation --------------------------------------------- */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab {
  display: inline-flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-3); margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-2); font-weight: 600; font-size: var(--text-sm); white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-selected="true"], .tab.is-active { color: var(--text); border-bottom-color: var(--awp-blue); }
.tab .count { background: var(--surface-3); color: var(--text-2); }
.tab[aria-selected="true"] .count { background: var(--primary); color: #fff; }
.tab-panel[hidden] { display: none; }
.tabs-pill { border: 0; gap: var(--s-1); padding: 3px; background: var(--surface-3); border-radius: var(--r-md); display: inline-flex; }
.tabs-pill .tab { border: 0; margin: 0; padding: 6px var(--s-3); border-radius: var(--r-sm); }
.tabs-pill .tab[aria-selected="true"] { background: var(--surface); box-shadow: var(--shadow-sm); }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: var(--r-md); gap: 2px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; gap: var(--s-1); padding: 5px var(--s-3); border-radius: var(--r-sm); font-size: var(--text-sm); font-weight: 600; color: var(--text-2); cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); font-size: var(--text-sm); color: var(--text-3); list-style: none; padding: 0; }
.breadcrumb li { display: inline-flex; align-items: center; gap: var(--s-2); }
.breadcrumb li + li::before { content: "/"; color: var(--border-strong); }
.breadcrumb a { color: var(--text-2); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 600; }
.pagination { display: flex; align-items: center; gap: var(--s-1); list-style: none; padding: 0; }
.pagination a, .pagination span { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 var(--s-2); border-radius: var(--r-sm); font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }
.pagination a:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.pagination [aria-current="page"] { background: var(--awp-ink); color: #fff; }
:root[data-theme="dark"] .pagination [aria-current="page"] { background: var(--gray-100); color: var(--gray-900); }
.accordion { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.accordion details + details { border-top: 1px solid var(--border); }
.accordion summary { list-style: none; display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5); cursor: pointer; font-weight: 600; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform var(--dur-2); }
.accordion details[open] summary::after { transform: rotate(-135deg); }
.accordion .accordion-body { padding: 0 var(--s-5) var(--s-4); color: var(--text-2); font-size: var(--text-sm); }

/* ---------- 14. Dropdown / menu ---------------------------------------- */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.menu {
  position: absolute; z-index: var(--z-dropdown); top: calc(100% + 6px); left: 0; min-width: 200px;
  padding: var(--s-1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  animation: pop var(--dur-2) var(--ease);
}
.menu-right { left: auto; right: 0; }
.menu-item { display: flex; align-items: center; gap: var(--s-3); width: 100%; padding: 7px var(--s-3); border: 0; background: none; border-radius: var(--r-sm); font-size: var(--text-sm); color: var(--text); text-align: left; }
.menu-item:hover { background: var(--surface-3); text-decoration: none; }
.menu-item svg.lucide { color: var(--text-3); }
.menu-item.danger { color: var(--danger); } .menu-item.danger svg.lucide { color: var(--danger); }
.menu-item kbd { margin-left: auto; }
.menu-sep { height: 1px; background: var(--border); margin: var(--s-1) 0; }
.menu-label { padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--text-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- 15. Dialog & drawer (native <dialog>) ---------------------- */
.dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 0; border: 1px solid var(--border); border-radius: var(--r-xl);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-xl); margin: auto;
}
.dialog[open] { animation: pop var(--dur-2) var(--ease); }
.dialog::backdrop { background: rgb(18 18 17 / .55); backdrop-filter: blur(2px); }
.dialog-lg { width: min(760px, calc(100vw - 32px)); }
.dialog-header { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-5) var(--s-6) var(--s-3); }
.dialog-header h3 { font-size: var(--text-lg); }
.dialog-body { padding: var(--s-2) var(--s-6) var(--s-5); color: var(--text-2); }
.dialog-footer { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-6); border-top: 1px solid var(--border); background: var(--surface-2); }
.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(440px, 100vw); border-radius: 0; border: 0; border-left: 1px solid var(--border); display: none; flex-direction: column; }
.drawer[open] { display: flex; animation: slide-in var(--dur-3) var(--ease); }
.drawer .dialog-body { flex: 1; overflow-y: auto; padding-top: var(--s-4); }

/* ---------- 16. Tooltip (CSS only: data-tip="…") ----------------------- */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; z-index: var(--z-tooltip); left: 50%; bottom: calc(100% + 8px); transform: translate(-50%, 4px);
  padding: 5px 9px; border-radius: var(--r-sm); background: var(--gray-900); color: #fff; font-size: var(--text-xs); font-weight: 500; line-height: 1.3;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--dur-1), transform var(--dur-1);
}
:root[data-theme="dark"] [data-tip]::after { background: var(--gray-100); color: var(--gray-900); }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
[data-tip-pos="bottom"]::after { bottom: auto; top: calc(100% + 8px); }

/* ---------- 17. Toasts -------------------------------------------------- */
.toasts { position: fixed; z-index: var(--z-toast); right: var(--s-4); bottom: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-4);
  background: var(--gray-900); color: #fff; border-radius: var(--r-md); box-shadow: var(--shadow-lg); font-size: var(--text-sm);
  animation: toast-in var(--dur-3) var(--ease);
}
:root[data-theme="dark"] .toast { background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text); }
.toast.is-leaving { animation: toast-out var(--dur-2) var(--ease) forwards; }
.toast .t-icon { color: var(--blue-300); margin-top: 1px; }
.toast.success .t-icon { color: var(--green-300); } .toast.danger .t-icon { color: var(--red-300); } .toast.warning .t-icon { color: var(--amber-300); }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .6; padding: 0; display: inline-flex; }

/* ---------- 18. Empty / loading ---------------------------------------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3); padding: var(--s-12) var(--s-6); }
.empty .icon-tile { width: 64px; height: 64px; }
.empty .icon-tile svg.lucide { width: 28px; height: 28px; }
.empty p { max-width: 360px; color: var(--text-2); font-size: var(--text-sm); }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-sm); height: 12px; }
.skeleton-circle { border-radius: 50%; }
.spinner { width: 20px; height: 20px; border: 2.5px solid var(--surface-3); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }

/* ---------- 19. Attendance --------------------------------------------- */
.checkin { display: flex; flex-direction: column; align-items: center; gap: var(--s-4); text-align: center; }
.checkin-clock { font-family: var(--font-display); font-size: var(--text-4xl); font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.checkin-btn {
  width: 148px; height: 148px; border-radius: var(--r-leaf-full); border: 0; color: #fff; display: grid; place-items: center; align-content: center; gap: var(--s-1);
  background: var(--green-600); box-shadow: 0 10px 30px color-mix(in srgb, var(--green-500) 40%, transparent), inset 0 -4px 0 rgb(0 0 0 / .15);
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-md); transition: transform var(--dur-2) var(--ease);
}
.checkin-btn svg.lucide { width: 34px; height: 34px; }
.checkin-btn:hover { transform: scale(1.03); }
.checkin-btn:active { transform: scale(.98); }
.checkin-btn.out { background: var(--red-500); box-shadow: 0 10px 30px color-mix(in srgb, var(--red-500) 40%, transparent), inset 0 -4px 0 rgb(0 0 0 / .15); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { font-size: var(--text-xs); font-weight: 600; color: var(--text-3); text-align: center; padding-bottom: var(--s-1); }
.cal-day {
  aspect-ratio: 1 / 1; min-height: 40px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; justify-content: space-between; padding: 6px; font-size: var(--text-xs); font-weight: 600; color: var(--text-2); position: relative;
}
.cal-day[class*="st-"] { background: var(--b-bg); border-color: var(--b-line); color: var(--b-fg); }
.cal-day[class*="st-"]::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--st); align-self: flex-end; }
.cal-day.is-out { visibility: hidden; }
.cal-day.is-today { box-shadow: 0 0 0 2px var(--text); }
.cal-day.is-weekend { background: var(--surface-2); color: var(--text-3); }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; }
.heatmap i { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-3); }
.heatmap i[data-l="1"] { background: color-mix(in srgb, var(--green-500) 30%, var(--surface-3)); }
.heatmap i[data-l="2"] { background: color-mix(in srgb, var(--green-500) 55%, var(--surface-3)); }
.heatmap i[data-l="3"] { background: color-mix(in srgb, var(--green-500) 80%, var(--surface-3)); }
.heatmap i[data-l="4"] { background: var(--green-600); }
.heatmap i[data-l="x"] { background: var(--red-300); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); font-size: var(--text-xs); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--st, var(--surface-3)); }

/* ---------- 20. Learning ----------------------------------------------- */
.prose { font-size: var(--text-md); line-height: 1.75; color: var(--text); }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: var(--text-xl); margin-top: 2em; }
.prose h3 { font-size: var(--text-lg); margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .35em; }
.prose li::marker { color: var(--text-3); }
.prose blockquote { border-left: 3px solid var(--border-strong); padding-left: var(--s-4); color: var(--text-2); font-style: italic; }
.prose img { border-radius: var(--r-lg); border: 1px solid var(--border); }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.prose th, .prose td { border: 1px solid var(--border); padding: var(--s-2) var(--s-3); text-align: left; }
.prose th { background: var(--surface-2); }
.code { border-radius: var(--r-lg); overflow: hidden; border: 1px solid #2B2B28; background: #161615; color: #E7E7E3; font-size: var(--text-sm); }
.code-head { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3) var(--s-2) var(--s-4); background: #1F1F1D; border-bottom: 1px solid #2B2B28; font-family: var(--font-mono); font-size: var(--text-xs); color: #A1A19B; }
.code-head .copy { margin-left: auto; background: none; border: 0; color: #A1A19B; display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: var(--r-xs); font: inherit; }
.code-head .copy:hover { background: #2B2B28; color: #fff; }
.code pre { margin: 0; padding: var(--s-4); overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; tab-size: 4; }
.code pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.code .k { color: #FF7A6E; } .code .s { color: #6EDB9C; } .code .c { color: #7A7A74; font-style: italic; } .code .f { color: #8BB8EA; } .code .v { color: #F8C35A; } .code .n { color: #C5A8F5; }
.lesson-list { list-style: none; padding: 0; display: flex; flex-direction: column; }
.lesson-item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); color: var(--text); font-size: var(--text-sm); }
.lesson-item:hover { background: var(--surface-3); text-decoration: none; }
.lesson-item .li-state { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.lesson-item .li-state svg.lucide { width: 12px; height: 12px; stroke-width: 3; }
.lesson-item.is-done .li-state { background: var(--success-solid); border-color: var(--success-solid); }
.lesson-item.is-current { background: var(--primary-soft); font-weight: 600; }
.lesson-item.is-current .li-state { border-color: var(--primary); box-shadow: inset 0 0 0 4px var(--surface); background: var(--primary); }
.lesson-item.is-locked { color: var(--text-3); }
.lesson-item .li-meta { margin-left: auto; font-size: var(--text-xs); color: var(--text-3); white-space: nowrap; }
.quiz-option {
  display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1.5px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; background: var(--surface); transition: border-color var(--dur-1), background var(--dur-1); font-size: var(--text-sm);
}
.quiz-option:hover { border-color: var(--border-strong); }
.quiz-option input { position: absolute; opacity: 0; }
.quiz-option .qo-key { width: 26px; height: 26px; border-radius: var(--r-sm); background: var(--surface-3); display: grid; place-items: center; font-weight: 700; font-size: var(--text-xs); flex-shrink: 0; }
.quiz-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.quiz-option:has(input:checked) .qo-key { background: var(--primary); color: #fff; }
.quiz-option:has(input:focus-visible) { outline: 3px solid var(--focus); }
.quiz-option.is-correct { border-color: var(--success-solid); background: var(--success-soft); }
.quiz-option.is-correct .qo-key { background: var(--success-solid); color: #fff; }
.quiz-option.is-wrong { border-color: var(--danger-solid); background: var(--danger-soft); }
.quiz-option.is-wrong .qo-key { background: var(--danger-solid); color: #fff; }

/* ---------- 21. Reviews, timeline, comments ---------------------------- */
.rubric { display: flex; flex-direction: column; gap: var(--s-4); }
.rubric-row { display: grid; grid-template-columns: 1fr auto; gap: var(--s-2) var(--s-4); align-items: center; }
.score-picker { display: inline-flex; gap: 4px; }
.score-picker label input { position: absolute; opacity: 0; }
.score-picker label span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); font-weight: 700; font-size: var(--text-sm); cursor: pointer; color: var(--text-2); background: var(--surface); }
.score-picker label span:hover { border-color: var(--text-3); }
.score-picker input:checked + span { background: var(--awp-ink); border-color: var(--awp-ink); color: #fff; }
:root[data-theme="dark"] .score-picker input:checked + span { background: var(--gray-100); color: var(--gray-900); }
.score-picker input:focus-visible + span { outline: 3px solid var(--focus); }
.timeline { list-style: none; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.timeline li { position: relative; display: flex; gap: var(--s-3); padding-bottom: var(--s-5); }
.timeline li:last-child { padding-bottom: 0; }
.tl-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--surface); border: 2px solid var(--border); color: var(--text-3); position: relative; z-index: 1; }
.tl-icon svg.lucide { width: 14px; height: 14px; }
.tl-icon.green { border-color: var(--green-500); color: var(--green-600); } .tl-icon.red { border-color: var(--red-500); color: var(--red-500); }
.tl-icon.blue { border-color: var(--blue-500); color: var(--blue-500); } .tl-icon.amber { border-color: var(--amber-500); color: var(--amber-600); }
.tl-body { padding-top: 5px; font-size: var(--text-sm); min-width: 0; }
.tl-time { font-size: var(--text-xs); color: var(--text-3); }
.comment { display: flex; gap: var(--s-3); }
.comment-bubble { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 0 var(--r-lg) var(--r-lg) var(--r-lg); padding: var(--s-3) var(--s-4); font-size: var(--text-sm); }
.comment-bubble .meta { display: flex; gap: var(--s-2); align-items: baseline; margin-bottom: var(--s-1); }

/* ---------- 22. Performance -------------------------------------------- */
.leaderboard { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--s-1); }
.leaderboard li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-md); }
.leaderboard li.is-me { background: var(--primary-soft); }
.rank { width: 26px; font-family: var(--font-display); font-weight: 800; color: var(--text-3); text-align: center; font-variant-numeric: tabular-nums; }
.rank-1 { color: var(--amber-500); } .rank-2 { color: var(--gray-400); } .rank-3 { color: #C0814A; }
.bars { display: flex; align-items: flex-end; gap: var(--s-2); height: 140px; padding-top: var(--s-4); }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--s-1); height: 100%; justify-content: flex-end; font-size: var(--text-xs); color: var(--text-3); }
.bars .bar i { width: 100%; max-width: 36px; height: var(--v); background: var(--bc, var(--blue-200)); border-radius: 6px 6px 0 0; transition: height var(--dur-3) var(--ease); position: relative; }
:root[data-theme="dark"] .bars .bar i { --bc: var(--blue-700); }
.bars .bar.is-hl i { --bc: var(--awp-blue); }
.bars .bar i[data-v]::before { content: attr(data-v); position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-2); font-weight: 600; }
.metric-row { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: var(--s-3); font-size: var(--text-sm); }
.metric-row .num { text-align: right; font-weight: 600; }

/* ---------- 23. Certificate -------------------------------------------- */
.certificate {
  position: relative; aspect-ratio: 1.414 / 1; width: 100%; background: #FFFEFB; color: var(--gray-900);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 6% 8%; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; font-family: var(--font-body);
  container-type: inline-size;
}
.certificate::before { content: ""; position: absolute; inset: 14px; border: 1.5px solid #E6E2D6; border-radius: 6px; pointer-events: none; }
.certificate .cert-shapes { position: absolute; right: 8%; top: 9%; display: flex; gap: 1cqw; }
.certificate .cert-shapes span { width: 7cqw; height: 7cqw; }
.certificate .cert-title { font-family: var(--font-display); font-size: 4.6cqw; font-weight: 800; letter-spacing: -.02em; color: var(--gray-900); line-height: 1.1; }
.certificate .cert-name { font-family: var(--font-display); font-size: 5.4cqw; font-weight: 700; color: var(--blue-700); line-height: 1.1; margin: 1.5cqw 0; }
.certificate .cert-text { font-size: 1.7cqw; color: var(--gray-600); max-width: 70%; line-height: 1.6; }
.certificate .cert-label { font-size: 1.2cqw; letter-spacing: .18em; text-transform: uppercase; color: var(--gray-500); font-weight: 600; }
.certificate .cert-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 4cqw; font-size: 1.45cqw; color: var(--gray-600); }
.certificate .cert-sign { border-top: 1px solid var(--gray-300); padding-top: .8cqw; min-width: 18cqw; }
.certificate .cert-sign b { display: block; color: var(--gray-900); font-size: 1.6cqw; }
.certificate .cert-code { font-family: var(--font-mono); font-size: 1.3cqw; color: var(--gray-500); }
.certificate .awp-logo { height: 4.2cqw; }
.verify { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-5); border-radius: var(--r-leaf); background: var(--success-soft); border: 1px solid var(--success-line); }
.verify.is-invalid { background: var(--danger-soft); border-color: var(--danger-line); }
@media print {
  body * { visibility: hidden; }
  .certificate, .certificate * { visibility: visible; }
  .certificate { position: fixed; inset: 0; box-shadow: none; border-radius: 0; }
}

/* ---------- 24. Brand: logo & shapes ----------------------------------- */
.awp-logo { display: inline-flex; align-items: center; gap: .7em; height: 32px; color: inherit; }
.awp-logo svg { height: 100%; width: auto; }
.awp-logo .wordmark { font-family: var(--font-display); line-height: 1; font-size: calc(1em); white-space: nowrap; }
.shape { display: inline-block; width: 40px; height: 40px; }
.shape-leaf { background: var(--awp-green); border-radius: 50% 50% 0 50%; }
.shape-notch { background: var(--awp-red); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 56%, 0 100%); }
.shape-p { background: var(--awp-blue); clip-path: path("M0 0 H26.5 A13.2 13.2 0 0 1 26.5 26.4 H19.8 V40 H0 Z"); }
.brand-strip { height: 4px; background: linear-gradient(90deg, var(--awp-green) 0 33.3%, var(--awp-red) 33.3% 66.6%, var(--awp-blue) 66.6%); }

/* ---------- 25. App shell ---------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4) var(--s-3); background: var(--surface); border-right: 1px solid var(--border); }
.sidebar-brand { padding: var(--s-2) var(--s-3) var(--s-5); }
.nav-section { padding: var(--s-4) var(--s-3) var(--s-1); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.nav-link { display: flex; align-items: center; gap: var(--s-3); padding: 8px var(--s-3); border-radius: var(--r-md); color: var(--text-2); font-size: var(--text-sm); font-weight: 500; }
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link.is-active, .nav-link[aria-current="page"] { background: var(--awp-ink); color: #fff; }
.nav-link.is-active svg.lucide, .nav-link[aria-current="page"] svg.lucide { color: var(--awp-green); }
:root[data-theme="dark"] .nav-link.is-active, :root[data-theme="dark"] .nav-link[aria-current="page"] { background: var(--surface-3); color: var(--text); }
.nav-link .count { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding-top: var(--s-4); border-top: 1px solid var(--border); }
.topbar { position: sticky; top: 0; z-index: var(--z-sticky); height: var(--topbar-h); display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-6); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.main { padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-6); min-width: 0; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.page-header h1 { font-size: var(--text-2xl); }
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: var(--z-overlay); left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform var(--dur-3) var(--ease); box-shadow: var(--shadow-xl); }
  .app.nav-open .sidebar { transform: none; }
  .menu-toggle { display: inline-flex; }
  .topbar, .main { padding-inline: var(--s-4); }
}
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: var(--awp-ink); color: #fff; padding: var(--s-12); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-form { display: grid; place-items: center; padding: var(--s-8) var(--s-4); }
@media (max-width: 900px) { .auth-page { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* ---------- 26. Keyframes ---------------------------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(2.6); opacity: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

/* ---------- 27. Lesson reader ------------------------------------------ */
.reader { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.reader-nav { position: sticky; top: calc(var(--topbar-h) + var(--s-4)); max-height: calc(100vh - var(--topbar-h) - var(--s-8)); overflow-y: auto; }
.reader-body { padding: var(--s-8) var(--s-10) var(--s-6); min-width: 0; }
.reader-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-10); padding-top: var(--s-5); border-top: 1px solid var(--border); }
.prose { max-width: 76ch; }
.prose .code { margin-top: 1.1em; }
.prose .code pre { font-size: 13px; }
.prose :not(pre) > code { white-space: nowrap; }
.prose .callout p { margin: 0; }
.prose .callout p + p { margin-top: .5em; }
.prose h4 { font-size: var(--text-md); margin-top: 1.4em; }
.table-scroll { overflow-x: auto; }
@media (max-width: 1100px) { .reader { grid-template-columns: 1fr; } .reader-nav { position: static; max-height: none; } }
@media (max-width: 600px) { .reader-body { padding: var(--s-5) var(--s-4); } .prose { font-size: var(--text-base); } .prose :not(pre) > code { white-space: normal; } }

/* highlight.js tokens → the same palette as the hand-coloured .code examples */
.hljs-keyword, .hljs-selector-tag, .hljs-built_in.hljs-keyword { color: #FF7A6E; }
.hljs-string, .hljs-regexp, .hljs-template-tag { color: #6EDB9C; }
.hljs-comment, .hljs-quote, .hljs-meta { color: #7A7A74; font-style: italic; }
.hljs-title.function_, .hljs-built_in, .hljs-attr, .hljs-attribute, .hljs-section { color: #8BB8EA; }
.hljs-variable, .hljs-template-variable, .hljs-params .hljs-variable, .hljs-number, .hljs-literal { color: #F8C35A; }
.hljs-title.class_, .hljs-type, .hljs-title, .hljs-name, .hljs-selector-class { color: #C5A8F5; }
.hljs-subst, .hljs-punctuation, .hljs-operator { color: #E7E7E3; }

/* ---------- 28. Curriculum editor -------------------------------------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-4); }
.editor-pane { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: var(--s-2); border-bottom: 1px solid var(--border); background: var(--surface-2); min-height: 44px; }
.editor-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 var(--s-1); }
.editor-text { flex: 1; width: 100%; min-height: 68vh; border: 0; padding: var(--s-4); resize: vertical; background: var(--surface); color: var(--text);
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7; tab-size: 4; }
.editor-text:focus { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.editor-preview { flex: 1; height: 68vh; overflow-y: auto; padding: var(--s-5) var(--s-6); max-width: none; font-size: var(--text-base); }
.editor-bar { position: sticky; bottom: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-md); }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } .editor-preview { height: auto; max-height: 60vh; } }

/* ---------- 29. Certificate page --------------------------------------- */
.cert-page { min-height: 100vh; padding: var(--s-5) var(--s-4) var(--s-10); }
.cert-actions { display: flex; align-items: center; gap: var(--s-2); max-width: 1000px; margin: 0 auto var(--s-5); }
.cert-page .certificate { max-width: 1000px; margin: 0 auto; }
.certificate .cert-shapes { display: flex; gap: 1cqw; }
.certificate .cert-shapes span { display: block; width: 6cqw; height: 6cqw; }
.certificate.is-revoked { filter: grayscale(1); opacity: .75; }
.cert-void { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 12cqw; color: rgb(212 54 42 / .28); transform: rotate(-18deg); pointer-events: none; }
@page { size: A4 landscape; margin: 0; }
