/* 색은 이 토큰에만 둔다. 고치면 jobs/contrast_check.py로 대비를 확인한다.
   글자는 순수 검정·순수 흰색을 피한 무채색, 강조색은 메뉴 묶음별 한 가지, 빨강·노랑·초록은 상태에만 쓴다. */
:root {
  --bg: #f0f2f5; --surface: #ffffff; --sunken: #f3f5f7; --line: #d5d9df; --edge: #858e9c; --fg: #1c2430; --muted: #4a5464; --ink: #1c2430; --on-ink: #ffffff;
  --accent: #2450a6; --on-accent: #ffffff; --accent-bg: #e9eef8; --link: #2450a6;
  --good: #14603d; --good-bg: #dcf3e6; --mid: #7a4f00; --mid-bg: #fbeecb; --low: #b42318; --low-bg: #fde8e6; --info: #1f4e9c; --info-bg: #e2eafa; --shade: rgba(20,24,32,.42); --lift: 0 1px 2px rgba(20,24,32,.06);
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #14171c; --surface: #1d2127; --sunken: #262b33; --line: #39404b; --edge: #7d8796; --fg: #e8ebef; --muted: #b6bdc8; --ink: #e8ebef; --on-ink: #171a1f;
  --accent: #8fb0f0; --on-accent: #10182a; --accent-bg: #252e40; --link: #9dbbf3;
  --good: #86dfae; --good-bg: #1a3a2a; --mid: #eec56b; --mid-bg: #3b3016; --low: #f7a8a0; --low-bg: #472421; --info: #a6c1f5; --info-bg: #202f4d; --shade: rgba(0,0,0,.6); --lift: none; color-scheme: dark;
} }
[data-section="home"] { --accent: #2450a6; --accent-bg: #e9eef8; --link: #2450a6; }
[data-section="pm"] { --accent: #4a3fb5; --accent-bg: #edecf9; --link: #4a3fb5; }
[data-section="cs"] { --accent: #0b6b63; --accent-bg: #e3f2f0; --link: #0b6b63; }
[data-section="mkt"] { --accent: #93266f; --accent-bg: #f8e9f3; --link: #93266f; }
[data-section="sales"] { --accent: #1b5a8a; --accent-bg: #e5f0f7; --link: #1b5a8a; }
[data-section="crm"] { --accent: #6a3ab2; --accent-bg: #f0eaf9; --link: #6a3ab2; }
[data-section="mi"] { --accent: #0a6480; --accent-bg: #e2f1f5; --link: #0a6480; }
[data-section="fin"] { --accent: #2f6236; --accent-bg: #e8f2e9; --link: #2f6236; }
[data-section="hr"] { --accent: #9c2f4d; --accent-bg: #f9e9ed; --link: #9c2f4d; }
[data-section="admin"] { --accent: #455063; --accent-bg: #eceef1; --link: #455063; }
@media (prefers-color-scheme: dark) {
  .dk[data-section="home"] { --accent: #8fb0f0; --accent-bg: #252e40; --link: #9dbbf3; }
  .dk[data-section="pm"] { --accent: #aaa3f2; --accent-bg: #2b2a43; --link: #b5aff4; }
  .dk[data-section="cs"] { --accent: #6fd0c3; --accent-bg: #1c3431; --link: #7dd6ca; }
  .dk[data-section="mkt"] { --accent: #eb9fd0; --accent-bg: #3a2233; --link: #efacd7; }
  .dk[data-section="sales"] { --accent: #84bfe6; --accent-bg: #1e3140; --link: #92c7ea; }
  .dk[data-section="crm"] { --accent: #bea3ee; --accent-bg: #2f2741; --link: #c7aff1; }
  .dk[data-section="mi"] { --accent: #6fc8e0; --accent-bg: #1a3339; --link: #7ed0e5; }
  .dk[data-section="fin"] { --accent: #93d29b; --accent-bg: #203425; --link: #a0d8a7; }
  .dk[data-section="hr"] { --accent: #f0a2b5; --accent-bg: #3e242c; --link: #f3afc0; }
  .dk[data-section="admin"] { --accent: #b3bccb; --accent-bg: #2a2f38; --link: #bec6d3; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 15px/1.6 "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; }
h1 { font-size: 17px; margin: 0; }
h2 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
main > h2:first-child { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
h3 { font-size: 15px; margin: 0 0 6px; color: var(--fg); font-weight: 700; }
[hidden] { display: none !important; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; align-items: end; }
.form label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.form label.wide { grid-column: 1 / -1; }
.form input, .form select, .form textarea { width: 100%; color: var(--fg); }
.ro form.form, .ro .filters ~ form.form { display: none; }
.ro td select, .ro td input, .ro td button { pointer-events: none; opacity: .75; }
.authbox { max-width: 380px; margin: 40px auto; display: grid; gap: 10px; }
.authbox label { display: grid; gap: 3px; font-size: 14px; color: var(--muted); }
.authbox input { width: 100%; }
.warn { background: var(--mid-bg); color: var(--mid); padding: 10px 14px; border-radius: 12px; margin: 0; font-size: 14px; }
button, select, input, textarea { font: inherit; color: inherit; }
select, input, textarea { background: var(--surface); border: 1px solid var(--edge); border-radius: 10px; padding: 7px 10px; }
button.btn { border: 1px solid var(--edge); background: var(--surface); border-radius: 10px; padding: 7px 13px; cursor: pointer; font-weight: 500; }
button.btn[type=submit] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
button.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent) !important; color: var(--on-accent); }
button.btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-bg); }
button.btn[type=submit]:hover:not(:disabled) { background: var(--ink); opacity: .9; }
a { color: var(--link); text-underline-offset: 2px; }
button.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { all: unset; box-sizing: border-box; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--lift); cursor: pointer; display: grid; gap: 1px; }
.tile:focus-visible { outline: 2px solid var(--accent); }
.tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-bg); }
.tile small { color: var(--muted); font-size: 13px; }
.tile b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filters label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.filters input[type=search] { width: 240px; }
.check { display: flex !important; gap: 5px; align-items: center; padding-bottom: 6px; }
.tablebox { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--lift); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; font-size: 14px; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
th { font-size: 13px; color: var(--fg); font-weight: 700; background: var(--sunken); }
td.wrap { white-space: normal; min-width: 260px; max-width: 460px; overflow-wrap: anywhere; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: var(--accent-bg); }
tbody tr:last-child td { border-bottom: 0; }
.chip { display: inline-block; font-size: 13px; font-weight: 600; padding: 1px 9px; border-radius: 99px; background: var(--sunken); color: var(--fg); white-space: nowrap; }
.s-완료, .s-배송완료 { background: var(--good-bg); color: var(--good); }
.s-미발송 { background: var(--mid-bg); color: var(--mid); }
.s-배송중 { background: var(--info-bg); color: var(--info); }
.s-취소, .s-취소요청 { background: var(--low-bg); color: var(--low); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.pager { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; }
.note { color: var(--muted); font-size: 13px; margin: 0; }
.bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(46px, 1fr)); gap: 4px; align-items: end; height: 112px; }
.bar { display: grid; grid-template-rows: 1fr auto auto; height: 100%; text-align: center; font-size: 12px; color: var(--muted); }
.bar i { display: flex; flex-direction: column; justify-content: flex-end; font-style: normal; min-height: 0; }
.bar u { display: block; border-radius: 3px 3px 0 0; background: var(--accent); text-decoration: none; }
.bar s { display: block; background: var(--low); opacity: .6; text-decoration: none; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--lift); }
.legend { display: flex; gap: 12px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 4px; background: var(--accent); }
.legend span.c::before { background: var(--low); opacity: .6; }
.legend span[style]::before { background: var(--dot); }
.shade { position: fixed; inset: 0; background: var(--shade); z-index: 5; }
.drawer { position: fixed; top: 8px; right: 8px; bottom: 8px; width: min(760px, calc(100% - 16px)); border-radius: 18px; border: 1px solid var(--line); background: var(--surface); z-index: 6; overflow-y: auto; padding: 16px; display: grid; gap: 14px; align-content: start; }
.drawhead { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.drawer .tablebox { border-color: var(--line); }
textarea { width: 100%; min-height: 70px; resize: vertical; }
.error { background: var(--low-bg); color: var(--low); padding: 10px 14px; border-radius: 12px; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* 화면 뼈대: 왼쪽 아이콘 레일 + 둥근 작업 카드. 하위 메뉴는 카드 위쪽 알약 탭 */
#shell { display: grid; grid-template-columns: 84px minmax(0, 1fr); min-height: 100vh; }
#shell.noside { grid-template-columns: minmax(0, 1fr); }
#side { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 12px; scrollbar-width: none; }
.mark { margin: 0; width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; font-size: 17px; font-weight: 800; }
#tree { display: grid; gap: 2px; width: 100%; }
#tree button { all: unset; box-sizing: border-box; display: grid; justify-items: center; gap: 3px; width: 100%; padding: 8px 2px; border-radius: 12px; cursor: pointer; color: var(--muted); font-size: 12px; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
#tree button:hover { background: var(--sunken); color: var(--fg); }
#tree button:focus-visible, .pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#tree .group.on, #tree .group[aria-current="page"] { background: var(--surface); color: var(--accent); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent), 0 0 0 1px var(--line); }
.ico { display: block; width: 20px; height: 20px; }
.ico svg { width: 100%; height: 100%; display: block; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#page { min-width: 0; display: flex; flex-direction: column; padding: 0 12px 12px 0; }
#shell.noside #page { padding-left: 12px; }
.top { background: var(--bg); padding: 10px 6px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; position: sticky; top: 0; z-index: 4; }
.top .right { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
#basis { color: var(--muted); font-size: 13px; }
#stage { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; min-width: 0; display: flex; flex-direction: column; }
#tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 16px; background: var(--accent-bg); border-radius: 18px 18px 0 0; border-bottom: 1px solid var(--line); }
#tabs:empty { display: none; }
.pill { all: unset; box-sizing: border-box; padding: 6px 14px; border-radius: 99px; cursor: pointer; font-size: 14px; color: var(--fg); }
.pill:hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent); }
.pill[aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
main { padding: 18px 20px 24px; display: grid; gap: 16px; min-width: 0; outline: none; align-content: start; }
main:focus-visible { outline: none; }
.tile:hover { border-color: var(--accent); }
#sideShade { display: none; }
#menuBtn { display: none; }
@media (max-width: 820px) {
  #shell { grid-template-columns: minmax(0, 1fr); }
  #side { position: fixed; left: 0; top: 0; z-index: 20; width: 96px; background: var(--bg); transform: translateX(-100%); transition: transform .15s; }
  #shell.sideopen #side { transform: none; }
  #shell.sideopen #sideShade { display: block; position: fixed; inset: 0; background: var(--shade); z-index: 15; }
  #menuBtn { display: inline-flex; }
  #basis { display: none; }
  #page { padding: 0 8px 8px; }
  #tabs { flex-wrap: nowrap; overflow-x: auto; }
  .pill { white-space: nowrap; }
  main { padding: 14px 16px 20px; }
}
@media (prefers-reduced-motion: reduce) { #side { transition: none; } }
.mkcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mkday { min-height: 78px; background: var(--sunken); border-radius: 10px; padding: 4px 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mkday small { color: var(--muted); }
.mkday .chip { border: 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-align: left; font: inherit; font-size: 12px; }

/* 다듬기: 한글 줄바꿈, 조작 크기, 고정 영역, 위계. 색은 토큰만 쓴다. */
body { word-break: keep-all; overflow-wrap: break-word; -webkit-font-smoothing: antialiased; }
main { gap: 20px; transition: opacity .12s .15s; }
main[aria-busy="true"] { opacity: .5; }
main p, .note { max-width: 96ch; }
button.btn, select, input:not([type=checkbox]):not([type=radio]) { min-height: 36px; }
button.btn { transition: background-color .12s, border-color .12s; }
#tree button, .pill, .tile { transition: background-color .12s, border-color .12s, color .12s; }
#tree button { min-height: 56px; align-content: center; }
.top { padding: 8px 6px; }
.top .btn { border-color: transparent; background: transparent; min-height: 32px; padding: 4px 10px; }
.top .btn:hover:not(:disabled) { background: var(--surface); border-color: var(--line); }
.top select { min-height: 32px; padding: 3px 8px; background: transparent; border-color: var(--line); }
#crumb b { font-size: 16px; font-weight: 800; letter-spacing: -.01em; color: var(--accent); }
#tabs { position: sticky; top: var(--top-h, 48px); z-index: 3; }
#stage { box-shadow: var(--lift); }
.filters { padding: 10px 12px; background: var(--sunken); border-radius: 12px; }
.panel .filters, .drawer .filters, form.filters + form.filters { background: transparent; padding: 0; }
.panel { display: block; }
.panel > h3:first-child { margin-bottom: 10px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
button.tile:hover { background: var(--accent-bg); }
.tile { gap: 3px; align-content: start; }
.tablebox { max-height: 76vh; overflow: auto; scrollbar-width: thin; }
.tablebox th { position: sticky; top: 0; z-index: 1; box-shadow: inset 0 -1px 0 var(--line); border-bottom: 0; }
.drawer .tablebox th, .tablebox tbody th { position: static; }
td { font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--sunken); }
tbody tr.link:hover { background: var(--accent-bg); }
tbody tr.link:focus-visible { outline-offset: -2px; }
details > summary { cursor: pointer; padding: 2px 0; }
details > summary:hover { color: var(--accent); }
.drawer { box-shadow: 0 8px 28px var(--shade); }
.empty { background: var(--sunken); border-radius: 14px; }
@media (max-width: 820px) {
  #tabs { position: static; }
  .top { position: static; }
  .tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { button.btn, #tree button, .pill, .tile { transition: none; } }

.linkbtn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; text-align: left; }
