/* ==========================================================================
   M2M WORKS — 통합 모듈형 업무 앱 코어 스타일
   - 외부 폰트/CDN 없음. 시스템 한글 폰트 스택.
   - 캔버스 화이트+회백, 주요 파랑 #294B85, 청록 #087F83, 황색 사용 안 함.
   - tasks/WORKS-UI-CONTRACT.md 공통 클래스 + WORKS-STYLE-001 셸 구조.
   - UI-COLOR-002: 태그 헤어라인/잉크, 활성 메뉴 아이콘 칩, 주요 버튼 깊이, 지표 카드 상단 악센트.
   ========================================================================== */

/* ---------- 1. 토큰 ---------- */
:root {
  /* color: canvas / surface */
  --c-canvas: #f4f6fa;
  --c-surface: #ffffff;
  --c-surface-2: #f7f9fc;
  --c-surface-3: #eef2f7;
  --c-border: #e3e8f0;
  --c-border-strong: #b6c3d3;

  /* color: text */
  --c-text: #1f2b40;
  --c-text-2: #52637b;
  --c-text-3: #596980;
  --c-text-inverse: #ffffff;

  /* color: brand */
  --c-accent: #294b85;
  --c-accent-hover: #22406f;
  --c-accent-dark: #242c5b;
  --c-accent-soft: #eaf1fa;
  --c-accent-line: #c9d8ec;
  --c-cyan: #2689aa;

  /* color: semantic
     - *-ink: 옅은 배경 위 작은 글자용(4.5:1 이상). 점/선/아이콘은 원색 유지.
     - *-line: 태그·알림 헤어라인. */
  --c-teal: #087f83;
  --c-teal-ink: #0b6c70;
  --c-teal-soft: #e4f4f3;
  --c-teal-line: #bfe2e0;
  --c-slate: #52637b;
  --c-slate-soft: #eef2f7;
  --c-slate-line: #d5dde8;
  --c-red: #a12f2f;
  --c-red-hover: #862626;
  --c-red-soft: #f8e6e6;
  --c-red-line: #eec9c9;
  --c-accent-shadow: rgba(36, 44, 91, 0.22);

  /* type */
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕",
    "Noto Sans KR", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "D2Coding", "Nanum Gothic Coding", monospace;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-body: 14px;
  --fs-lg: 16px;
  --fs-xl: 18px;
  --fs-2xl: 22px;
  --fs-3xl: 26px;
  --lh-tight: 1.3;
  --lh-body: 1.55;

  /* spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;

  /* radius / shadow */
  --r-1: 4px;
  --r-2: 8px;
  --r-3: 12px;
  --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(31, 43, 64, 0.05);
  --sh-2: 0 4px 14px rgba(31, 43, 64, 0.08);
  --sh-3: 0 18px 48px rgba(31, 43, 64, 0.18);

  /* layout */
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --control-h: 36px;
  --control-h-sm: 30px;
  --content-max: 1360px;
  --table-min-w: 750px;

  /* motion */
  --dur: 160ms;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ---------- 2. 리셋 / 베이스 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--c-text);
  background: var(--c-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, dl, dd, figure {
  margin: 0;
}

h1, h2, h3, h4 {
  line-height: var(--lh-tight);
  letter-spacing: -0.015em;
  font-weight: 600;
  color: var(--c-text);
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-body); }

ul, ol {
  margin: 0;
  padding: 0;
}

a {
  color: var(--c-accent);
  text-decoration: none;
}

a:hover {
  color: var(--c-accent-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

img, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

strong, b {
  font-weight: 600;
}

small {
  font-size: var(--fs-sm);
}

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--c-surface-3);
  padding: 1px 5px;
  border-radius: var(--r-1);
}

hr {
  border: 0;
  border-top: 1px solid var(--c-border);
  margin: var(--sp-4) 0;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  background: var(--c-accent-soft);
  color: var(--c-accent-dark);
}

/* ---------- 3. 앱 셸 ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* 사이드바 */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--sp-1) var(--sp-2) var(--sp-6);
  color: var(--c-accent-dark);
}

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand span {
  font-size: 16.8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--c-accent-dark);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  flex: 1 1 auto;
}

.nav-section-label {
  display: block;
  margin: var(--sp-4) var(--sp-2) var(--sp-1);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-3);
}

.nav-section-label:first-child {
  margin-top: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 9px var(--sp-3);
  border: 0;
  border-radius: var(--r-2);
  background: transparent;
  color: var(--c-text-2);
  font-weight: 500;
  font-size: var(--fs-body);
  text-align: left;
  text-decoration: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav-link:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
  text-decoration: none;
}

.nav-link.active,
.nav-link[aria-current="page"] {
  background: var(--c-accent-soft);
  color: var(--c-accent);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--c-accent);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  font-size: 15px;
  line-height: 1;
  color: var(--c-text-3);
  border-radius: var(--r-1);
}

.nav-link:hover .nav-icon {
  color: var(--c-accent);
}

/* 활성 모듈: 좌측 바 + 아이콘 칩(CI 파랑 채움) */
.nav-link.active .nav-icon,
.nav-link[aria-current="page"] .nav-icon {
  background: var(--c-accent);
  color: var(--c-text-inverse);
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-link .badge {
  margin-left: auto;
}

.sidebar-footer {
  margin-top: var(--sp-5);
  padding: var(--sp-3) var(--sp-2) 0;
  border-top: 1px solid var(--c-border);
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--c-text-3);
}

.sidebar-footer strong {
  color: var(--c-text-2);
}

