/* ApplyCBET shared theme — deep green field, warm amber for "not yet competent",
   earth and verification accents drawn from the subject. Light + dark. */

:root {
  --bg: #F4F2EA;
  --bg-2: #EDEAE0;
  --surface: #FFFFFF;
  --surface-2: #FBF9F3;
  --overlay: #FFFFFF;
  --scrim: rgba(8, 26, 18, .55);
  --fg: #14231B;
  --fg-soft: #2C3D33;
  --muted: #5A6B5E;
  --line: #DCD8C8;
  --line-soft: #E9E5D8;

  --brand: #14532D;
  --brand-2: #2F7D4F;
  --brand-3: #7FBF8F;
  --brand-ink: #FFFFFF;

  --amber: #E08A00;
  --amber-field: #F5A524;
  --clay: #C2410C;
  --blue: #2456E6;
  --teal: #0E7C86;
  --magenta: #C42D78;

  --ok: #1F7A45;
  --warn: #B26A00;
  --danger: #C0362C;
  --info: #2456E6;

  --ok-bg: #E4F3E8;
  --warn-bg: #FDF0D8;
  --danger-bg: #FBE6E3;
  --info-bg: #E5EBFD;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-pill: 999px;

  --space: 1;
  --type: 1;
  --motion: 1;
  --radius-scale: 1;

  --shadow-1: 0 1px 2px rgba(10, 35, 22, .06), 0 4px 14px rgba(10, 35, 22, .06);
  --shadow-2: 0 12px 40px rgba(8, 30, 19, .16);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --nav-h: 62px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #06170F;
  --bg-2: #0A2116;
  --surface: #0E2A1E;
  --surface-2: #123527;
  --overlay: #10301F;
  --scrim: rgba(2, 10, 6, .7);
  --fg: #EAF3EC;
  --fg-soft: #CFE2D4;
  --muted: #9DBBA6;
  --line: #1E4634;
  --line-soft: #173A2A;

  --brand: #46A06A;
  --brand-2: #7FBF8F;
  --brand-3: #2F7D4F;
  --brand-ink: #04150C;

  --amber: #FFC24D;
  --amber-field: #F5A524;
  --clay: #FF8A50;
  --blue: #7FA6FF;
  --teal: #3FC7D1;
  --magenta: #F277B4;

  --ok: #5BD695;
  --warn: #FFC24D;
  --danger: #FF8078;
  --info: #7FA6FF;

  --ok-bg: #10331F;
  --warn-bg: #33270D;
  --danger-bg: #351815;
  --info-bg: #131F3D;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-2: 0 18px 50px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #06170F; --bg-2: #0A2116; --surface: #0E2A1E; --surface-2: #123527;
    --overlay: #10301F; --scrim: rgba(2, 10, 6, .7);
    --fg: #EAF3EC; --fg-soft: #CFE2D4; --muted: #9DBBA6; --line: #1E4634; --line-soft: #173A2A;
    --brand: #46A06A; --brand-2: #7FBF8F; --brand-3: #2F7D4F; --brand-ink: #04150C;
    --amber: #FFC24D; --clay: #FF8A50; --blue: #7FA6FF; --teal: #3FC7D1; --magenta: #F277B4;
    --ok: #5BD695; --warn: #FFC24D; --danger: #FF8078; --info: #7FA6FF;
    --ok-bg: #10331F; --warn-bg: #33270D; --danger-bg: #351815; --info-bg: #131F3D;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-2: 0 18px 50px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  :root { --motion: 0; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: calc(16px * var(--type));
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.locked { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; line-height: 1.18; font-weight: 650; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* scrollbar in the artifact's own language */
* { scrollbar-width: thin; scrollbar-color: var(--brand-3) var(--bg-2); }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-track { background: var(--bg-2); }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border: 3px solid var(--bg-2);
  border-radius: var(--r-pill);
}
*::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--amber-field), var(--clay)); }

.ic { width: 18px; height: 18px; flex: none; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: calc(var(--r-sm) * var(--radius-scale));
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  font-size: calc(14.5px * var(--type)); font-weight: 600; cursor: pointer;
  transition: transform calc(140ms * var(--motion)) ease, box-shadow calc(140ms * var(--motion)) ease, background calc(140ms * var(--motion)) ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.btn:active { transform: translateY(0) scale(.985); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--brand-3); }
.btn-amber { background: var(--amber-field); border-color: var(--amber-field); color: #2A1B00; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: calc(13.5px * var(--type)); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: calc(var(--r-sm) * var(--radius-scale));
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer;
  transition: background calc(140ms * var(--motion)) ease, border-color calc(140ms * var(--motion)) ease;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--brand-3); }

