/* ============================================================================
   CHARAN REVIEW SYSTEM — Application Stylesheet
   ----------------------------------------------------------------------------
   Design language ported from the "worldcup2026" system:
     Barlow Condensed (structural display) / Inter (body) / JetBrains Mono (numeric)
     Frosted-glass surfaces, neutral zinc base, spring easing.

   Adapted for an HR review product:
     · Indigo brand accent drives focus, links and active navigation.
     · A 1–5 score ramp (red → amber → green) is a first-class token family.
     · A full form system — the reference app had none — built in the same idiom.

   Dark theme is a first-class citizen throughout.
   Korean is the primary content language: `word-break: keep-all` + Korean-aware
   fallback stacks are applied globally.

   SECTIONS
     A. Tokens
     B. Base / reset / shell atmosphere
     C. Layout
     D. Navigation
     E. Surfaces  (card, badge, button, stat, skeleton, divider, empty, toast, modal)
     F. Form system  (field, input, select, likert, checkbox-card, actions, progress)
     G. Data display (table, list, score-bar, score-ring, progress-steps)
     H. Motion
   ========================================================================= */


/* ============================================================================
   A. TOKENS
   ========================================================================= */

:root {
  /* ── Base Colors (Light, neutral gray) ── */
  --color-bg:           #f4f4f5;
  --color-bg-raised:    #ffffff;
  --color-surface:      rgba(9, 9, 11, 0.04);
  --color-surface-hover:rgba(9, 9, 11, 0.07);
  --color-border:       rgba(9, 9, 11, 0.10);
  --color-border-strong:rgba(9, 9, 11, 0.18);

  /* ── Text ── */
  --color-text-1: #18181b;
  --color-text-2: #52525b;
  --color-text-3: #a1a1aa;

  /* hover shade for solid (near-black) primary button */
  --color-text-1-hover: #3f3f46;

  /* nav surfaces (frosted white) */
  --color-nav-bg: rgba(255, 255, 255, 0.80);

  /* ── Status ── */
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger:  #dc2626;

  /* ── Score breakdown colors ── */
  --color-score-power:   #3b82f6;
  --color-score-bracket: #10b981;
  --color-score-upset:   #f59e0b;

  /* ── Highlight (amber) ── */
  --color-highlight: #f59e0b;

  /* ── Podium medals ── */
  --color-podium-gold:   #FFD700;
  --color-podium-silver: #C0C0C0;
  --color-podium-bronze: #CD7F32;

  /* ── Rank badge ── */
  --color-rank-badge: #3b82f6;

  /* ── Generic accent (overridable per component) ── */
  --color-accent: #18181b;

  /* ── Typography ──
     Korean is primary content: every stack ends in a Korean system face. */
  --font-display: 'Barlow Condensed', 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-body:    'Inter', 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  /* ── Type Scale ── */
  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   0.875rem;  /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg:   1.125rem;  /* 18px */
  --text-xl:   1.25rem;   /* 20px */
  --text-2xl:  1.5rem;    /* 24px */
  --text-3xl:  1.875rem;  /* 30px */
  --text-4xl:  2.25rem;   /* 36px */
  --text-5xl:  3rem;      /* 48px */
  --text-6xl:  4rem;      /* 64px */
  --text-hero: 6.5rem;    /* 104px */

  /* ── Font Weights ── */
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;
  --weight-black:    900;

  /* ── Line heights tuned for Hangul (needs more leading than Latin) ── */
  --leading-tight: 1.35;
  --leading-body:  1.7;

  /* ── Spacing (4px base) ── */
  --space-1:  0.25rem;   /*  4px */
  --space-2:  0.5rem;    /*  8px */
  --space-3:  0.75rem;   /* 12px */
  --space-4:  1rem;      /* 16px */
  --space-5:  1.25rem;   /* 20px */
  --space-6:  1.5rem;    /* 24px */
  --space-8:  2rem;      /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */

  /* ── Border Radius ── */
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   12px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* ── Shadows (soft, neutral on light) ── */
  --shadow-sm: 0 1px 2px rgba(9, 9, 11, 0.06);
  --shadow-md: 0 4px 16px rgba(9, 9, 11, 0.08);
  --shadow-lg: 0 8px 40px rgba(9, 9, 11, 0.12);

  /* ── Glass surface (frosted white on light bg) ── */
  --glass-bg:       rgba(255, 255, 255, 0.65);
  --glass-bg-hover: rgba(255, 255, 255, 0.88);
  --glass-blur:     blur(16px);
  --glass-border:   rgba(9, 9, 11, 0.08);

  /* ── Layout ── */
  --max-width:    1280px;
  --max-width-narrow: 56rem;
  --nav-height:   64px;
  --gutter:       1.5rem;
  --gutter-sm:    1rem;

  /* ── Z-index ── */
  --z-base:    0;
  --z-above:   10;
  --z-nav:     100;
  --z-overlay: 500;
  --z-modal:   1000;
  --z-toast:   2000;

  /* ── Animation ── */
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:  cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast:     120ms;
  --dur-base:     220ms;
  --dur-slow:     400ms;
  --dur-slower:   700ms;

  /* ══ ADDITIONS FOR CHARAN ══════════════════════════════════════════════ */

  /* ── Brand (indigo) — focus, links, active nav, primary emphasis ── */
  --color-brand:          #6366f1;
  --color-brand-hover:    #4f46e5;
  --color-brand-active:   #4338ca;
  --color-brand-contrast: #ffffff;
  --color-brand-soft:     rgba(99, 102, 241, 0.12);
  --color-brand-softer:   rgba(99, 102, 241, 0.06);
  --color-brand-line:     rgba(99, 102, 241, 0.28);

  /* ── Focus ring built on the brand ── */
  --ring:       0 0 0 3px color-mix(in srgb, var(--color-brand) 34%, transparent);
  --ring-error: 0 0 0 3px color-mix(in srgb, var(--color-danger) 30%, transparent);

  /* ── 1–5 Likert score ramp (red → amber → green) ── */
  --score-1: #dc2626;
  --score-2: #ea580c;
  --score-3: #d97706;
  --score-4: #65a30d;
  --score-5: #16a34a;
  --score-contrast: #ffffff;
  /* neutral default when a score is unknown */
  --score-0: var(--color-text-3);

  /* ── Form metrics ── */
  --control-h:    42px;
  --control-h-sm: 34px;
}

/* ============================================================================
   Dark Theme Tokens — <html data-theme="dark">
   ========================================================================= */