/* 메인 영역 */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-height: var(--topbar-h);
  padding: 0 var(--sp-7);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--c-border);
}

.mobile-menu.button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-2);
  background: var(--c-surface);
  color: var(--c-text-2);
  font-size: 18px;
  line-height: 1;
  flex: 0 0 auto;
}

.mobile-menu:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  min-width: 0;
  font-size: var(--fs-md);
  color: var(--c-text-3);
  list-style: none;
}

.breadcrumb > * {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
}

.breadcrumb > * + *::before {
  content: "/";
  color: var(--c-border-strong);
}

.breadcrumb a {
  color: var(--c-text-2);
}

.breadcrumb a:hover {
  color: var(--c-accent);
}

.breadcrumb strong,
.breadcrumb [aria-current] {
  color: var(--c-text);
  font-weight: 600;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
  flex: 0 0 auto;
}

.topbar-tools .field {
  margin: 0;
}

.topbar-tools .field input,
.topbar-tools .field select {
  height: var(--control-h);
  min-width: 0;
}

.profile-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 var(--sp-3) 0 var(--sp-1);
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: var(--fs-md);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.profile-button:hover {
  background: var(--c-surface-2);
  border-color: var(--c-border-strong);
}

.profile-button .avatar {
  width: 30px;
  height: 30px;
  font-size: var(--fs-sm);
}

.profile-button small {
  color: var(--c-text-3);
  font-weight: 400;
}

/* 데모 배너: 회청색, 황색 금지 */
.demo-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-2) var(--sp-7);
  background: var(--c-slate-soft);
  border-bottom: 1px solid var(--c-border);
  color: var(--c-slate);
  font-size: var(--fs-md);
  line-height: 1.5;
}

.demo-banner::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-slate);
  flex: 0 0 auto;
}

.demo-banner strong {
  color: var(--c-text);
}

.demo-banner .button,
.demo-banner .link-button {
  margin-left: auto;
}

#view {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-7);
  min-width: 0;
}

#view > * + * {
  margin-top: var(--sp-6);
}

/* ---------- 4. 페이지 헤딩 / 텍스트 유틸 ---------- */
.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
}

.page-heading > div:first-child,
.page-heading .heading-copy {
  min-width: 0;
  flex: 1 1 320px;
}

.page-heading h1 {
  font-size: var(--fs-2xl);
  letter-spacing: -0.02em;
}

.page-heading p {
  margin-top: var(--sp-1);
  color: var(--c-text-2);
  max-width: 68ch;
}

.page-heading .actions {
  flex: 0 0 auto;
  margin-left: auto;
}

.eyebrow {
  display: block;
  margin-bottom: var(--sp-1);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-accent);
}

.muted {
  color: var(--c-text-3);
}

.hint {
  display: block;
  margin-top: var(--sp-1);
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--c-text-3);
}

.hint.error,
.field.invalid .hint,
.field.error .hint {
  color: var(--c-red);
}

.num,
.tabular,
td.money,
.money {
  font-variant-numeric: tabular-nums;
}

.money,
td.money {
  text-align: right;
  white-space: nowrap;
}

/* ---------- 5. 버튼 ---------- */
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.actions.end {
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-h);
  padding: 0 var(--sp-4);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-2);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: var(--fs-body);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.button:hover {
  background: var(--c-surface-2);
  border-color: var(--c-text-3);
  color: var(--c-text);
  text-decoration: none;
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-text-inverse);
  box-shadow: 0 1px 2px var(--c-accent-shadow);
}

.button.primary:hover {
  background: var(--c-accent-hover);
  border-color: var(--c-accent-hover);
  color: var(--c-text-inverse);
  box-shadow: 0 2px 6px var(--c-accent-shadow);
}

.button.primary:active {
  background: var(--c-accent-dark);
  border-color: var(--c-accent-dark);
  box-shadow: none;
}

.button.secondary {
  background: var(--c-accent-soft);
  border-color: var(--c-accent-line);
  color: var(--c-accent);
}

.button.secondary:hover {
  background: #dde8f6;
  border-color: var(--c-accent-line);
  color: var(--c-accent-dark);
}

.button.danger {
  background: var(--c-surface);
  border-color: var(--c-red);
  color: var(--c-red);
}

.button.danger:hover {
  background: var(--c-red);
  border-color: var(--c-red);
  color: var(--c-text-inverse);
}

.button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--c-text-2);
}

.button.ghost:hover {
  background: var(--c-surface-3);
  color: var(--c-text);
}

.button.small,
.button.sm {
  min-height: var(--control-h-sm);
  padding: 0 var(--sp-3);
  font-size: var(--fs-md);
  border-radius: 6px;
}

.button.icon {
  width: var(--control-h);
  padding: 0;
}

.button.block {
  width: 100%;
}

.button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.link-button {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-accent);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--c-accent-line);
  cursor: pointer;
}

.link-button:hover {
  color: var(--c-accent-dark);
  text-decoration-color: currentColor;
}

.link-button.danger {
  color: var(--c-red);
}

.link-button:disabled {
  color: var(--c-text-3);
  text-decoration: none;
}

/* ---------- 6. 패널 / 그리드 / 지표 ---------- */
.panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-3);
  box-shadow: var(--sh-1);
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
}

.panel-header h2,
.panel-header h3 {
  font-size: var(--fs-lg);
  font-weight: 600;
}

.panel-header p {
  flex-basis: 100%;
  font-size: var(--fs-md);
  color: var(--c-text-2);
}

.panel-header .actions {
  margin-left: auto;
}

