@layer components {
  /* ───── Button */
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-weight: 600; }
  .btn:hover { background: var(--surface-2); }
  .btn--primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
  .btn--primary:hover { background: var(--brand); filter: brightness(1.12); }
  .btn--ghost { border-color: transparent; background: transparent; }
  .btn[disabled] { opacity: .5; cursor: default; }

  /* ───── Field */
  .field { display: grid; gap: 6px; }
  .field label { font-size: 13px; font-weight: 600; }
  .field input, .field select { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }

  /* ───── Panel */
  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
  .panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

  /* ───── Tag (꼬리표). 상태는 색만이 아니라 모양+글자로도 표시 */
  .tag { display: inline-flex; white-space: nowrap; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px;
    font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--ink); }
  .tag--alert { background: transparent; color: var(--alert); border: 1px solid var(--alert); }
  .tag--ok { background: transparent; color: var(--ok); border: 1px solid var(--ok); }
  .tag--warn { background: transparent; color: var(--warn); border: 1px solid var(--warn); }
  .tag--opinion { background: var(--alert); color: #fff; }   /* 미반영 세무사님 의견(은아님 요청 2026-11-04: 붉게) */

  /* ───── KPI (숫자 카드) */
  .kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
  .kpis--six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpi { display: grid; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; cursor: pointer; }
  .kpi:hover { border-color: var(--brand); }
  .kpi__label { font-size: 12px; color: var(--muted); }
  .kpi__value { font-size: 24px; font-weight: 700; line-height: 1.2; }
  .kpi--alert .kpi__value { color: var(--alert); }

  /* ───── ListRow (목록 줄): 1줄 굵은 제목 / 2줄 회색 / 오른쪽 */
  .rows { display: grid; }
  .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
  .row:first-child { border-top: 0; }
  .row__title { font-weight: 700; }
  .row__meta { font-size: 13px; color: var(--muted); }
  .row--alert .row__title { color: var(--alert); }

  /* ───── EmptyState */
  .empty { padding: 36px 16px; text-align: center; color: var(--muted); }
  .empty strong { display: block; margin-bottom: 4px; color: var(--ink); }

  /* ───── ClientSwitcher */
  .switcher { display: grid; gap: 4px; }
  .switcher label { font-size: 12px; color: var(--muted); }
  .switcher select { min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-weight: 600; }

  /* ───── Toast */
  .toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; border-radius: var(--radius);
    background: var(--ink); color: var(--surface); font-weight: 600; z-index: 50; }
  @media (prefers-reduced-motion: no-preference) { .toast { animation: toast-in .18s ease-out; } }
  @keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

  /* ───── 작업실 뼈대 (Shell) */
  .shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
  .side { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: 20px;
    padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--line); }
  .brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; font-weight: 800; letter-spacing: .04em; }
  .brand img { width: 40px; height: 28px; object-fit: contain; }
  .hstack { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .small { font-size: 12.5px; }
  .logo--dark { display: none; }
  :root[data-theme="dark"] .logo--light { display: none; }
  :root[data-theme="dark"] .logo--dark { display: inline-block; }
  .brand small { display: block; font-weight: 500; letter-spacing: 0; color: var(--muted); font-size: 11px; }
  .nav { display: grid; gap: 2px; }
  .nav a { display: flex; align-items: center; justify-content: space-between; min-height: 38px; padding: 0 10px; border-radius: var(--radius-sm); font-weight: 600; }
  .nav a:hover { background: var(--surface-2); }
  .nav a[aria-current="page"] { background: var(--surface-3); color: var(--brand); }
  .nav kbd { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
  .nav__sub { display: grid; gap: 2px; padding-left: 14px; }
  .nav__sub a { min-height: 32px; font-size: 13.5px; font-weight: 500; }
  .side__foot { margin-top: auto; display: grid; gap: 8px; }
  .side__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .side__toggle { flex: none; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }
  .side__toggle:hover { color: var(--ink); border-color: var(--ink); }
  .shell.is-collapsed { grid-template-columns: 56px minmax(0, 1fr); }
  .shell.is-collapsed .side { padding: 18px 8px; align-items: center; }
  .shell.is-collapsed .side > :not(.side__top) { display: none; }
  .shell.is-collapsed .side__top { flex-direction: column; gap: 12px; }
  .shell.is-collapsed .brand { padding: 0; }
  .shell.is-collapsed .brand > div { display: none; }
  .main { min-width: 0; padding: 20px 28px 48px; }
  .crumb { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
  .page { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
  .tabbar { display: none; }
  .mbar { display: none; }

  /* 지금은 하단 탭 기준점(760px)만 먼저 */
  @media (max-width: 760px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .side { display: none; }
    .main { padding: 14px 14px 88px; }
    .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .kpi { padding: 9px 11px; }
    .kpi__value { font-size: 20px; }
    .panel { padding: 14px; }
    h1 { font-size: 22px; }
    .tabbar { position: fixed; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); z-index: 20; }
    .tabbar a { display: grid; place-items: center; min-height: 56px; font-size: 12px; font-weight: 600; color: var(--muted); }
    .tabbar a[aria-current="page"] { color: var(--brand); }
    .tabbar { padding-bottom: env(safe-area-inset-bottom); }
    .main { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
    .crumb { display: none; }
    .mbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
    .mbar__home { display: flex; flex: none; }
    .mbar__logo { width: 34px; height: 24px; object-fit: contain; flex: none; }
    :root[data-theme="dark"] .mbar__logo.logo--light, :root:not([data-theme="dark"]) .mbar__logo.logo--dark { display: none; }
    .mbar select { flex: 1; min-width: 0; height: 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); padding: 0 10px; font-weight: 600; }
    .mbar__set { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 18px; }
    .mbar__set[aria-current="page"] { border-color: var(--brand); color: var(--brand); }
    .panel__head { flex-wrap: wrap; row-gap: 4px; }
    .tag { white-space: nowrap; }
  }
}

/* 사례(office_cases.js): 세무사님 화면 정보 > 전문 분야, 작업실 자료실 > 고객 자료 */
@layer components {
  .oc { display: grid; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
  .oc__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .oc__title { font-size: 15px; font-weight: 700; }
  .oc__add { min-height: 38px; }
  .oc__list { display: grid; gap: 10px; }
  .oc__note { margin: 0; font-size: 14px; color: var(--muted); }
  .oc__item { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .oc__row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .oc__name { font-size: 15.5px; line-height: 1.45; }
  .oc__date { flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .oc__body { margin: 0; font-size: 14.5px; line-height: 1.65; white-space: pre-line; }
  .oc__files { display: flex; flex-wrap: wrap; gap: 6px; }
  .oc__file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 34px; padding: 4px 10px 4px 4px; border: 1px solid var(--line);
    border-radius: 8px; background: var(--surface-2); color: inherit; font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
  .oc__file > span:not(.oc__ext) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .oc__file small { color: var(--muted); }
  .oc__file--edit { cursor: default; }
  .oc__ext { flex: none; padding: 3px 6px; border-radius: 5px; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
  .oc__x { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
  .oc__acts { display: flex; justify-content: flex-end; gap: 6px; }
  .oc__form { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--brand); border-radius: var(--radius); background: var(--surface); }
  .oc__drop { display: grid; gap: 4px; justify-items: center; padding: 18px 12px; border: 1.5px dashed var(--line); border-radius: var(--radius);
    background: var(--surface-2); color: inherit; font: inherit; cursor: pointer; text-align: center; }
  .oc__drop span { font-size: 13px; color: var(--muted); }
  .oc__drop:hover { border-color: var(--brand); }
  .oc__label { font-size: 14px; font-weight: 600; margin-top: 4px; }
  .oc__input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; }
  textarea.oc__input { min-height: 120px; resize: vertical; line-height: 1.6; }
}
