:root {
  --page: #f6f6f4;
  --panel: #ffffff;
  --side: #fbfbfa;
  --line: #e6e5e1;
  --line-2: #c9c8c2;
  --ink: #1f2328;
  --ink-2: #5b616b;
  --ink-3: #6b7280;
  --on-accent: #ffffff;
  --accent-hover: #0b5c55;
  --accent: #0f766e;
  --accent-ink: #0b5c55;
  --accent-weak: #e5f1ef;
  --hover: #f3f3f0;
  --row-on: #eef5f3;
  --field: #ffffff;
  --plan: #cfe6e2;
  --actual: #0f766e;
  --today: #fff4d6;

  --s-prog: #2563eb;
  --s-prog-bg: #eaf0fd;
  --s-done: #15803d;
  --s-done-bg: #e8f5ec;
  --s-wait: #b45309;
  --s-wait-bg: #fcf1e3;
  --s-hold: #6b7280;
  --s-hold-bg: #efeff1;
  --s-check: #b91c1c;
  --s-check-bg: #fbeaea;

  --r: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0d1117;
    --panel: #0d1117;
    --side: #151b23;
    --line: #30363d;
    --line-2: #3d444d;
    --ink: #e6edf3;
    --ink-2: #c9d1d9;
    --ink-3: #9198a1;
    --accent: #4fc3b4;
    --accent-hover: #6fd3c6;
    --on-accent: #06201d;
    --accent-ink: #7fdccf;
    --accent-weak: #12302c;
    --hover: #1c2128;
    --row-on: #132a28;
    --field: #0d1117;
    --plan: #1f4a44;
    --actual: #4fc3b4;
    --today: #3a3220;
    --s-prog: #4493f8;
    --s-prog-bg: #121d2f;
    --s-done: #3fb950;
    --s-done-bg: #12261e;
    --s-wait: #d29922;
    --s-wait-bg: #272115;
    --s-hold: #9198a1;
    --s-hold-bg: #1c2128;
    --s-check: #f85149;
    --s-check-bg: #25171c;
    color-scheme: dark;
  }
}

/* 사용자가 어둡게를 직접 고른 경우 */
:root[data-theme="dark"] {
  --page: #0d1117;
  --panel: #0d1117;
  --side: #151b23;
  --line: #30363d;
  --line-2: #3d444d;
  --ink: #e6edf3;
  --ink-2: #c9d1d9;
  --ink-3: #9198a1;
  --accent: #4fc3b4;
  --accent-hover: #6fd3c6;
  --on-accent: #06201d;
  --accent-ink: #7fdccf;
  --accent-weak: #12302c;
  --hover: #1c2128;
  --row-on: #132a28;
  --field: #0d1117;
  --plan: #1f4a44;
  --actual: #4fc3b4;
  --today: #3a3220;
  --s-prog: #4493f8;
  --s-prog-bg: #121d2f;
  --s-done: #3fb950;
  --s-done-bg: #12261e;
  --s-wait: #d29922;
  --s-wait-bg: #272115;
  --s-hold: #9198a1;
  --s-hold-bg: #1c2128;
  --s-check: #f85149;
  --s-check-bg: #25171c;
  color-scheme: dark;
}


* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, "Malgun Gothic", "Segoe UI", system-ui, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- 틀 ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 8px; padding: 16px 16px 12px; font-weight: 700; font-size: 15.5px; }
.mark { width: 24px; height: 24px; border-radius: 6px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: 13.5px; }
.side-user { display: flex; align-items: center; gap: 10px; margin: 0 10px 10px; padding: 10px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-weak); color: var(--accent-ink); display: grid; place-items: center; font-weight: 600; font-size: 13.5px; flex: none; }
.me-name { font-weight: 600; }
.me-team { color: var(--ink-3); font-size: 13.5px; }
.side-nav { display: flex; flex-direction: column; gap: 1px; padding: 4px 8px; }
.nav-label { color: var(--ink); font-size: 15px; font-weight: 700; padding: 16px 10px 6px; }
.nav-label:first-child { padding-top: 6px; }
.nav-btn { display: flex; align-items: center; gap: 9px; border: 0; background: none; text-align: left; padding: 7px 10px 7px 20px; border-radius: 6px; color: var(--ink-2); }
.nav-btn svg { flex: none; opacity: .8; }
.nav-btn:hover { background: var(--hover); color: var(--ink); }
.nav-btn.on { background: var(--accent-weak); color: var(--accent-ink); font-weight: 600; }
.nav-btn .badge { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-weight: 400; }
.side-foot { margin-top: auto; padding: 12px 16px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.demo { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-3); }
.demo select { border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 6px; background: var(--field); color: var(--ink); font-size: 13.5px; }
.link { border: 0; background: none; color: var(--ink-3); padding: 0; font-size: 13.5px; text-align: left; text-decoration: underline; text-underline-offset: 2px; }
.link:hover { color: var(--ink); }