[data-theme="dark"] {
  --color-score-power:   #60a5fa;
  --color-score-bracket: #34d399;
  --color-score-upset:   #fbbf24;
  --color-highlight:     #fbbf24;
  --color-bg:           #0a0a0f;
  --color-bg-raised:    #12121a;
  --color-surface:      rgba(255, 255, 255, 0.05);
  --color-surface-hover:rgba(255, 255, 255, 0.09);
  --color-border:       rgba(255, 255, 255, 0.10);
  --color-border-strong:rgba(255, 255, 255, 0.18);

  --color-text-1: #f4f4f5;
  --color-text-2: #a1a1aa;
  --color-text-3: #52525b;
  --color-text-1-hover: #d4d4d8;

  --color-nav-bg: rgba(10, 10, 15, 0.85);

  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger:  #f87171;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);

  --glass-bg:       rgba(18, 18, 26, 0.75);
  --glass-bg-hover: rgba(18, 18, 26, 0.92);
  --glass-border:   rgba(255, 255, 255, 0.08);

  --color-accent: #f4f4f5;

  /* brand lifts for contrast on near-black */
  --color-brand:          #818cf8;
  --color-brand-hover:    #a5b4fc;
  --color-brand-active:   #c7d2fe;
  --color-brand-contrast: #0a0a0f;
  --color-brand-soft:     rgba(129, 140, 248, 0.16);
  --color-brand-softer:   rgba(129, 140, 248, 0.08);
  --color-brand-line:     rgba(129, 140, 248, 0.34);

  /* score ramp brightened so it reads on #0a0a0f */
  --score-1: #f87171;
  --score-2: #fb923c;
  --score-3: #fbbf24;
  --score-4: #a3e635;
  --score-5: #4ade80;
  --score-contrast: #0a0a0f;
}


/* ============================================================================
   B. BASE / RESET / SHELL ATMOSPHERE
   ========================================================================= */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  -webkit-tap-highlight-color: transparent;
  color-scheme: light;
}

[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  color: var(--color-text-1);
  background: var(--color-bg);
  min-height: 100dvh;
  line-height: var(--leading-body);
  /* Hangul must not break mid-word */
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* ── Ambient background wash: two soft brand-tinted pools, fixed behind all.
      Subtle enough to read as depth, never as decoration. ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 34rem at 12% -8%,  color-mix(in srgb, var(--color-brand) 13%, transparent), transparent 62%),
    radial-gradient(48rem 30rem at 92% 4%,   color-mix(in srgb, var(--color-score-bracket) 9%, transparent), transparent 60%),
    radial-gradient(70rem 40rem at 50% 108%, color-mix(in srgb, var(--color-brand) 7%, transparent), transparent 68%);
}

[data-theme="dark"] body::before {
  background:
    radial-gradient(60rem 34rem at 12% -8%,  color-mix(in srgb, var(--color-brand) 18%, transparent), transparent 62%),
    radial-gradient(48rem 30rem at 92% 4%,   color-mix(in srgb, var(--color-score-bracket) 11%, transparent), transparent 60%),
    radial-gradient(70rem 40rem at 50% 108%, color-mix(in srgb, var(--color-brand) 10%, transparent), transparent 68%);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

/* Inline prose links pick up the brand */
p > a, li > a, .prose a, .link {
  color: var(--color-brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
p > a:hover, li > a:hover, .prose a:hover, .link:hover { color: var(--color-brand-hover); }

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

/* ── Headings: display face, Hangul-safe leading ── */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--leading-tight);
  color: var(--color-text-1);
  font-weight: var(--weight-bold);
  letter-spacing: -0.005em;
}
h1 { font-size: var(--text-3xl); font-family: var(--font-display); font-weight: var(--weight-black); letter-spacing: 0; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4, h5, h6 { font-size: var(--text-base); }

p { line-height: var(--leading-body); }

small { font-size: var(--text-xs); color: var(--color-text-3); }

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

hr {
  border: 0;
  height: 1px;
  background: var(--color-border);
  margin: var(--space-6) 0;
}

fieldset { border: 0; min-width: 0; }
legend { padding: 0; }

/* ── Bare-element defaults so un-migrated markup still reads well.
      Component classes below always win on specificity. ── */
button {
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  color: var(--color-text-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  transition: background var(--dur-fast) var(--ease-out);
}
button:hover { background: var(--color-surface-hover); }
button:disabled { opacity: 0.45; pointer-events: none; }

input, textarea, select { font-family: inherit; font-size: var(--text-sm); color: var(--color-text-1); }

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="tel"], input[type="url"], input[type="date"],
input[type="datetime-local"], input[type="time"], textarea, select {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-1);
}

input[type="checkbox"], input[type="radio"] {
  accent-color: var(--color-brand);
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

/* ── Focus: never remove the ring, always brand it ── */
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* Elements that render their own ring opt out of the outline */
.btn:focus-visible,
.input:focus-visible, .textarea:focus-visible, .select:focus-visible,
.likert__option:focus-visible, .checkbox-card:focus-visible,
.top-nav__link:focus-visible, .top-nav__theme-toggle:focus-visible,
.top-nav__user:focus-visible, .top-nav__menu-link:focus-visible,
.top-nav__logout:focus-visible, .top-nav__burger:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

::selection {
  background: color-mix(in srgb, var(--color-brand) 26%, transparent);
  color: var(--color-text-1);
}

/* ── Custom scrollbar ── */
* { scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-3);
  background-clip: content-box;
}

/* ── Screen-reader-only ── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}


/* ============================================================================
   C. LAYOUT
   ========================================================================= */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.main-content {
  flex: 1;
  padding-top: var(--nav-height);
  padding-bottom: var(--space-16);
}

/* Signed-out pages render no nav — reclaim the reserved height and center. */
.app-shell:not(:has(.top-nav)) {
  justify-content: center;
}
.app-shell:not(:has(.top-nav)) .main-content {
  flex: 0 1 auto;
  padding-top: var(--space-8);
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-8) var(--gutter);
}

/* Form / reading pages — narrower measure for long Korean sentences */
.page--narrow { max-width: var(--max-width-narrow); }
.page--tight  { max-width: 34rem; }

@media (max-width: 640px) {
  .page { padding: var(--space-6) var(--gutter-sm); }
}

/* ── Page header ── */
.page-header { margin-bottom: var(--space-8); }

.page-header__title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: var(--weight-black);
  letter-spacing: -0.01em;
  color: var(--color-text-1);
  line-height: 1.1;
}

@media (max-width: 640px) {
  .page-header__title { font-size: var(--text-3xl); }
}

.page-header__sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}
/* Nothing in this row may establish an un-shrinkable min-content floor —
   that is what pushed the document past 320px. */
.page-header__sub-row > * { min-width: 0; max-width: 100%; }

.page-header__sub {
  flex: 1 1 12rem;
  font-size: var(--text-sm);
  color: var(--color-text-3);
  letter-spacing: 0.01em;
}

/* The trailing cluster: `.page-header__right`, or a bare `.ml-auto` wrapper. */
.page-header__right,
.page-header__sub-row > .ml-auto {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
  flex: 0 1 auto;
  margin-left: auto;
}

/* ── Section title ── */
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-text-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

/* ── Grids ── */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ── KPI variant: stays three-across at every width ──
      Single-digit counts waste a whole phone screen when they stack, so this
      grid never collapses; the numerals shrink instead. ── */
