/* 화면 틀: LXP(코스모스) 기본 테마 톤 — 흰 상단 바 64px + 흰 왼쪽 메뉴 240px(아이콘+이름) + 연회색 본문.
   값은 LXP 테마 변수(--csms-*)에서 가져왔다: 주색 #0075F8, 글자 #161819·#2C2F32·#575E64, 선 #E0E3E5·#EEEFF0,
   의미색(빨강 #F04438·초록 #1EA465·주황 #FD7E14·노랑 #FFC107·보라 #6F42C1), 모서리 6·8·12px, 글꼴 Pretendard. 라이트 테마 하나. */
:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #F8F9FA;
  --ink: #161819;
  --ink-2: #2C2F32;
  --muted: #575E64;
  --faint: #6D767E;
  --line: #E0E3E5;
  --line-2: #EEEFF0;
  --line-strong: #D3D6D9;
  --accent: #0075F8;
  --accent-hover: #0069DF;
  --accent-dark: #005EC6;
  --accent-weak: #EAF4FE;
  --accent-weak-2: #E0EEFE;
  --accent-line: #C0DEFD;
  --on-accent: #FFFFFF;
  --crit: #DC1E11;
  --crit-solid: #F04438;
  --crit-weak: #FBEBED;
  --high: #C24A06;
  --high-solid: #FD7E14;
  --high-weak: #FFF0E7;
  --warn: #8A6700;
  --warn-weak: #FFF9E6;
  --warn-line: #FFDA69;
  --ok: #188351;
  --ok-solid: #1EA465;
  --ok-weak: #E4FAF0;
  --ext: #58339D;
  --ext-weak: #F1ECF9;
  --gray-weak: #F0F1F2;
  --ai: #0E7C70;
  --ai-weak: #E3F6F3;
  --font: "Pretendard Variable", Pretendard, Inter, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --shadow: 0 1px 2px rgba(22, 24, 25, .04), 0 6px 20px rgba(22, 24, 25, .07);
  --nav-w: 240px;
  --top-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--ink); }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: break-word;
}
code, .mono { overflow-wrap: anywhere; }
@media (max-width: 760px) { table.tbl { min-width: 680px; } .drawer table.tbl { min-width: 560px; } }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--accent-dark); }
code, .mono { font-family: var(--mono); font-size: .9em; letter-spacing: 0; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; color: var(--ink); letter-spacing: -0.02em; }
h1 { font-size: 24px; line-height: 1.3; font-weight: 700; }
h2 { font-size: 17px; line-height: 1.35; font-weight: 700; }
h3 { font-size: 15px; line-height: 1.4; font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 40; background: var(--surface);
}