.panel-body {
  padding: var(--sp-5);
}

.panel-body > * + * {
  margin-top: var(--sp-4);
}

.panel-body.flush,
.panel > .table-wrap {
  padding: 0;
}

.panel > .table-wrap {
  border: 0;
  border-radius: 0 0 var(--r-3) var(--r-3);
  box-shadow: none;
}

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
  border-radius: 0 0 var(--r-3) var(--r-3);
}

.grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.grid > * {
  min-width: 0;
}

.span-2 {
  grid-column: span 2;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-4) var(--sp-5);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-3);
  /* 단독 지표 카드: 상단 2px 옅은 파랑 선(레이아웃 변화 없음) */
  box-shadow: var(--sh-1), inset 0 2px 0 var(--c-accent-line);
  min-width: 0;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

a.metric,
a.metric:hover,
button.metric {
  color: inherit;
  text-decoration: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

a.metric:hover,
button.metric:hover {
  border-color: var(--c-accent-line);
  box-shadow: var(--sh-2), inset 0 2px 0 var(--c-accent);
}

a.metric:hover .metric-note,
button.metric:hover .metric-note {
  color: var(--c-accent);
}

.panel-body .metric {
  padding: var(--sp-3) var(--sp-4);
  box-shadow: none;
  background: var(--c-surface-2);
}

.metric-label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-text-2);
}

.metric-value {
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--c-accent-dark);
}

.metric-value small,
.metric-value .unit {
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--c-text-3);
  margin-left: 2px;
}

.metric-note {
  font-size: var(--fs-sm);
  color: var(--c-text-3);
}

.metric-note.positive,
.metric-note.teal {
  color: var(--c-teal);
}

.metric-note.negative,
.metric-note.red {
  color: var(--c-red);
}

/* ---------- 7. 툴바 / 폼 필드 ---------- */
.toolbar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-4);
}

.toolbar .field {
  flex: 0 1 220px;
  min-width: 160px;
}

.toolbar .field.grow,
.toolbar .field.search {
  flex: 1 1 260px;
}

.toolbar .actions {
  margin-left: auto;
}

.panel-header .toolbar {
  flex-basis: 100%;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label,
.field > legend,
.field-label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-text-2);
}

.field.required > label::after {
  content: " *";
  color: var(--c-red);
}

.field.inline {
  flex-direction: row;
  align-items: center;
  gap: var(--sp-2);
}

.field.inline > label {
  font-size: var(--fs-body);
  color: var(--c-text);
}

.field input[type="checkbox"],
.field input[type="radio"],
.task-row input[type="checkbox"],
.list-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--c-accent);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]),
select,
textarea {
  width: 100%;
  min-height: var(--control-h);
  padding: 0 var(--sp-3);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-2);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: var(--fs-body);
  line-height: 1.4;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

textarea {
  min-height: 96px;
  padding: var(--sp-2) var(--sp-3);
  resize: vertical;
  line-height: var(--lh-body);
}

select {
  padding-right: 32px;
  appearance: auto;
  -webkit-appearance: auto;
  background-image: none;
  background-repeat: no-repeat;
  background-position: right 12px center;
}

select[multiple] {
  padding-right: var(--sp-3);
  background-image: none;
  min-height: 120px;
}

input::placeholder,
textarea::placeholder {
  color: var(--c-text-3);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--c-text-3);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(41, 75, 133, 0.18);
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly] {
  background: var(--c-surface-3);
  color: var(--c-text-2);
  cursor: default;
}

input[readonly] {
  border-color: var(--c-border);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"],
.field.invalid input,
.field.invalid select,
.field.invalid textarea {
  border-color: var(--c-red);
}

input[aria-invalid="true"]:focus,
.field.invalid input:focus {
  box-shadow: 0 0 0 3px rgba(161, 47, 47, 0.16);
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: auto;
}

input[type="number"] {
  font-variant-numeric: tabular-nums;
}

input[type="date"],
input[type="month"] {
  font-variant-numeric: tabular-nums;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4) var(--sp-5);
}

.form-grid .span-2,
.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid .actions,
form .form-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: var(--sp-2);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
}

/* ---------- 8. 표 ---------- */
.table-wrap {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-3);
  box-shadow: var(--sh-1);
  -webkit-overflow-scrolling: touch;
}

.table-wrap table,
table.table {
  width: 100%;
  min-width: var(--table-min-w);
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-body);
}

.table-wrap caption {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--fs-sm);
  color: var(--c-text-3);
}

.table-wrap th,
.table-wrap td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--c-border);
}

.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 42px;
  padding-top: var(--sp-2);
  padding-bottom: var(--sp-2);
  background: var(--c-surface-2);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.table-wrap tbody tr {
  transition: background-color var(--dur) var(--ease);
}

.table-wrap tbody tr:hover > td {
  background: var(--c-surface-2);
}

.table-wrap tbody tr:last-child > td {
  border-bottom: 0;
}

.table-wrap tbody tr.selected > td,
.table-wrap tbody tr[aria-selected="true"] > td {
  background: var(--c-accent-soft);
}

.table-wrap tbody tr.selected > td:first-child,
.table-wrap tbody tr[aria-selected="true"] > td:first-child {
  box-shadow: inset 3px 0 0 var(--c-accent);
}

.table-wrap tbody tr[tabindex]:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: -2px;
}

.table-wrap tfoot td,
.table-wrap tfoot th {
  background: var(--c-surface-2);
  font-weight: 600;
  border-bottom: 0;
  border-top: 1px solid var(--c-border);
}