.grid-3--compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 640px) {
  .grid-3--compact { gap: var(--space-2); }
  .grid-3--compact .stat { gap: 2px; }
  .grid-3--compact .stat__value--md { font-size: var(--text-3xl); }
  .grid-3--compact .stat__label {
    font-size: 10px;
    letter-spacing: 0.06em;
    line-height: 1.35;
  }
  /* supporting sentence has no room in a third of a phone — keep it for
     assistive tech, drop it visually (the progress bar says the same thing) */
  .grid-3--compact .stat__sub {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
}

@media (max-width: 360px) {
  .grid-3--compact .stat__value--md { font-size: var(--text-2xl); }
}

/* ── Stack: vertical rhythm container ── */
.stack   { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-6 { display: flex; flex-direction: column; gap: var(--space-6); }
.stack-8 { display: flex; flex-direction: column; gap: var(--space-8); }

/* ── Utility ── */
.flex         { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-col     { display: flex; flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; min-width: 0; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.mb-2  { margin-bottom: var(--space-2); }
.mb-3  { margin-bottom: var(--space-3); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }
.mb-16 { margin-bottom: var(--space-16); }
.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.ml-auto { margin-left: auto; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--color-text-3); }
.text-dim    { color: var(--color-text-2); }
.text-brand  { color: var(--color-brand); }
.text-xs     { font-size: var(--text-xs); }
.text-sm     { font-size: var(--text-sm); }
.text-lg     { font-size: var(--text-lg); }
.font-medium   { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold     { font-weight: var(--weight-bold); }
.num           { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.icon-inline {
  display: inline;
  vertical-align: -2px;
  margin-right: 6px;
  flex-shrink: 0;
}

.section-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}


/* ============================================================================
   D. NAVIGATION
   ========================================================================= */

.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  z-index: var(--z-nav);
  background: var(--color-nav-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--color-border);
  /* fixed + backdrop-filter는 스크롤마다 나브 밑 영역을 다시 블러링해
     Windows Chrome/Edge에서 화면 깜빡임을 일으킨다 — 자체 합성 레이어로
     승격해 리페인트를 격리한다 */
  transform: translateZ(0);
}

.top-nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

@media (max-width: 640px) {
  .top-nav__inner { padding: 0 var(--gutter-sm); gap: var(--space-3); }
}

/* ── Wordmark ── */
.top-nav__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.top-nav__logo:hover { opacity: 0.75; }

.top-nav__mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--color-brand), color-mix(in srgb, var(--color-brand) 55%, var(--color-score-power)));
  color: #fff;
  font-family: var(--font-display);
  font-weight: var(--weight-black);
  font-size: var(--text-sm);
  line-height: 1;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--color-brand) 45%, transparent);
}

.top-nav__wordmark {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-1);
  line-height: 1;
}

/* ── Primary links ── */
.top-nav__links {
  display: none;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  position: relative;
  min-width: 0;
}

.top-nav__slider {
  position: absolute;
  top: 0; left: 0;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-text-1) 13%, transparent);
  transition: transform 0.32s var(--ease-out),
              width 0.32s var(--ease-out),
              height 0.32s var(--ease-out),
              opacity 0.18s var(--ease-out);
  pointer-events: none;
  z-index: 0;
}

@media (min-width: 900px) {
  .top-nav__links { display: flex; }
}

.top-nav__link {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-2);
  transition: color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.top-nav__link:hover {
  color: var(--color-text-1);
  background: var(--color-surface-hover);
}

.top-nav__link.active {
  color: var(--color-brand);
  background: var(--color-brand-soft);
  font-weight: var(--weight-semibold);
}

/* underline tick for the active route — reads even at low color contrast */
.top-nav__link.active::after {
  content: '';
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: -1px;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--color-brand);
}

.top-nav__link svg { flex-shrink: 0; opacity: 0.7; }
.top-nav__link.active svg { opacity: 1; }

/* ── Grouped links divider label ("팀 관리") ── */
.top-nav__group-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-left: var(--space-3);
  margin-left: var(--space-2);
  border-left: 1px solid var(--color-border);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-3);
  white-space: nowrap;
  user-select: none;
}

/* ── Right cluster ── */
.top-nav__account {
  margin-left: auto;
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.top-nav__theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-2);
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-spring);
}

@media (hover: hover) {
  .top-nav__theme-toggle:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-1);
    transform: rotate(15deg) scale(1.08);
  }
}

.top-nav__theme-toggle:active { transform: scale(0.92); }

/* icon swap driven by the theme attribute */
.top-nav__theme-toggle .icon-sun  { display: none; }
.top-nav__theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .top-nav__theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .top-nav__theme-toggle .icon-moon { display: none; }

.top-nav__user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-2);
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.top-nav__user:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-1);
}

.top-nav__user svg { opacity: 0.6; }

.top-nav__avatar {
  width: 20px; height: 20px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--color-brand-soft);
  color: var(--color-brand);
  font-size: 10px;
  font-weight: var(--weight-bold);
  line-height: 1;
}

/* desktop-only / mobile-only helpers inside the nav */
.top-nav__desk { display: none; }
@media (min-width: 900px) { .top-nav__desk { display: flex; } }

/* ── Hamburger ── */
.top-nav__burger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-2);
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.top-nav__burger:hover { background: var(--color-surface-hover); color: var(--color-text-1); }
@media (min-width: 900px) { .top-nav__burger { display: none; } }

/* ── Dropdown ──
      One panel, not a pile of cards: the sheet carries the surface, the border
      and the elevation; every row inside is flush chrome-less until hovered. */
.top-nav__dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 232px;
  max-width: min(20rem, calc(100vw - var(--gutter-sm) * 2));
  z-index: var(--z-overlay);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  /* near-opaque so group labels never let page text bleed through, while the
     blur still frosts whatever slides under the panel edge */
  background: color-mix(in srgb, var(--color-bg-raised) 94%, var(--glass-bg));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
}

.top-nav__dropdown[hidden] { display: none; }

/* ── Dismiss scrim ──
      A real element (so the existing outside-click handler in app.js sees the
      tap as "outside the menu") revealed purely by the --open class. It is a
      sibling of .top-nav, never a descendant: the nav's backdrop-filter makes
      it a containing block for fixed children, which would collapse the scrim
      to zero height. It starts below the bar and sits under the nav's
      z-index, so the burger and theme toggle stay fully tappable. */
.nav-scrim { display: none; }

.top-nav:has(.top-nav__dropdown--open) + .nav-scrim {
  display: block;
  position: fixed;
  top: var(--nav-height);
  left: 0; right: 0; bottom: 0;
  z-index: calc(var(--z-nav) - 1);
  /* veiling with the page background pushes content *toward* the backdrop —
     correct in both themes, unlike a fixed black wash */
  background: color-mix(in srgb, var(--color-bg) 62%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: scrimIn var(--dur-base) var(--ease-out) both;
}

@keyframes scrimIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (min-width: 900px) {
  .top-nav:has(.top-nav__dropdown--open) + .nav-scrim { display: none; }
}

.top-nav__menu-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
@media (min-width: 900px) {
  .top-nav__menu-nav { display: none; }
}

/* Group heading — rides directly on the panel, no chrome of its own. */
.top-nav__menu-label {
  display: block;
  padding: var(--space-3) var(--space-3) var(--space-1);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-3);
  line-height: 1.4;
}
.top-nav__menu-label:first-child { padding-top: var(--space-1); }

.top-nav__menu-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: transparent;
  border: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-1);
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.top-nav__menu-link svg { opacity: 0.6; }
.top-nav__menu-link:hover { background: var(--color-surface-hover); }
.top-nav__menu-link.active {
  color: var(--color-brand);
  background: var(--color-brand-soft);
  font-weight: var(--weight-semibold);
}

