/* ==========================================================================
   Design tokens + shared components (public site and HR dashboard)
   ========================================================================== */
:root {
  --ink: #101a33;
  --ink-2: #1b2748;
  --ink-3: #2a3760;
  --cobalt: #3355ff;
  --cobalt-d: #2440d6;
  --cobalt-l: #e6ebff;
  --sun: #ffc933;
  --sun-d: #e8b01a;
  --sun-l: #fff3cc;
  --mist: #edf0f7;
  --paper: #f6f8fc;
  --white: #ffffff;
  --text: #101a33;
  --muted: #5b6478;
  --faint: #8d96a8;
  --line: #dde3ee;
  --leaf: #0f9b72;
  --leaf-l: #ddf5ec;
  --rose: #d93a41;
  --rose-l: #fdebec;
  --amber-l: #fff4d6;

  --radius: 16px;
  --radius-s: 10px;
  --shadow-1: 0 1px 2px rgba(16, 26, 51, 0.06), 0 10px 28px -14px rgba(16, 26, 51, 0.22);
  --shadow-2: 0 2px 4px rgba(16, 26, 51, 0.08), 0 24px 48px -16px rgba(16, 26, 51, 0.32);

  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1160px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; margin: 0 0 0.5em; letter-spacing: -0.015em; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--cobalt); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--cobalt-d); }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; white-space: nowrap; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 8px; color: #fff; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 12px; border: 2px solid transparent;
  background: var(--cobalt); color: #fff; font-weight: 650; font-size: 15.5px; cursor: pointer;
  text-decoration: none; transition: background 0.15s, transform 0.12s, box-shadow 0.15s, border-color 0.15s; white-space: nowrap;
}
.btn:hover { background: var(--cobalt-d); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.btn-ink { background: var(--ink); } .btn-ink:hover { background: var(--ink-3); }
.btn-sun { background: var(--sun); color: var(--ink); } .btn-sun:hover { background: var(--sun-d); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); } .btn-ghost:hover { background: var(--white); color: var(--ink); border-color: var(--ink); }
.btn-danger { background: var(--rose); } .btn-danger:hover { background: #b92b31; }
.btn-soft { background: var(--cobalt-l); color: var(--cobalt-d); } .btn-soft:hover { background: #d4dcff; color: var(--cobalt-d); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 17px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- forms ---------------- */
.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field > label, .field > .label, legend.label { font-weight: 650; font-size: 14.5px; color: var(--ink); }
.field .opt { color: var(--faint); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 11px; background: var(--white);
  border: 1.5px solid var(--line); transition: border-color 0.15s, box-shadow 0.15s; appearance: none;
}
.textarea { min-height: 110px; resize: vertical; }
.select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6478' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.input:hover, .select:hover, .textarea:hover { border-color: #b9c3d6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 4px var(--cobalt-l); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--rose); box-shadow: 0 0 0 4px var(--rose-l); }
.hint { font-size: 13.5px; color: var(--muted); }
.error-text { font-size: 13.5px; color: var(--rose); font-weight: 600; display: none; }
.has-error > .error-text, .has-error .error-text { display: block; }
.grid-2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--white); font-weight: 600; font-size: 15px; transition: all 0.15s; user-select: none;
}
.chip:hover span { border-color: var(--cobalt); }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--cobalt); outline-offset: 2px; }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--cobalt); flex: none; }

/* ---------------- pills / badges ---------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 650; background: var(--mist); color: var(--ink); white-space: nowrap; }
.pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--faint)); }
.pill.plain::before { display: none; }
.flag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 700; }
.flag.sun { background: var(--sun-l); color: #7a5a00; }
.flag.rose { background: var(--rose-l); color: #a2262b; }
.flag.blue { background: var(--cobalt-l); color: var(--cobalt-d); }
.flag.leaf { background: var(--leaf-l); color: #0a7656; }
.flag svg { width: 13px; height: 13px; }

/* ---------------- toasts + dialog ---------------- */
.toasts { position: fixed; z-index: 200; right: 16px; bottom: 16px; left: 16px; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 440px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px;
  box-shadow: var(--shadow-2); font-weight: 550; display: flex; gap: 10px; align-items: flex-start; animation: toast-in 0.25s ease-out;
}
.toast.error { background: var(--rose); }
.toast.success { background: var(--leaf); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

dialog.modal {
  border: 0; padding: 0; border-radius: 20px; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  box-shadow: var(--shadow-2); color: var(--text); background: var(--white);
}
dialog.modal::backdrop { background: rgba(16, 26, 51, 0.55); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 0; }
.modal-head h2 { margin: 0; font-size: 21px; }
.modal-body { padding: 16px 24px 8px; overflow: auto; max-height: calc(100dvh - 200px); }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 12px 24px 22px; }
@media (max-width: 560px) {
  dialog.modal { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 20px 20px 0 0; }
  .modal-foot .btn { flex: 1; }
}

.skeleton { background: linear-gradient(90deg, var(--mist) 25%, #f6f8fc 50%, var(--mist) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; min-height: 18px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 19px; margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