.table-wrap td.num,
.table-wrap th.num,
.table-wrap td.money,
.table-wrap th.money,
.table-wrap td.right,
.table-wrap th.right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-wrap td.center,
.table-wrap th.center {
  text-align: center;
}

.table-wrap td.nowrap,
.table-wrap td time,
.table-wrap td .badge {
  white-space: nowrap;
}

.table-wrap td.actions-cell,
.table-wrap td .actions {
  justify-content: flex-end;
  white-space: nowrap;
}

.table-wrap td .actions {
  flex-wrap: nowrap;
}

.table-wrap td.primary,
.table-wrap td strong {
  font-weight: 600;
  color: var(--c-text);
}

.table-wrap td.muted,
.table-wrap td .muted {
  color: var(--c-text-3);
}

.table-wrap .empty {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.table-wrap td .empty,
.table-wrap tr.empty-row td {
  padding: var(--sp-7) var(--sp-4);
  text-align: center;
  color: var(--c-text-3);
}

.table-wrap.compact th,
.table-wrap.compact td {
  padding: var(--sp-2) var(--sp-3);
}

/* ---------- 9. 배지 / 상태 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
  background: var(--c-slate-soft);
  color: var(--c-slate);
  /* 태그 헤어라인: 톤별 옅은 선으로 칩 형태를 분명히 */
  box-shadow: inset 0 0 0 1px var(--c-slate-line);
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

/* teal: 글자는 잉크(대비 5.4:1), 점은 원색 #087F83 유지 */
.badge.teal {
  background: var(--c-teal-soft);
  color: var(--c-teal-ink);
  box-shadow: inset 0 0 0 1px var(--c-teal-line);
}

.badge.teal::before {
  background: var(--c-teal);
}

.badge.blue {
  background: var(--c-accent-soft);
  color: var(--c-accent);
  box-shadow: inset 0 0 0 1px var(--c-accent-line);
}

.badge.slate {
  background: var(--c-slate-soft);
  color: var(--c-slate);
  box-shadow: inset 0 0 0 1px var(--c-slate-line);
}

.badge.red {
  background: var(--c-red-soft);
  color: var(--c-red);
  box-shadow: inset 0 0 0 1px var(--c-red-line);
}

.badge.plain::before {
  display: none;
}

.badge.outline {
  background: transparent;
  box-shadow: inset 0 0 0 1px currentColor;
}

/* 빈 상태 / 권한 없음 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  background: var(--c-surface);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-3);
  color: var(--c-text-2);
}

.empty h2,
.empty h3,
.empty strong {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--c-text);
}

.empty p {
  max-width: 48ch;
  font-size: var(--fs-md);
  color: var(--c-text-2);
}

.empty .actions {
  justify-content: center;
  margin-top: var(--sp-2);
}

.empty.denied {
  border-style: solid;
  background: var(--c-slate-soft);
}

.empty.denied h2,
.empty.denied h3,
.empty.denied strong {
  color: var(--c-slate);
}

.empty.error {
  border-style: solid;
  border-color: var(--c-red);
  background: var(--c-red-soft);
}

.empty.error h2,
.empty.error h3,
.empty.error strong {
  color: var(--c-red);
}

.panel-body > .empty {
  border: 0;
  background: transparent;
  padding: var(--sp-6) var(--sp-4);
}

/* 알림 상자 (선택 사용) */
.notice {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-2);
  background: var(--c-slate-soft);
  border: 1px solid var(--c-slate-line);
  color: var(--c-slate);
  font-size: var(--fs-md);
  line-height: 1.5;
  /* 좌측 3px 톤 바: 알림 톤을 한눈에 */
  box-shadow: inset 3px 0 0 currentColor;
}

.notice.teal {
  background: var(--c-teal-soft);
  border-color: var(--c-teal-line);
  color: var(--c-teal-ink);
  box-shadow: inset 3px 0 0 var(--c-teal);
}

.notice.red {
  background: var(--c-red-soft);
  border-color: var(--c-red-line);
  color: var(--c-red);
}

.notice.blue {
  background: var(--c-accent-soft);
  border-color: var(--c-accent-line);
  color: var(--c-accent);
}

/* ---------- 10. 탭 / 스택 / 리스트 행 / 아바타 ---------- */
.tabs {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--c-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs > button,
.tabs > a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 var(--sp-3);
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--c-text-2);
  font-size: var(--fs-body);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.tabs > button:hover,
.tabs > a:hover {
  color: var(--c-text);
  text-decoration: none;
}

.tabs > .active,
.tabs > .is-active,
.tabs > [aria-selected="true"],
.tabs > [aria-current="page"] {
  color: var(--c-accent);
  font-weight: 600;
  border-bottom-color: var(--c-accent);
}

.tabs > button:focus-visible,
.tabs > a:focus-visible {
  outline-offset: -2px;
  border-radius: var(--r-1);
}

.tabs .badge {
  min-height: 18px;
  padding: 0 6px;
  font-size: var(--fs-xs);
}

.tabs .badge::before {
  display: none;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.stack.tight {
  gap: var(--sp-2);
}

.stack.loose {
  gap: var(--sp-5);
}

.stack.row {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}

.stack > * {
  margin: 0;
}

.list-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--c-border);
  min-width: 0;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row > div:first-child,
.list-row .list-main {
  flex: 1 1 auto;
  min-width: 0;
}