.top-nav__dropdown--open {
  animation: dropdownIn var(--dur-base) var(--ease-spring) both;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Last row of the panel — a hairline rule separates it, nothing more. */
.top-nav__logout {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  margin-top: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: transparent;
  border: 0;
  border-top: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding-top: var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-danger);
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out);
}

.top-nav__logout:hover {
  background: color-mix(in srgb, var(--color-danger) 10%, transparent);
}


/* ============================================================================
   E. SURFACES
   ========================================================================= */

/* ── Card ── */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: background var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}

.card:hover { background: var(--glass-bg-hover); box-shadow: var(--shadow-md); }

/* opt out of the hover lift for static content panels */
.card--static:hover { background: var(--glass-bg); box-shadow: var(--shadow-sm); }

.card--accent {
  background: color-mix(in srgb, var(--color-accent) 8%, var(--glass-bg));
  border-color: color-mix(in srgb, var(--color-accent) 20%, var(--glass-border));
}
.card--accent:hover {
  background: color-mix(in srgb, var(--color-accent) 12%, var(--glass-bg-hover));
}

.card--brand {
  background: color-mix(in srgb, var(--color-brand) 8%, var(--glass-bg));
  border-color: var(--color-brand-line);
}
.card--brand:hover {
  background: color-mix(in srgb, var(--color-brand) 12%, var(--glass-bg-hover));
}

.card--pad-lg { padding: var(--space-8); }
.card--flush  { padding: 0; overflow: hidden; }

.card__title {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-3);
  margin-bottom: var(--space-4);
}

.card__heading {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-1);
  line-height: var(--leading-tight);
}

.card__desc {
  font-size: var(--text-sm);
  color: var(--color-text-2);
  line-height: var(--leading-body);
}

.card__body { display: flex; flex-direction: column; gap: var(--space-3); }

.card__footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}
.card__footer > * { min-width: 0; max-width: 100%; }
.card__footer > .ml-auto { margin-left: auto; }

/* ── Score empty state ── */
.score-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-2);
  min-height: 130px;
  text-align: center;
}
.score-empty-state__icon { color: var(--color-text-3); flex-shrink: 0; }
.score-empty-state__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-1);
  margin: 0;
}
.score-empty-state__desc {
  font-size: var(--text-sm);
  color: var(--color-text-3);
  margin: 0;
  line-height: var(--leading-body);
}
.score-empty-state__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--color-brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Buttons ── */
.btn {
  position: relative;   /* anchor for the coarse-pointer hit-area overlay */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-5);
  height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.01em;
  line-height: 1;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-spring),
              opacity var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}

.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

.btn--primary {
  background: var(--color-text-1);
  color: var(--color-bg-raised);
}
.btn--primary:hover { background: var(--color-text-1-hover); }

/* the brand button — the app's call to action */
.btn--brand {
  background: var(--color-brand);
  color: var(--color-brand-contrast);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--color-brand) 38%, transparent);
}
.btn--brand:hover {
  background: var(--color-brand-hover);
  box-shadow: 0 4px 18px color-mix(in srgb, var(--color-brand) 46%, transparent);
}

.btn--success {
  background: var(--color-success);
  color: #fff;
  cursor: default;
  opacity: 0.85;
}

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text-1);
  border-color: var(--color-border-strong);
}
.btn--secondary:hover { background: var(--color-surface-hover); }

.btn--ghost {
  background: transparent;
  color: var(--color-text-2);
}
.btn--ghost:hover { background: var(--color-surface); color: var(--color-text-1); }

.btn--danger {
  background: color-mix(in srgb, var(--color-danger) 15%, transparent);
  color: var(--color-danger);
  border-color: color-mix(in srgb, var(--color-danger) 30%, transparent);
}
.btn--danger:hover { background: color-mix(in srgb, var(--color-danger) 25%, transparent); }

.btn--sm { height: 32px; padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn--lg { height: 48px; padding: 0 var(--space-8); font-size: var(--text-base); }
.btn--full { width: 100%; }

.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.05em;
  line-height: 1.6;
  white-space: nowrap;
  max-width: 100%;
}

/* On a phone a long badge must fold rather than force the document wider. */
@media (max-width: 640px) {
  .badge { white-space: normal; word-break: keep-all; }
  /* inside a horizontally scrollable table the old behaviour is still right */
  .table .badge { white-space: nowrap; }
}

.badge--default  { background: var(--color-surface); color: var(--color-text-2); }
.badge--success  { background: color-mix(in srgb, var(--color-success) 15%, transparent); color: var(--color-success); }
.badge--warning  { background: color-mix(in srgb, var(--color-warning) 15%, transparent); color: var(--color-warning); }
.badge--danger   { background: color-mix(in srgb, var(--color-danger) 15%, transparent); color: var(--color-danger); }
.badge--accent   { background: color-mix(in srgb, var(--color-accent) 15%, transparent); color: var(--color-accent); }
.badge--brand    { background: var(--color-brand-soft); color: var(--color-brand); }
.badge--outline  { background: transparent; color: var(--color-text-2); box-shadow: inset 0 0 0 1px var(--color-border-strong); }

.badge--dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
  flex-shrink: 0;
}

/* ── Stat ── */
.stat { display: flex; flex-direction: column; gap: var(--space-1); }

.stat__value {
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  color: var(--color-text-1);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat__value--sm { font-size: var(--text-2xl); }
.stat__value--md { font-size: var(--text-4xl); }
.stat__value--lg { font-size: var(--text-6xl); }
.stat__value--xl { font-size: var(--text-hero); }

.stat__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-3);
}

.stat__sub { font-size: var(--text-xs); color: var(--color-text-3); }

/* ── Skeleton ── */
.skeleton {
  border-radius: var(--radius-lg);
  background: linear-gradient(
    100deg,
    var(--color-surface) 35%,
    var(--color-surface-hover) 50%,
    var(--color-surface) 65%
  );
  background-size: 300% 100%;
  animation: skeletonShimmer 1.6s var(--ease-in-out) infinite;
}
.skeleton--text { height: 0.9em; border-radius: var(--radius-sm); }
.skeleton--line { height: 1px; }

@keyframes skeletonShimmer {
  from { background-position: 100% 0; }
  to   { background-position: 0 0; }
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-6) 0;
  border: 0;
}
.divider--tight { margin: var(--space-4) 0; }

.divider--labeled {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: auto;
  background: none;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-text-3);
}
.divider--labeled::before,
.divider--labeled::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ── Empty state ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-4);
  text-align: center;
  color: var(--color-text-3);
}
.empty-state svg { opacity: 0.4; }
.empty-state__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-1);
}
.empty-state__text { font-size: var(--text-sm); max-width: 34ch; }