.main { padding: 18px 24px 40px; min-width: 0; }

/* ---------- 페이지 머리 ---------- */
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head h1 { font-size: 20px; font-weight: 700; margin: 0; }
.head .desc { color: var(--ink-3); font-size: 13.5px; }
.grow { flex: 1; }
.weeknav { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel); height: 36px; }
.weeknav button { border: 0; background: none; width: 34px; height: 100%; color: var(--ink-2); display: grid; place-items: center; }
.weeknav button:hover { background: var(--hover); color: var(--ink); }
.weeknav .wk { padding: 0 8px; font-weight: 600; white-space: nowrap; border-left: 1px solid var(--line); border-right: 1px solid var(--line); height: 100%; display: flex; align-items: center; gap: 6px; }
.weeknav .wk span { color: var(--ink-3); font-weight: 400; font-size: 13.5px; }

.btn { height: 36px; border: 1px solid var(--line-2); background: var(--panel); border-radius: var(--r); padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--hover); color: var(--ink); }
.btn.sm { height: 31px; padding: 0 11px; font-size: 13.5px; }
.icon-btn { border: 0; background: none; width: 28px; height: 28px; border-radius: 6px; color: var(--ink-3); display: grid; place-items: center; }
.icon-btn:hover { background: var(--hover); color: var(--s-check); }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel); height: 36px; padding: 2px; }
.seg button { border: 0; background: none; padding: 0 10px; border-radius: 6px; color: var(--ink-2); }
.seg button.on { background: var(--hover); color: var(--ink); font-weight: 600; }
.sel { height: 36px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--field); padding: 0 8px; }

.state { font-size: 13.5px; color: var(--ink-3); white-space: nowrap; }
.state.err { color: var(--s-check); }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.tag.draft { background: var(--s-prog-bg); color: var(--s-prog); }
.tag.submitted { background: var(--s-done-bg); color: var(--s-done); }
.tag.none { background: var(--s-hold-bg); color: var(--s-hold); }

.banner { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r); margin-bottom: 12px; background: var(--accent-weak); border: 1px solid transparent; }
.banner .msg { flex: 1; }
.banner.warn { background: var(--s-wait-bg); }
.banner.danger { background: var(--s-check-bg); }
.banner.muted { background: var(--hover); color: var(--ink-2); }