.list-row .list-main > *,
.list-row > div:first-child > * {
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row strong {
  display: block;
  font-weight: 600;
  color: var(--c-text);
}

.list-row .muted,
.list-row small {
  display: block;
  font-size: var(--fs-sm);
  color: var(--c-text-3);
}

.list-row .badge,
.list-row .actions {
  flex: 0 0 auto;
}

.list-row .money {
  font-weight: 600;
  min-width: 96px;
}

.list-row.clickable,
.list-row[role="button"],
a.list-row,
button.list-row {
  width: 100%;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  background: none;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--dur) var(--ease);
}

.list-row.clickable:hover,
.list-row[role="button"]:hover,
a.list-row:hover,
button.list-row:hover {
  background: var(--c-surface-2);
  text-decoration: none;
}

.panel-body > .list-row:first-child {
  padding-top: 0;
}

.panel-body > .list-row:last-child {
  padding-bottom: 0;
}

.panel-body > .stack > .list-row {
  padding: var(--sp-3) 0;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-accent-soft);
  color: var(--c-accent);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0;
  flex: 0 0 auto;
  overflow: hidden;
  user-select: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.lg {
  width: 56px;
  height: 56px;
  font-size: var(--fs-xl);
}

.avatar.sm {
  width: 28px;
  height: 28px;
  font-size: var(--fs-xs);
}

.avatar.teal {
  background: var(--c-teal-soft);
  color: var(--c-teal);
}

.avatar.slate {
  background: var(--c-slate-soft);
  color: var(--c-slate);
}

/* ---------- 11. 타임라인 / 조직도 / 진행률 ---------- */
.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding-left: var(--sp-6);
}

.timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 7px;
  width: 2px;
  background: var(--c-border);
  border-radius: 1px;
}

.timeline > li,
.timeline > .timeline-item {
  position: relative;
  padding: 0 0 var(--sp-4);
  font-size: var(--fs-md);
  line-height: 1.5;
}

.timeline > li:last-child,
.timeline > .timeline-item:last-child {
  padding-bottom: 0;
}

.timeline > li::before,
.timeline > .timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--sp-6) + 3px);
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 2px solid var(--c-accent);
  box-sizing: border-box;
}

.timeline > li.teal::before,
.timeline > .timeline-item.teal::before {
  border-color: var(--c-teal);
  background: var(--c-teal);
}

.timeline > li.red::before,
.timeline > .timeline-item.red::before {
  border-color: var(--c-red);
}

.timeline > li.slate::before,
.timeline > .timeline-item.slate::before {
  border-color: var(--c-border-strong);
}

.timeline time,
.timeline .timeline-date,
.timeline .muted {
  display: block;
  font-size: var(--fs-sm);
  color: var(--c-text-3);
  font-variant-numeric: tabular-nums;
}

.timeline strong {
  color: var(--c-text);
}

.org-tree,
.org-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.org-tree ul {
  margin-left: var(--sp-5);
  padding-left: var(--sp-4);
  border-left: 1px solid var(--c-border);
}

.org-tree li {
  position: relative;
  padding: var(--sp-1) 0;
}

.org-tree ul > li::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--sp-4));
  top: 20px;
  width: var(--sp-3);
  height: 1px;
  background: var(--c-border);
}

.org-tree .org-node,
.org-tree li > div,
.org-tree li > button,
.org-tree li > a {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 32px;
  padding: 4px var(--sp-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-2);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: var(--fs-md);
  text-align: left;
  text-decoration: none;
  max-width: 100%;
}

.org-tree li > button:hover,
.org-tree li > a:hover {
  border-color: var(--c-accent-line);
  background: var(--c-accent-soft);
  text-decoration: none;
}

.org-tree strong {
  font-weight: 600;
}

.org-tree .muted {
  font-size: var(--fs-sm);
}

.org-tree > li > .org-node,
.org-tree > li > div {
  background: var(--c-accent-soft);
  border-color: var(--c-accent-line);
  color: var(--c-accent-dark);
  font-weight: 600;
}

.org-tree .active > .org-node,
.org-tree .active > div,
.org-tree .is-me > .org-node {
  box-shadow: inset 0 0 0 1px var(--c-accent);
}

/* 진행률: <div class="progress"><span style="width:40%"></span></div> 또는 <progress> */
.progress {
  position: relative;
  display: block;
  width: 100%;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--c-surface-3);
  overflow: hidden;
}

.progress > span,
.progress > i,
.progress > div,
.progress-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--c-accent);
  transition: width 300ms var(--ease);
}

.progress.teal > *,
.progress > .teal {
  background: var(--c-teal);
}

.progress.red > *,
.progress > .red {
  background: var(--c-red);
}

.progress.slate > *,
.progress > .slate {
  background: var(--c-border-strong);
}

.progress.thin {
  height: 4px;
}

progress.progress,
progress {
  appearance: auto;
  -webkit-appearance: auto;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--c-surface-3);
  overflow: hidden;
  color: var(--c-accent);
}

progress::-webkit-progress-bar {
  background: var(--c-surface-3);
  border-radius: var(--r-pill);
}

progress::-webkit-progress-value {
  background: var(--c-accent);
  border-radius: var(--r-pill);
}

progress::-moz-progress-bar {
  background: var(--c-accent);
  border-radius: var(--r-pill);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.progress-row .progress {
  flex: 1 1 auto;
}

.progress-row .num,
.progress-row .muted {
  flex: 0 0 auto;
  min-width: 40px;
  text-align: right;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

/* ---------- 12. 홈: 히어로 / 모듈 런처 / 바로가기 / 과업 / 프로젝트 카드 ---------- */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-5) var(--sp-7);
  padding: var(--sp-7);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(234, 241, 250, 0.9) 0%, rgba(234, 241, 250, 0) 55%),
    linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: var(--sh-1);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 28px solid rgba(41, 75, 133, 0.05);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  flex: 1 1 360px;
  min-width: 0;
  max-width: 62ch;
}

