/* ─────────────────────────────────────────────────────────────────────────
   경인창호 안전보건시스템 — 공용 화면 틀 (windowplatform 관리자 앱 기준)

   출처: mono-platform 8039f00 (2026-09-07)
     · 색·모서리 토큰   apps/admin/src/app/globals.css (값 그대로)
     · 사이드바         components/ui/sidebar.tsx (폭 15.5rem) + layout/app-sidebar.tsx
     · 상단바           layout/app-header.tsx (52px, 빵부스러기, 모바일은 제목만)
     · 모바일 하단 메뉴 layout/mobile-bottom-nav.tsx (고정, 슬레이트 950, 전체 메뉴 시트)
     · 페이지 머리      layout/page-header.tsx (eyebrow 11px 파랑 · 제목 26/32px)
     · 카드·버튼·배지·표·입력  components/ui/{card,button,badge,table,input}.tsx
     · 모바일 규칙      docs/superpowers/2026-09-07-admin-ui-ux-review.md
                        (터치 44px 이상, 입력 글자 16px, 모바일 95%)

   쓰는 법: <link rel="stylesheet" href="kw-platform.css"> + <script src="kw-shell.js">
   접두사 kwp- 만 쓴다. 기존 kw-theme.css(kw-) 와 섞이지 않는다.
   빌드 없음 — 이 파일 하나로 끝난다.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* === 프리미엄 슬레이트 (라이트) — globals.css 값 그대로 === */
  --background: 216 33% 97%;
  --foreground: 222 47% 13%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  --primary: 222.2 47.4% 11.2%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215 19% 40%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 214.3 31.8% 91.4%;
  --input: 214 25% 80%;
  --ring: 222.2 84% 4.9%;
  --radius: 0.5rem;

  --success: 142.1 76.2% 36.3%;
  --success-foreground: 355.7 100% 97.3%;
  --warning: 37.7 92.1% 50.2%;
  --warning-foreground: 26 83.3% 14.1%;
  --info: 217.2 91.2% 59.8%;
  --info-foreground: 210 40% 98%;

  --chart-1: 221 83% 53%;
  --chart-2: 160 84% 39%;
  --chart-3: 262 83% 58%;
  --chart-4: 24 95% 53%;
  --chart-5: 330 81% 60%;

  --sidebar-background: 222.2 47.4% 11.2%;
  --sidebar-foreground: 213 31% 91%;
  --sidebar-primary: 217.2 91.2% 59.8%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 215 28% 17%;
  --sidebar-accent-foreground: 213 31% 91%;
  --sidebar-border: 215 20% 20%;
  --sidebar-ring: 217.2 91.2% 59.8%;

  /* 치수 (sidebar.tsx · app-header.tsx · mobile-bottom-nav.tsx) */
  --kwp-sidebar-w: 15.5rem;
  --kwp-sidebar-header-h: 68px;
  --kwp-header-h: 52px;
  --kwp-bottom-nav-h: 4.5rem;
  --kwp-content-max: 80rem;
}

.dark {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;
  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;
  --primary: 210 40% 98%;
  --primary-foreground: 222.2 47.4% 11.2%;
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 212.7 26.8% 83.9%;
  --success: 142.1 70.6% 45.3%;
  --success-foreground: 144.9 80.4% 10%;
  --info-foreground: 222.2 47.4% 11.2%;
  --sidebar-foreground: 210 40% 98%;
  --sidebar-primary: 210 40% 98%;
  --sidebar-primary-foreground: 222.2 47.4% 11.2%;
  --sidebar-accent: 217.2 32.6% 17.5%;
  --sidebar-accent-foreground: 210 40% 98%;
  --sidebar-border: 217.2 32.6% 17.5%;
}

/* ── 바탕 ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; border-color: hsl(var(--border)); }
html { scrollbar-gutter: stable; -webkit-text-size-adjust: 100%; }
html, body { max-width: 100%; overflow-x: clip; }
body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo",
               "Malgun Gothic", "맑은 고딕", "Noto Sans KR", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: keep-all;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: hsl(var(--primary) / 0.15); color: hsl(var(--foreground)); }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: hsl(var(--muted-foreground) / 0.3); border-radius: 9999px; }
*::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground) / 0.5); }
*::-webkit-scrollbar-track { background: transparent; }
.kwp-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── 앱 틀: 사이드바 + 본문 ────────────────────────────────────────── */
.kwp-app { display: flex; min-height: 100svh; width: 100%; }

