:root {
  --ink: #1B232B; --muted: #5B6370; --line: #E2E5EA; --line2: #ECEEF1; --bg: #F3F4F6; --card: #FFFFFF;
  --side: #172027; --side-ink: #E8ECEF; --side-mute: #93A1AC; --side-on: #2A3A45;
  --green: #23704F; --green-ink: #174D36; --green-bg: #E3F1EA; --sem-chip: #CFE7DB;
  --oji: #B24A12; --oji-ink: #7A320B; --oji-bg: #F8E3D6; --oji-chip: #FBEFE7;
  --warn-ink: #8A5300; --warn-bg: #FFF4DE; --warn-line: #F5A524;
  --red: #B42318; --red-bg: #FDECEA; --blue-bg: #E1EEF4; --blue-ink: #1D4E68;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Noto Sans KR', system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.5; }
a { color: #1D5F8A; }
button { font: inherit; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* 레이아웃 */
.app { display: flex; min-height: 100vh; }
.side { width: 228px; flex: none; background: var(--side); color: var(--side-ink); padding: 22px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 0 10px 18px; }
.brand b { display: block; font-size: 16px; }
.brand span { font-size: 12px; color: var(--side-mute); }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-size: 14px; }
.nav a:hover { background: #22303A; }
.nav a.on { background: var(--side-on); font-weight: 700; }
.nav .badge { margin-left: auto; background: #E5534B; color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.nav .sep { height: 1px; background: #2C3943; margin: 10px 8px; }
.side .me { margin-top: auto; padding: 12px 10px 0; font-size: 12px; color: var(--side-mute); border-top: 1px solid #2C3943; }
.side .me button { background: none; border: 0; color: var(--side-mute); text-decoration: underline; cursor: pointer; padding: 0; font-size: 12px; }
.main { flex: 1; min-width: 0; padding: 24px 28px 60px; display: flex; flex-direction: column; gap: 18px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar h1 { flex: 1; }
.sync { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.btn.menu-btn { display: none; }
.demo-bar { background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; padding: 8px 14px; border-radius: 8px; border: 1px solid #F3D9A4; }

/* 카드 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 8px; }
.card-h h2 { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 12px; color: var(--muted); }

/* 칩·배지 */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.c-oji { color: var(--oji-ink); background: var(--oji-bg); }
.c-sem { color: var(--green-ink); background: var(--green-bg); }
.c-gmo { color: var(--blue-ink); background: var(--blue-bg); }
.c-gray { color: #3A424D; background: var(--line2); }
.c-warn { color: var(--warn-ink); background: var(--warn-bg); }
.c-red { color: var(--red); background: var(--red-bg); }
.c-done { color: #fff; background: var(--green); }

/* 버튼 */
.btn { min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn:hover { background: #F7F8FA; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--side); color: #fff; border-color: var(--side); }
.btn.green { border-color: var(--green); color: var(--green-ink); }
.btn.green.fill { background: var(--green); color: #fff; }
.btn.danger { border-color: #F1B8B2; color: var(--red); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btn.working { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); animation: workBlink 1.4s ease-in-out infinite; }
@keyframes workBlink { 0%,100% { background: #FFF4DE; box-shadow: 0 0 0 0 rgba(245,165,36,0); } 50% { background: #FFDF9E; box-shadow: 0 0 0 4px rgba(245,165,36,.28); } }
@media (prefers-reduced-motion: reduce) { .btn.working { animation: none; } }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--side); color: #fff; font-weight: 700; }

/* 목록 */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line2); flex-wrap: wrap; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 180px; }
.row .title { font-weight: 700; }
.row .sub { font-size: 12px; color: var(--muted); white-space: pre-line; }
.empty { color: var(--muted); font-size: 13px; padding: 10px 0; }

/* 표 */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.tbl tr.daysep td { background: #F7F8FA; font-weight: 700; font-size: 12px; color: #3A424D; }
.tbl input, .tbl select { width: 100%; min-width: 80px; }

/* 입력 */
input[type=text], input[type=email], input[type=date], input[type=url], select, textarea { font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); }
textarea { width: 100%; min-height: 70px; }
.form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }

/* 일정표 */
.sched { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.sched-grid { display: grid; min-width: 900px; font-size: 12px; }
.sched-grid .hd { position: sticky; top: 0; background: #fff; text-align: center; padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.sched-grid .hd.today { color: #fff; background: var(--side); border-radius: 6px; }
.sched-grid .hd.we { color: #B24A12; }
.sched-grid .lbl { padding: 6px 10px; border-right: 1px solid var(--line2); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.sched-grid .lane { border-bottom: 1px solid var(--line2); }
.bar { margin: 4px 2px; border-radius: 6px; padding: 3px 8px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; cursor: pointer; border: 0; text-align: left; }
.bar.sem { background: var(--sem-chip); color: var(--green-ink); }
.bar.oji { background: var(--oji-bg); color: var(--oji-ink); }
.bar.ready { background: var(--green); color: #fff; }
.bar.guide { background: var(--blue-bg); color: var(--blue-ink); }
.sched-sec { grid-column: 1 / -1; background: #F7F8FA; font-weight: 700; padding: 6px 10px; color: #3A424D; border-bottom: 1px solid var(--line2); }

/* 셋팅 체크 */
.setting { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 2px; }
.setting .it { display: flex; align-items: center; gap: 10px; min-height: 44px; border-top: 1px solid var(--line2); }
.setting .it:first-of-type { border-top: 0; }
.setting .it .lb { width: 92px; flex: none; font-weight: 700; font-size: 13px; }
.setting .it .dt { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); }

/* 단계 */
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--line2); color: #6B7480; }
.step.on { background: var(--green-bg); color: var(--green-ink); }

/* 모달 */
.modal-bg { position: fixed; inset: 0; background: rgba(15,22,28,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; padding: 20px; width: min(520px, 100%); max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--side); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 60; max-width: 90vw; }
.toast.err { background: var(--red); }

/* 로그인 */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .box { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; }

@media (max-width: 1100px) { .grid3 { grid-template-columns: 1fr 1fr; } .stats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px) {
  .app { display: block; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .btn.menu-btn { display: inline-flex; }
  .main { padding: 14px 16px 60px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .grid-cards { grid-template-columns: 1fr; }
}