.hero h1 {
  font-size: var(--fs-3xl);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--c-text);
}

.hero h1 strong,
.hero h1 em {
  font-style: normal;
  color: var(--c-accent);
}

.hero-copy p {
  margin-top: var(--sp-2);
  color: var(--c-text-2);
}

.welcome-date {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--c-text-2);
  font-variant-numeric: tabular-nums;
}

.welcome-date::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--c-cyan);
}

.hero-meta {
  position: relative;
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: var(--sp-3);
  flex: 0 1 auto;
}

.hero-meta > * {
  min-width: 128px;
}

.hero-meta .metric {
  padding: var(--sp-3) var(--sp-4);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: none;
}

.hero-meta .metric-value {
  font-size: var(--fs-2xl);
}

.hero .actions {
  flex-basis: 100%;
}

.hero .actions:empty {
  display: none;
}

/* 모듈 런처 (Odoo 스타일 앱 그리드) */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
}

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-3);
  width: 100%;
  min-height: 132px;
  padding: var(--sp-5);
  border: 1px solid var(--c-border);
  border-radius: var(--r-3);
  background: var(--c-surface);
  color: var(--c-text);
  text-align: left;
  text-decoration: none;
  font: inherit;
  box-shadow: var(--sh-1);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    transform var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.app-card:hover {
  border-color: var(--c-accent-line);
  box-shadow: var(--sh-2);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--c-text);
}

.app-card:active {
  transform: translateY(0);
}

.app-card:focus-visible {
  outline-offset: 3px;
}

.app-card strong,
.app-card h3,
.app-card .app-title {
  display: block;
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.3;
  color: var(--c-text);
}

.app-card p,
.app-card .muted,
.app-card small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--c-text-3);
}

.app-card .badge {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
}

.app-card.disabled,
.app-card[aria-disabled="true"],
.app-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.app-card.compact {
  flex-direction: row;
  align-items: center;
  min-height: 0;
  padding: var(--sp-3) var(--sp-4);
}

.app-card.compact .card-icon {
  width: 36px;
  height: 36px;
  font-size: 16px;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--c-accent-soft);
  color: var(--c-accent);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.card-icon svg {
  width: 22px;
  height: 22px;
}

.card-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.app-card:hover .card-icon {
  background: var(--c-accent);
  color: var(--c-text-inverse);
}

.card-icon.teal {
  background: var(--c-teal-soft);
  color: var(--c-teal);
}

.card-icon.slate {
  background: var(--c-slate-soft);
  color: var(--c-slate);
}

.card-icon.cyan {
  background: #e3f2f7;
  color: var(--c-cyan);
}

.app-card:hover .card-icon.teal {
  background: var(--c-teal);
  color: var(--c-text-inverse);
}

.app-card:hover .card-icon.slate {
  background: var(--c-slate);
  color: var(--c-text-inverse);
}

.app-card:hover .card-icon.cyan {
  background: var(--c-cyan);
  color: var(--c-text-inverse);
}

/* 바로가기 */
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  list-style: none;
}

.quick-links > a,
.quick-links > button,
.quick-links > li > a,
.quick-links > li > button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 var(--sp-3) 0 var(--sp-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-text-2);
  font-size: var(--fs-md);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.quick-links > a:hover,
.quick-links > button:hover,
.quick-links > li > a:hover,
.quick-links > li > button:hover {
  border-color: var(--c-accent-line);
  background: var(--c-accent-soft);
  color: var(--c-accent);
  text-decoration: none;
}

.quick-links .nav-icon,
.quick-links .card-icon {
  width: 20px;
  height: 20px;
  font-size: 13px;
  border-radius: 4px;
  background: transparent;
  color: inherit;
}

/* 오늘 할 일 행 */
.task-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--c-border);
  min-width: 0;
}

.task-row:last-child {
  border-bottom: 0;
}

.task-row > div:first-of-type,
.task-row .task-main {
  flex: 1 1 auto;
  min-width: 0;
}