/* ── Toasts ── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  cursor: pointer;
  max-width: 340px;
  animation: toastIn var(--dur-slow) var(--ease-spring) both;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(40%) scale(0.94); }
}

.toast--leaving { animation: toastOut var(--dur-base) var(--ease-in-out) both; }

.toast--success {
  background: color-mix(in srgb, var(--color-success) 12%, var(--color-bg-raised));
  border-color: color-mix(in srgb, var(--color-success) 30%, transparent);
  color: var(--color-success);
}

.toast--error {
  background: color-mix(in srgb, var(--color-danger) 12%, var(--color-bg-raised));
  border-color: color-mix(in srgb, var(--color-danger) 30%, transparent);
  color: var(--color-danger);
}

.toast--info {
  background: var(--color-bg-raised);
  color: var(--color-text-1);
}

.toast__icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: currentColor;
  font-size: 11px;
}
.toast__icon svg { color: var(--color-bg-raised); flex-shrink: 0; }
.toast__message { color: var(--color-text-1); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn var(--dur-base) var(--ease-out) both;
}
.modal-overlay[hidden] { display: none; }

@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
}

.modal-sheet {
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 620px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  animation: sheetUp var(--dur-slow) var(--ease-spring) both;
  overflow: hidden;
}

@media (min-width: 640px) {
  .modal-sheet { border-radius: var(--radius-xl); max-height: 85dvh; }
}

@keyframes sheetUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-sheet__header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-sheet__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: 0.01em;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}

.modal-sheet__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  padding: 0;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-2);
  flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease-out);
}
.modal-sheet__close:hover { background: var(--color-surface-hover); color: var(--color-text-1); }

.modal-sheet__body {
  overflow-y: auto;
  flex: 1;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.modal-sheet__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}


/* ============================================================================
   F. FORM SYSTEM
   ----------------------------------------------------------------------------
   Designed for this app. Same tokens, radii, glass feel and easing as the
   reference system — but every control is new.
   ========================================================================= */

/* ── Field wrapper ── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.field__label {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-1);
  line-height: var(--leading-tight);
}

/* the label may be a <legend> inside a <fieldset class="field"> */
legend.field__label { padding: 0; }

.field--required > .field__label::after,
.field__label.field--required::after {
  content: '*';
  color: var(--color-danger);
  font-weight: var(--weight-bold);
  margin-left: -2px;
}

.field__hint {
  font-size: var(--text-xs);
  color: var(--color-text-3);
  line-height: var(--leading-body);
}

.field__error {
  display: none;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-danger);
}
.field--invalid .field__error { display: flex; }

.field__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.field__count {
  align-self: flex-end;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-3);
  transition: color var(--dur-fast) var(--ease-out);
}
.field__count--warn { color: var(--color-warning); }
.field__count--over { color: var(--color-danger); font-weight: var(--weight-bold); }

/* ── Category skip toggle ("평가할 만큼 함께 일한 경험이 없음") ── */
.skip-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  align-self: flex-start;
  cursor: pointer;
  user-select: none;
}

.skip-toggle__input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-warning);
  cursor: pointer;
}

.skip-toggle__label {
  font-size: var(--text-sm);
  color: var(--color-text-3);
  line-height: var(--leading-tight);
}

.skip-toggle:hover .skip-toggle__label { color: var(--color-text-1); }

/* 스킵된 카테고리의 입력 블록은 흐리게 + 조작 차단 (inputs는 JS/서버에서 disabled 처리) */
[data-skip-fields].is-skipped {
  opacity: 0.4;
  pointer-events: none;
}

/* ── 리뷰 작성 가이드 (접이식) ── */
.review-guide > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.review-guide > summary::-webkit-details-marker { display: none; }
.review-guide > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: var(--space-2);
  transition: transform var(--dur-fast) var(--ease-out);
}
.review-guide[open] > summary::before { transform: rotate(90deg); }

.review-guide__list {
  margin: 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-2);
  line-height: var(--leading-body);
}

/* ── Text controls ── */
.input,
.textarea,
.select {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  color: var(--color-text-1);
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
  appearance: none;
  -webkit-appearance: none;
}

.input, .select { height: var(--control-h); }

.textarea {
  min-height: calc(var(--control-h) * 2);
  padding: var(--space-3);
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder { color: var(--color-text-3); }

.input:hover:not(:disabled),
.textarea:hover:not(:disabled),
.select:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--color-brand) 45%, var(--color-border-strong));
}

.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible,
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: var(--ring);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  background: var(--color-surface);
  color: var(--color-text-3);
  border-color: var(--color-border);
  cursor: not-allowed;
}

.input:read-only:not(:disabled),
.textarea:read-only:not(:disabled) { background: var(--color-surface); }

/* invalid — explicit class wins over :user-invalid so server errors work too */
.input.is-invalid, .textarea.is-invalid, .select.is-invalid,
.field--invalid .input, .field--invalid .textarea, .field--invalid .select,
.input:user-invalid, .textarea:user-invalid, .select:user-invalid {
  border-color: var(--color-danger);
}
.input.is-invalid:focus, .textarea.is-invalid:focus, .select.is-invalid:focus,
.field--invalid .input:focus, .field--invalid .textarea:focus, .field--invalid .select:focus,
.input:user-invalid:focus, .textarea:user-invalid:focus, .select:user-invalid:focus {
  box-shadow: var(--ring-error);
}

.input--sm, .select--sm { height: var(--control-h-sm); font-size: var(--text-xs); }
.input--mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ── Select: custom chevron, no external asset ── */
.select {
  padding-right: var(--space-8);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.75L6 6.25L11 1.75' stroke='%2352525b' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 12px 8px;
}

[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.75L6 6.25L11 1.75' stroke='%23a1a1aa' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.select option { background: var(--color-bg-raised); color: var(--color-text-1); }

/* ── Auto-growing textarea ── */
.textarea--auto {
  resize: none;
  overflow: hidden;
  min-height: calc(var(--control-h) * 1.6);
}

/* ── Input group (label + control on one row) ── */
.input-group {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
}
.input-group > .input,
.input-group > .select { flex: 1; min-width: 0; }


/* ────────────────────────────────────────────────────────────────────────────
   THE LIKERT SCALE — signature component
   Native radios, visually hidden but fully keyboard operable. The <label>
   is the visual affordance; :checked fills it with the matching score color.

   Markup:
     <fieldset class="field">
       <legend class="field__label field--required">질문</legend>
       <div class="likert likert--stacked">
         <label class="likert__option" data-score="1">
           <input class="likert__input" type="radio" name="score_x" value="1" required>
           <span class="likert__score">1</span>
           <span class="likert__anchor">앵커 문장</span>
         </label>
         … 2 … 3 … 4 … 5 …
       </div>
     </fieldset>
   ──────────────────────────────────────────────────────────────────────── */

.likert {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-2);
}

.likert__option {
  --score: var(--color-brand);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-2);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-bg-raised);
  cursor: pointer;
  text-align: center;
  user-select: none;
  transition: transform var(--dur-base) var(--ease-spring),
              border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}

/* score → color mapping */
.likert__option[data-score="1"] { --score: var(--score-1); }
.likert__option[data-score="2"] { --score: var(--score-2); }
.likert__option[data-score="3"] { --score: var(--score-3); }
.likert__option[data-score="4"] { --score: var(--score-4); }
.likert__option[data-score="5"] { --score: var(--score-5); }

/* radio: hidden from sight, present for a11y and keyboard */
.likert__input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.likert__score {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-2);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
  line-height: 1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  transition: background var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-spring);
}

.likert__anchor {
  font-size: var(--text-xs);
  line-height: var(--leading-body);
  color: var(--color-text-2);
  word-break: keep-all;
  transition: color var(--dur-fast) var(--ease-out);
}

