:root {
  --bg: #F5F7FA; --card: #fff; --ink: #172B4D; --ink2: #44546F; --ink3: #626F86;
  --line: #DFE3EA; --line2: #EBEEF2; --teal: #087F8C; --teal-d: #05606A; --teal-bg: #E3F3F4; --teal-bg2: #F0F8F9;
  --red: #AE2A19; --red-bg: #FDECEA; --amber: #6E4A00; --amber-bg: #FFF1D1; --blue: #1D4F91; --blue-bg: #E8EFFA;
  --radius: 12px;
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--teal); }
h1 { margin: 0; font-size: 26px; letter-spacing: -0.4px; }
h2 { margin: 0; font-size: 18px; }
p { margin: 4px 0 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink3); }
.small { font-size: 13px; }
.strong { font-weight: 700; }
[hidden] { display: none !important; }

/* 레이아웃 */
.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 20px; display: flex; flex-direction: column; gap: 20px; }
.wrap.narrow { max-width: 640px; }
.wrap.mid { max-width: 820px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap { gap: 12px; } .gap-sm { gap: 6px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 160px; }
.form-layout { display: grid; grid-template-columns: minmax(0, 600px) minmax(0, 1fr); gap: 20px; align-items: start; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(23,43,77,.05); }
.pad { padding: 18px 22px; }
.pad-lg { padding: 28px 32px; }
.section-title { font-size: 18px; }
.empty { padding: 28px; text-align: center; color: var(--ink3); }

/* 상단 바 */
.topbar { height: 60px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 24px; gap: 32px; position: sticky; top: 0; z-index: 10; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand b { width: 7px; height: 20px; border-radius: 2px; background: var(--teal); display: inline-block; }
.brand.big { font-size: 26px; } .brand.big b { height: 28px; width: 8px; }
.nav { display: flex; gap: 24px; align-self: stretch; }
.nav a { display: flex; align-items: center; color: var(--ink2); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a.on { color: var(--ink); border-color: var(--teal); font-weight: 700; }
.account { margin-left: auto; position: relative; }
.account summary { cursor: pointer; list-style: none; font-size: 14px; color: var(--ink2); padding: 8px 10px; border-radius: 8px; white-space: nowrap; }
.account summary::-webkit-details-marker { display: none; }
.account summary::after { content: ' ▾'; }
.menu { position: absolute; right: 0; top: 40px; min-width: 180px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(23,43,77,.16); padding: 6px; z-index: 30; display: flex; flex-direction: column; }
.menu a, .menu button { display: flex; width: 100%; height: 38px; align-items: center; padding: 0 12px; border: 0; background: transparent; border-radius: 6px; font: inherit; font-size: 14px; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--bg); }
.pw-note { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 20px; background: var(--amber-bg); color: var(--amber); font-size: 14px; font-weight: 500; text-decoration: none; }
.conn { position: sticky; top: 0; z-index: 20; background: var(--amber-bg); color: var(--amber); padding: 9px 20px; font-size: 14px; font-weight: 500; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid #CDD3DC; background: #fff; color: var(--ink); font: inherit; font-size: 15px; font-weight: 500; white-space: nowrap; text-decoration: none; cursor: pointer; }
.btn:hover { background: #F8F9FB; color: var(--ink); }
.btn.pri { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.pri:hover { background: #06646E; }
.btn.outline { border-color: var(--teal); color: var(--teal); }
.btn.warn { color: var(--red); border-color: #F1C7C0; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink2); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn.lg { height: 48px; padding: 0 20px; font-size: 16px; }
.btn.wide { min-width: 150px; }
.btn.full { width: 100%; }
.btn:disabled { background: #F1F3F6; border-color: #E4E7EC; color: #8590A2; cursor: not-allowed; }
.ib { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink2); display: inline-flex; align-items: center; justify-content: center; }
.ib:hover { background: var(--bg); }
form { margin: 0; }

/* 상태 칩 */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; vertical-align: middle; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.chip.ok { background: var(--teal-bg); color: var(--teal-d); }
.chip.use { background: var(--blue-bg); color: var(--blue); }
.chip.wait { background: #EEF1F5; color: var(--ink2); }
.chip.done { background: #F1F2F4; color: var(--ink3); }
.chip.cxl { background: var(--red-bg); color: var(--red); }
.chip.warn { background: var(--amber-bg); color: var(--amber); }
.tag { font-size: 12px; color: var(--amber); background: var(--amber-bg); border-radius: 6px; padding: 1px 6px; font-weight: 500; }

/* 알림 */
.flash { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 8px; font-size: 14px; background: var(--teal-bg); color: var(--teal-d); }
.flash.error { background: var(--red-bg); color: var(--red); }
.flash.warn { background: var(--amber-bg); color: var(--amber); }

/* 입력 */
.field-row { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; }
.field-row label, .field-row legend { font-size: 15px; font-weight: 500; padding: 0; }
.field-row legend { margin-bottom: 6px; }
.req { color: var(--red); margin-left: 2px; }
.field { height: 46px; border: 1px solid #CDD3DC; border-radius: 8px; background: #fff; padding: 0 12px; font: inherit; font-size: 16px; color: var(--ink); width: 100%; }
.field.sm { height: 36px; font-size: 14px; width: auto; }
.field.date { flex: 1; min-width: 150px; width: auto; }
.field.hour { width: 110px; }
.field:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8,127,140,.15); }
.hint { font-size: 13px; color: var(--ink3); }
.err { font-size: 13px; color: var(--red); font-weight: 500; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line2); padding-top: 18px; }
.field-row label.opt, .opt { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 17px; flex: 1; min-width: 150px; }
.opt:has(input:checked) { border-color: var(--teal); background: var(--teal-bg2); color: var(--teal-d); }
.mini { padding: 8px 10px; border-radius: 8px; background: var(--bg); font-size: 14px; }
.mini.self { outline: 1.5px dashed var(--teal); }

/* 로그인 */
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login { width: 100%; max-width: 440px; padding: 24px 16px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.login > form { width: 100%; }

/* 차량 상태 카드 */
.cars { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.car-card { padding: 18px 22px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; border-left: 5px solid var(--teal); }
.car-card.busy { border-left-color: var(--blue); }
.car-card:hover { box-shadow: 0 4px 14px rgba(23,43,77,.1); }
.plate { display: inline-flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; letter-spacing: .3px; }
.plate.lg { font-size: 24px; }
.car-now { font-size: 16px; }

/* 날짜 이동 */
.day-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.day-nav h1 { font-size: 24px; min-width: 190px; text-align: center; }
.day-nav .btn.pri { margin-left: auto; }

/* 주간 시간표: 행 = 날짜 × 차량, 열 = 1시간 */
.wrap.wide { max-width: 1280px; }
.wk-wrap { overflow-x: auto; }
.wk { width: 100%; min-width: 860px; border-collapse: collapse; table-layout: fixed; }
.wk th, .wk td { border-bottom: 1px solid var(--line2); }
.wk thead th { height: 34px; font-size: 12px; font-weight: 500; color: var(--ink3); text-align: left; padding-left: 4px; background: #F8F9FB; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.wk thead th.now-h { color: var(--teal-d); font-weight: 700; }
.wk th.day { width: 64px; }
.wk th.car { width: 92px; }
.wk tbody th.day { font-size: 15px; font-weight: 700; text-align: center; background: #FAFBFC; border-right: 1px solid var(--line); line-height: 1.3; }
.wk tbody th.day b { display: block; font-size: 13px; color: var(--ink3); }
.wk tbody th.day i { display: block; font-style: normal; font-size: 11px; color: #fff; background: var(--teal); border-radius: 999px; margin: 3px auto 0; width: 36px; }
.wk tbody th.car { font-size: 13px; font-weight: 500; color: var(--ink2); text-align: left; padding: 0 8px; white-space: nowrap; border-right: 1px solid var(--line2); }
.m-only { display: none; }
.wk tbody th, .wk thead th.day, .wk thead th.car { position: sticky; z-index: 2; }
.wk th.day { left: 0; }
.wk tbody th.car { left: 64px; background: #fff; }
.wk thead th.car { left: 64px; }
.wk tr.day-first > * { border-top: 2px solid var(--line); }
.wk tr.today th.day { background: var(--teal-bg); color: var(--teal-d); }
.wk td { height: 40px; padding: 0; border-left: 1px solid var(--line2); }
.wk td.free a { display: flex; height: 39px; align-items: center; justify-content: center; color: transparent; }
.wk td.free a:hover, .wk td.free.sel a { background: var(--teal-bg2); color: var(--teal); }
.wk td.free.sel a { box-shadow: inset 0 -3px 0 var(--teal); }
.wk td.free.now-col { box-shadow: inset 2px 0 0 var(--teal); }
.wk td.past { background: repeating-linear-gradient(135deg, #FAFBFC 0 6px, #F3F5F8 6px 12px); }
.wk td.out { background: #F4F5F7; }
.wk td.blk { position: relative; }
.wk td.blk a { position: absolute; inset: 3px 2px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border-radius: 6px; background: #EEF1F5; border-left: 4px solid #8993A4; color: var(--ink); text-decoration: none; font-size: 13px; white-space: nowrap; overflow: hidden; }
.wk td.blk a b { overflow: hidden; text-overflow: ellipsis; }
.wk td.blk a span { color: var(--ink2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.wk td.blk.mine a { background: var(--teal-bg); border-left-color: var(--teal); }
.wk td.blk.now a { background: var(--blue-bg); border-left-color: var(--blue); }
.wk td.blk.past a { opacity: .6; }
.wk td.blk a:hover { box-shadow: 0 2px 8px rgba(23,43,77,.15); z-index: 1; }
body.dragging { user-select: none; }

/* 예약 화면 시간 고르기 */
/* 날짜 고르기 (월~금 3주) */
.days { display: flex; flex-direction: column; gap: 8px; }
.cal { border-collapse: separate; border-spacing: 5px; width: calc(100% + 10px); table-layout: fixed; margin: -5px; }
.cal th { font-size: 12px; font-weight: 500; color: var(--ink3); height: 20px; }
.cal button { width: 100%; min-height: 52px; padding: 4px 2px; border: 1px solid #CDD3DC; border-radius: 8px; background: #fff; font: inherit; font-size: 16px; cursor: pointer; line-height: 1.25; }
.cal button span { color: var(--ink2); }
.cal button b { font-variant-numeric: tabular-nums; }
.cal button i { display: block; font-style: normal; font-size: 11px; color: var(--teal-d); font-weight: 700; }
.cal button:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-bg2); }
.cal button.sel, .cal button.sel:hover:not(:disabled) { background: var(--teal); border-color: var(--teal); color: #fff; }
.cal button.sel span, .cal button.sel i { color: #fff; }
.cal button:disabled { background: #F4F5F7; border-color: var(--line2); color: #B3BAC5; cursor: not-allowed; }
.cal button:disabled span { color: #B3BAC5; }
.cal-nav { display: flex; gap: 8px; }
.label-like { font-size: 15px; font-weight: 500; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.label-like .err { font-size: 13px; }
.pick-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.pick { border-collapse: collapse; width: 100%; min-width: 560px; table-layout: fixed; }
.pick th { font-size: 12px; font-weight: 500; color: var(--ink3); height: 26px; text-align: left; padding-left: 3px; background: #F8F9FB; }
.pick tr th:first-child { position: sticky; left: 0; z-index: 1; width: 88px; font-size: 13px; color: var(--ink2); text-align: left; padding: 0 8px; background: #FAFBFC; border-right: 1px solid var(--line2); white-space: nowrap; }
.pick td { padding: 3px 1px; border-top: 1px solid var(--line2); }
.pick button { width: 100%; height: 46px; border: 1px solid #CDD3DC; border-radius: 6px; background: #fff; cursor: pointer; font: inherit; }
.pick button:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-bg2); }
.busy-blk { height: 46px; display: flex; align-items: center; padding: 0 6px; border-radius: 6px; background: var(--blue-bg); border-left: 4px solid var(--blue); color: var(--blue); font-size: 13px; white-space: nowrap; overflow: hidden; cursor: not-allowed; }
.busy-blk b { overflow: hidden; text-overflow: ellipsis; }
.pick button.off { background: repeating-linear-gradient(135deg, #FAFBFC 0 5px, #EEF1F5 5px 10px); border-color: var(--line2); cursor: not-allowed; }
.pick button.sel, .pick button.sel:hover:not(:disabled) { background: var(--teal); border-color: var(--teal); }
.pick button.anchor { box-shadow: 0 0 0 3px rgba(8,127,140,.35); }
.picker { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.picker > .pick-wrap { align-self: stretch; }
.done-hero { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 24px 28px; border-radius: var(--radius); background: var(--teal); color: #fff; box-shadow: 0 6px 18px rgba(8,127,140,.25); }
.done-hero h2 { font-size: 24px; }
.done-hero p { margin-top: 4px; font-size: 17px; }
.done-hero p.small { font-size: 14px; opacity: .85; }
.done-check { width: 60px; height: 60px; border-radius: 50%; background: #fff; color: var(--teal); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.done-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.done-actions .btn { border-color: #fff; }
.done-actions .btn.pri { background: #fff; color: var(--teal-d); }
.pick-summary { font-size: 17px; min-height: 26px; color: var(--teal-d); }
.manual summary { cursor: pointer; font-size: 14px; color: var(--ink2); }
.manual > div { margin-top: 12px; padding: 14px; background: var(--bg); border-radius: 10px; }
.manual .opt { font-size: 15px; padding: 8px 12px; background: #fff; }
.manual .lbl { width: 36px; font-size: 14px; color: var(--ink3); }

/* 상세 */
.big-time { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 15px; }
.kv dt { color: var(--ink3); } .kv dd { margin: 0; }
.card-actions { display: flex; gap: 8px; border-top: 1px solid var(--line2); padding-top: 16px; flex-wrap: wrap; align-items: center; }

/* 목록 */
.tr { display: grid; gap: 12px; align-items: center; padding: 10px 16px; min-height: 52px; border-bottom: 1px solid var(--line2); }
.list > .tr:last-child { border-bottom: 0; }
.tr.th { min-height: 40px; font-size: 13px; font-weight: 700; color: var(--ink3); background: #F8F9FB; border-radius: var(--radius) var(--radius) 0 0; }
.res-cols { grid-template-columns: 250px 90px 130px minmax(0, 1fr) 70px; font-size: 14px; }
.acct-cols { grid-template-columns: 150px 70px 100px 100px 110px minmax(0, 1fr); font-size: 14px; }
.row-link { color: inherit; text-decoration: none; }
.row-link:hover { background: var(--teal-bg2); }
.tr.dim { opacity: .6; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.filter label { font-size: 14px; }

/* 확인창 */
.dialog { border: 0; border-radius: var(--radius); padding: 24px 26px; max-width: 420px; width: calc(100% - 32px); box-shadow: 0 16px 48px rgba(23,43,77,.25); }
.dialog::backdrop { background: rgba(23,43,77,.4); }
.dialog p { color: var(--ink2); margin: 10px 0 20px; }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; }

/* 좁은 화면 */
@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 16px 0; gap: 4px 16px; }
  .nav { order: 3; width: 100%; overflow-x: auto; gap: 20px; height: 42px; }
  .wrap { padding: 18px 16px; }
  .pad-lg { padding: 22px 18px; }
  .form-layout { grid-template-columns: 1fr; }
    .pick { min-width: 520px; }
  .pick tr th:first-child { width: 52px; padding: 0 6px; }
  .pick .pfx { display: none; }
  .cal button { font-size: 14px; min-height: 56px; }
  .cal button b { display: block; }
  .day-nav h1 { font-size: 20px; min-width: 0; flex: 1; }
  .day-nav .btn.pri { margin-left: 0; width: 100%; }
  .day-pick { width: 100%; }
  .tr.th { display: none; }
  .m-only { display: inline; }
  .wk { min-width: 720px; }
  .wk th.day { width: 46px; }
  .wk th.car { width: 50px; }
  .wk tbody th.day { font-size: 13px; }
  .wk tbody th.car, .wk thead th.car { left: 46px; }
  .wk tbody th.car { padding: 0 6px; }
  .wk th.car .pfx { display: none; }
  .res-cols, .acct-cols { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .res-cols > span:first-child { grid-column: 1 / -1; font-weight: 700; }
  .res-cols > span:nth-child(3):empty { display: none; }
  .acct-cols .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
