/* =========================================================
   TRIPLESC 인트라넷 — 디자인 시스템 (v2)
   세계관: 제작 데스크 / 인쇄 공정(CMYK) 색 문법
   모드: Operate (업무 콘솔) — 정밀도 우선
   ========================================================= */

:root {
  --ink: #101216;
  --ink-2: #4a505a;
  --ink-3: #626975;
  --paper: #fcfcfa;
  --canvas: #f3f3ef;
  --rule: #e2e1da;
  --rule-soft: #edece6;
  --wash: #f7f7f3;

  --cyan: #0b6e77;
  --cyan-wash: #e8f2f2;
  --magenta: #a81e5b;
  --magenta-wash: #fbeaf1;
  --amber: #8a6200;
  --amber-wash: #faf1de;
  --green: #2c6244;
  --green-wash: #e9f2ec;

  /* 호환 토큰 */
  --bg: var(--canvas);
  --card: var(--paper);
  --line: var(--rule);
  --muted: var(--ink-3);
  --accent: var(--cyan);
  --accent-soft: var(--cyan-wash);
  --ok: var(--green);
  --ok-soft: var(--green-wash);
  --warn: var(--amber);
  --warn-soft: var(--amber-wash);
  --bad: var(--magenta);
  --bad-soft: var(--magenta-wash);
  --navy: var(--ink);
  --navy-2: #1b1f26;

  --r-sm: 4px;
  --r: 6px;
  --r-lg: 10px;
  --r-xl: 14px;
  --shadow-menu: 0 12px 32px -12px rgba(16, 18, 22, 0.28), 0 1px 2px rgba(16, 18, 22, 0.08);
  --shadow-modal: 0 32px 64px -24px rgba(16, 18, 22, 0.42), 0 2px 6px rgba(16, 18, 22, 0.08);
  --focus: 0 0 0 2px var(--paper), 0 0 0 4px rgba(11, 110, 119, 0.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Pretendard Variable', 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, -apple-system, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(11, 110, 119, 0.16); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
* { scrollbar-width: thin; scrollbar-color: #c9c8c0 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #d3d2ca; border: 3px solid transparent; background-clip: content-box; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #b9b8b0; background-clip: content-box; }

.layout { display: flex; min-height: 100vh; }

/* ---------- 사이드 레일 ---------- */
.sidebar {
  width: 232px; flex: 0 0 232px;
  background: var(--paper);
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column;
  padding: 20px 12px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 0 8px 20px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--ink); color: var(--paper);
  font-weight: 800; display: grid; place-items: center;
  font-size: 14px; letter-spacing: -0.03em;
  position: relative; overflow: hidden;
}
.brand-mark::after {
  content: ''; position: absolute; right: 0; bottom: 0;
  width: 10px; height: 10px; background: var(--cyan);
}
.brand-name { color: var(--ink); font-weight: 750; font-size: 13px; letter-spacing: 0.02em; }
.brand-sub { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

#nav { display: flex; flex-direction: column; gap: 1px; overflow: auto; padding-bottom: 8px; }
.nav-group { margin-top: 16px; }
.nav-group-label {
  font-size: 10.5px; letter-spacing: 0.04em; color: var(--ink-3);
  padding: 0 10px 6px; font-weight: 650;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r);
  color: var(--ink-2); text-decoration: none;
  font-size: 13px; line-height: 1.3;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: var(--wash); color: var(--ink); }
.nav-item.active {
  background: var(--cyan-wash); color: var(--cyan);
  border-left-color: var(--cyan); font-weight: 650;
}
.nav-item .ico { width: 16px; text-align: center; opacity: 0.85; font-size: 12px; }
.nav-badge {
  margin-left: auto; background: var(--magenta); color: #fff;
  font-size: 10px; border-radius: 9px; padding: 0 5px; min-width: 17px;
  text-align: center; font-weight: 700; font-variant-numeric: tabular-nums;
}
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--rule); }
.side-foot-label { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.03em; }
.side-foot-val { font-size: 11.5px; color: var(--ink-2); margin: 3px 0 10px; }
.ghost-btn {
  width: 100%; padding: 7px; border-radius: var(--r);
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--rule); font-size: 11.5px; cursor: pointer; font-family: inherit;
}
.ghost-btn:hover { background: var(--wash); color: var(--ink); border-color: #d6d5cd; }

/* ---------- 메인 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  padding: 20px 32px 16px; background: var(--canvas);
  border-bottom: 1px solid var(--rule);
}
.crumb { font-size: 11px; color: var(--ink-3); margin-bottom: 5px; letter-spacing: 0.01em; }
h1 {
  margin: 0; font-size: 25px; line-height: 1.15;
  letter-spacing: -0.025em; font-weight: 750; text-wrap: balance;
}
.top-right { display: flex; align-items: center; gap: 18px; }
.today { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.me { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 30px; height: 30px; border-radius: var(--r);
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-weight: 700; font-size: 11.5px;
}
.me-name { font-size: 12.5px; font-weight: 650; }
.me-role { font-size: 10.5px; color: var(--ink-3); }
.view { padding: 24px 32px 64px; max-width: 1240px; width: 100%; }
.view > * { animation: rise 0.22s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- 표면 ---------- */
.card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-lg); }
.card-h {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 18px; border-bottom: 1px solid var(--rule-soft);
}
.card-h h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: -0.01em; }
.card-b { padding: 16px 18px; }
.hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g21 { grid-template-columns: 1.65fr 1fr; }
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3, .g2, .g21 { grid-template-columns: 1fr; }
}
.section-title { font-size: 11px; font-weight: 700; color: var(--ink-3); letter-spacing: 0.03em; margin: 28px 0 10px; }