/* ---------- 패널·표 ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; overflow: hidden; }
.panel-h { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.panel-h h2 { font-size: 14.5px; font-weight: 700; margin: 0; }
.panel-h .count { color: var(--ink-3); font-size: 13.5px; }
.panel-b { padding: 12px 14px; }
.scroll-x { overflow-x: auto; }

table.t { width: 100%; border-collapse: collapse; table-layout: fixed; }
.t th { position: sticky; top: 0; background: var(--side); text-align: left; font-weight: 600; color: var(--ink-2); font-size: 13.5px; padding: 8px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t td { border-bottom: 1px solid var(--line); padding: 0; vertical-align: top; height: 38px; }
.t tr:last-child td { border-bottom: 0; }
.t td.pad { padding: 8px 9px; }
.t td.c, .t th.c { text-align: center; }
.t tbody tr:hover td { background: var(--hover); }
.t tr.on td { background: var(--row-on); }
.t tr.click { cursor: pointer; }
.t tr.new td { background: var(--side); }
.t tr.sub td { background: var(--page); }
.t td + td, .t th + th { border-left: 1px solid var(--line); }
.t .muted, .muted { color: var(--ink-3); }
.t .clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code { font-weight: 600; }

.cell { width: 100%; min-height: 38px; border: 0; background: transparent; padding: 8px 9px; display: block; outline: none; border-radius: 0; }
.cell:focus { box-shadow: inset 0 0 0 2px var(--accent); background: var(--field); }
textarea.cell { resize: none; overflow: hidden; line-height: 1.5; }
select.cell { appearance: none; -webkit-appearance: none; padding-right: 18px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 10px) 17px, calc(100% - 6px) 17px; background-size: 4px 4px; background-repeat: no-repeat; text-overflow: ellipsis; }
select.cell:disabled, input.cell:read-only, textarea.cell:read-only { background-image: none; cursor: default; }
input.cell[type="date"] { color: var(--ink); }
input.cell[type="date"]:invalid, input.cell[type="date"][value=""] { color: var(--ink-3); }
.cell::placeholder, .note-area::placeholder, .inp::placeholder { color: var(--ink-3); opacity: 1; }
select, select option { color: var(--ink); background-color: var(--field); }
select.cell { background-color: transparent; }
.cell.empty-proj { color: var(--ink-3); }

.st { display: inline-flex; align-items: center; gap: 6px; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.st-진행 { color: var(--s-prog); }
.st-완료 { color: var(--s-done); }
.st-대기 { color: var(--s-wait); }
.st-보류 { color: var(--s-hold); }
.st-확인 { color: var(--s-check); }
select.cell.st-진행, select.cell.st-완료, select.cell.st-대기, select.cell.st-보류, select.cell.st-확인 { font-weight: 500; }

.carry { display: inline-block; margin: 0 8px 6px; font-size: 12.5px; color: var(--ink-3); background: var(--hover); border-radius: 4px; padding: 0 5px; }
.hint { color: var(--ink-3); font-size: 13.5px; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--side); }
.err-text { color: var(--s-check); font-size: 13.5px; padding: 6px 14px; }
.empty { color: var(--ink-3); padding: 18px 14px; text-align: center; }

/* ---------- 주간보고 ---------- */
.report-meta { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.report-meta > div { padding: 10px 14px; border-right: 1px solid var(--line); }
.report-meta > div:last-child { border-right: 0; }
.k { color: var(--ink-3); font-size: 12.5px; }
.v { font-weight: 600; margin-top: 2px; }
.v.big { font-size: 22px; font-variant-numeric: tabular-nums; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.two > div { padding: 12px 14px; }
.two > div + div { border-left: 1px solid var(--line); }
.lines { margin: 4px 0 0; padding: 0; list-style: none; }
.lines li { padding: 3px 0; display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 8px; }
.lines .p { color: var(--accent-ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-area { width: 100%; border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 9px; min-height: 54px; resize: vertical; background: var(--field); }
.note-area:focus { outline: none; border-color: var(--accent); }
.note-area:read-only { background: transparent; }

/* ---------- 지표 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }

/* ---------- 로드맵 (간트) ---------- */
/* 단계 막대는 한 가지 색만 쓴다. 연한 바탕은 이 색을 패널색과 섞어서 만든다. */
:root { --bar: #378add; }
:root[data-theme="dark"] { --bar: #4493f8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bar: #4493f8; } }
.gantt { --h: var(--bar); }
.gantt-scroll { overflow-x: auto; scroll-behavior: auto; }
.gantt { position: relative; }
.g-row { display: flex; border-bottom: 1px solid var(--line); }
.g-row:last-child { border-bottom: 0; }
.g-left { position: sticky; left: 0; z-index: 3; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 6px 14px; min-width: 0; }
.g-track { position: relative; flex: none; }
.g-head { position: sticky; top: 0; z-index: 4; background: var(--side); }
.g-head .g-left { background: var(--side); display: flex; align-items: flex-end; color: var(--ink-3); font-size: 13.5px; font-weight: 500; }
.g-month { position: absolute; top: 0; height: 28px; display: flex; align-items: center; padding-left: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
.g-wk { position: absolute; top: 28px; height: 22px; display: grid; place-items: center; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.g-wk.now { color: #e24b4a; font-weight: 700; }
.g-grid { position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 1; }
.g-mline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.g-today { position: absolute; top: 0; bottom: 0; width: 1px; background: #e24b4a; }
.g-group { background: var(--side); }
.g-group .g-left { background: var(--side); display: flex; align-items: center; gap: 8px; }
.g-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--h); flex: none; }
.g-code { font-weight: 700; white-space: nowrap; }
.g-pname { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.g-stage-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-meta { display: flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: 12.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; }
.g-pill { font-size: 12px; padding: 0 6px; border-radius: 4px; background: var(--hover); color: var(--ink-2); }
.g-pill.run { background: var(--s-prog-bg); color: var(--s-prog); }
.g-pill.late { background: var(--s-check-bg); color: var(--s-check); }
.g-pill.done { background: var(--s-done-bg); color: var(--s-done); }
.g-bar { position: absolute; top: 50%; height: 16px; margin-top: -8px; border-radius: 4px; overflow: hidden; z-index: 2;
  background: color-mix(in srgb, var(--h) 18%, var(--panel)); }
.g-bar.thin { height: 6px; margin-top: -3px; border-radius: 3px; }
/* 프로젝트 전체 진척률은 단계 색과 섞이지 않게 무채색으로 */
.g-group .g-bar { background: var(--line-2); }
.g-group .g-fill { background: var(--ink-2); }
.g-group .g-pct { color: var(--ink); font-weight: 600; }
.lg-total { width: 22px; height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--ink-2) 60%, var(--line-2) 60%); }
.g-fill { height: 100%; background: var(--h); border-radius: inherit; }
.g-bar:not(.full) .g-fill { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.g-pct { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; z-index: 2; white-space: nowrap; }
.g-mark { position: absolute; bottom: 6px; height: 3px; border-radius: 2px; background: var(--ink-3); opacity: .55; z-index: 2; }
.legend { display: flex; gap: 16px; align-items: center; color: var(--ink-2); font-size: 13.5px; flex-wrap: wrap; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.lg-bar { width: 22px; height: 10px; border-radius: 3px; background: color-mix(in srgb, var(--bar) 18%, var(--panel)); }
.lg-fill { width: 22px; height: 10px; border-radius: 3px; background: var(--bar); }
.lg-line { width: 1px; height: 14px; background: #e24b4a; }
.lg-mark { width: 18px; height: 3px; border-radius: 2px; background: var(--ink-3); opacity: .55; }

/* ---------- 프로젝트 편집 ---------- */
.form-grid { display: grid; grid-template-columns: 140px 110px 120px minmax(0, 1fr) 140px; gap: 8px; }
.form-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--ink-3); }
.inp { height: 36px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 8px; background: var(--field); width: 100%; }
.inp:focus { outline: none; border-color: var(--accent); }
.inp:read-only { background: transparent; }
.yw { display: grid; grid-template-columns: 1fr 1fr; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand foot" "nav nav"; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-brand { grid-area: brand; padding: 10px 12px; }
  .side-user, .nav-label, .side-foot .link, .demo span { display: none; }
  .side-nav { grid-area: nav; flex-direction: row; overflow-x: auto; padding: 0 8px 6px; }
  .nav-btn { white-space: nowrap; }
  .side-foot { grid-area: foot; margin: 0; border: 0; padding: 8px 12px; }
  .main { padding: 14px 12px 32px; }
  .report-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two { grid-template-columns: minmax(0, 1fr); }
  .two > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .hide-md { display: none; }
}

/* 화면 테마 전환 (오른쪽 위 아이콘) */
.theme-btn { width: 36px; height: 36px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel); color: var(--ink-2); display: grid; place-items: center; }
.theme-btn:hover { background: var(--hover); color: var(--ink); }
.weeknav .today-btn { width: auto; padding: 0 12px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); white-space: nowrap; font-weight: 500; }

/* 키보드 포커스 표시 */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cell:focus-visible { outline: none; }
.t tr.click:focus-visible td { box-shadow: inset 0 0 0 2px var(--accent); }

/* 삭제 실행 취소 알림 */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--panel); border-radius: 8px; padding: 9px 10px 9px 14px; display: flex; gap: 12px; align-items: center; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast button { border: 0; background: none; color: var(--panel); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; padding: 4px 6px; }

/* 업무기록 표: 가로 스크롤해도 프로젝트 열 고정 */
.t.sticky1 th:first-child, .t.sticky1 td:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }
.t.sticky1 th:first-child { z-index: 2; background: var(--side); }
.t.sticky1 tr.new td:first-child { background: var(--side); }
.t.sticky1 tbody tr:hover td:first-child { background: var(--hover); }

/* 로드맵 진척률 고정 열 */
.g-left.with-pct { display: flex; align-items: center; gap: 10px; }
.g-left .g-text { flex: 1; min-width: 0; }
.g-left .g-pct-col { flex: none; width: 46px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13.5px; }
.g-group .g-left .g-pct-col { color: var(--ink); font-weight: 700; }

/* 데이터 위치 전환 · 로그인/안내 화면 */
.source { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-3); }
.source select { border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 6px; background: var(--field); color: var(--ink); font-size: 13.5px; }
.gate { max-width: 460px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.gate h1 { font-size: 22px; margin: 0; }
.gate p { margin: 0; line-height: 1.7; }
a.btn { text-decoration: none; color: inherit; }
a.btn.primary { color: var(--on-accent); }
.setup-list { margin: 0; padding-left: 20px; line-height: 1.8; color: var(--ink-2); }
.setup-log { font-size: 13.5px; color: var(--ink-2); line-height: 1.8; }
