@font-face { font-family: "Pretendard Variable"; font-weight: 45 920; font-style: normal; font-display: swap; src: url("../../fonts/PretendardVariable.woff2") format("woff2"); }

@layer reset, tokens, base, layout, components, views;

/* ───────── reset ───────── */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
  ol, ul { padding: 0; list-style: none; }
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; }
  button:disabled { cursor: not-allowed; }
  a { color: inherit; text-decoration: none; }
  img, svg { display: block; }
  table { border-collapse: collapse; }
  [hidden] { display: none !important; }
}

/* ───────── tokens ─────────
   글자 크기: 본문 15px → 17px, 보조 13px → 15px, 최소 14px로 상향
   회색 글자 대비도 한 단계 진하게 조정 */
@layer tokens {
  :root {
    color-scheme: light dark;
    --bg:        light-dark(#F1F3F7, #0E1420);
    --surface:   light-dark(#FFFFFF, #161E2E);
    --surface-2: light-dark(#F6F8FB, #1B2438);
    --ink:       light-dark(#121A2B, #EEF2F8);
    --muted:     light-dark(#465066, #AEB8CA);
    --faint:     light-dark(#677287, #8893A9);
    --line:      light-dark(#DCE2EB, #2A3550);
    --brand:     light-dark(#2447D5, #7E9CFF);
    --brand-ink: light-dark(#FFFFFF, #0E1420);
    --focus:     light-dark(#2447D5, #A9BCFF);
    --danger:    light-dark(#C0283F, #FF7C8F);

    /* 처리상태 */
    --s-req:    light-dark(#D1335E, #FF7C9C);
    --s-recv:   light-dark(#B86200, #FFB451);
    --s-prog:   light-dark(#1C6CD0, #6BB1FF);
    --s-review: light-dark(#6B44D6, #B69EFF);
    --s-long:   light-dark(#268045, #6DD58F);
    --s-done:   light-dark(#586274, #A6B0C2);

    /* 권한 */
    --r-super:  light-dark(#B42318, #FF8F85);
    --r-admin:  light-dark(#2447D5, #8EA8FF);
    --r-answer: light-dark(#0B7A62, #5FD4B5);
    --r-writer: light-dark(#8A5300, #F3BE62);

    --radius-s: 6px;
    --radius-m: 10px;
    --radius-l: 16px;
    --shadow: 0 1px 2px light-dark(rgb(23 32 51 / .06), rgb(0 0 0 / .4)),
              0 8px 24px -12px light-dark(rgb(23 32 51 / .18), rgb(0 0 0 / .6));

    --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
    --fs-s:    .875rem;   /* 14px  최소 크기 */
    --step--1: .9375rem;  /* 15px  보조 텍스트 */
    --step-0:  1.0625rem; /* 17px  본문 */
    --step-1:  1.1875rem; /* 19px */
    --step-2:  1.5rem;    /* 24px */
    --step-3:  clamp(1.875rem, 1.45rem + 1.4vw, 2.5rem);
  }
  :root[data-theme="light"] { color-scheme: light; }
  :root[data-theme="dark"]  { color-scheme: dark; }
}

/* ───────── base ───────── */
@layer base {
  html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 88px); -webkit-text-size-adjust: 100%; }
  body {
    background: var(--bg); color: var(--ink);
    font-family: var(--font); font-size: var(--step-0); line-height: 1.6;
    font-feature-settings: "ss06"; -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
    padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
  .num { font-variant-numeric: tabular-nums; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .muted { color: var(--muted); }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
  }
}

/* ───────── layout ───────── */
@layer layout {
  .wrap { width: min(1320px, 100% - 2 * clamp(16px, 3vw, 40px)); margin-inline: auto; }
  .narrow { width: min(560px, 100% - 32px); margin-inline: auto; }

  .topbar {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in oklab, var(--surface) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .wrap { display: flex; align-items: center; gap: 28px; min-height: 72px; }

  .page { padding-block: 32px 72px; }
  .page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; }

  .shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
  @media (width < 1024px) { .shell { grid-template-columns: 1fr; } }

  .dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  @media (width < 960px) { .dash-grid { grid-template-columns: 1fr; } }
}

/* ───────── components ───────── */
@layer components {

  /* 브랜드 */
  .brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
  .brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
  .brand-text { line-height: 1.25; }
  .brand-text strong { display: block; font-size: var(--step-1); font-weight: 760; letter-spacing: -.01em; }
  .brand-text span { font-size: var(--fs-s); color: var(--muted); }

  /* 상단 메뉴 */
  .gnav { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .gnav ul { display: flex; gap: 4px; }
  .gnav a {
    display: block; padding: 10px 14px; border-radius: 9px; white-space: nowrap;
    color: var(--muted); font-weight: 620; font-size: var(--step-0);
    &:hover { color: var(--ink); background: var(--surface-2); }
    &[aria-current="page"] { color: var(--brand); background: color-mix(in oklab, var(--brand) 10%, transparent); }
  }

  .top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
  .icon-btn {
    width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px;
    border: 1px solid var(--line); background: var(--surface); color: var(--muted);
    &:hover { color: var(--ink); border-color: color-mix(in oklab, var(--ink) 25%, var(--line)); }
  }
  .user-chip {
    display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
    &:hover { border-color: color-mix(in oklab, var(--ink) 25%, var(--line)); }
  }
  .avatar {
    --c: var(--brand);
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: color-mix(in oklab, var(--c) 16%, var(--surface)); color: var(--c);
    font-weight: 750; font-size: var(--fs-s);
  }
  .user-chip .who { text-align: left; line-height: 1.2; }
  .user-chip .who b { display: block; font-size: var(--step--1); }
  .user-chip .who small { font-size: var(--fs-s); color: var(--muted); }
  @media (width < 760px) { .user-chip .who { display: none; } .user-chip { padding: 4px; } .brand-text span { display: none; } }

  /* 권한 표시 */
  [data-role="SUPER_ADMIN"] { --c: var(--r-super); }
  [data-role="ADMIN"]       { --c: var(--r-admin); }
  [data-role="ANSWERER"]    { --c: var(--r-answer); }
  [data-role="WRITER"]      { --c: var(--r-writer); }
  .role-badge {
    display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 7px;
    font-size: var(--fs-s); font-weight: 720; white-space: nowrap; vertical-align: middle;
    color: var(--c); background: color-mix(in oklab, var(--c) 13%, transparent);
  }
  .role-badge.lg { height: 36px; padding: 0 14px; font-size: var(--step--1); }

  /* 사용자 메뉴 팝오버 */
  .menu {
    inset: auto; margin: 0; position: fixed; top: calc(env(safe-area-inset-top, 0px) + 76px); right: max(16px, calc((100vw - 1320px) / 2));
    width: 340px; max-height: calc(100dvh - 100px); overflow-y: auto; padding: 8px;
    border: 1px solid var(--line); border-radius: var(--radius-l);
    background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
    opacity: 0; translate: 0 -6px;
    transition: opacity .16s, translate .16s, display .16s allow-discrete, overlay .16s allow-discrete;
    &:popover-open { opacity: 1; translate: 0 0; }
  }
  @starting-style { .menu:popover-open { opacity: 0; translate: 0 -6px; } }
  .menu-me { display: grid; gap: 4px; padding: 12px 12px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
  .menu-me b { font-size: var(--step-1); }
  .menu-me small { color: var(--muted); font-size: var(--fs-s); }
  .menu h3 { font-size: var(--fs-s); font-weight: 650; color: var(--muted); padding: 8px 12px 6px; }
  .menu label {
    display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center;
    padding: 10px 12px; border-radius: 10px; cursor: pointer;
    &:hover { background: var(--surface-2); }
    &:has(input:checked) { background: color-mix(in oklab, var(--brand) 9%, transparent); }
  }
  .menu input { grid-row: span 2; accent-color: var(--brand); }
  .menu label b { font-size: var(--step--1); display: flex; align-items: center; gap: 8px; }
  .menu label small { grid-column: 2; font-size: var(--fs-s); color: var(--muted); }
  .menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
  .menu .logout { width: 100%; text-align: left; border: 0; background: none; padding: 11px 12px; border-radius: 10px; color: var(--muted); font-size: var(--step--1); &:hover { background: var(--surface-2); color: var(--ink); } }

  /* 페이지 제목 */
  .page-title h1 { font-size: var(--step-3); font-weight: 780; letter-spacing: -.025em; line-height: 1.15; }
  .scope { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: var(--step--1); color: var(--muted); }
  .scope svg { color: var(--faint); flex-shrink: 0; }
  .scope b { color: var(--ink); font-weight: 680; }

  /* 버튼 */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--surface); font-weight: 650; font-size: var(--step--1); white-space: nowrap;
    &:hover:not(:disabled) { border-color: color-mix(in oklab, var(--ink) 30%, var(--line)); }
    &:disabled { opacity: .55; }
  }
  .btn-primary {
    background: var(--brand); border-color: var(--brand); color: var(--brand-ink);
    &:hover:not(:disabled) { background: color-mix(in oklab, var(--brand) 88%, #000); border-color: transparent; }
  }
  .btn-lg { height: 50px; padding: 0 22px; font-size: var(--step-0); }
  .btn-s { height: 36px; padding: 0 12px; font-size: var(--fs-s); border-radius: 8px; }
  .btn-danger { color: var(--danger); &:hover:not(:disabled) { border-color: var(--danger); } }
  .btn-danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
  .link-btn { border: 0; background: none; padding: 0; color: var(--brand); font-weight: 650; font-size: var(--step--1); &:hover { text-decoration: underline; } }

  /* 처리상태 */
  [data-s="req"]    { --c: var(--s-req); }
  [data-s="recv"]   { --c: var(--s-recv); }
  [data-s="prog"]   { --c: var(--s-prog); }
  [data-s="review"] { --c: var(--s-review); }
  [data-s="long"]   { --c: var(--s-long); }
  [data-s="done"]   { --c: var(--s-done); }
  [data-s="all"]    { --c: var(--brand); }

  .badge {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px 0 9px; border-radius: 7px;
    font-size: var(--step--1); font-weight: 720; white-space: nowrap;
    color: var(--c); background: color-mix(in oklab, var(--c) 13%, transparent);
    &::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
  }
  .badge[data-s="prog"]::before { animation: pulse 1.6s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: .35; } }

  /* 처리상태 파이프라인 */
  .pipeline { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 6px; margin-bottom: 24px; }
  .pipeline-tabs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  @media (width < 820px) { .pipeline-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
  .p-tab {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 12px 14px 14px; border: 0; border-radius: 10px; background: none; text-align: left; position: relative;
    &:hover { background: var(--surface-2); }
    .lbl { display: flex; align-items: center; gap: 7px; font-size: var(--step--1); font-weight: 650; color: var(--muted); }
    .lbl::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
    .cnt { font-size: 1.75rem; font-weight: 780; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
    &[data-s="all"] .lbl::before { display: none; }
    &[aria-pressed="true"] { background: color-mix(in oklab, var(--c) 10%, transparent); }
    &[aria-pressed="true"] .lbl { color: var(--c); }
    &[aria-pressed="true"]::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 3px; border-radius: 3px; background: var(--c); }
    &[data-empty] .cnt { color: var(--faint); }
  }
  .flowbar { display: flex; gap: 3px; height: 7px; margin: 6px 8px; border-radius: 6px; overflow: hidden; }
  .flowbar span { background: var(--c); min-width: 0; }

  /* 사이드 */
  .side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 92px); display: grid; gap: 16px; }
  @media (width < 1024px) { .side { position: static; } }
  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 16px; }
  .panel h2 { font-size: var(--step--1); font-weight: 720; color: var(--muted); margin-bottom: 10px; }
  .region-list { display: grid; gap: 2px; }
  @media (width < 1024px) { .region-list { display: flex; flex-wrap: wrap; gap: 6px; } }
  .region-list button {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
    padding: 10px 12px; border: 0; border-radius: 8px; background: none; text-align: left; font-weight: 600; font-size: var(--step-0);
    &:hover { background: var(--surface-2); }
    &[aria-pressed="true"] { background: color-mix(in oklab, var(--brand) 10%, transparent); color: var(--brand); }
    span:last-child { font-size: var(--step--1); color: var(--muted); font-variant-numeric: tabular-nums; }
  }
  @media (width < 1024px) { .region-list button { width: auto; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; } }
  .lock-card { display: grid; gap: 10px; }
  .lock-card .org { font-size: var(--step-1); font-weight: 720; }
  .lock-card p { font-size: var(--step--1); color: var(--muted); line-height: 1.65; }
  .pill { justify-self: start; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-s); font-weight: 680; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
  .help-links a { display: flex; justify-content: space-between; padding: 10px 0; font-size: var(--step--1); color: var(--muted); border-top: 1px solid var(--line); &:first-of-type { border-top: 0; } &:hover { color: var(--brand); } }

  /* 게시판 */
  .board { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); container: board / inline-size; overflow: clip; }
  .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
  .seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
  .seg button {
    border: 0; background: none; padding: 7px 13px; border-radius: 7px; font-size: var(--step--1); font-weight: 650; color: var(--muted);
    &[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 0 0 1px var(--line); }
  }
  .search { position: relative; flex: 1 1 240px; }
  .search svg { position: absolute; left: 13px; top: 50%; translate: 0 -50%; color: var(--faint); pointer-events: none; }
  .search input {
    width: 100%; height: 44px; padding: 0 44px 0 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: var(--step--1);
    &::placeholder { color: var(--faint); }
    &:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand) 16%, transparent); }
  }
  .search kbd { position: absolute; right: 10px; top: 50%; translate: 0 -50%; font: 600 12px/1 var(--font); padding: 4px 7px; border-radius: 5px; border: 1px solid var(--line); color: var(--faint); background: var(--surface); }
  .search:has(input:focus) kbd, .search:has(input:not(:placeholder-shown)) kbd { display: none; }
  .select {
    height: 44px; padding: 0 36px 0 12px; border-radius: 10px; border: 1px solid var(--line); background-color: var(--surface);
    appearance: none; font-size: var(--step--1); font-weight: 580;
    background-image: none;
    background-repeat: no-repeat; background-position: right 12px center;
  }
  .select.input-s { height: 38px; font-size: var(--fs-s); }

  .result-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 18px; font-size: var(--step--1); color: var(--muted); }
  .result-line b { color: var(--ink); font-variant-numeric: tabular-nums; }
  .hint { font-size: var(--fs-s); color: var(--faint); }
  .chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); font-size: var(--fs-s); font-weight: 600; }
  .chip button { border: 0; background: none; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); &:hover { background: var(--line); color: var(--ink); } }

  /* 목록 — subgrid로 헤더·행 열 정렬 */
  .list {
    display: grid;
    grid-template-columns: 5.25rem 6.25rem minmax(10rem, 1fr) 5.75rem 10rem 5.5rem 7rem 3.5rem;
    column-gap: 12px;
  }
  .rows { display: contents; }
  .list-head, .row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; padding-inline: 16px; }
  .list-head { padding-block: 11px; background: var(--surface-2); border-block: 1px solid var(--line); font-size: var(--step--1); font-weight: 680; color: var(--muted); }
  .list-head .r, .row .r { text-align: right; }
  .row {
    position: relative; padding-block: 16px; border-bottom: 1px solid var(--line);
    font-size: var(--step--1); color: var(--muted);
    &:hover { background: color-mix(in oklab, var(--brand) 4%, transparent); }
    &:has(.title:focus-visible) { background: color-mix(in oklab, var(--brand) 7%, transparent); }
    &:last-child { border-bottom: 0; }
  }
  .c-no { font-variant-numeric: tabular-nums; color: var(--faint); }
  .c-title { min-width: 0; }
  .title {
    color: var(--ink); font-size: var(--step-0); font-weight: 650; line-height: 1.45; overflow-wrap: anywhere;
    &::after { content: ""; position: absolute; inset: 0; }
    &:focus-visible { outline: none; }
  }
  .row:hover .title { color: var(--brand); }
  .title mark { background: color-mix(in oklab, #FFD43B 55%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
  .tag-pre { color: var(--muted); font-weight: 580; }
  .lock-tag { display: inline-flex; vertical-align: -2px; margin-right: 5px; color: var(--s-review); }
  .secret-title { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-weight: 600; font-size: var(--step-0); }
  .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: var(--fs-s); color: var(--faint); }
  .meta .has { color: var(--muted); }
  .meta .unassigned { color: var(--s-req); font-weight: 650; }
  .c-org b { display: block; color: var(--ink); font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .c-org small { font-size: var(--fs-s); color: var(--faint); }
  .c-date { font-variant-numeric: tabular-nums; }
  .c-date small { display: block; font-size: var(--fs-s); }
  .elapsed { color: var(--c, var(--muted)); font-weight: 680; }

  @container board (width < 1000px) {
    .list { grid-template-columns: 1fr; }
    .list-head { display: none; }
    .row {
      grid-template-columns: auto 1fr auto;
      grid-template-areas: "st no date" "title title title" "org org views";
      gap: 8px 10px; padding: 16px;
    }
    .c-st { grid-area: st; } .c-no { grid-area: no; } .c-views { grid-area: views; }
    .c-title { grid-area: title; } .c-org { grid-area: org; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
    .c-type, .c-author { display: none; }
    .c-org::after { content: attr(data-extra); font-size: var(--fs-s); color: var(--faint); }
    .c-date { grid-area: date; text-align: right; }
    .c-date small { display: inline; margin-left: 6px; }
    .c-views::before { content: "조회 "; color: var(--faint); }
  }

  .empty { padding: 56px 20px; text-align: center; display: grid; justify-items: center; gap: 10px; }
  .empty strong { font-size: var(--step-1); }
  .empty p { color: var(--muted); font-size: var(--step--1); }

  .pager { display: flex; justify-content: center; gap: 4px; padding: 16px; border-top: 1px solid var(--line); }
  .pager button {
    min-width: 40px; height: 40px; padding: 0 10px; border-radius: 9px; border: 1px solid transparent; background: none;
    font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums;
    &:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
    &[aria-current="page"] { background: var(--ink); color: var(--surface); }
    &:disabled { opacity: .35; }
  }

  /* 표 */
  .table-wrap { overflow-x: auto; }
  .tbl { width: 100%; font-size: var(--step--1); }
  .tbl th { text-align: left; padding: 12px 16px; background: var(--surface-2); color: var(--muted); font-weight: 680; border-block: 1px solid var(--line); white-space: nowrap; }
  .tbl td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--muted); }
  .tbl tbody tr:last-child td { border-bottom: 0; }
  .tbl tbody tr:hover td { background: color-mix(in oklab, var(--brand) 3%, transparent); }
  .tbl .strong { color: var(--ink); font-weight: 680; }
  .tbl .r { text-align: right; }
  .tbl .nowrap { white-space: nowrap; }
  .tbl .w-order { width: 7rem; }
  .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
  .tag { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; margin-left: 8px; border-radius: 6px; font-size: 13px; font-weight: 680; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; }
  .tag.warn { color: var(--s-recv); border-color: color-mix(in oklab, var(--s-recv) 35%, transparent); background: color-mix(in oklab, var(--s-recv) 10%, transparent); }
  .acct { display: inline-flex; align-items: center; gap: 7px; font-weight: 650; white-space: nowrap; color: var(--c); }
  .acct::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
  .acct[data-acct="active"]   { --c: var(--s-long); }
  .acct[data-acct="locked"]   { --c: var(--s-req); }
  .acct[data-acct="disabled"] { --c: var(--s-done); }
  .kind-tag { --c: var(--muted); display: inline-flex; height: 26px; align-items: center; padding: 0 9px; border-radius: 6px; font-size: var(--fs-s); font-weight: 680; color: var(--c); background: color-mix(in oklab, var(--c) 11%, transparent); white-space: nowrap; }

  /* 스위치 */
  .switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--step--1); font-weight: 620; color: var(--ink); }
  .switch input {
    appearance: none; margin: 0; flex-shrink: 0; width: 46px; height: 26px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s;
    &::before { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: translate .15s; }
    &:checked { background: var(--brand); }
    &:checked::before { translate: 20px 0; }
  }

  /* 탭 */
  .tabs { display: flex; gap: 4px; padding: 0 8px; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .tabs button {
    border: 0; background: none; padding: 16px 16px 14px; font-size: var(--step-0); font-weight: 680; color: var(--muted); position: relative; white-space: nowrap;
    &:hover { color: var(--ink); }
    &[aria-selected="true"] { color: var(--brand); }
    &[aria-selected="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px; background: var(--brand); }
    small { margin-left: 6px; color: var(--faint); font-weight: 600; font-size: var(--fs-s); }
  }

  /* 대시보드 */
  .dash-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
  .dash-head .date { font-size: var(--step--1); color: var(--muted); margin-bottom: 6px; }
  .dash-head h1 { font-size: var(--step-3); font-weight: 780; letter-spacing: -.025em; line-height: 1.2; }
  .dash-head p.lead { margin-top: 8px; color: var(--muted); font-size: var(--step-0); }

  .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
  .kpi {
    --c: var(--ink);
    display: grid; gap: 2px; text-align: left; padding: 16px 18px 18px; position: relative; overflow: hidden;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
    &::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
    &:hover { border-color: color-mix(in oklab, var(--c) 45%, var(--line)); }
    &[aria-pressed="true"] { border-color: var(--c); background: color-mix(in oklab, var(--c) 6%, var(--surface)); }
    .k-lbl { font-size: var(--step--1); font-weight: 650; color: var(--muted); }
    .k-num { font-size: 2.125rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); }
    .k-sub { font-size: var(--fs-s); color: var(--faint); }
  }

  .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .card.span-2 { grid-column: 1 / -1; }
  .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .card-head h2 { font-size: var(--step-1); font-weight: 740; display: flex; align-items: center; gap: 10px; }
  .count { display: inline-grid; place-items: center; min-width: 28px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); font-size: var(--fs-s); font-weight: 720; color: var(--muted); font-variant-numeric: tabular-nums; }
  .count.alert { background: color-mix(in oklab, var(--s-req) 14%, transparent); color: var(--s-req); }

  .mini li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 13px 2px; border-top: 1px solid var(--line); }
  .mini li:first-child { border-top: 0; }
  .m-title { min-width: 0; border: 0; background: none; padding: 0; text-align: left; font-size: var(--step-0); font-weight: 650; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  button.m-title:hover { color: var(--brand); }
  .m-title .lock-tag { vertical-align: -2px; }
  .m-side { grid-column: 3; grid-row: 1 / span 2; font-size: var(--step--1); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .m-sub { grid-column: 2; font-size: var(--fs-s); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-act { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
  .m-quote { grid-column: 2 / -1; font-size: var(--step--1); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .empty-s { padding: 24px 8px; text-align: center; color: var(--muted); font-size: var(--step--1); }

  .bars { display: grid; gap: 12px; }
  .bar-row { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) 2.75rem; gap: 12px; align-items: center; font-size: var(--step--1); }
  .bar-row > span:first-child { font-weight: 620; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bar-track { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
  .bar-fill { display: block; height: 100%; border-radius: 6px; background: var(--c, var(--brand)); }
  .bar-row b { text-align: right; font-variant-numeric: tabular-nums; }
  button.bar-row { border: 0; background: none; padding: 4px 0; text-align: left; width: 100%; border-radius: 6px; &:hover > span:first-child { color: var(--brand); } }

  .quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
  .quick button { display: grid; gap: 4px; padding: 16px 18px; text-align: left; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface-2); font-weight: 720; font-size: var(--step-0); &:hover { border-color: var(--brand); color: var(--brand); } }
  .quick small { font-weight: 450; color: var(--muted); font-size: var(--step--1); }
  .stat-line { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: var(--step--1); color: var(--muted); }
  .stat-line b { color: var(--ink); font-variant-numeric: tabular-nums; }

  .hero {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px;
    padding: 28px 30px; margin-bottom: 24px; border-radius: var(--radius-l);
    background: var(--brand); color: var(--brand-ink);
  }
  .hero .pill { background: color-mix(in oklab, var(--brand-ink) 18%, transparent); color: var(--brand-ink); }
  .hero h1 { font-size: var(--step-3); font-weight: 780; letter-spacing: -.025em; line-height: 1.2; margin-top: 10px; }
  .hero p { margin-top: 6px; opacity: .9; font-size: var(--step-0); }
  .hero .btn { background: var(--brand-ink); color: var(--brand); border-color: transparent; height: 54px; padding: 0 24px; font-size: var(--step-1); }

  /* 다이얼로그 공통 */
  dialog {
    border: 0; padding: 0; color: var(--ink); background: var(--surface);
    opacity: 0;
    transition: opacity .2s, translate .25s cubic-bezier(.2,.7,.2,1), display .25s allow-discrete, overlay .25s allow-discrete;
    &[open] { opacity: 1; translate: 0 0; }
    &::backdrop { background: rgb(10 16 28 / 0); transition: all .25s allow-discrete; }
    &[open]::backdrop { background: rgb(10 16 28 / .45); backdrop-filter: blur(2px); }
  }
  @starting-style { dialog[open] { opacity: 0; } dialog[open]::backdrop { background: rgb(10 16 28 / 0); } }

  /* 상세 시트 */
  .sheet { margin: 0 0 0 auto; width: min(620px, 100%); height: 100dvh; max-height: none; translate: 40px 0; border-left: 1px solid var(--line); }
  @starting-style { .sheet[open] { translate: 40px 0; } }
  .sheet-inner { display: flex; flex-direction: column; height: 100%; }
  .sheet header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
  .sheet header .hl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .sheet .body { padding: 24px 22px 40px; overflow-y: auto; display: grid; gap: 26px; align-content: start; }
  .sheet h2 { font-size: var(--step-2); font-weight: 760; letter-spacing: -.02em; line-height: 1.35; text-wrap: balance; }
  .req-no { color: var(--muted); font-size: var(--step--1); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
  .facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; padding: 18px; border-radius: var(--radius-m); background: var(--surface-2); }
  .facts dt { font-size: var(--fs-s); color: var(--muted); }
  .facts dd { font-weight: 650; font-variant-numeric: tabular-nums; }
  .steps li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding-bottom: 16px; position: relative; color: var(--faint); }
  .steps li::before { content: ""; width: 12px; height: 12px; margin: 6px 5px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); z-index: 1; }
  .steps li:not(:last-child)::after { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
  .steps li.passed { color: var(--ink); }
  .steps li.passed::before { background: var(--brand); border-color: var(--brand); }
  .steps li.passed:not(:last-child)::after { background: var(--brand); }
  .steps li.now { color: var(--c); font-weight: 720; }
  .steps li.now::before { border-color: var(--c); background: var(--c); box-shadow: 0 0 0 4px color-mix(in oklab, var(--c) 22%, transparent); }
  .steps small { display: block; font-weight: 400; font-size: var(--fs-s); color: var(--muted); }
  .section-title { font-size: var(--step--1); font-weight: 720; color: var(--muted); margin-bottom: 12px; }
  .q-body { line-height: 1.8; white-space: pre-wrap; }
  .answer { border-left: 3px solid var(--brand); padding: 14px 18px; background: color-mix(in oklab, var(--brand) 6%, transparent); border-radius: 0 var(--radius-m) var(--radius-m) 0; display: grid; gap: 6px; }
  .answer + .answer { margin-top: 12px; }
  .answer header { display: flex; justify-content: space-between; gap: 8px; padding: 0; border: 0; font-size: var(--step--1); }
  .answer header b { font-weight: 720; }
  .answer p { white-space: pre-wrap; }

  .att { display: grid; gap: 8px; }
  .att-file { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); font-size: var(--step--1); }
  .att-file .fname { font-weight: 620; color: var(--ink); overflow-wrap: anywhere; }
  .att-file small { display: block; color: var(--faint); font-size: var(--fs-s); }
  .att-icon { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
  .video-box { aspect-ratio: 16 / 9; border-radius: var(--radius-m); background: #0E1420; color: #fff; display: grid; place-items: center; position: relative; overflow: hidden; }
  .video-box .play { width: 68px; height: 68px; border-radius: 50%; background: rgb(255 255 255 / .16); display: grid; place-items: center; border: 0; color: #fff; }
  .video-box .vbar { position: absolute; left: 14px; right: 14px; bottom: 12px; display: flex; align-items: center; gap: 10px; font-size: var(--fs-s); color: rgb(255 255 255 / .85); }
  .video-box .vbar i { flex: 1; height: 4px; border-radius: 4px; background: rgb(255 255 255 / .25); }
  .video-box .vcap { position: absolute; top: 12px; left: 14px; font-size: var(--fs-s); color: rgb(255 255 255 / .8); }

  .manage { display: grid; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface-2); }
  .manage h3 { font-size: var(--step-0); font-weight: 740; }
  .inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .inline-form .select { flex: 1 1 180px; }
  .owner-actions { display: flex; flex-wrap: wrap; gap: 8px; }

  /* 모달 폼 */
  .modal { width: min(680px, 100% - 24px); max-height: min(90dvh, 900px); border-radius: var(--radius-l); translate: 0 16px; box-shadow: var(--shadow); }
  .modal.modal-s { width: min(460px, 100% - 24px); }
  @starting-style { .modal[open] { translate: 0 16px; } }
  .modal form { display: grid; gap: 18px; padding: 26px; }
  .modal h2 { font-size: var(--step-2); font-weight: 760; letter-spacing: -.02em; }
  .modal .sub { color: var(--muted); font-size: var(--step--1); margin-top: -10px; }
  .field { display: grid; gap: 7px; min-width: 0; }
  .field > span, .field legend { font-size: var(--step--1); font-weight: 680; }
  .field small { font-size: var(--fs-s); color: var(--muted); }
  .field .field-err { color: var(--danger); font-weight: 650; }
  .field.grow { flex: 1 1 240px; }
  .star { color: var(--danger); margin-left: 2px; }
  form[data-role]:not([data-role="WRITER"]) .star.w { display: none; }
  .opt { font-style: normal; font-size: var(--fs-s); font-weight: 600; color: var(--faint); margin-left: 4px; }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  @media (width < 560px) { .grid-2 { grid-template-columns: 1fr; } }
  .input {
    width: 100%; min-height: 46px; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: var(--step-0);
    &:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand) 16%, transparent); }
    &[aria-invalid="true"] { border-color: var(--danger); }
    &[readonly] { background: var(--surface-2); color: var(--muted); }
  }
  textarea.input { field-sizing: content; min-height: 8lh; resize: vertical; line-height: 1.65; }
  .input.select { padding-right: 36px; height: 46px; }
  .input-row { display: flex; gap: 8px; }
  fieldset.field { border: 0; padding: 0; margin: 0; }
  .type-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .type-chips label {
    position: relative; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); font-size: var(--step--1); font-weight: 650; cursor: pointer; color: var(--muted);
    &:has(input:checked) { border-color: var(--brand); color: var(--brand); background: color-mix(in oklab, var(--brand) 9%, transparent); }
    &:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
    &:has(input:disabled) { opacity: .55; cursor: not-allowed; }
    input { position: absolute; opacity: 0; pointer-events: none; }
  }
  .secret-box { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 16px; border-radius: var(--radius-m); border: 1px solid var(--line); }
  .secret-box p { font-size: var(--fs-s); color: var(--muted); margin-top: 2px; font-weight: 450; }
  .form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
  .notice-inline { display: flex; gap: 8px; align-items: flex-start; font-size: var(--step--1); color: var(--muted); padding: 12px 14px; border-radius: 10px; background: var(--surface-2); }
  .notice-inline svg { flex-shrink: 0; margin-top: 3px; }
  .notice-inline.warn { color: var(--s-recv); background: color-mix(in oklab, var(--s-recv) 10%, transparent); font-weight: 600; }
  .form-error { display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-radius: 10px; background: color-mix(in oklab, var(--danger) 10%, transparent); color: var(--danger); font-size: var(--step--1); font-weight: 650; }

  /* 업로드 */
  .drop {
    position: relative; display: grid; justify-items: center; gap: 4px; padding: 22px 16px; text-align: center; cursor: pointer;
    border: 2px dashed var(--line); border-radius: var(--radius-m); background: var(--surface-2); color: var(--muted); font-size: var(--step--1);
    &:hover, &.over { border-color: var(--brand); color: var(--brand); }
    b { color: var(--ink); font-size: var(--step-0); }
    input { position: absolute; width: 1px; height: 1px; opacity: 0; }
    &:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
  }
  .file-list { display: grid; gap: 8px; }
  .file-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 6px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: var(--step--1); }
  .file-list li.bad { border-color: color-mix(in oklab, var(--danger) 45%, var(--line)); background: color-mix(in oklab, var(--danger) 5%, transparent); }
  .file-list .fname { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .file-list .fsize { color: var(--faint); font-size: var(--fs-s); font-variant-numeric: tabular-nums; }
  .file-list .ferr { grid-column: 2 / -1; color: var(--danger); font-size: var(--fs-s); font-weight: 650; }
  .file-list .rm { width: 30px; height: 30px; border: 0; background: none; border-radius: 50%; color: var(--muted); &:hover { background: var(--surface-2); color: var(--ink); } }
  .progress { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
  .progress span { display: block; height: 100%; background: var(--brand); transition: width .1s linear; }
  [data-kind="video"] { --c: var(--s-review); }
  [data-kind="img"]   { --c: var(--s-long); }
  [data-kind="doc"]   { --c: var(--s-prog); }

  /* 토스트 */
  .toast {
    position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); translate: -50% 20px; z-index: 50;
    padding: 13px 20px; border-radius: 12px; background: var(--ink); color: var(--surface); font-weight: 650; font-size: var(--step--1);
    box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, translate .25s;
    &.show { opacity: 1; translate: -50% 0; }
  }

  .footer { padding-block: 24px 40px; color: var(--faint); font-size: var(--fs-s); border-top: 1px solid var(--line); }
}

/* ───────── 로그인 · 오류 화면 ───────── */
@layer views {
  .login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
  .login-card { width: min(980px, 100%); display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
  @media (width < 820px) { .login-card { grid-template-columns: 1fr; } .login-side ul { display: none; } }
  .login-side { background: var(--brand); color: var(--brand-ink); padding: 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; }
  .login-side .brand-mark { background: color-mix(in oklab, var(--brand-ink) 18%, transparent); width: 46px; height: 46px; }
  .login-side h1 { font-size: 2.125rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.25; margin-top: 18px; }
  .login-side p { margin-top: 10px; opacity: .9; }
  .login-side ul { display: grid; gap: 10px; font-size: var(--step--1); }
  .login-side li { display: flex; gap: 10px; align-items: center; }
  .login-side li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
  .login-form { padding: 40px; display: grid; gap: 18px; align-content: center; }
  .login-form h2 { font-size: var(--step-2); font-weight: 780; }
  .login-form .lead { color: var(--muted); font-size: var(--step--1); margin-top: 4px; }
  .login-form .btn-primary { width: 100%; }
  .demo { border-top: 1px dashed var(--line); padding-top: 14px; }
  .demo summary { cursor: pointer; font-size: var(--step--1); font-weight: 680; color: var(--muted); }
  .demo-accts { display: grid; gap: 6px; margin-top: 10px; }
  .demo-accts button { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); text-align: left; font-size: var(--step--1); &:hover { border-color: var(--brand); } }
  .demo-accts small { color: var(--muted); font-size: var(--fs-s); }

  .pw-card { padding: 30px; display: grid; gap: 18px; width: min(520px, 100%); }
  .pw-card h2 { font-size: var(--step-2); font-weight: 780; }
  .pw-rules { display: grid; gap: 6px; padding: 14px 16px; border-radius: var(--radius-m); background: var(--surface-2); }
  .pw-rules li { display: flex; gap: 10px; align-items: center; font-size: var(--step--1); color: var(--muted); }
  .pw-rules li::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; }
  .pw-rules li.ok { color: var(--s-long); font-weight: 650; }
  .pw-rules li.ok::before { border-color: var(--s-long); background: var(--s-long) none center / 12px no-repeat; }

  .err { padding: 80px 20px; text-align: center; display: grid; justify-items: center; gap: 14px; }
  .err .code { font-size: 4.5rem; font-weight: 800; letter-spacing: -.04em; color: var(--faint); line-height: 1; }
  .err h1 { font-size: var(--step-2); font-weight: 780; }
  .err p { color: var(--muted); max-width: 32rem; }
}