/* hover raise */
@media (hover: hover) {
  .likert__option:hover {
    border-color: color-mix(in srgb, var(--score) 55%, var(--color-border-strong));
    background: color-mix(in srgb, var(--score) 6%, var(--color-bg-raised));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
  .likert__option:hover .likert__score {
    background: color-mix(in srgb, var(--score) 18%, transparent);
    color: var(--score);
  }
}

/* checked — fills with the score color and springs up */
.likert__option:has(.likert__input:checked) {
  border-color: var(--score);
  background: color-mix(in srgb, var(--score) 12%, var(--color-bg-raised));
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 6px 22px color-mix(in srgb, var(--score) 30%, transparent);
}

/* chip fill works with or without :has() support */
.likert__input:checked ~ .likert__score {
  background: var(--score);
  color: var(--score-contrast);
  transform: scale(1.06);
}

.likert__option:has(.likert__input:checked) .likert__anchor {
  color: var(--color-text-1);
  font-weight: var(--weight-medium);
}

/* keyboard focus lands on the hidden radio — surface it on the card */
.likert__option:has(.likert__input:focus-visible) {
  box-shadow: var(--ring);
  border-color: var(--color-brand);
}

.likert__option:active { transform: scale(0.985); }

.likert__input:disabled ~ .likert__score { opacity: 0.4; }
.likert__option:has(.likert__input:disabled) { opacity: 0.55; cursor: not-allowed; }

/* ── Stacked variant — the polished default for long Korean anchors ── */
.likert--stacked {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.likert--stacked .likert__option {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-radius: var(--radius-lg);
}

.likert--stacked .likert__score {
  width: 44px; height: 44px;
  font-size: var(--text-2xl);
}

.likert--stacked .likert__anchor {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  line-height: var(--leading-body);
}

/* a slim colored rail on the left edge reinforces the ramp */
.likert--stacked .likert__option::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  translate: 0 -50%;
  width: 3px;
  height: 0;
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  background: var(--score);
  transition: height var(--dur-base) var(--ease-spring);
}
.likert--stacked .likert__option:has(.likert__input:checked)::before { height: 62%; }

.likert--stacked .likert__option:has(.likert__input:checked) {
  transform: translateX(3px);
}

/* horizontal variant degrades to a readable vertical stack on small screens */
@media (max-width: 640px) {
  .likert {
    grid-template-columns: 1fr;
  }
  .likert .likert__option {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: var(--space-3);
    padding: var(--space-3);
  }
  .likert .likert__score { width: 38px; height: 38px; font-size: var(--text-xl); }
  .likert .likert__anchor { flex: 1; min-width: 0; font-size: var(--text-sm); }
  .likert__option:has(.likert__input:checked) { transform: translateX(3px); }
}

/* optional end-labels under a horizontal likert */
.likert-legend {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-3);
}


/* ── Checkbox cards (multi-select value picker) ── */
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

@media (min-width: 640px) {
  .checkbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checkbox-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.checkbox-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-bg-raised);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              transform var(--dur-base) var(--ease-spring),
              box-shadow var(--dur-fast) var(--ease-out);
}

.checkbox-card__input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.checkbox-card__mark {
  position: relative;
  width: 20px; height: 20px;
  flex-shrink: 0;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}

/* the tick */
.checkbox-card__mark::after {
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid var(--color-brand-contrast);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0.4);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out),
              transform var(--dur-base) var(--ease-spring);
}

.checkbox-card__label {
  font-size: var(--text-sm);
  line-height: var(--leading-tight);
  color: var(--color-text-2);
  word-break: keep-all;
  transition: color var(--dur-fast) var(--ease-out);
}

@media (hover: hover) {
  .checkbox-card:hover {
    border-color: color-mix(in srgb, var(--color-brand) 50%, var(--color-border-strong));
    background: var(--color-brand-softer);
  }
}

.checkbox-card__input:checked ~ .checkbox-card__mark {
  background: var(--color-brand);
  border-color: var(--color-brand);
}
.checkbox-card__input:checked ~ .checkbox-card__mark::after {
  opacity: 1;
  transform: rotate(45deg) scale(1);
}

.checkbox-card:has(.checkbox-card__input:checked) {
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
  box-shadow: 0 3px 14px color-mix(in srgb, var(--color-brand) 20%, transparent);
}
.checkbox-card:has(.checkbox-card__input:checked) .checkbox-card__label {
  color: var(--color-text-1);
  font-weight: var(--weight-medium);
}

.checkbox-card:has(.checkbox-card__input:focus-visible) {
  box-shadow: var(--ring);
  border-color: var(--color-brand);
}

.checkbox-card:active { transform: scale(0.99); }
.checkbox-card:has(.checkbox-card__input:disabled) { opacity: 0.5; cursor: not-allowed; }

/* ── Inline check / radio row (compact, non-card) ── */
.check-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  color: var(--color-text-2);
  cursor: pointer;
}
.check-row input { margin-top: 0.35em; flex-shrink: 0; }

/* ── Form actions ── */
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-8);
  flex-wrap: wrap;
}

.form-actions__note {
  margin-right: auto;
  font-size: var(--text-xs);
  color: var(--color-text-3);
}

.form-actions--sticky {
  position: sticky;
  bottom: 0;
  z-index: var(--z-above);
  margin-top: var(--space-8);
  margin-inline: calc(-1 * var(--gutter));
  padding: var(--space-4) var(--gutter);
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  background: var(--color-nav-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--color-border);
}

/* On a phone the sticky bar is competing with the questions for screen. Strip
   it to the one thing it must show — the submit button. The note still exists
   for assistive tech (it explains the required-field rule); the same rule is
   also carried visually by the asterisks and the progress dock. */
@media (max-width: 640px) {
  .form-actions--sticky {
    margin-inline: calc(-1 * var(--gutter-sm));
    padding-inline: var(--gutter-sm);
    padding-block: var(--space-2);
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
    margin-top: var(--space-6);
    gap: var(--space-2);
  }
  .form-actions--sticky .btn { flex: 1; }
  .form-actions--sticky .btn--lg { height: 46px; font-size: var(--text-sm); }

  .form-actions--sticky .form-actions__note {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
}

/* ── Progress bar (review form completion) ── */
.progress-bar {
  position: relative;
  height: 6px;
  width: 100%;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--color-brand) 0%,
    color-mix(in srgb, var(--color-brand) 55%, var(--color-score-bracket)) 100%
  );
  box-shadow: 0 0 12px color-mix(in srgb, var(--color-brand) 55%, transparent);
  transition: width var(--dur-slow) var(--ease-out);
}

.progress-bar--lg { height: 10px; }

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-3);
}

.progress-meta__value {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--color-brand);
}

/* sticky progress rail that docks under the nav */
.progress-dock {
  position: sticky;
  top: var(--nav-height);
  z-index: var(--z-above);
  margin-inline: calc(-1 * var(--gutter));
  padding: var(--space-3) var(--gutter);
  background: var(--color-nav-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--color-border);
}

@media (max-width: 640px) {
  .progress-dock {
    margin-inline: calc(-1 * var(--gutter-sm));
    padding-inline: var(--gutter-sm);
    padding-block: var(--space-2);
  }
  /* slimmer rail: the count line drops to a single tight row */
  .progress-dock .progress-meta {
    margin-bottom: var(--space-1);
    line-height: 1.35;
    gap: var(--space-2);
  }
  .progress-dock.mb-8 { margin-bottom: var(--space-6); }
}