/* KPI */
.kpi { padding: 15px 18px 16px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-lg); }
.kpi .lab { font-size: 11px; color: var(--ink-3); letter-spacing: 0.01em; }
.kpi .val {
  font-size: 27px; font-weight: 700; letter-spacing: -0.03em;
  margin-top: 7px; line-height: 1; font-variant-numeric: tabular-nums;
}
.kpi .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 8px; }
.kpi .sub b { color: var(--ink); font-weight: 650; }

/* ---------- 표 ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; font-weight: 650; color: var(--ink-3);
  letter-spacing: 0.01em; padding: 9px 12px;
  border-bottom: 1px solid var(--rule); background: var(--wash); white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--rule-soft); font-size: 12.5px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f6f7f4; }
td.right, th.right { text-align: right; }
td.mono, .mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.nowrap { white-space: nowrap; }

/* ---------- 칩 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: var(--r-sm);
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--wash); color: var(--ink-2); border: 1px solid var(--rule);
}
.chip.ok { background: var(--green-wash); color: var(--green); border-color: #cfe1d5; }
.chip.warn { background: var(--amber-wash); color: var(--amber); border-color: #ecd9b4; }
.chip.bad { background: var(--magenta-wash); color: var(--magenta); border-color: #efc7d8; }
.chip.info { background: var(--cyan-wash); color: var(--cyan); border-color: #c6e0e0; }
.chip.gray { background: var(--wash); color: var(--ink-2); }

/* ---------- 버튼 ---------- */
.btn {
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  padding: 8px 13px; border-radius: var(--r);
  border: 1px solid #d9d8d0; background: var(--paper); color: var(--ink);
  cursor: pointer; white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.btn:hover { background: var(--wash); border-color: #cbcac2; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover { background: #23272f; border-color: #23272f; }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.bad, .btn.danger { background: var(--paper); border-color: #ecc4d4; color: var(--magenta); }
.btn.bad:hover, .btn.danger:hover { background: var(--magenta-wash); }
.btn.sm { padding: 4px 9px; font-size: 11.5px; border-radius: var(--r-sm); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- 폼 ---------- */
label { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; font-family: inherit; font-size: 12.5px;
  padding: 8px 10px; border: 1px solid #d9d8d0;
  border-radius: var(--r); background: #fff; color: var(--ink);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input::placeholder, textarea::placeholder { color: #9a9f9f; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(11, 110, 119, 0.12);
}
input[type='checkbox'], input[type='radio'] { width: auto; accent-color: var(--cyan); }
textarea { resize: vertical; min-height: 64px; }
.field { margin-bottom: 12px; }
.row { display: grid; gap: 12px; }
.row.c2 { grid-template-columns: 1fr 1fr; }
.row.c3 { grid-template-columns: repeat(3, 1fr); }
.row.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .row.c2, .row.c3, .row.c4 { grid-template-columns: 1fr; } }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline > .field { margin-bottom: 0; min-width: 130px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.check input { width: auto; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 160px; }
.toolbar select { width: auto; min-width: 120px; }

/* ---------- 리스트 ---------- */
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--rule-soft); }
.list-row:last-child { border-bottom: none; }
.list-main { min-width: 0; }
.list-title { font-size: 13px; font-weight: 600; }
.list-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

.req-card { border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 14px; margin-bottom: 12px; background: var(--paper); }
.req-card.urgent { border-color: #ecc4d4; background: #fffafc; }
.req-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.req-name { font-size: 13.5px; font-weight: 700; }
.req-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.req-body { margin: 11px 0; font-size: 12.5px; line-height: 1.7; }
.req-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.req-actions input { flex: 1; min-width: 120px; }

/* ---------- 진행 바 ---------- */
.bar-line { display: grid; grid-template-columns: 84px 1fr 44px; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12px; }
.bar { height: 6px; border-radius: 3px; background: #e9e8e1; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--cyan); }
.bar-line .n { text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.proj { padding: 14px 0; border-bottom: 1px solid var(--rule-soft); }
.proj:last-child { border-bottom: none; }
.proj-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.proj-name { font-size: 13px; font-weight: 700; }
.gantt { position: relative; height: 6px; background: #e9e8e1; border-radius: 3px; margin: 6px 0 4px; }
.gantt > span { position: absolute; top: 0; height: 6px; border-radius: 3px; background: #9fc6c9; }
.gantt > span.done { background: var(--cyan); }
.gantt-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); }

.empty { padding: 36px; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab {
  padding: 7px 12px; border-radius: var(--r); font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); background: var(--paper); border: 1px solid var(--rule);
  cursor: pointer; font-family: inherit;
}
.tab.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.note { font-size: 11.5px; color: var(--ink-2); background: var(--wash); border: 1px solid var(--rule); border-radius: var(--r); padding: 10px 12px; line-height: 1.7; }
.rules { width: 100%; font-size: 11.5px; }
.rules td, .rules th { padding: 7px 9px; }
.doc-link { color: var(--cyan); text-decoration: none; font-weight: 650; font-size: 12px; text-underline-offset: 3px; }
.doc-link:hover { text-decoration: underline; }

/* ---------- 모달 ---------- */
.modal-wrap[hidden] { display: none; }
.modal-wrap { position: fixed; inset: 0; background: rgba(16, 18, 22, 0.42); display: grid; place-items: center; z-index: 50; padding: 24px; backdrop-filter: blur(2px); }
.modal {
  background: var(--paper); border-radius: var(--r-xl);
  max-width: 600px; width: 100%; max-height: 84vh; overflow: auto;
  padding: 22px; box-shadow: var(--shadow-modal);
  border: 1px solid rgba(16, 18, 22, 0.06);
}
.modal h2 { margin: 0 0 4px; font-size: 17px; letter-spacing: -0.02em; }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-h h2 { margin: 0; }
.modal-h .icon-btn { flex: none; background: none; border: 0; font-size: 15px; color: var(--ink-3); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.modal-h .icon-btn:hover { background: rgba(16, 18, 22, 0.06); color: var(--ink); }
.modal .sub { font-size: 12px; color: var(--ink-3); margin-bottom: 16px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 9px 12px; font-size: 12.5px; padding: 12px 0; border-top: 1px solid var(--rule); }
.kv .k { color: var(--ink-3); font-size: 11.5px; }
.modal:has(.wide-marker) { max-width: 780px; }

/* ---------- 규정집 ---------- */
.rule-card { border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 12px; background: var(--paper); }
.rule-no { font-size: 11px; font-weight: 700; color: var(--cyan); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.rule-title { font-size: 14px; font-weight: 700; margin: 4px 0 8px; letter-spacing: -0.01em; }
.rule-body { font-size: 12.5px; line-height: 1.85; color: var(--ink-2); }
.rule-body li { margin-bottom: 3px; }
.rule-src { margin-top: 10px; font-size: 11px; color: var(--ink-3); }
.chapter-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chapter-nav button {
  font-family: inherit; font-size: 12px; padding: 5px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--rule); background: var(--paper); cursor: pointer; color: var(--ink-2);
}
.chapter-nav button.active { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600; }

/* ---------- AI 도우미 ---------- */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  display: flex; align-items: center; gap: 8px;
  background: var(--ink); color: var(--paper);
  border: 0; border-radius: var(--r-lg);
  padding: 11px 16px; font-family: inherit; font-size: 12.5px; font-weight: 650;
  cursor: pointer; box-shadow: var(--shadow-menu);
  transition: transform 0.14s ease, background 0.14s ease;
}
.chat-fab:hover { transform: translateY(-1px); background: #23272f; }
.chat-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 61;
  width: 384px; max-width: calc(100vw - 32px);
  height: min(560px, calc(100vh - 44px));
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-xl);
  box-shadow: var(--shadow-modal); display: flex; flex-direction: column; overflow: hidden;
}
.chat-h { display: flex; align-items: center; gap: 9px; padding: 12px 15px; background: var(--ink); color: var(--paper); }
.chat-h .t { font-size: 13px; font-weight: 700; }
.chat-h .s { font-size: 10.5px; color: #b7bcc4; }
.chat-h button { margin-left: auto; background: transparent; border: 0; color: #d6d9de; font-size: 16px; cursor: pointer; }
.chat-body { flex: 1; overflow: auto; padding: 14px; background: var(--canvas); display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 9px 12px; border-radius: var(--r-lg); font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--cyan); color: #fff; border-bottom-right-radius: var(--r-sm); }
.msg.bot { align-self: flex-start; background: var(--paper); border: 1px solid var(--rule); border-bottom-left-radius: var(--r-sm); }
.msg .src { margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--rule); font-size: 10.5px; color: var(--ink-3); }
.chat-quick { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 12px; border-top: 1px solid var(--rule); background: var(--paper); }
.chat-quick button {
  font-family: inherit; font-size: 10.5px; padding: 4px 8px; border-radius: var(--r-sm);
  border: 1px solid var(--rule); background: var(--wash); color: var(--ink-2); cursor: pointer;
}
.chat-quick button:hover { background: var(--cyan-wash); border-color: #c6e0e0; color: var(--cyan); }
.chat-f { padding: 9px 12px; border-top: 1px solid var(--rule); background: var(--paper); display: flex; gap: 7px; align-items: center; }
.chat-f input { flex: 1; }
.chat-f button { background: var(--ink); border: 0; color: var(--paper); border-radius: var(--r); padding: 8px 13px; font-family: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; }
.chat-opt { font-size: 10.5px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; padding: 0 12px 8px; background: var(--paper); }
.chat-opt input { width: auto; }

/* ---------- CRM ---------- */
tr.crm-sel { background: var(--cyan-wash) !important; }
tr.crm-sel td { border-bottom-color: #cfe3e3; }

/* ---------- 회사 알림판 ---------- */
.notice-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--rule-soft); text-decoration: none; color: inherit; }
.notice-row:last-child { border-bottom: 0; }
.notice-row:hover { background: var(--wash); border-radius: var(--r); }
.notice-title { font-size: 13px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice-title.unread::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); margin-right: 7px; vertical-align: middle; }
.notice-row .pin { font-size: 12px; }
.notice-body {
  margin-top: 14px; padding: 14px 16px; background: var(--wash);
  border: 1px solid var(--rule); border-radius: var(--r-lg);
  font-size: 13px; line-height: 1.78; color: var(--ink); max-height: 46vh; overflow: auto;
}

/* ---------- 칸반 ---------- */
.kanban-col { background: var(--wash); border: 1px solid var(--rule); border-radius: var(--r-lg); }

/* ---------- 모션 최소화 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 좁은 화면 ---------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--rule); }
  #nav { flex-direction: row; flex-wrap: wrap; gap: 2px; }
  .nav-group { margin-top: 8px; width: 100%; }
  .nav-group-label { display: none; }
  .nav-item { border-left: 0; border-bottom: 2px solid transparent; }
  .nav-item.active { border-left: 0; border-bottom-color: var(--cyan); }
  .side-foot { display: none; }
  .topbar { padding: 16px 18px 12px; align-items: flex-start; flex-direction: column; }
  .view { padding: 18px 18px 48px; }
  h1 { font-size: 21px; }
}

/* ---------- v2 보정 ---------- */
@media (max-width: 900px) {
  .card > table { display: block; overflow-x: auto; white-space: nowrap; }
}

.ic { flex: 0 0 auto; display: block; }
.nav-item .ico { width: 14px; display: flex; align-items: center; justify-content: center; opacity: 0.9; }
.card-h select, .card-h input { width: auto; }
.card-h > div > select { max-width: 260px; }
.kanban-col { min-width: 208px; }

/* ---------- 전자결재 ---------- */
.ap-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.tabs { display: flex; gap: 6px; background: #eceeea; padding: 4px; border-radius: 10px; }
.tab { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; color: #4a5048; display: flex; align-items: center; gap: 6px; }
.tab.on { background: #fff; color: #101216; box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }
.tab-n { font-size: 11px; background: #dfe3dd; border-radius: 20px; padding: 1px 6px; color: #3d443c; }
.tab.on .tab-n { background: #0b6e77; color: #fff; }
.ap-card { margin-bottom: 12px; }
.ap-body { font-size: 13px; color: #3d443c; background: #f6f7f4; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; white-space: pre-wrap; }
.ap-flow { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 10px; border-radius: 20px; background: #f0f2ee; color: #6b726a; border: 1px solid transparent; }
.step-n { width: 17px; height: 17px; border-radius: 50%; background: #d9ddd5; color: #4a5048; display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.step.run { background: #e6f2f3; border-color: #9fc9cd; color: #0b6e77; font-weight: 600; }
.step.run .step-n { background: #0b6e77; color: #fff; }
.step.ok { background: #e8f3ea; color: #2e6b39; }
.step.ok .step-n { background: #2e7d43; color: #fff; }
.step.bad { background: #fbecec; color: #a33636; }
.step.bad .step-n { background: #b84141; color: #fff; }
.step-line { width: 16px; height: 1px; background: #d6dad2; }
.chip.run { background: #e6f2f3; color: #0b6e77; }

/* ---------- 알림 벨 ---------- */
.bell { position: relative; border: 1px solid #e2e4de; background: #fff; width: 34px; height: 34px; border-radius: 9px; cursor: pointer; display: grid; place-items: center; }
.bell:hover { background: #f4f5f1; }
.bell-dot { position: absolute; top: -6px; right: -6px; background: #c0392b; color: #fff; font-size: 9.5px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 9px; display: grid; place-items: center; padding: 0 3px; }
.bell-pop { position: absolute; top: 58px; right: 24px; width: 330px; max-height: 420px; overflow: auto; background: #fff; border: 1px solid #e2e4de; border-radius: 12px; box-shadow: 0 12px 32px rgba(15,20,15,.14); z-index: 60; }
.bell-h { display: flex; justify-content: space-between; align-items: center; padding: 11px 13px; border-bottom: 1px solid #eef0ea; font-size: 13px; }
.link-btn { border: 0; background: none; color: #0b6e77; font: inherit; font-size: 12px; cursor: pointer; }
.bell-list { padding: 4px; }
.bell-row { padding: 9px 10px; border-radius: 8px; }
.bell-row.unread { background: #f4f9f8; }
.bell-t { font-size: 12.5px; font-weight: 600; color: #1d211d; }
.bell-b { font-size: 11.5px; color: #6b726a; margin-top: 2px; }
.bell-time { font-size: 10.5px; color: #9aa197; margin-top: 3px; font-variant-numeric: tabular-nums; }
.bell-empty { padding: 26px; text-align: center; color: #8a9187; font-size: 12.5px; }

/* 톱바 정렬 보정 (알림 벨 추가) */
.topbar { gap: 16px; }
.top-right { display: flex; align-items: center; gap: 10px; }
.top-right .me { white-space: nowrap; }
.top-right .me-name, .top-right .me-role { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

.ap-card .row { display: flex; gap: 8px; }
.ap-card .row .btn { width: auto; padding: 8px 18px; }

/* ---------- 주 52시간 바 ---------- */
.bar-list { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-name { width: 62px; flex: none; color: #3d443c; }
.bar-track { flex: 1; height: 8px; background: #eef0ea; border-radius: 6px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: #2e7d43; border-radius: 6px; }
.bar-fill.warn { background: #b8860b; }
.bar-fill.bad { background: #b84141; }
.bar-val { width: 52px; text-align: right; color: #4a5048; }

/* ---------- 통합 검색 ---------- */
.search { position: relative; }
.search input { width: 240px; height: 34px; border: 1px solid #e2e4de; background: #fff; border-radius: 9px;
  padding: 0 12px; font: inherit; font-size: 12.5px; color: #1d211d; outline: none; }
.search input:focus { border-color: #0b6e77; box-shadow: 0 0 0 3px rgba(11,110,119,.10); width: 290px; transition: width .15s; }
.search-pop { position: absolute; top: 42px; left: 0; width: 420px; max-height: 420px; overflow: auto;
  background: #fff; border: 1px solid #e2e4de; border-radius: 12px; box-shadow: 0 14px 34px rgba(15,20,15,.16); z-index: 70; }
.sr-head { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; border-bottom: 1px solid #eef0ea;
  font-size: 11.5px; color: #6b726a; }
.sr-row { display: flex; gap: 10px; padding: 9px 12px; text-decoration: none; color: inherit; border-bottom: 1px solid #f4f5f1; }
.sr-row:hover { background: #f6f9f7; }
.sr-kind { flex: none; width: 62px; font-size: 10.5px; color: #0b6e77; background: #e9f3f3; border-radius: 5px;
  height: 18px; display: grid; place-items: center; margin-top: 2px; }
.sr-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sr-main b { font-size: 12.5px; font-weight: 600; }
.sr-snip { font-size: 11.5px; color: #6b726a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-empty { padding: 22px; text-align: center; color: #8a9187; font-size: 12px; }
/* 한 줄 라벨·값 (보안 화면). 모달의 .kv(2열 grid)와 이름이 겹쳐 모달이 깨졌었다 → kv-row 로 분리 */
.kv-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 12.5px; }
.kv-row span { color: #6b726a; }
@media (max-width: 1100px) { .search input { width: 170px; } .search input:focus { width: 210px; } .search-pop { width: 320px; } }

/* ============================================================
   모바일 (≤820px) — 사이드바 드로어 + 콘텐츠 전면 스택
   기존 900px 규칙(사이드바가 위로 쌓임)을 대체한다.
   ============================================================ */
.nav-toggle {
  display: none; flex: none;
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--rule); background: #fff; color: #1d211d;
  align-items: center; justify-content: center; font-size: 15px; cursor: pointer;
}
@media (max-width: 820px) {
  .layout { flex-direction: row; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(78vw, 296px); height: 100dvh;
    transform: translateX(-102%); transition: transform .24s cubic-bezier(.22,1,.36,1);
    z-index: 90; overflow-y: auto; border-right: 1px solid var(--rule); border-bottom: 0;
    box-shadow: 0 0 0 rgba(0,0,0,0);
  }
  .layout.nav-open .sidebar { transform: none; box-shadow: 0 18px 60px rgba(15,20,15,.28); }
  .layout.nav-open::after {
    content: ""; position: fixed; inset: 0; background: rgba(16,18,22,.44); z-index: 80;
  }
  #nav { flex-direction: column; flex-wrap: nowrap; gap: 2px; }
  .nav-item { border-bottom: 0; border-left: 3px solid transparent; }
  .nav-item.active { border-bottom: 0; border-left-color: var(--cyan); }
  .side-foot { display: block; }
  .main { width: 100%; min-width: 0; }
  .nav-toggle { display: inline-flex; }
  .topbar {
    flex-direction: row; align-items: center; gap: 10px;
    padding: 10px 12px; position: sticky; top: 0; background: var(--paper);
    z-index: 70; border-bottom: 1px solid var(--rule);
  }
  .topbar h1 { font-size: 17px; line-height: 1.25; }
  .crumb { font-size: 10.5px; margin-bottom: 1px; }
  .today { display: none; }
  .search input { width: 116px; }
  .search input:focus { width: 150px; }
  .search-pop { width: calc(100vw - 24px); left: auto; right: 0; }
  .me-role { display: none; }
  .me-name { font-size: 12px; }
  .view { padding: 12px 12px 56px; }
  .grid, .grid.g21, .grid.g4, .grid.g3, .grid.g2 { display: block !important; }
  .grid > * + * { margin-top: 12px; }
  .card-b, .card-h { padding: 12px; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; }
  .ap-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .modal-wrap { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; max-height: 92dvh; overflow: auto; }
  .bar-name { width: 52px; }
  .bar-val { width: 44px; }
  .statgrid, .kpigrid { grid-template-columns: 1fr 1fr !important; }
  .sw-kpis { grid-template-columns: 1fr 1fr; }
  h2 { font-size: 17px; }
  h3 { font-size: 14px; }
}
@media (max-width: 420px) {
  .me { display: none; }
  .search input { width: 96px; }
}

/* ============================================================
   모바일 폴리시 v2 (2026-10-24) — 여백·카드·드로어·타이포
   ============================================================ */
@media (max-width: 820px) {
  :root { --m-radius: 16px; }
  body { -webkit-text-size-adjust: 100%; }

  .view { padding: 14px 14px calc(64px + env(safe-area-inset-bottom)); }

  /* 카드 — 그림자·라운드·테두리 톤 정리 */
  .card {
    border-radius: var(--m-radius);
    border: 1px solid rgba(29,33,29,.08);
    box-shadow: 0 1px 2px rgba(20,24,20,.04), 0 8px 24px -18px rgba(20,24,20,.35);
    overflow: hidden;
  }
  .card-h { padding: 14px 14px 0; }
  .card > .card-h + * { padding-top: 10px; }
  .card-b { padding: 14px; }
  h1, .page-title { letter-spacing: -.02em; }

  /* 상단바 — 유리 느낌 + 얇은 라인 */
  .topbar {
    padding: 10px 14px;
    background: rgba(246,245,240,.86);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid rgba(29,33,29,.07);
  }
  .topbar h1 { font-size: 17.5px; font-weight: 800; letter-spacing: -.02em; }
  .nav-toggle { border-color: rgba(29,33,29,.1); box-shadow: 0 1px 2px rgba(0,0,0,.04); }

  /* KPI — 숫자 중심, 상단 액센트 */
  .kpi, .stat, .kpi-card {
    border-radius: var(--m-radius);
    padding: 14px 14px 12px;
    position: relative;
    overflow: hidden;
  }
  .kpi::before, .stat::before, .kpi-card::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
    background: linear-gradient(90deg, var(--cyan, #0f9d8b), rgba(15,157,139,.15));
  }
  .kpi .v, .stat .v, .kpi-card .v { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }

  /* 표 — 첫 열 고정 + 줄무늬 */
  .card-b table tbody tr:nth-child(even) { background: rgba(29,33,29,.022); }
  .card-b table th { position: sticky; top: 0; background: #fff; z-index: 1; }

  /* 버튼 — 터치감 */
  .btn, button.btn { min-height: 42px; border-radius: 12px; font-weight: 700; }
  .btn:active, button.btn:active { transform: scale(.985); }

  /* 드로어 — 브랜드 헤더 + 구분선 + 활성 pill */
  .sidebar { width: min(82vw, 312px); border-radius: 0 20px 20px 0; }
  .sidebar .brand, .side-brand { padding: 18px 16px 14px; }
  #nav { padding: 8px 10px 14px; gap: 4px; }
  .nav-item {
    border-left: 0 !important;
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 13.5px;
  }
  .nav-item.active {
    background: rgba(15,157,139,.1);
    color: #0b6b5f;
    font-weight: 800;
  }
  .side-foot { padding: 12px 14px 18px; border-top: 1px solid rgba(29,33,29,.07); }
}

/* K4: 모바일 표를 카드로 (<=820px, 라벨은 mobile-cards.js가 부여) */
@media (max-width: 820px) {
  .card table.mc-ready { display: block; border: 0; background: transparent; }
  .card table.mc-ready thead { display: none; }
  .card table.mc-ready tbody { display: block; }
  .card table.mc-ready tr { display: block; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 10px 12px; margin-bottom: 8px; }
  .card table.mc-ready td { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0; text-align: right; white-space: normal; }
  .card table.mc-ready td::before { content: attr(data-label); flex: 0 0 auto; text-align: left; color: var(--dim); font-weight: 600; font-size: 11.5px; }
  .card table.mc-ready td:empty { display: none; }
}

/* ── 부서 현황판: 칸반 + 간트 ─────────────────────────── */
.kb { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kb-col { background: var(--wash); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 160px; transition: background .15s, border-color .15s; }
.kb-col.over { background: var(--cyan-wash, #e6f2f2); border-color: var(--accent); }
.kb-col h4 { margin: 0 0 8px; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kb-col h4 .n { font-size: 11px; background: #e3e2db; border-radius: 20px; padding: 1px 7px; color: var(--ink-2, #3d443c); }
.kb-card { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 8px 10px; margin-bottom: 7px; cursor: grab; font-size: 12.5px; }
.kb-card.dragging { opacity: .45; }
.kb-card.late { border-left-color: var(--bad); }
.kb-card.done { border-left-color: #b9b8b0; color: var(--muted); }
.kb-card .t { font-weight: 600; line-height: 1.4; }
.kb-card .m { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 11px; color: var(--muted); }
.kb-card .mv { margin-left: auto; display: flex; gap: 2px; }
.kb-card .mv button { border: 1px solid var(--line); background: #fff; border-radius: 5px; font-size: 10.5px; padding: 0 6px; line-height: 18px; cursor: pointer; }
.kb-card .late-tag { color: var(--bad); font-weight: 700; }
.gt { overflow-x: auto; }
.gt-inner { min-width: 640px; position: relative; }
.gt-head, .gt-row { display: grid; grid-template-columns: 210px 1fr; align-items: center; }
.gt-head { font-size: 10.5px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.gt-scale { position: relative; height: 16px; }
.gt-scale span { position: absolute; top: 0; transform: translateX(-2px); white-space: nowrap; }
.gt-row { border-bottom: 1px dashed #ecebe4; min-height: 30px; cursor: pointer; }
.gt-row:hover { background: var(--wash); }
.gt-row.sel { background: var(--cyan-wash, #e6f2f2); }
.gt-name { font-size: 12px; padding: 4px 8px 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gt-name small { color: var(--muted); margin-left: 4px; }
.gt-track { position: relative; height: 30px; }
.gt-bar { position: absolute; top: 9px; height: 12px; border-radius: 6px; background: #cfe3e3; overflow: hidden; }
.gt-bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.gt-bar.late { background: #f1d3df; } .gt-bar.late i { background: var(--bad); }
.gt-bar.done { background: #e4e3dc; } .gt-bar.done i { background: #a9a8a0; }
.gt-bar.standing { background: repeating-linear-gradient(45deg, #ecebe4 0 6px, #f5f4ef 6px 12px); height: 8px; top: 11px; }
.gt-bar.standing i { display: none; }
.gt-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--bad); pointer-events: none; }
.gt-grid { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid #efeee8; pointer-events: none; }
.kb-add { display: grid; grid-template-columns: 2fr 1.4fr 1fr 1fr auto; gap: 8px; align-items: end; }
.bd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.bd-card { cursor: pointer; }
.bd-card:hover { border-color: var(--accent); }
@media (max-width: 820px) {
  .kb { grid-template-columns: 1fr; }
  .kb-add { grid-template-columns: 1fr 1fr; }
  .kb-add .field:first-child { grid-column: span 2; }
  .kb-add button { grid-column: span 2; }
  .gt-head, .gt-row { grid-template-columns: 130px 1fr; }
}

/* ---------- 관리 · 데이터 보기·수정 ---------- */
.dv-wrap { overflow: auto; max-height: 68vh; border: 1px solid var(--line); border-radius: 10px; }
.dv-table { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
.dv-table th { position: sticky; top: 0; z-index: 1; background: var(--wash); white-space: nowrap; padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.dv-td { padding: 0; border-bottom: 1px solid #f0efe9; border-right: 1px solid #f4f3ee; max-width: 260px; }
.dv-td.ro { padding: 6px 8px; color: var(--muted); background: #fafaf7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-in { width: 100%; min-width: 110px; border: 0; background: transparent; padding: 6px 8px; font: inherit; border-radius: 0; }
.dv-in:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: #fff; }
.dv-in.dv-ok { background: #e7f7ef; transition: background .3s; }