.task-row strong,
.task-row .task-title {
  display: block;
  font-weight: 600;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row .muted,
.task-row small,
.task-row .task-meta {
  display: block;
  font-size: var(--fs-sm);
  color: var(--c-text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row .badge,
.task-row .actions,
.task-row time {
  flex: 0 0 auto;
}

.task-row time {
  font-size: var(--fs-sm);
  color: var(--c-text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.task-row .card-icon {
  width: 36px;
  height: 36px;
  font-size: 15px;
  border-radius: var(--r-2);
}

a.task-row,
a.task-row:hover,
button.task-row {
  color: inherit;
  text-decoration: none;
  font: inherit;
  text-align: left;
  width: 100%;
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  cursor: pointer;
}

a.task-row:hover strong,
button.task-row:hover strong {
  color: var(--c-accent);
}

a.task-row:hover .card-icon,
button.task-row:hover .card-icon {
  background: var(--c-accent);
  color: var(--c-text-inverse);
}

.task-row.done strong,
.task-row.done .task-title {
  color: var(--c-text-3);
  text-decoration: line-through;
  font-weight: 500;
}

.task-row.done .card-icon {
  background: var(--c-teal-soft);
  color: var(--c-teal);
}

.task-row.overdue .badge,
.task-row.overdue time {
  color: var(--c-red);
}

/* 프로젝트 카드 */
.project-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border: 1px solid var(--c-border);
  border-radius: var(--r-3);
  background: var(--c-surface);
  box-shadow: var(--sh-1);
  color: var(--c-text);
  min-width: 0;
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

a.project-card:hover,
button.project-card:hover,
.project-card.clickable:hover {
  border-color: var(--c-accent-line);
  box-shadow: var(--sh-2);
  text-decoration: none;
}

button.project-card {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.project-card header,
.project-card .project-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}

.project-card h3,
.project-card strong.project-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.3;
  min-width: 0;
  overflow-wrap: anywhere;
}

.project-card .eyebrow {
  margin-bottom: 2px;
}

.project-card p {
  font-size: var(--fs-md);
  color: var(--c-text-2);
}

.project-card .badge {
  flex: 0 0 auto;
}

.project-card .progress {
  margin-top: var(--sp-1);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--c-text-3);
  font-variant-numeric: tabular-nums;
}

.project-meta > * {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.project-meta dt {
  color: var(--c-text-3);
}

.project-meta dt::after {
  content: "";
}

.project-meta dd {
  margin: 0;
  color: var(--c-text-2);
  font-weight: 500;
}

.project-meta strong,
.project-meta b {
  color: var(--c-text);
  font-weight: 600;
}

.project-meta .money {
  text-align: left;
}

.project-card footer,
.project-card .project-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--c-border);
  font-size: var(--fs-sm);
  color: var(--c-text-3);
}

/* ---------- 13. 모달 (HTML dialog) ---------- */
#modal-dialog,
dialog.modal {
  width: min(800px, calc(100vw - 32px));
  max-width: 800px;
  max-height: 90vh;
  max-height: 90dvh;
  margin: auto;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: 16px;
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: var(--sh-3);
  overflow: hidden;
}

#modal-dialog[open],
dialog.modal[open] {
  display: flex;
  flex-direction: column;
  animation: modal-in 180ms var(--ease);
}

#modal-dialog::backdrop,
dialog.modal::backdrop {
  background: rgba(31, 43, 64, 0.48);
  backdrop-filter: blur(2px);
  animation: fade-in 180ms var(--ease);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6) var(--sp-4);
  border-bottom: 1px solid var(--c-border);
  flex: 0 0 auto;
}

.modal-header h2 {
  font-size: var(--fs-xl);
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}

.modal-header button,
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  margin-right: -8px;
  border: 0;
  border-radius: var(--r-2);
  background: transparent;
  color: var(--c-text-3);
  font-size: 22px;
  line-height: 1;
}

.modal-header button:hover,
.modal-close:hover {
  background: var(--c-surface-3);
  color: var(--c-text);
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-body > * + * {
  margin-top: var(--sp-4);
}

.modal-body .form-grid + .actions,
.modal-body form > .actions,
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding-top: var(--sp-4);
  margin-top: var(--sp-5);
  border-top: 1px solid var(--c-border);
}

.modal-body .table-wrap table {
  min-width: 750px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
  flex: 0 0 auto;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- 14. 토스트 ---------- */
.toast-container {
  position: fixed;
  right: var(--sp-6);
  bottom: var(--sp-6);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-2);
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 220px;
  max-width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-3);
  background: var(--c-text);
  color: var(--c-text-inverse);
  font-size: var(--fs-md);
  line-height: 1.45;
  box-shadow: var(--sh-3);
  pointer-events: auto;
  animation: toast-in 200ms var(--ease);
}

.toast::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-cyan);
  flex: 0 0 auto;
}

.toast.teal::before,
.toast.success::before {
  background: #3fc7c0;
}

.toast.red::before,
.toast.error::before {
  background: #f08a8a;
}

.toast.slate::before,
.toast.info::before {
  background: var(--c-border-strong);
}

.toast button,
.toast .link-button {
  margin-left: auto;
  color: #cfe0f5;
  text-decoration: none;
  background: none;
  border: 0;
  font-weight: 600;
  white-space: nowrap;
}

.toast button:hover,
.toast .link-button:hover {
  color: var(--c-text-inverse);
}