/* ============================================================================
   G. DATA DISPLAY
   ========================================================================= */

/* ── Table ── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-raised);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: color-mix(in srgb, var(--color-bg-raised) 92%, var(--color-text-1));
  border-bottom: 1px solid var(--color-border-strong);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-3);
  white-space: nowrap;
}

.table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-2);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }

.table tbody tr {
  transition: background var(--dur-fast) var(--ease-out);
}
.table tbody tr:hover td { background: var(--color-surface); color: var(--color-text-1); }

.table td.num, .table th.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--color-text-1);
}

.table td.wrap { white-space: normal; word-break: keep-all; min-width: 18rem; }
.table td.strong { color: var(--color-text-1); font-weight: var(--weight-semibold); }

.table--compact tbody td,
.table--compact thead th { padding: var(--space-2) var(--space-3); }

/* ── List rows ── */
.list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-raised);
  overflow: hidden;
}

.list__row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--dur-fast) var(--ease-out);
  min-width: 0;
}

.list__row:last-child { border-bottom: 0; }
.list__row:hover { background: var(--color-surface); }

a.list__row:hover { background: var(--color-brand-softer); }

.list__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.list__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-1);
  line-height: var(--leading-tight);
}

.list__meta {
  font-size: var(--text-xs);
  color: var(--color-text-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.list__aside {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Secondary meta that is already stated in the page header — dropped on a
   phone so the title line stops wrapping into three cramped lines. */
.list__meta-extra { display: inline; }

@media (max-width: 640px) {
  /* the aside drops to its own line, right-aligned under the title, which
     gives the title + meta the full row width */
  .list__row {
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3) var(--space-4);
  }
  .list__main  { flex: 1 1 auto; }
  .list__aside { flex: 1 0 100%; justify-content: flex-end; }
  .list__meta-extra { display: none; }
}

.list__avatar {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  background: var(--color-brand-soft);
  color: var(--color-brand);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: 1;
}

/* ── Score bar (0–5 horizontal meter) ──
   set --score-value (0–5) and optionally --score-color inline */
.score-bar {
  --score-value: 0;
  --score-color: var(--color-brand);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.score-bar__track {
  position: relative;
  flex: 1;
  min-width: 5rem;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  overflow: hidden;
}

.score-bar__fill {
  height: 100%;
  width: calc(var(--score-value) / 5 * 100%);
  border-radius: inherit;
  background: var(--score-color);
  transition: width var(--dur-slow) var(--ease-out);
}

/* tick marks at each integer step */
.score-bar__track::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 calc(20% - 1px),
    var(--color-bg-raised) calc(20% - 1px) 20%
  );
  opacity: 0.85;
}

.score-bar__value {
  flex-shrink: 0;
  min-width: 3.2rem;
  text-align: right;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--score-color);
}

.score-bar__label {
  flex-shrink: 0;
  min-width: 7rem;
  font-size: var(--text-sm);
  color: var(--color-text-2);
}

@media (max-width: 640px) {
  .score-bar { flex-wrap: wrap; }
  .score-bar__label { min-width: 100%; }
}

/* score-N helpers for tinting anything by score */
.score-1 { --score-color: var(--score-1); color: var(--score-1); }
.score-2 { --score-color: var(--score-2); color: var(--score-2); }
.score-3 { --score-color: var(--score-3); color: var(--score-3); }
.score-4 { --score-color: var(--score-4); color: var(--score-4); }
.score-5 { --score-color: var(--score-5); color: var(--score-5); }

/* ── Score ring (conic donut) ──
   set --score-value (0–5) and optionally --score-color inline */
.score-ring {
  --score-value: 0;
  --score-color: var(--color-brand);
  --ring-size: 104px;
  --ring-thickness: 10px;
  position: relative;
  width: var(--ring-size);
  height: var(--ring-size);
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background:
    conic-gradient(
      var(--score-color) calc(var(--score-value) / 5 * 360deg),
      var(--color-surface) 0
    );
  display: grid;
  place-items: center;
  transition: background var(--dur-slow) var(--ease-out);
}

.score-ring::before {
  content: '';
  position: absolute;
  inset: var(--ring-thickness);
  border-radius: inherit;
  background: var(--color-bg-raised);
}

.score-ring__value {
  position: relative;
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--color-text-1);
  letter-spacing: -0.03em;
}

.score-ring__label {
  position: relative;
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-3);
}

.score-ring--sm { --ring-size: 72px; --ring-thickness: 8px; }
.score-ring--sm .score-ring__value { font-size: var(--text-lg); }
.score-ring--lg { --ring-size: 144px; --ring-thickness: 14px; }
.score-ring--lg .score-ring__value { font-size: var(--text-4xl); }

/* ── Progress steps ── */
.progress-steps {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.progress-step {
  flex: 1;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  position: relative;
  overflow: hidden;
}

.progress-step--done::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-brand);
  border-radius: inherit;
}

.progress-step--partial::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-text-3);
  border-radius: inherit;
}

.progress-step--current::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-highlight);
  border-radius: inherit;
  animation: progressStepPulse 1.8s var(--ease-in-out) infinite;
}

@keyframes progressStepPulse {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 0.85; }
}

.progress-legend {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-3);
}

/* ── Quote / comment block (anonymous feedback) ── */
.quote {
  position: relative;
  padding: var(--space-3) var(--space-4);
  padding-left: var(--space-5);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  color: var(--color-text-1);
  word-break: keep-all;
}

.quote::before {
  content: '';
  position: absolute;
  left: 0; top: var(--space-3); bottom: var(--space-3);
  width: 3px;
  border-radius: var(--radius-full);
  background: var(--color-brand-line);
}

.quote__meta {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-3);
}

/* ── Key/value definition row ── */
.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
}
.kv__key { color: var(--color-text-3); flex-shrink: 0; }
.kv__val { color: var(--color-text-1); font-weight: var(--weight-medium); text-align: right; }


/* ============================================================================
   G2. TOUCH ERGONOMICS
   ----------------------------------------------------------------------------
   A coarse pointer needs a 44px target. The *visual* sizes below are left
   exactly as designed — the target is grown underneath with a transparent
   ::after overlay on a negative inset, so the chrome never gets chunky.
   Form controls, which cannot carry a pseudo-element reliably, simply take a
   taller metric via the two control-height tokens.
   ========================================================================= */