.inp {
  width: 100%; padding: 9px 12px;
  border-radius: calc(var(--r-sm) * var(--radius-scale));
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  font-size: calc(15px * var(--type));
  transition: border-color calc(140ms * var(--motion)) ease, box-shadow calc(140ms * var(--motion)) ease;
}
.inp:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 22%, transparent); outline: none; }
.inp::placeholder { color: var(--muted); opacity: .8; }
select.inp { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
textarea.inp { resize: vertical; min-height: 74px; line-height: 1.5; }

.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field-label { font-size: calc(13px * var(--type)); font-weight: 650; color: var(--fg-soft); letter-spacing: .01em; }
.field-hint { font-size: calc(12.5px * var(--type)); color: var(--muted); }

.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.col { display: grid; gap: 14px; }

/* ---------- badges, chips, meters ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: calc(12px * var(--type)); font-weight: 650; letter-spacing: .01em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-neutral { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-brand { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.badge-teal { background: color-mix(in srgb, var(--teal) 15%, transparent); color: var(--teal); }
.badge-magenta { background: color-mix(in srgb, var(--magenta) 15%, transparent); color: var(--magenta); }

.chip {
  padding: 6px 13px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--fg-soft);
  font-size: calc(13.5px * var(--type)); font-weight: 600; cursor: pointer;
  transition: all calc(140ms * var(--motion)) ease;
}
.chip:hover { border-color: var(--brand-3); background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.meter { position: relative; height: 20px; border-radius: var(--r-pill); background: var(--bg-2); overflow: hidden; border: 1px solid var(--line-soft); }
.meter-fill { height: 100%; border-radius: var(--r-pill); transition: width calc(420ms * var(--motion)) cubic-bezier(.22, 1, .36, 1); }
.m-green { background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.m-amber { background: linear-gradient(90deg, var(--clay), var(--amber-field)); }
.m-teal { background: linear-gradient(90deg, var(--teal), var(--brand-2)); }
.m-blue { background: linear-gradient(90deg, var(--blue), var(--teal)); }
.m-magenta { background: linear-gradient(90deg, var(--magenta), var(--clay)); }
.meter-num { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 700; color: var(--fg); background: var(--surface); padding: 0 6px; border-radius: var(--r-pill); line-height: 14px; box-shadow: 0 0 0 1px var(--line-soft); }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: calc(var(--r) * var(--radius-scale)); box-shadow: var(--shadow-1);
}
.eyebrow {
  font-size: calc(11.5px * var(--type)); font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 6px;
}
.muted { color: var(--muted); }
.small { font-size: calc(13px * var(--type)); }
.mono { font-family: var(--mono); font-size: .92em; }

.empty { padding: 34px 22px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r); background: var(--surface-2); }
.empty h3 { font-size: calc(17px * var(--type)); margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: calc(14px * var(--type)); margin-bottom: 12px; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); opacity: 0; transition: opacity calc(200ms * var(--motion)) ease; z-index: 80; }
.scrim.in { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  background: var(--overlay); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-2); z-index: 90; display: flex; flex-direction: column;
  transform: translateX(102%); transition: transform calc(260ms * var(--motion)) cubic-bezier(.22, 1, .36, 1);
}
.drawer-wide { width: min(880px, 100%); }
.drawer.in { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 10%, var(--surface)), var(--surface)); }
.drawer-head h2 { font-size: calc(19px * var(--type)); }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); }
.confirm-body p { margin-bottom: 18px; color: var(--fg-soft); }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 120; width: min(560px, calc(100% - 28px)); }
.toast {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 15px; border-radius: var(--r); background: var(--overlay);
  border: 1px solid var(--line); border-left: 4px solid var(--brand-2);
  box-shadow: var(--shadow-2); font-size: calc(14px * var(--type));
  animation: toast-in calc(240ms * var(--motion)) cubic-bezier(.22, 1, .36, 1);
}
.toast-warn { border-left-color: var(--amber-field); }
.toast-info { border-left-color: var(--blue); }
.toast-danger { border-left-color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); transition: all calc(300ms * var(--motion)) ease; }
.toast-act { background: transparent; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px 12px; font-size: 13px; font-weight: 650; cursor: pointer; color: var(--brand); }
.toast-act:hover { background: var(--surface-2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.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; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 200; }
.skip:focus { left: 12px; top: 12px; background: var(--brand); color: var(--brand-ink); padding: 10px 16px; border-radius: var(--r-sm); }

@media print {
  body { background: #fff; color: #000; }
  .no-print, #toasts, .scrim, .drawer { display: none !important; }
}