.toast.is-leaving,
.toast.hide {
  animation: toast-out 200ms var(--ease) forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------- 15. 반응형 ---------- */
@media (max-width: 1200px) {
  .grid.cols-4,
  .grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .demo-banner {
    padding-left: var(--sp-6);
    padding-right: var(--sp-6);
  }

  #view {
    padding: var(--sp-6);
  }

  .hero {
    padding: var(--sp-6);
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-w: 272px;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 사이드바: 모바일 고정 드로어 */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    max-width: 86vw;
    height: 100dvh;
    transform: translateX(-100%);
    visibility: hidden;
    box-shadow: none;
    transition: transform 220ms var(--ease), visibility 0s linear 220ms, box-shadow 220ms var(--ease);
    z-index: 60;
  }

  .sidebar.is-open {
    transform: none;
    visibility: visible;
    box-shadow: var(--sh-3);
    transition: transform 220ms var(--ease), visibility 0s, box-shadow 220ms var(--ease);
  }

  /* 드로어 뒤 어둡게: 부모 JS가 body.nav-open 또는 .sidebar-backdrop.is-open 사용 가능 */
  body.nav-open::before,
  .sidebar-backdrop.is-open {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(31, 43, 64, 0.4);
    z-index: 50;
  }

  .mobile-menu.button {
    display: inline-flex;
  }

  .topbar {
    gap: var(--sp-3);
    min-height: 56px;
    padding: 0 var(--sp-4);
  }

  .breadcrumb {
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .breadcrumb > * {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .profile-button {
    padding-right: var(--sp-1);
    gap: 0;
  }

  .profile-button > *:not(.avatar) {
    display: none;
  }

  .demo-banner {
    padding: var(--sp-2) var(--sp-4);
    font-size: var(--fs-sm);
  }

  #view {
    padding: var(--sp-4);
  }

  #view > * + * {
    margin-top: var(--sp-5);
  }

  .page-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .page-heading .actions {
    margin-left: 0;
  }

  .page-heading h1 {
    font-size: 20px;
  }

  .grid,
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .span-2 {
    grid-column: auto;
  }

  .module-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--sp-3);
  }

  .app-card {
    padding: var(--sp-4);
    min-height: 0;
  }

  .hero {
    padding: var(--sp-5);
    border-radius: var(--r-3);
    align-items: stretch;
  }

  .hero h1 {
    font-size: var(--fs-2xl);
  }

  .hero-meta {
    width: 100%;
  }

  .hero-meta > * {
    flex: 1 1 120px;
  }

  .hero::after {
    display: none;
  }

  .panel-header,
  .panel-body {
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }

  .panel-header .actions {
    margin-left: 0;
    flex-basis: 100%;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar .field,
  .toolbar .field.grow,
  .toolbar .field.search {
    flex: 1 1 100%;
    min-width: 0;
  }

  .toolbar .actions {
    margin-left: 0;
    width: 100%;
  }

  .toolbar .actions .button {
    flex: 1 1 auto;
  }

  .table-wrap {
    border-radius: var(--r-2);
  }

  .table-wrap th,
  .table-wrap td {
    padding: var(--sp-2) var(--sp-3);
  }

  .metric-value {
    font-size: var(--fs-2xl);
  }

  .list-row,
  .task-row {
    flex-wrap: wrap;
  }

  .list-row .actions,
  .task-row .actions {
    flex-basis: 100%;
    justify-content: flex-end;
  }

  #modal-dialog,
  dialog.modal {
    width: calc(100vw - 16px);
    max-height: min(90vh, calc(100dvh - 16px));
    border-radius: var(--r-3);
  }

  .modal-header {
    padding: var(--sp-4) var(--sp-4) var(--sp-3);
  }

  .modal-body {
    padding: var(--sp-4);
  }

  .modal-footer {
    padding: var(--sp-3) var(--sp-4);
  }

  .toast-container {
    left: var(--sp-3);
    right: var(--sp-3);
    bottom: var(--sp-3);
    align-items: stretch;
    max-width: none;
  }

  .toast {
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .hero-meta > * {
    flex-basis: 100%;
  }

  .actions .button {
    flex: 1 1 auto;
  }

  .page-heading .actions .button,
  .modal-actions .button {
    flex: 1 1 auto;
  }
}

/* ---------- 16. 모션 감소 ---------- */
@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;
  }

  .app-card:hover {
    transform: none;
  }

  .sidebar {
    transition: none;
  }
}

/* ---------- 17. 인쇄 ---------- */
@media print {
  @page {
    margin: 14mm;
  }

  html,
  body {
    background: #fff;
    color: #000;
  }

  .sidebar,
  .topbar,
  .demo-banner,
  .mobile-menu,
  .toast-container,
  .button,
  .link-button,
  .actions,
  .tabs,
  .toolbar,
  .sidebar-backdrop,
  .modal-header button,
  .modal-close,
  .modal-footer,
  .modal-actions,
  button:not(.app-card):not(.project-card) {
    display: none !important;
  }

  .app-shell {
    display: block;
    min-height: 0;
  }

  .main-area {
    min-height: 0;
  }

  #view {
    max-width: none;
    padding: 0;
  }

  .panel,
  .metric,
  .app-card,
  .project-card,
  .table-wrap,
  .hero,
  .empty {
    box-shadow: none;
    border-color: #bbb;
    break-inside: avoid;
    background: #fff;
  }

  .hero::after {
    display: none;
  }

  .table-wrap {
    overflow: visible;
  }

  .table-wrap table {
    min-width: 0;
  }

  .table-wrap thead th {
    position: static;
    background: #f0f0f0;
    color: #000;
  }

  .table-wrap tbody tr:hover > td {
    background: transparent;
  }

  .badge {
    box-shadow: inset 0 0 0 1px currentColor;
    background: transparent;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  .app-card:hover .card-icon {
    background: var(--c-accent-soft);
    color: var(--c-accent);
  }

  /* 모달 열린 상태: 모달 내용만 인쇄 (:has 지원 브라우저) */
  body:has(#modal-dialog[open]) .app-shell,
  body:has(dialog.modal[open]) .app-shell {
    display: none !important;
  }

  #modal-dialog[open],
  dialog.modal[open] {
    position: static;
    display: block;
    width: auto;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    animation: none;
  }

  #modal-dialog::backdrop,
  dialog.modal::backdrop {
    display: none;
  }

  .modal-header {
    padding: 0 0 var(--sp-3);
    border-bottom: 1px solid #bbb;
  }

  .modal-body {
    padding: var(--sp-4) 0 0;
    overflow: visible;
  }
}

.hero-meta { flex-direction: column; align-items: flex-start; gap: 8px; }
@media (max-width: 900px) { .page-heading > div:first-child, .page-heading .heading-copy { flex-basis: auto; } }
@media (max-width: 480px) { .module-grid { grid-template-columns: minmax(0, 1fr); } }