/* ---------- 상단 바 ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar-in {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  min-height: var(--top-h); padding-block: 10px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; text-decoration: none; color: inherit; border-radius: var(--r); }
.brand:hover .brand-name { color: var(--accent-dark); }
.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; }
.skip { position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); top: -80px; z-index: 100; background: var(--accent); color: #fff; border: 0; border-radius: var(--r); padding: 8px 14px; font-weight: 700; cursor: pointer; }
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 8px); }
.tsearch { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tsearch input[type="search"] { width: 230px; min-height: 36px; padding: 6px 12px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: var(--r); background: var(--accent);
  display: grid; place-items: center; flex: none;
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font-weight: 700; font-size: 16px; white-space: nowrap; letter-spacing: -0.02em; }
.top-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acct { position: relative; }
.acct-btn { display: flex; align-items: center; gap: 8px; border: 1px solid transparent; background: none; padding: 4px 8px 4px 4px; border-radius: var(--r-lg); cursor: pointer; text-align: left; color: var(--ink); }
.acct-btn:hover, .acct-btn[aria-expanded="true"] { background: var(--gray-weak); border-color: var(--line); }
.acct .av, .umenu .av { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-weak-2); color: var(--accent-dark); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.acct-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.acct-txt b { font-size: 13.5px; font-weight: 700; }
.acct-txt small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.acct-btn .caret { width: 16px; height: 16px; color: var(--muted); flex: none; }
.umenu { position: absolute; right: 0; top: calc(100% + 6px); width: 300px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 6px; z-index: 46; }
.um-cap { font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px 4px; }
.um-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: var(--r); cursor: pointer; text-align: left; color: var(--ink); }
.um-item:hover { background: var(--gray-weak); }
.um-item.on { background: var(--accent-weak); }
.client-main { max-width: 900px; margin: 0 auto; width: 100%; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--r); border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--gray-weak); }
.icon-btn svg { width: 20px; height: 20px; }
.badge-dot {
  position: absolute; top: 2px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--crit-solid); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; font-variant-numeric: tabular-nums; border: 2px solid var(--surface);
}

/* ---------- 화면 틀 ---------- */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: calc(100vh - var(--top-h)); }
.nav {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--top-h)); align-self: start;
  height: calc(100vh - var(--top-h) - env(safe-area-inset-top, 0px)); overflow: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 18px 14px 28px max(14px, env(safe-area-inset-left, 0px));
}
.nav-role { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 12px 2px; }
.nav-who { padding: 0 12px 12px; font-size: 15px; color: var(--ink); border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.nav-who b { font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 10px; min-height: 40px;
  padding: 8px 12px; border-radius: var(--r); color: var(--ink-2); text-decoration: none;
  font-size: 14px; font-weight: 500;
}
.nav a .ni { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; color: var(--muted); }
.nav a .ni svg { width: 19px; height: 19px; }
.nav a .nt { flex: 1; min-width: 0; }
.nav a:hover { background: var(--gray-weak); }
.nav a[aria-current="page"] { background: var(--accent-weak); color: var(--accent-dark); font-weight: 700; }
.nav a[aria-current="page"] .ni { color: var(--accent); }
.nav .cnt {
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2);
  background: var(--gray-weak); border-radius: 10px; padding: 0 7px; min-width: 22px; height: 20px; line-height: 20px; text-align: center;
}
.nav a[aria-current="page"] .cnt { background: #fff; color: var(--accent-dark); }
.nav .cnt.hot { background: var(--crit); color: #fff; }
.nav-sep { height: 1px; background: var(--line-2); margin: 12px 12px; }
.nav-group { font-size: 12px; color: var(--faint); padding: 14px 12px 6px; font-weight: 600; }

.main {
  min-width: 0;
  padding-block: 24px 72px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.main > * { max-width: 1320px; }
@media (min-width: 961px) { .main { padding-left: 32px; padding-right: max(32px, env(safe-area-inset-right, 0px)); } }

/* ---------- 페이지 머리 ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent-dark); text-decoration: underline; }
.crumbs .sep { color: var(--faint); }
.crumbs .cur { color: var(--ink-2); font-weight: 600; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 16px; margin-bottom: 20px; }
.page-head .ttl { flex: 1 1 360px; min-width: 0; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 6px; max-width: 920px; }
.page-head .acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface);
  min-height: 36px; padding: 7px 14px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  color: var(--ink-2); text-decoration: none; line-height: 1.3;
}
.btn:hover { background: var(--surface-2); border-color: #C4C8CC; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--crit); border-color: #F1AFB6; }
.btn.danger:hover { background: var(--crit-weak); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent-dark); padding-inline: 10px; }
.btn.ghost:hover { background: var(--accent-weak); }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 13px; border-radius: var(--r-sm); }
.btn[disabled], .btn.is-off { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.why-off { font-size: 13px; color: var(--warn); }
.link { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; text-align: left; }
.link:hover { color: var(--accent); }

/* ---------- 상태 표시 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; border-radius: var(--r-sm); padding: 1px 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; line-height: 1.65;
}
.chip.gray { background: var(--gray-weak); color: var(--ink-2); }
.chip.blue { background: var(--accent-weak); color: var(--accent-dark); }
.chip.green { background: var(--ok-weak); color: var(--ok); }
.chip.amber { background: var(--warn-weak); color: var(--warn); border-color: #FFECB4; }
.chip.red { background: var(--crit-weak); color: var(--crit); }
.chip.orange { background: var(--high-weak); color: var(--high); }
.chip.violet { background: var(--ext-weak); color: var(--ext); }
.chip.ai { background: var(--ai-weak); color: var(--ai); }
.chip.line { background: var(--surface); border-color: var(--line-strong); color: var(--muted); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sev { font-weight: 700; }
.dday { font-variant-numeric: tabular-nums; font-weight: 700; }
.dday.late { color: var(--crit); }
.dday.soon { color: var(--high); }
.dday.ok { color: var(--ink-2); }
.dday small { font-weight: 400; color: var(--muted); }
.tag-src { font-size: 12px; color: var(--muted); }
.ai-mark {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700;
  color: var(--ai); background: var(--ai-weak); border-radius: 4px; padding: 0 6px;
}
.undecided {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  color: var(--warn); background: var(--warn-weak); border-radius: 4px; padding: 0 6px; border: 1px dashed var(--warn-line);
}

/* ---------- 카드·구역 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 1px 2px rgba(22, 24, 25, .03); }
.card-pad { padding: 20px; }
.section { margin-top: 24px; }
.section > .sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 12px; }
.section > .sec-head .hint { color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
@media (max-width: 1180px) { .grid.side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); } }

/* 할 일 타일 */
.todo {
  display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px 14px;
  min-width: 0; box-shadow: 0 1px 2px rgba(22, 24, 25, .03);
}
.todo:hover { border-color: var(--accent-line); box-shadow: var(--shadow); }
.todo .n { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -0.02em; }
.todo .l { font-weight: 700; font-size: 14px; }
.todo .d { color: var(--muted); font-size: 13px; }
.todo.hot .n { color: var(--crit); }
.todo.zero { opacity: .6; }
.todo.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak-2); background: var(--accent-weak); }

/* ---------- 표 ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th {
  text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); background: var(--surface-2);
  padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td, .tbl tbody tr.click:focus-visible td { background: #F5F9FF; }
.tbl tbody tr.click .t-main { color: var(--accent-dark); }
.tbl tbody tr.click:hover .t-main, .tbl tbody tr.click:focus-visible .t-main { text-decoration: underline; text-underline-offset: 2px; }
.tbl tbody tr.click:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tbl tbody tr.sel td { background: var(--accent-weak); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .sevbar { width: 4px; padding: 0; }
.tbl .sevbar span { display: block; width: 4px; min-height: 40px; height: 100%; border-radius: 2px; }
.sevbar .s-crit { background: var(--crit-solid); }
.sevbar .s-high { background: var(--high-solid); }
.sevbar .s-mid { background: var(--line-strong); }
.tbl .t-main { font-weight: 600; color: var(--ink); }
.t-sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; font-weight: 400; }
.tbl td > .t-main { display: block; }
.tbl tr.dim td { color: var(--faint); }
.tbl tr.dim .t-main { color: var(--muted); }
.tbl tr.grp td { background: var(--surface-2); font-weight: 700; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---------- 탭 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 15px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 700; }

/* ---------- 이름-값 ---------- */
.kvg { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 24px; margin: 0; font-size: 13.5px; }
.kvg > div { min-width: 0; }
.kvg dt { color: var(--muted); font-size: 12.5px; margin-bottom: 2px; }
.kvg dd { margin: 0; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .kv { grid-template-columns: minmax(0, 1fr); } .kv dt { margin-top: 6px; } }

/* ---------- 판단 근거 비교 ---------- */
.cmp td.ok-cell { color: var(--ok); font-weight: 700; }
.cmp td.no-cell { color: var(--crit); font-weight: 700; }
.cmp td.unk-cell { color: var(--warn); font-weight: 700; }
.src { display: block; font-size: 12px; color: var(--muted); }
.src.ref { color: var(--faint); text-decoration: line-through; text-decoration-color: rgba(137, 145, 153, .5); }
.refnote { font-size: 12px; color: var(--warn); display: block; }

/* ---------- 단계 표시 ---------- */
.steps { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12.5px; }
.steps .st { padding: 3px 9px; border-radius: var(--r-sm); background: var(--gray-weak); color: var(--muted); white-space: nowrap; font-weight: 500; }
.steps .st.done { background: var(--ok-weak); color: var(--ok); }
.steps .st.now { background: var(--accent); color: #fff; font-weight: 700; }
.steps .arr { color: var(--faint); }
.nd { display: inline-flex; flex-wrap: wrap; gap: 4px; max-width: 260px; }
.nd i {
  font-style: normal; display: inline-flex; align-items: center; white-space: nowrap; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6; border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface);
}
.nd i.sent { background: var(--ok-weak); border-color: #B5E3CB; color: #146C43; }
.nd i.due { background: var(--warn-weak); border-color: var(--warn-line); color: #6B5000; font-weight: 700; }
.nd i.none { color: var(--muted); border-style: dashed; }

/* ---------- 알림 띠 ---------- */
.banner {
  display: flex; gap: 10px; align-items: flex-start; border-radius: 10px; padding: 12px 16px;
  font-size: 13.5px; border: 1px solid var(--line); background: var(--surface);
}
.banner.info { background: var(--accent-weak); border-color: var(--accent-line); color: #0A4A99; }
.banner.warn { background: var(--warn-weak); border-color: var(--warn-line); color: #5E4500; }
.banner.ai { background: var(--ai-weak); border-color: #A8DED6; color: #0A4F47; }
.banner.ext { background: var(--ext-weak); border-color: #D6C8F0; color: #45297D; }
.banner.ok { background: var(--ok-weak); border-color: #A6E6C6; color: #0E5A37; }
.banner .b-body { min-width: 0; flex: 1; }
.banner b { font-weight: 700; }

/* ---------- 입력 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--crit); margin-left: 2px; }
.field .help { font-size: 12.5px; color: var(--muted); }
input[type="text"], input[type="search"], input[type="email"], input[type="date"], input[type="datetime-local"], input[type="number"], select, textarea {
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); padding: 8px 12px; width: 100%; min-width: 0; min-height: 38px;
}
textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 117, 248, .14); }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.radios { display: flex; flex-wrap: wrap; gap: 6px; }
.radio-card {
  display: flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: var(--r);
  padding: 7px 12px; cursor: pointer; background: var(--surface); font-size: 13.5px;
}
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); color: var(--accent-dark); font-weight: 700; }
.radio-card input { accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.inline-edit { display: flex; gap: 6px; align-items: center; }
.inline-edit input, .inline-edit select { padding: 4px 8px; font-size: 13px; min-height: 32px; }

/* ---------- 오른쪽 상세 창 ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(22, 24, 25, .32); z-index: 50; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(740px, 100%); z-index: 51;
  background: var(--bg); box-shadow: -10px 0 32px rgba(22, 24, 25, .16); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.drawer-head {
  display: flex; align-items: flex-start; gap: 10px; padding: 18px 20px 16px; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.drawer-head .ttl { flex: 1; min-width: 0; }
.drawer-body { padding: 18px 20px 44px; overflow: auto; flex: 1; }

/* ---------- 대화창 ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(22, 24, 25, .4); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface);
  border-radius: 16px; box-shadow: 0 24px 56px rgba(22, 24, 25, .24);
}
.modal.wide { width: min(880px, 100%); }
.modal-head { padding: 22px 24px 8px; }
.modal-body { padding: 8px 24px 14px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line-2); }

/* ---------- 알림 문구(잠깐 뜨는 것) ---------- */
.toast-area {
  position: fixed; z-index: 70; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: max-content; max-width: calc(100% - 32px);
}
.toast {
  background: var(--ink-2); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13.5px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22); max-width: 560px;
}
.toast b { color: #9CC9FF; font-weight: 700; }

/* ---------- 처리 이력 ---------- */
.tl { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0; }
.tl li { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.tl li:last-child { border-bottom: 0; }
.tl time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.tl .who { color: var(--muted); font-size: 12.5px; }

/* ---------- 메일·문안 미리보기 ---------- */
.mail { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.mail-head { padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); display: grid; gap: 2px; }
.mail-body { padding: 16px 18px; white-space: pre-wrap; font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.var { background: #FFF3CD; border-radius: 3px; padding: 0 2px; }
.piece { border-left: 3px solid var(--accent-line); padding-left: 10px; margin: 6px 0; }
.status-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); margin-top: 12px; font-size: 13.5px; white-space: normal; }

/* ---------- 고객 화면 ---------- */
.client-wrap { max-width: 760px; margin: 0 auto; }
.client-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.code-input { font-family: var(--mono); letter-spacing: .3em; font-size: 22px; text-align: center; }
.prog { display: flex; gap: 4px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.prog span, .prog li { flex: 1 1 70px; text-align: center; font-size: 12px; padding: 6px 4px; border-radius: var(--r-sm); background: var(--gray-weak); color: var(--faint); font-weight: 600; }
.prog span.done, .prog li.done { background: var(--ok-weak); color: var(--ok); }
.prog span.now, .prog li.now { background: var(--accent); color: #fff; font-weight: 700; }


/* ---------- 기타 ---------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.hr { height: 1px; background: var(--line); margin: 16px 0; }
.box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.box.soft { background: var(--surface-2); }
.list-plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.kbd { font-family: var(--mono); font-size: 12px; background: var(--gray-weak); border-radius: 4px; padding: 0 5px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.copy-line { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.copy-line code { background: var(--gray-weak); padding: 2px 6px; border-radius: 4px; }
.meter { height: 8px; border-radius: 4px; background: var(--gray-weak); overflow: hidden; display: flex; min-width: 90px; }
.meter i { display: block; height: 100%; }
.meter .m-ok { background: var(--ok-solid); }
.meter .m-run { background: var(--accent); }
.meter .m-wait { background: #A98EDA; }
.meter .m-unk { background: var(--warn-line); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav {
    position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h, 96px)); z-index: 20; height: auto; overflow-x: auto; overflow-y: hidden;
    display: flex; gap: 4px; padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .nav-role, .nav-who, .nav-sep, .nav-group { display: none; }
  .nav a { flex: none; white-space: nowrap; padding: 6px 12px; min-height: 36px; }
  .nav a .ni { display: none; }
  .brand-name { font-size: 15px; }
  .main { padding-top: 18px; }
}
@media (max-width: 960px) { .tsearch input[type="search"] { width: 170px; } }
@media (max-width: 520px) {
  .acct-txt small { display: none; }
  .acct-txt b { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tsearch { order: 5; width: 100%; }
  .tsearch input[type="search"] { flex: 1; width: auto; }
  h1 { font-size: 21px; }
  .topbar-in { gap: 10px; }
}

/* ===== 사용성 보완(필수 칸·확인·고정 막대·좁은 화면) ===== */
[hidden] { display: none !important; }
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus, main[tabindex="-1"]:focus { outline: none; }
.nd i > span[aria-hidden] { margin-left: 3px; }
.mb { margin-bottom: 12px; }
.grow { flex: 1 1 240px; min-width: 0; }
.card-ttl { font-size: 15px; line-height: 1.4; }
.alt-row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding-top: 10px; border-top: 1px dashed var(--line); }
.filter-on { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; border-radius: var(--r); background: var(--accent-weak); color: var(--accent-dark); font-size: 13.5px; }
.left-list { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.left-list .link { text-align: left; }
.ap-who { gap: 8px 18px; margin-bottom: 12px; color: var(--ink-2); }
.err-msg { font-size: 12.5px; color: var(--crit); font-weight: 600; }
input.invalid, select.invalid, textarea.invalid { border-color: var(--crit) !important; box-shadow: 0 0 0 3px var(--crit-weak); }
.row.invalid, .checks.invalid, .radios.invalid { outline: 2px solid #F1AFB6; outline-offset: 4px; border-radius: 6px; }
.submit-row .btn.is-off { cursor: pointer; }
.modal-foot .submit-row { flex-direction: row-reverse; }
.toast .toast-undo { margin-left: 10px; background: transparent; color: #9CC9FF; border-color: rgba(255, 255, 255, .4); }
.toast .toast-undo:hover { background: rgba(255, 255, 255, .12); }
.tabs.tabs-sm { margin-bottom: 12px; }
.tabs.tabs-sm button { padding-top: 6px; padding-bottom: 8px; font-size: 13.5px; }
.send-bar { position: sticky; bottom: 0; z-index: 4; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px -20px -20px; padding: 12px 20px; background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.decide-bar { position: sticky; bottom: 0; z-index: 4; display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-top: 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 -6px 18px rgba(22, 24, 25, .07); }
.decide-bar .field { margin: 0; }
.sticky-side { position: sticky; top: calc(var(--topbar-h, 64px) + 12px); max-height: calc(100vh - var(--topbar-h, 64px) - 24px); overflow: auto; }
.opt-chip { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 2px 1px 10px; font-size: 13px; background: var(--surface); }
.opt-chip .opt-btn { border: 0; background: transparent; color: var(--accent-dark); font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 999px; cursor: pointer; }
.opt-chip .opt-btn:hover { background: var(--accent-weak); }
.opt-chip.off .v { text-decoration: line-through; color: var(--faint); }
.radio-card .t-sub { font-weight: 400; }
details.fold { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: 4px 16px; }
details.fold > summary { cursor: pointer; list-style: revert; padding: 10px 0; }
details.fold > summary h2 { display: inline; font-size: 15px; }
details.fold[open] { padding-bottom: 14px; }
.brand-name small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.crumbs .cur { max-width: 32em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a { max-width: 18em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-tag { font-size: 11px; font-weight: 700; background: rgba(255, 255, 255, .22); border-radius: 999px; padding: 0 6px; margin-left: 4px; }
@media (max-width: 960px) {
  .nav { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
  .nav.at-end { -webkit-mask-image: none; mask-image: none; }
}
@media (max-width: 760px) {
  .decide-bar { position: static; box-shadow: none; }
  .sticky-side { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .grid.c4.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .tiles .todo.zero { display: none; }
  .tiles .todo { padding: 12px; }
  .tiles .todo .n { font-size: 22px; }
  .tiles .todo .d { display: none; }
  table.tbl.stackable, .drawer table.tbl.stackable { min-width: 0; }
  .tbl.stackable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tbl.stackable, .tbl.stackable tbody { display: block; }
  .tbl.stackable tbody tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
  .tbl.stackable tbody tr:last-child { border-bottom: 0; }
  .tbl.stackable tbody td { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; padding: 3px 0; border: 0; }
  .tbl.stackable tbody td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; }
  .tbl.stackable tbody td[data-label=""], .tbl.stackable tbody td.cell-head { grid-template-columns: minmax(0, 1fr); }
  .tbl.stackable tbody td[data-label=""]::before, .tbl.stackable tbody td.cell-head::before { content: none; }
  .tbl.stackable tbody td.cell-head { padding-bottom: 6px; }
  .tbl.stackable td.sevbar { display: none; }
  .tbl.stackable tr.grp td { display: block; padding: 4px 0; }
  .tbl.stackable tbody td:empty { display: none; }
  .prog { flex-direction: column; }
  .prog li, .prog span { flex: none; text-align: left; padding: 8px 12px; }
}

/* ===== 쉬운 화면(목록·접기·거르기) ===== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar input[type="search"] { flex: 1 1 260px; width: auto; }
.filter-bar select { width: auto; min-width: 150px; }
.act-cell { text-align: right; white-space: nowrap; }
.chip-btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.chip-btn:hover { border-color: var(--accent-line); }
.chip-btn.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent-dark); font-weight: 700; }
ul.facts { margin: 6px 0 4px; padding-left: 18px; display: grid; gap: 2px; font-size: 13.5px; }
details.more { margin-top: 8px; }
details.more > summary { cursor: pointer; color: var(--accent-dark); font-size: 13.5px; font-weight: 600; padding: 2px 0; }
.tpl-pick { margin: 2px 0 6px 26px; gap: 4px 12px; }
@media (max-width: 640px) { .act-cell { text-align: left; } }

.todo-ttl { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.todo-ttl .chip { flex: none; }
@media (max-width: 640px) {
  .tbl.stackable tbody td > * { grid-column: 2; }
  .tbl.stackable tbody td.cell-head > *, .tbl.stackable tbody td[data-label=""] > * { grid-column: 1; }
}

/* 처리 기준 입력(부서) */
.defform { display: flex; flex-direction: column; gap: 4px; }
.dsec { border-top: 1px solid var(--line); padding: 16px 0 6px; display: flex; flex-direction: column; gap: 12px; }
.dsec:first-child { border-top: 0; padding-top: 0; }
.dsec > h3 { font-size: 15px; margin: 0; display: flex; align-items: center; gap: 8px; }
.dnum { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-weak); color: var(--accent-dark); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.dsec .help { font-size: 12.5px; color: var(--muted); }
.sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sugg .chip-btn { font-size: 12.5px; padding: 3px 10px; }
.lrows { display: flex; flex-direction: column; gap: 6px; }
.lrow { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.lrow > span:nth-child(2), .lrow > span:first-child:not(.snum) { flex: 1; min-width: 0; }
.lrow .btn { margin-left: auto; }
.lrow-acts { margin-left: auto; display: inline-flex; gap: 4px; flex: none; }
.lrow-acts .btn { margin-left: 0; }
.snum { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-strong); font-size: 11.5px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.add-row { display: flex; gap: 6px; margin-top: 8px; }
.add-row input { flex: 1; min-width: 0; }
.mrow { display: grid; grid-template-columns: minmax(84px, max-content) minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.mrow > .chip { justify-self: start; margin-top: 7px; max-width: 170px; white-space: normal; line-height: 1.35; }
.mrow .field { margin: 0; }
.defform .radios .radio-card { padding: 6px 12px; }
@media (max-width: 640px) {
  .mrow { grid-template-columns: minmax(0, 1fr) auto; }
  .mrow > .chip { grid-column: 1 / -1; margin-top: 0; }
}