@media (pointer: coarse), (max-width: 640px) {

  :root {
    --control-h:    44px;
    --control-h-sm: 44px;
  }

  /* ── Nav icon buttons — 34px visual, 44px target ── */
  .top-nav__burger,
  .top-nav__theme-toggle { position: relative; }

  .top-nav__burger::after,
  .top-nav__theme-toggle::after {
    content: '';
    position: absolute;
    inset: -5px;                 /* 34 + 5 + 5 = 44 */
    border-radius: var(--radius-md);
  }

  /* widen the cluster so the two grown targets cannot poach each other */
  .top-nav__account { gap: var(--space-3); }

  /* ── Wordmark — 26px mark, 44px target, no visual change (nav is 64px) ── */
  .top-nav__logo   { min-height: 44px; }
  .top-nav__user   { min-height: 44px; }

  /* ── Buttons — visual height untouched, target lifted to 44px.
        Vertical only: neighbours in a dense row (badge + button in
        .list__aside) keep their own horizontal hit areas intact. ── */
  .btn::after {
    content: '';
    position: absolute;
    inset: -2px 0;               /* 40 + 2 + 2 = 44 */
  }
  .btn--sm::after { inset: -6px 0; }   /* 32 + 6 + 6 = 44 */
  .btn--lg::after { content: none; }   /* already 48 */

  .btn--icon { min-width: 44px; min-height: 44px; }

  /* ── Modal close — 32px visual, 44px target ── */
  .modal-sheet__close { position: relative; }
  .modal-sheet__close::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: var(--radius-full);
  }

  /* ── Inline text links ──
        Padding on an inline box grows the hit area without changing the line
        box, so running prose is untouched; where the link is a flex item the
        row simply grows to a comfortable height. ── */
  .link,
  p  > a:not(.btn),
  li > a:not(.btn),
  .prose a:not(.btn),
  a.text-sm:not(.btn),
  a.text-xs:not(.btn) {
    padding-block: 0.875rem;     /* 17px line box + 28 = 45 */
  }
}


/* ============================================================================
   H. MOTION
   ========================================================================= */

.fade-in { animation: fadeIn var(--dur-slow) var(--ease-out) both; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0); }
}

.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Staggered entrance: set --i on each child (or rely on the nth-child
      fallback below for the first twelve). ── */
.stagger > * {
  animation: fadeIn var(--dur-slow) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

.stagger > *:nth-child(1)  { --i: 0; }
.stagger > *:nth-child(2)  { --i: 1; }
.stagger > *:nth-child(3)  { --i: 2; }
.stagger > *:nth-child(4)  { --i: 3; }
.stagger > *:nth-child(5)  { --i: 4; }
.stagger > *:nth-child(6)  { --i: 5; }
.stagger > *:nth-child(7)  { --i: 6; }
.stagger > *:nth-child(8)  { --i: 7; }
.stagger > *:nth-child(9)  { --i: 8; }
.stagger > *:nth-child(10) { --i: 9; }
.stagger > *:nth-child(11) { --i: 10; }
.stagger > *:nth-child(12) { --i: 11; }

/* ── Reduced motion: strip transforms and animation everywhere ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
  .likert__option,
  .likert__option:hover,
  .likert__option:has(.likert__input:checked),
  .checkbox-card,
  .checkbox-card:has(.checkbox-card__input:checked),
  .btn:active,
  .top-nav__theme-toggle:hover {
    transform: none !important;
  }
  .likert__input:checked ~ .likert__score { transform: none !important; }
  .skeleton { animation: none !important; background: var(--color-surface); }
  .progress-step--current::before { animation: none !important; opacity: 0.7; }
}

/* ── Print ── */
@media print {
  /* 다크모드 사용자도 종이엔 라이트 팔레트로 — 흰 종이에 밝은 글자가 찍히는 사고 방지 */
  :root, [data-theme="dark"] {
    --color-bg:           #ffffff;
    --color-bg-raised:    #ffffff;
    --color-surface:      rgba(9, 9, 11, 0.04);
    --color-surface-hover:rgba(9, 9, 11, 0.07);
    --color-border:       rgba(9, 9, 11, 0.10);
    --color-border-strong:rgba(9, 9, 11, 0.18);
    --color-text-1: #18181b;
    --color-text-2: #52525b;
    --color-text-3: #a1a1aa;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger:  #dc2626;
    --color-brand:   #4f46e5;
    --color-brand-soft:   rgba(99, 102, 241, 0.12);
    --color-brand-softer: rgba(99, 102, 241, 0.06);
    --glass-bg: #ffffff;
    --score-1: #dc2626;
    --score-2: #ea580c;
    --score-3: #d97706;
    --score-4: #65a30d;
    --score-5: #16a34a;
    --shadow-sm: none; --shadow-md: none; --shadow-lg: none;
  }
  html, body { background: #fff !important; }

  .top-nav, .nav-scrim, .form-actions, .toast-container, .progress-dock,
  .skip-link { display: none !important; }
  body::before { display: none !important; }
  .main-content { padding-top: 0; }
  .card { box-shadow: none; border-color: #ddd; background: #fff; backdrop-filter: none; }

  /* 점수 막대/링/뱃지의 배경색은 브라우저 기본이 '잉크 절약'으로 지워버린다 */
  .score-bar__track, .score-bar__fill, .score-ring, .badge, .progress-bar, .progress-bar__fill {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .card, blockquote, .quote, .score-bar, tr { break-inside: avoid; }
  @page { margin: 1.6cm; }
}


/* ============================================================================
   I. UI FOUNDATION ADDITIONS
   ----------------------------------------------------------------------------
   skip-link · toast close · submit loading · dirty rows · select/table filter
   ========================================================================= */

/* ── Skip to content: sr-only until focused ── */
.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: calc(var(--z-toast) + 1);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-bg-raised);
  color: var(--color-text-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  box-shadow: var(--shadow-lg);
  transform: translateY(calc(-100% - var(--space-6)));
}
.skip-link:focus-visible {
  transform: none;
  outline: none;
  box-shadow: var(--ring), var(--shadow-lg);
}

/* ── Toast close button (js가 생성) ── */
.toast__close {
  margin-left: auto;
  padding: 0 var(--space-1);
  border: none;
  background: none;
  color: var(--color-text-3);
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.toast__close:hover { color: var(--color-text-1); }
.toast__close:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* ── Submit in flight: initSubmitGuard()가 붙인다 ── */
.btn--loading { opacity: 0.6; cursor: progress; }

/* ── Unsaved inline-table edits: initDirtyGuard()가 <tr>에 붙인다 ── */
tr.row--dirty {
  background: var(--color-brand-softer);
  box-shadow: inset 3px 0 0 var(--color-brand);
}
tr.row--dirty .btn { box-shadow: var(--ring); }

/* ── 비활성(퇴사 등) 행 — 인라인 opacity 대신 상태 클래스 ── */
tr.row--inactive { opacity: 0.55; }

/* ── select 검색 필터 입력 (initSelectFilters가 select 앞에 삽입) ── */
.select-filter { margin-bottom: var(--space-2); }
.field .select-filter, .input-group .select-filter { width: 100%; }

/* ── 모바일 터치 타깃 누락분 (G2 블록 보완) ── */
@media (pointer: coarse), (max-width: 640px) {
  .top-nav__menu-link { min-height: 44px; display: flex; align-items: center; }
  /* 표 안의 단독 체크박스(관리자 권한 토글 등)는 16px로는 못 누른다 */
  .table input[type="checkbox"] { width: 1.375rem; height: 1.375rem; }
}

/* ── 유틸 추가 (인라인 style 이관용, 단위: rem) ── */
.items-end   { align-items: flex-end; }
.items-center{ align-items: center; }
.shrink-0    { flex-shrink: 0; }
.min-w-6  { min-width: 6rem; }
.min-w-7  { min-width: 7rem; }
.min-w-8  { min-width: 8rem; }
.min-w-9  { min-width: 9rem; }
.min-w-12 { min-width: 12rem; }
.min-w-14 { min-width: 14rem; }