.kwp-sidebar {
  display: none;
  position: fixed; inset-block: 0; left: 0; z-index: 10;
  width: var(--kwp-sidebar-w); height: 100svh;
  flex-direction: column;
  background: hsl(var(--sidebar-background));
  color: hsl(var(--sidebar-foreground));
  border-right: 1px solid rgb(30 41 59 / 0.8);
}
.kwp-sidebar-header {
  height: var(--kwp-sidebar-header-h);
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
  flex: none;
}
.kwp-brand {
  display: flex; align-items: center; gap: 12px; height: 100%; padding: 0 18px;
  text-decoration: none; color: inherit;
}
.kwp-brand:hover { opacity: .9; }
.kwp-brand-tile {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #4f46e5);
  color: #fff; font-size: 15px; font-weight: 900;
  box-shadow: 0 8px 20px rgb(37 99 235 / 0.28);
}
.kwp-brand-name { display: block; font-size: 14px; font-weight: 700; letter-spacing: -0.02em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kwp-brand-sub { display: block; margin-top: 2px; font-size: 9px; font-weight: 600; letter-spacing: 0.12em; color: #94a3b8; }

.kwp-sidebar-content { flex: 1; overflow-y: auto; padding: 8px 0; }
.kwp-nav-group { padding: 8px 12px; }
.kwp-nav-label {
  display: flex; align-items: center; height: 28px; padding: 0 12px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em; color: #94a3b8;
}
.kwp-nav-menu { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.kwp-nav-item {
  display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px;
  border-radius: 9px; text-decoration: none;
  font-size: 13px; font-weight: 600; color: hsl(var(--sidebar-foreground) / 0.65);
  transition: background-color .15s, color .15s, transform .15s;
  width: 100%; border: 0; background: none; cursor: pointer; text-align: left;
}
.kwp-nav-item:hover { background: rgb(255 255 255 / 0.055); color: #fff; transform: translateX(1px); }
.kwp-nav-item svg { width: 18px; height: 18px; flex: none; color: #94a3b8; transition: color .15s; }
.kwp-nav-item .kwp-chev { margin-left: auto; width: 16px; height: 16px; color: #64748b; transition: transform .2s; }
.kwp-nav-item[aria-expanded="true"] .kwp-chev { transform: rotate(90deg); }
.kwp-nav-item.is-active {
  background: hsl(var(--sidebar-accent)); color: #fff;
  box-shadow: inset 3px 0 0 #60a5fa;
}
.kwp-nav-item.is-active svg { color: #93c5fd; }
.kwp-nav-sub {
  list-style: none; margin: 0 16px; padding: 4px 8px;
  border-left: 1px solid rgb(51 65 85 / 0.7);
  display: flex; flex-direction: column; gap: 2px;
}
.kwp-nav-sub[hidden] { display: none; }
.kwp-nav-subitem {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border-radius: 8px; text-decoration: none;
  font-size: 12px; font-weight: 500; color: hsl(var(--sidebar-foreground) / 0.6);
}
.kwp-nav-subitem:hover { background: rgb(255 255 255 / 0.05); color: #fff; }
.kwp-nav-subitem svg { width: 16px; height: 16px; flex: none; color: #64748b; }
.kwp-nav-subitem.is-active { background: rgb(255 255 255 / 0.07); color: #fff; }
.kwp-nav-subitem.is-active svg { color: #93c5fd; }
.kwp-nav-count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9999px; font-size: 10px; font-weight: 700;
  background: hsl(var(--destructive)); color: #fff;
}
.kwp-sidebar-footer { flex: none; padding: 12px; border-top: 1px solid rgb(255 255 255 / 0.08); }
.kwp-user {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px;
  font-size: 12px; color: hsl(var(--sidebar-foreground) / 0.75);
}
.kwp-user-avatar {
  width: 30px; height: 30px; border-radius: 9999px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgb(255 255 255 / 0.08); color: #fff; font-size: 12px; font-weight: 700;
}
.kwp-user b { display: block; color: #fff; font-size: 12.5px; }
.kwp-user small { display: block; font-size: 10.5px; color: #94a3b8; }

/* ── 계정 메뉴 (로그인 통일 C6 · 플랫폼 auth.button: 사이드바 단추 · 폭 14rem 메뉴 · 항목 44px · 로그아웃 빨강) ── */
button.kwp-user {
  width: 100%; min-height: 52px; margin: 0; border: 1px solid rgb(255 255 255 / 0.08); border-radius: 11px;
  background: rgb(255 255 255 / 0.035); font: inherit; text-align: left; cursor: pointer;
}
button.kwp-user:hover { background: rgb(255 255 255 / 0.06); }
.kwp-user-txt { display: block; min-width: 0; }
.kwp-user-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kwp-user-avatar { position: relative; }
.kwp-user-avatar.is-warn::after {
  content: ""; position: absolute; top: -1px; right: -1px; width: 9px; height: 9px; border-radius: 9999px;
  background: hsl(var(--destructive)); box-shadow: 0 0 0 2px hsl(var(--sidebar-background));
}
button.kwp-user-chip { border: 0; background: transparent; font: inherit; cursor: pointer; }
button.kwp-user-chip:hover { background: hsl(var(--accent)); }
.kwp-acct-mbtn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin: 0; padding: 0;
  border: 0; border-radius: 9px; background: transparent; color: hsl(var(--foreground)); cursor: pointer;
}
.kwp-acct-mbtn svg { width: 18px; height: 18px; }
button.kwp-user:focus-visible, button.kwp-user-chip:focus-visible, .kwp-acct-mbtn:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--ring) / 0.5); }
.kwp-acct-menu {
  position: fixed; z-index: 70; width: 14rem; margin: 0; padding: 4px;
  border: 1px solid hsl(var(--border)); border-radius: 6px; background: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
.kwp-acct-head { padding: 6px 8px; }
.kwp-acct-head b { display: block; font-size: 14px; font-weight: 500; }
.kwp-acct-head small { display: block; font-size: 12px; color: hsl(var(--muted-foreground)); }
.kwp-acct-warn { margin: 2px 4px 4px; padding: 6px 8px; border-radius: 4px; background: #fef3c7; color: #92400e; font-size: 12px; font-weight: 600; }
.kwp-acct-sep { height: 1px; margin: 4px -4px; background: hsl(var(--border)); }
.kwp-acct-item {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; margin: 0; padding: 6px 8px;
  border: 0; border-radius: 4px; background: transparent; color: inherit; font: inherit; font-size: 14px;
  text-decoration: none; text-align: left; cursor: pointer;
}
.kwp-acct-item:hover, .kwp-acct-item:focus-visible { background: hsl(var(--accent)); outline: none; }
.kwp-acct-item svg { width: 16px; height: 16px; flex: none; color: hsl(var(--muted-foreground)); }
.kwp-acct-item.is-danger, .kwp-acct-item.is-danger svg { color: #dc2626; }
@media (min-width: 768px) { .kwp-acct-mbtn { display: none; } }
@media print { .kwp-acct-menu, .kwp-acct-mbtn { display: none !important; } }
@media (min-width: 768px) { .kwp-app.is-collapsed .kwp-user-txt { display: none; } }

/* ── 본문 영역 ────────────────────────────────────────────────────── */
.kwp-inset { position: relative; display: flex; flex: 1; flex-direction: column; min-width: 0; width: 100%; }

.kwp-header {
  position: sticky; top: 0; z-index: 30; flex: none;
  border-bottom: 1px solid hsl(var(--border) / 0.7);
  background: hsl(var(--background) / 0.9);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.kwp-header-row {
  display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) 2.25rem;
  align-items: center; height: var(--kwp-header-h); padding: 0 12px;
}
.kwp-header-trigger {
  display: none; width: 36px; height: 36px; border-radius: 9px; border: 0;
  background: transparent; cursor: pointer; align-items: center; justify-content: center;
  color: hsl(var(--foreground));
}
.kwp-header-trigger:hover { background: hsl(var(--accent)); }
.kwp-header-trigger svg { width: 16px; height: 16px; }
.kwp-header-mobile-title { display: flex; min-width: 0; align-items: center; justify-content: center; padding: 0 8px; }
.kwp-header-mobile-title span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 700; letter-spacing: -0.02em; }
.kwp-breadcrumb { display: none; min-width: 0; flex: 1; align-items: center; gap: 6px; overflow: hidden; font-size: 13px; white-space: nowrap; }
.kwp-breadcrumb a { color: hsl(var(--muted-foreground)); text-decoration: none; }
.kwp-breadcrumb a:hover { color: hsl(var(--foreground)); }
.kwp-breadcrumb .kwp-sep { color: hsl(var(--muted-foreground)); display: inline-flex; }
.kwp-breadcrumb .kwp-sep svg { width: 14px; height: 14px; }
.kwp-breadcrumb .kwp-vsep { width: 1px; height: 16px; background: hsl(var(--border)); margin: 0 8px; flex: none; }
.kwp-breadcrumb b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.kwp-header-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.kwp-header-right .kwp-user-chip {
  display: none; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; color: hsl(var(--foreground));
}
.kwp-header-right .kwp-user-chip .kwp-user-avatar { width: 26px; height: 26px; background: hsl(var(--primary)); font-size: 11px; }

.kwp-content { display: flex; flex: 1; flex-direction: column; background: hsl(var(--muted) / 0.3); }
.kwp-container {
  margin: 0 auto; width: 100%; max-width: var(--kwp-content-max);
  display: flex; flex-direction: column; gap: 20px; padding: 16px 12px 24px;
}
.kwp-container.is-wide { max-width: 1540px; }

/* 페이지 머리 (page-header.tsx) */
.kwp-page-header { display: flex; flex-direction: column; gap: 16px; }
.kwp-page-eyebrow { display: none; margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: #2563eb; }
.kwp-page-title { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.04em; color: hsl(var(--foreground)); }
.kwp-page-title-rule { margin-top: 6px; height: 2px; width: 48px; border-radius: 9999px; background: linear-gradient(90deg, hsl(var(--primary) / 0.6), hsl(var(--primary) / 0)); }
.kwp-page-desc { margin: 8px 0 0; font-size: 14px; line-height: 1.6; color: hsl(var(--muted-foreground)); }
.kwp-page-action { display: flex; width: 100%; align-items: center; gap: 8px; }

/* 절 제목 (화면 회귀 검사 시안의 '통화 인사이트', '계약 목록' 패턴) */
.kwp-section { display: flex; flex-direction: column; gap: 10px; }
.kwp-section-title { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.kwp-section-desc { margin: -4px 0 0; font-size: 13px; color: hsl(var(--muted-foreground)); }
.kwp-section-head { display: flex; align-items: center; gap: 10px; }
.kwp-section-head .kwp-more { margin-left: auto; font-size: 12.5px; font-weight: 600; color: hsl(var(--muted-foreground)); text-decoration: none; }
.kwp-section-head .kwp-more:hover { color: hsl(var(--foreground)); }

/* ── 카드 (card.tsx: default = rounded-xl shadow-sm border / operations = rounded-2xl 이중 그림자) ── */
.kwp-card {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border)); border-radius: 12px;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.kwp-card.is-operations {
  border-radius: 16px;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 12px 30px rgb(15 23 42 / 0.04);
}
.kwp-card-header { display: flex; flex-direction: column; gap: 6px; padding: 20px 20px 0; }
.kwp-card-header.is-row { flex-direction: row; align-items: center; gap: 8px; }
.kwp-card-header .kwp-more { margin-left: auto; font-size: 12.5px; font-weight: 600; color: hsl(var(--muted-foreground)); text-decoration: none; white-space: nowrap; }
.kwp-card-header .kwp-more:hover { color: hsl(var(--foreground)); }
.kwp-card-title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
.kwp-card-desc { margin: 0; font-size: 13px; color: hsl(var(--muted-foreground)); }
.kwp-card-content { padding: 20px; }
.kwp-card-header + .kwp-card-content { padding-top: 14px; }
.kwp-card-footer { display: flex; align-items: center; gap: 8px; padding: 0 20px 20px; }
.kwp-card.is-tone-warning { border-color: hsl(var(--warning) / 0.45); background: hsl(var(--warning) / 0.05); }
.kwp-card.is-tone-destructive { border-color: hsl(var(--destructive) / 0.45); background: hsl(var(--destructive) / 0.05); }
.kwp-card.is-tone-success { border-color: hsl(var(--success) / 0.4); background: hsl(var(--success) / 0.04); }
.kwp-card.is-tone-info { border-color: hsl(var(--info) / 0.4); background: hsl(var(--info) / 0.05); }

/* 요약 숫자 카드 (회귀 검사 시안의 '진행 계약 24건' 패턴) */
.kwp-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kwp-stat { padding: 18px 20px; }
.kwp-stat-label { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-bottom: 6px; }
.kwp-stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.kwp-stat-value small { font-size: 14px; font-weight: 500; color: hsl(var(--muted-foreground)); margin-left: 2px; }
.kwp-stat-sub { margin-top: 6px; font-size: 12px; color: hsl(var(--muted-foreground)); }

.kwp-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.kwp-grid-3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

/* ── 배지 (badge.tsx) ─────────────────────────────────────────────── */
.kwp-badge {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  border-radius: 9999px; border: 1px solid transparent; padding: 2px 10px;
  font-size: 12px; font-weight: 600; line-height: 1.35;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
}
.kwp-badge.is-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.kwp-badge.is-muted { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.kwp-badge.is-success { background: #d1fae5; color: #047857; }
.kwp-badge.is-warning { background: #fef3c7; color: #b45309; }
.kwp-badge.is-destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.kwp-badge.is-danger-soft { background: #fee2e2; color: #b91c1c; }
.kwp-badge.is-info { background: #dbeafe; color: #1d4ed8; }
.kwp-badge.is-outline { background: transparent; color: hsl(var(--foreground)); border-color: hsl(var(--border)); }

/* ── 버튼 (button.tsx: 모바일 min-h 44·둥근 12px / PC h-36·둥근 6px) ── */
.kwp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  min-height: 44px; padding: 8px 16px; border-radius: 12px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: background-color .15s, color .15s, transform .1s;
}
.kwp-btn:hover { background: hsl(var(--primary) / 0.9); }
.kwp-btn:active { transform: scale(0.98); }
.kwp-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring) / 0.5); }
.kwp-btn:disabled { pointer-events: none; opacity: .5; }
.kwp-btn svg { width: 16px; height: 16px; flex: none; }
.kwp-btn.is-outline { background: hsl(var(--background)); color: hsl(var(--foreground)); border-color: hsl(var(--input)); }
.kwp-btn.is-outline:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.kwp-btn.is-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.kwp-btn.is-secondary:hover { background: hsl(var(--secondary) / 0.8); }
.kwp-btn.is-ghost { background: transparent; color: hsl(var(--foreground)); box-shadow: none; }
.kwp-btn.is-ghost:hover { background: hsl(var(--accent)); }
.kwp-btn.is-destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.kwp-btn.is-destructive:hover { background: hsl(var(--destructive) / 0.9); }
.kwp-btn.is-link { background: transparent; color: hsl(var(--primary)); box-shadow: none; text-decoration: underline; text-underline-offset: 4px; }
.kwp-btn.is-sm { font-size: 12px; padding: 6px 12px; }
.kwp-btn.is-icon { width: 44px; min-width: 44px; padding: 0; }
.kwp-btn.is-block { width: 100%; }

/* ── 입력 (input.tsx: 모바일 44px·16px 글자·둥근 12px / PC 36px·14px·둥근 6px) ── */
.kwp-input, .kwp-select, .kwp-textarea {
  display: flex; width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid hsl(var(--input)); border-radius: 12px;
  background: hsl(var(--card)); color: hsl(var(--foreground));
  font-size: 16px; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: border-color .15s, box-shadow .15s;
}
.kwp-input::placeholder, .kwp-textarea::placeholder { color: hsl(var(--muted-foreground)); }
.kwp-input:focus-visible, .kwp-select:focus-visible, .kwp-textarea:focus-visible {
  outline: none; border-color: hsl(var(--primary) / 0.5);
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring) / 0.5);
}
.kwp-input:disabled, .kwp-select:disabled, .kwp-textarea:disabled { cursor: not-allowed; opacity: .5; }
.kwp-input[readonly] { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.kwp-textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.kwp-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.kwp-field { display: flex; flex-direction: column; }
.kwp-field + .kwp-field { margin-top: 14px; }
.kwp-help { margin-top: 6px; font-size: 12px; color: hsl(var(--muted-foreground)); line-height: 1.6; }

/* ── 탭 (회귀 검사 시안: 흰 알약 상자, 활성은 남색) ───────────────────── */
.kwp-tabs {
  display: flex; gap: 4px; padding: 4px; overflow-x: auto;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 14px;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.kwp-tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 10px; border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  font-size: 13.5px; font-weight: 600; color: hsl(var(--muted-foreground)); flex: none;
}
.kwp-tab:hover { color: hsl(var(--foreground)); }
.kwp-tab.is-active { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.kwp-tab svg { width: 16px; height: 16px; }

/* ── 표 (table.tsx) + 모바일 카드 전환 (adaptive-list.tsx) ───────────── */
.kwp-table-wrap { position: relative; width: 100%; overflow: auto; }
.kwp-table { width: 100%; border-collapse: collapse; caption-side: bottom; font-size: 14px; }
.kwp-table th {
  height: 40px; padding: 0 8px; text-align: left; vertical-align: middle;
  font-weight: 500; color: hsl(var(--muted-foreground)); border-bottom: 1px solid hsl(var(--border));
  white-space: nowrap;
}
.kwp-table td { padding: 10px 8px; vertical-align: middle; border-bottom: 1px solid hsl(var(--border)); }
.kwp-table tbody tr:last-child td { border-bottom: 0; }
.kwp-table tbody tr { transition: background-color .15s; }
.kwp-table tbody tr:hover { background: hsl(var(--muted) / 0.5); }
.kwp-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.kwp-table .is-mono { font-variant-numeric: tabular-nums; }
.kwp-table-card { border: 1px solid hsl(var(--border)); border-radius: 12px; background: hsl(var(--card)); overflow: hidden; }
.kwp-table-card .kwp-table th { background: hsl(var(--muted) / 0.4); padding: 0 16px; }
.kwp-table-card .kwp-table td { padding: 12px 16px; }

/* 모바일: 표 한 줄 = 카드 하나, 칸마다 data-label 을 제목으로 */
@media (max-width: 767px) {
  .kwp-table.is-adaptive, .kwp-table.is-adaptive tbody, .kwp-table.is-adaptive tr, .kwp-table.is-adaptive td { display: block; }
  .kwp-table.is-adaptive thead { display: none; }
  .kwp-table.is-adaptive tr {
    border: 1px solid hsl(var(--border)); border-radius: 12px; background: hsl(var(--card));
    padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  }
  .kwp-table-card .kwp-table.is-adaptive tr { margin: 10px; }
  .kwp-table.is-adaptive tr:hover { background: hsl(var(--card)); }
  .kwp-table.is-adaptive td { padding: 4px 0 !important; border: 0; text-align: left !important; }
  .kwp-table.is-adaptive td[data-label]::before {
    content: attr(data-label); display: block; font-size: 11.5px; color: hsl(var(--muted-foreground)); margin-bottom: 1px;
  }
  .kwp-table.is-adaptive td.is-primary { font-size: 15px; font-weight: 700; padding-bottom: 8px !important; }
  .kwp-table.is-adaptive td.is-primary::before { display: none; }
  .kwp-table.is-adaptive td.is-action { padding-top: 10px !important; }
  .kwp-table.is-adaptive td.is-action::before { display: none; }
  .kwp-table.is-adaptive td.is-action .kwp-btn { width: 100%; }
  .kwp-table.is-adaptive .kwp-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
}

/* ── 결재 진행 단계 ────────────────────────────────────────────────── */
.kwp-flow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.kwp-step {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 500; background: hsl(var(--muted)); color: hsl(var(--muted-foreground));
}
.kwp-step.is-done { background: #d1fae5; color: #047857; font-weight: 600; }
.kwp-step.is-now { background: #dbeafe; color: #1d4ed8; font-weight: 600; }
.kwp-flow .kwp-arrow { color: hsl(var(--muted-foreground) / 0.5); font-size: 12px; }

/* ── 목록 행 (설정 허브 시안: 제목 + 설명 + 화살표) ───────────────────── */
.kwp-list { display: flex; flex-direction: column; }
.kwp-list-row {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 14px 20px;
  border-top: 1px solid hsl(var(--border)); text-decoration: none; color: inherit;
}
.kwp-list-row:hover { background: hsl(var(--muted) / 0.4); }
.kwp-list-row b { display: block; font-size: 14.5px; font-weight: 700; }
.kwp-list-row span { display: block; font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 2px; }
.kwp-list-row .kwp-list-arrow { margin-left: auto; color: hsl(var(--muted-foreground)); flex: none; }
.kwp-list-row .kwp-list-arrow svg { width: 16px; height: 16px; }

/* 링크형 "더 보기" 공통 */
.kwp-more { text-decoration: none; }
.kwp-more:hover { text-decoration: none; }
[hidden] { display: none !important; }

/* ── 알림 상자·빈 상태·뼈대 ─────────────────────────────────────────── */
.kwp-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid hsl(var(--border)); background: hsl(var(--card)); font-size: 13.5px; }
.kwp-alert.is-info { border-color: hsl(var(--info) / 0.4); background: hsl(var(--info) / 0.06); }
.kwp-alert.is-warning { border-color: hsl(var(--warning) / 0.45); background: hsl(var(--warning) / 0.07); }
.kwp-alert.is-destructive { border-color: hsl(var(--destructive) / 0.45); background: hsl(var(--destructive) / 0.06); }
.kwp-alert b { display: block; font-size: 13.5px; }
.kwp-alert p { margin: 2px 0 0; font-size: 12.5px; color: hsl(var(--muted-foreground)); }
.kwp-empty { padding: 28px 12px; text-align: center; font-size: 13.5px; color: hsl(var(--muted-foreground)); }
.kwp-skeleton { border-radius: 6px; background: hsl(var(--muted)); background-image: linear-gradient(90deg, hsl(var(--muted)) 0%, hsl(var(--card)) 50%, hsl(var(--muted)) 100%); background-size: 200% 100%; animation: kwp-shimmer 1.6s linear infinite; height: 14px; }
@keyframes kwp-shimmer { 0% { background-position: -200% 0 } 100% { background-position: 200% 0 } }
.kwp-muted { color: hsl(var(--muted-foreground)); }
.kwp-small { font-size: 12px; }
.kwp-sep { height: 1px; background: hsl(var(--border)); margin: 12px 0; }
.kwp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kwp-stack { display: flex; flex-direction: column; gap: 10px; }

/* ── 대외비 꼬리말 (confidential-footer) ────────────────────────────── */
.kwp-footer { padding: 16px 20px calc(16px + var(--kwp-bottom-nav-h) + env(safe-area-inset-bottom)); font-size: 11.5px; color: hsl(var(--muted-foreground)); text-align: center; }

/* ── 모바일 하단 메뉴 (mobile-bottom-nav.tsx) ──────────────────────── */
.kwp-bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 50; width: 100%; overflow: hidden;
  border-top: 1px solid rgb(30 41 59 / 0.9);
  background: rgb(2 6 23 / 0.95);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  padding: 6px 6px calc(0.5rem + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgb(15 23 42 / 0.16);
}
.kwp-bottom-nav-grid { margin: 0 auto; max-width: 32rem; display: grid; gap: 2px; }
.kwp-bottom-item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 56px; min-width: 0; padding: 4px 2px 0; border-radius: 9px; border: 0;
  background: transparent; color: #94a3b8; text-decoration: none; cursor: pointer;
}
.kwp-bottom-item:active { background: rgb(255 255 255 / 0.05); color: #e2e8f0; }
.kwp-bottom-item.is-active { color: #fff; }
.kwp-bottom-item.is-active::before { content: ""; position: absolute; top: 0; left: 50%; width: 28px; height: 2px; transform: translateX(-50%); border-radius: 9999px; background: #60a5fa; }
.kwp-bottom-icon { position: relative; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; }
.kwp-bottom-item.is-active .kwp-bottom-icon { background: rgb(255 255 255 / 0.1); color: #93c5fd; }
.kwp-bottom-icon svg { width: 18px; height: 18px; }
.kwp-bottom-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: 1; font-weight: 600; }
@media (min-width: 360px) { .kwp-bottom-label { font-size: 12px; } }

/* 전체 메뉴 시트 */
.kwp-sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgb(15 23 42 / 0.5); }
.kwp-sheet-backdrop[hidden] { display: none; }
.kwp-sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 61; display: flex; flex-direction: column;
  max-height: 88dvh; overflow: hidden; border-radius: 18px 18px 0 0;
  border: 1px solid hsl(var(--border)); border-bottom: 0; background: hsl(var(--background));
  box-shadow: 0 -18px 50px rgb(15 23 42 / 0.18);
  animation: kwp-slide-up .25s ease-out;
}
.kwp-sheet[hidden] { display: none; }
@keyframes kwp-slide-up { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }
.kwp-sheet-header { position: relative; padding: 12px 16px 16px; border-bottom: 1px solid hsl(var(--border)); }
.kwp-sheet-grip { display: block; margin: 0 auto 8px; width: 40px; height: 4px; border-radius: 9999px; background: hsl(var(--muted-foreground) / 0.25); }
.kwp-sheet-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: #2563eb; }
.kwp-sheet-title { margin: 2px 0 0; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.kwp-sheet-close { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 9px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; color: hsl(var(--muted-foreground)); }
.kwp-sheet-close:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.kwp-sheet-close svg { width: 18px; height: 18px; }
.kwp-sheet-body { flex: 1; overflow-y: auto; padding: 16px 12px calc(1rem + env(safe-area-inset-bottom)); }
.kwp-sheet-grid { margin: 0 auto; width: 100%; max-width: 48rem; display: grid; gap: 12px; }
.kwp-sheet-section { overflow: hidden; }
.kwp-sheet-section > header { padding: 10px 14px; border-bottom: 1px solid hsl(var(--border)); }
.kwp-sheet-section > header h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: #2563eb; }
.kwp-sheet-section > div { padding: 8px; }
.kwp-sheet-group { border-bottom: 1px solid hsl(var(--border) / 0.7); padding-bottom: 8px; margin-bottom: 8px; }
.kwp-sheet-group:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.kwp-sheet-group-title { padding: 4px 10px; font-size: 11px; font-weight: 700; color: hsl(var(--muted-foreground)); }
/* 접히는 서류 묶음 (details) — 항상 접힌 채로 시작 */
details.kwp-sheet-group { padding-bottom: 0; margin-bottom: 0; }
details.kwp-sheet-group > summary.kwp-sheet-group-title {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 10px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: hsl(var(--foreground)); cursor: pointer; list-style: none;
}
details.kwp-sheet-group > summary::-webkit-details-marker { display: none; }
details.kwp-sheet-group > summary svg { width: 16px; height: 16px; flex: none; color: hsl(var(--muted-foreground)); }
details.kwp-sheet-group > summary small { font-size: 12px; font-weight: 600; color: hsl(var(--muted-foreground)); }
details.kwp-sheet-group > summary .kwp-chev { margin-left: auto; transition: transform .2s; }
details.kwp-sheet-group[open] > summary { color: #1d4ed8; }
details.kwp-sheet-group[open] > summary .kwp-chev { transform: rotate(90deg); }
details.kwp-sheet-group > .kwp-sheet-link { margin-left: 16px; }
details.kwp-sheet-group[open] { padding-bottom: 6px; }
.kwp-sheet-link {
  display: flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0; padding: 0 10px;
  border-radius: 9px; text-decoration: none; font-size: 14px; font-weight: 600; color: hsl(var(--foreground) / 0.8);
}
.kwp-sheet-link:hover { background: hsl(var(--muted) / 0.7); color: hsl(var(--foreground)); }
.kwp-sheet-link.is-active { background: rgb(37 99 235 / 0.1); color: #1d4ed8; }
.kwp-sheet-link .kwp-sheet-ic { display: flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 9px; background: hsl(var(--muted) / 0.7); color: hsl(var(--muted-foreground)); }
.kwp-sheet-link.is-active .kwp-sheet-ic { background: rgb(37 99 235 / 0.1); color: #1d4ed8; }
.kwp-sheet-link svg { width: 16px; height: 16px; }
.kwp-sheet-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 데스크톱 (md: 768px 이상) ─────────────────────────────────────── */
@media (min-width: 768px) {
  .kwp-sidebar { display: flex; }
  .kwp-inset { padding-left: var(--kwp-sidebar-w); }
  .kwp-app.is-collapsed .kwp-sidebar { width: 4.5rem; }
  .kwp-app.is-collapsed .kwp-inset { padding-left: 4.5rem; }
  .kwp-app.is-collapsed .kwp-brand { justify-content: center; padding: 0; }
  .kwp-app.is-collapsed .kwp-brand-name, .kwp-app.is-collapsed .kwp-brand-sub,
  .kwp-app.is-collapsed .kwp-nav-label, .kwp-app.is-collapsed .kwp-nav-item span,
  .kwp-app.is-collapsed .kwp-nav-item .kwp-chev, .kwp-app.is-collapsed .kwp-nav-sub,
  .kwp-app.is-collapsed .kwp-user b, .kwp-app.is-collapsed .kwp-user small, .kwp-app.is-collapsed .kwp-nav-count { display: none; }
  .kwp-app.is-collapsed .kwp-nav-group { padding: 8px 16px; }
  .kwp-app.is-collapsed .kwp-nav-item { width: 40px; height: 40px; justify-content: center; padding: 0; }
  .kwp-app.is-collapsed .kwp-user { justify-content: center; padding: 6px 0; }
  .kwp-header-row { display: flex; padding: 0 20px; }
  .kwp-header-trigger { display: inline-flex; }
  .kwp-header-mobile-title { display: none; }
  .kwp-breadcrumb { display: flex; }
  .kwp-header-right { margin-left: 12px; }
  .kwp-header-right .kwp-user-chip { display: inline-flex; }
  .kwp-container { padding: 24px; gap: 24px; }
  .kwp-page-header { flex-direction: row; justify-content: space-between; align-items: flex-end; }
  .kwp-page-eyebrow { display: block; }
  .kwp-page-title { font-size: 32px; }
  .kwp-page-action { width: auto; flex: none; }
  .kwp-card-header { padding: 24px 24px 0; }
  .kwp-card-content { padding: 24px; }
  .kwp-card-header + .kwp-card-content { padding-top: 16px; }
  .kwp-card-footer { padding: 0 24px 24px; }
  .kwp-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .kwp-stat { padding: 20px 24px; }
  .kwp-stat-value { font-size: 26px; }
  .kwp-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kwp-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kwp-btn { min-height: 0; height: 36px; padding: 6px 16px; border-radius: 6px; }
  .kwp-btn.is-sm { height: 32px; padding: 0 12px; border-radius: 6px; }
  .kwp-btn.is-icon { width: 36px; min-width: 0; height: 36px; }
  .kwp-input, .kwp-select { min-height: 0; height: 36px; padding: 4px 12px; border-radius: 6px; font-size: 14px; }
  .kwp-textarea { min-height: 96px; border-radius: 6px; font-size: 14px; }
  .kwp-tab { min-height: 40px; }
  .kwp-footer { padding-bottom: 16px; }
  .kwp-bottom-nav, .kwp-sheet, .kwp-sheet-backdrop { display: none !important; }
}
@media (min-width: 1280px) { .kwp-breadcrumb .is-xl { display: inline-flex; } }

/* ── 인쇄 ─────────────────────────────────────────────────────────── */
@media print {
  .kwp-sidebar, .kwp-header, .kwp-bottom-nav, .kwp-sheet, .kwp-sheet-backdrop, .kwp-page-action { display: none !important; }
  .kwp-inset { padding-left: 0 !important; }
  .kwp-content { background: #fff; }
  .kwp-card { box-shadow: none; break-inside: avoid; }
}

/* ── 모션 줄이기 ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
