:root {
  --bg: #f5f6f8; --panel: #fff; --ink: #1d2129; --muted: #6b7280; --line: #e4e7ec; --head: #f1f3f6;
  --accent: #2f6fc4; --accent-ink: #fff; --accent-soft: #e6eefa;
  --exp: #e2701c; --exp-soft: #fff1e4; --fuel: #1b9466; --fuel-soft: #e2f5ec;
  --ok: #2e7d3a; --ok-bg: #e3f3e4; --bad: #c62a1e; --bad-bg: #fde3df; --warn: #8a6100; --warn-bg: #fff1c2;
  --r: 12px; --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hide { display: none !important; }

/* 위쪽 막대 */
.top { position: sticky; top: 0; z-index: 30; background: var(--panel); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 0 16px; height: 56px; }
.brand { font-weight: 800; font-size: 16px; white-space: nowrap; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.brand i { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--exp), var(--fuel)); display: inline-block; }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.nav a:hover { background: var(--head); color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.me { position: relative; }
.me > summary { list-style: none; cursor: pointer; padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-weight: 600; }
.me > summary::-webkit-details-marker { display: none; }
.me > summary::after { content: " ▾"; font-size: .7em; color: var(--muted); }
.me[open] > summary, .me > summary:hover { background: var(--head); }
.me .menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14); padding: 6px; min-width: 160px; }
.me .menu button { width: 100%; text-align: left; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.split { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid2, .split { grid-template-columns: minmax(0, 1fr); } }   /* 1fr 이면 넓은 표가 칸을 밀어 휴대폰에서 옆으로 넘침 */

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.split > .panel + .panel, .grid2 > .panel + .panel { margin-top: 0; }   /* 나란히 놓인 칸은 위를 맞춘다(좁으면 grid gap 이 띄움) */
.pagehead { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* 단추·칸 */
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 8px 14px;
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--head); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.exp { background: var(--exp); border-color: var(--exp); color: #fff; }
.btn.fuel { background: var(--fuel); border-color: var(--fuel); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: none; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #d3d8e0; border-radius: 8px; padding: 8px 10px; min-height: 38px; width: 100%; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { height: 38px; }   /* 날짜 칸만 2px 크던 것 — 한 줄 칸 높이 맞춤 */
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { background: var(--head); color: var(--muted); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .full { grid-column: 1 / -1; }
.seg { display: inline-flex; border: 1px solid #d3d8e0; border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { appearance: none; border: 0; background: none; padding: 8px 16px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid #d3d8e0; }
.seg button.on { background: var(--accent); color: #fff; }
.seg.exp button.on { background: var(--exp); }

/* 표 */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); background: var(--head); white-space: nowrap; }
table.t td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t th.num { text-align: right; }
table.t td, table.t th { word-break: keep-all; }   /* '접대/비'처럼 낱말 가운데서 끊지 않음 */   /* 숫자 열은 머리글도 오른쪽 — 위 th 규칙이 .num 을 이겨 왼쪽에 붙던 것 */
table.t tr:last-child td { border-bottom: 0; }
table.t tfoot td { font-weight: 700; background: var(--head); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* 표시 */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--head); color: var(--muted); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.info { background: var(--accent-soft); color: var(--accent); }
.chip.exp { background: var(--exp-soft); color: var(--exp); }
.chip.fuel { background: var(--fuel-soft); color: var(--fuel); }
.note { padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 600; }
.note.bad { background: var(--bad-bg); color: var(--bad); }
.note.info { background: var(--accent-soft); color: var(--accent); }

/* 알림 줄(처음 화면) */
.banners { display: grid; gap: 10px; margin-bottom: 16px; }
.banner { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--accent); box-shadow: var(--shadow); }
.banner.expense { border-left-color: var(--exp); }
.banner.fuel { border-left-color: var(--fuel); }
.banner.closed { border-left-color: var(--bad); }
.banner .title { font-weight: 800; }
.banner .dday { font-weight: 800; color: var(--bad); }
.banner .forms { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.formpill { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px; background: #fff; }

/* 캘린더 */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--line); gap: 1px; }
.cal .dow { background: var(--head); text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 0; }
.cal .dow:first-child { color: var(--bad); }
.cal .dow:last-child { color: var(--accent); }
.cal .d { background: var(--panel); min-height: 104px; padding: 6px; position: relative; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.cal .d:hover { background: #fafbfc; }
.cal .d.out { background: #fafafa; color: #b4b9c1; cursor: default; }
.cal .d.sel { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 1; }
.cal .d .n { font-size: 13px; font-weight: 700; }
.cal .d.sun .n { color: var(--bad); }
.cal .d.sat .n { color: var(--accent); }
.cal .d.today .n { background: var(--ink); color: #fff; border-radius: 999px; padding: 0 7px; align-self: flex-start; }
.cal .bandbar { height: 6px; border-radius: 3px; }
.cal .bandbar.expense { background: var(--exp); opacity: .75; }
.cal .bandbar.fuel { background: var(--fuel); opacity: .75; }
.cal .d.band-expense { background: linear-gradient(var(--exp-soft), var(--exp-soft)); }
.cal .d.band-fuel { background: linear-gradient(var(--fuel-soft), var(--fuel-soft)); }
.cal .d.band-expense.band-fuel { background: linear-gradient(135deg, var(--exp-soft) 50%, var(--fuel-soft) 50%); }
.cal .deadline { position: absolute; top: 6px; right: 6px; font-size: 11px; font-weight: 800; color: #fff; background: var(--bad); border-radius: 6px; padding: 0 5px; }
.cal .it { font-size: 12px; border-radius: 6px; padding: 1px 6px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .it.expense { background: var(--exp-soft); color: #a64d0b; border: 1px solid #f6d2b3; }
.cal .it.fuel { background: var(--fuel-soft); color: #11704c; border: 1px solid #b7e4cf; }
@media (max-width: 640px) {
  .cal .d { min-height: 64px; padding: 4px; }
  .cal .it { font-size: 10px; padding: 0 3px; }
  .cal .it .amt { display: none; }
}
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .l-exp::before { background: var(--exp-soft); border: 1px solid var(--exp); }
.legend .l-fuel::before { background: var(--fuel-soft); border: 1px solid var(--fuel); }
.legend .l-dl::before { background: var(--bad); }
.monthnav { display: flex; align-items: center; gap: 6px; }
.monthnav b { font-size: 18px; min-width: 120px; text-align: center; }

/* 차 사진(네이버 차 정보 느낌: 흰 바탕 큰 사진 + 차급 + 숫자 칸) */
.carpic, .carstage { background: radial-gradient(ellipse 58% 9% at 50% 86%, rgba(20, 28, 40, .13), transparent 72%), #fff; border-radius: 12px; overflow: hidden; }
.carpic { width: 150px; flex: none; }
.carpic svg, .carstage svg { display: block; width: 100%; height: auto; }
.carimg { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; padding: 4% 6%; }
.carstage { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); }
.carstage > svg { width: 92%; }
.carname { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.carseg { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
.carstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.carstats div { background: var(--head); border-radius: 12px; padding: 10px 12px; }
.carstats small { display: block; color: var(--accent); font-size: 12px; font-weight: 700; }
.carstats b { font-size: 16px; }
.cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.carcard { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.carcard .carstage { border: 0; }
.carcard .carname { font-size: 16px; }
.carcard > .row:last-child { margin-top: auto; }   /* 설명이 두 줄인 카드도 단추 줄은 바닥에 — 한 줄의 카드끼리 맞춤 */
.carcard.add { justify-content: center; align-items: center; border-style: dashed; color: var(--muted); cursor: pointer; min-height: 220px; font-weight: 700; }
.carcard.add:hover { border-color: var(--fuel); color: var(--fuel); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 30px; height: 30px; border-radius: 999px; border: 2px solid #fff; box-shadow: 0 0 0 1px #c9ced6; cursor: pointer; padding: 0; }
.swatches button.on { box-shadow: 0 0 0 2px var(--accent); }

/* 장소 고르기·지도 */
.place { position: relative; }
.place .drop { position: absolute; z-index: 25; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .14); max-height: 280px; overflow-y: auto; }
.place .drop button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; cursor: pointer; font: inherit; }
.place .drop button:hover, .place .drop button.on { background: var(--head); }
.place .drop .h { font-size: 11px; color: var(--muted); padding: 6px 12px 2px; font-weight: 700; }
.place .picked { font-size: 12px; color: var(--muted); margin-top: 2px; min-height: 18px; }
.pin { display: inline-flex; width: 20px; height: 20px; border-radius: 999px; color: #fff; font-size: 11px; font-weight: 800; align-items: center; justify-content: center; flex: none; }
.pin.o { background: var(--accent); }
.pin.d { background: var(--bad); }
#map { position: relative; z-index: 0; height: 300px; border-radius: 10px; border: 1px solid var(--line); background: #e9edf2; }
.calc { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.calc div { background: var(--head); border-radius: 10px; padding: 8px 10px; }
.calc small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.calc b { font-size: 16px; }
.calc .money b { color: var(--fuel); }
@media (max-width: 640px) { .calc { grid-template-columns: 1fr 1fr; } .form { grid-template-columns: 1fr; } }

/* 창 */
.shade { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; padding: 20px; width: min(520px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal h2 { margin-bottom: 14px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1d2129; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: 90vw; }
.toast.bad { background: var(--bad); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { appearance: none; border: 0; background: none; padding: 10px 14px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .cnt { background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; margin-left: 4px; }

details.guide > summary { cursor: pointer; font-weight: 700; }
details.guide ol { margin: 10px 0 0; padding-left: 20px; }
details.guide li { margin: 4px 0; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--head); display: block; }
.src { font-size: 11px; color: var(--muted); }

/* 휴대폰 — 메뉴 넷이 다 보이게, 캘린더 위 줄 정리, 누르기 쉬운 단추(12/4 디자인 검수) */
@media (max-width: 640px) {
  .top-in { gap: 8px; padding: 0 10px; }
  .top .brand { font-size: 0; gap: 0; }            /* 그림만 — 글자는 메뉴 자리를 비켜 줌 */
  .nav a { padding: 8px 9px; }
  .pagehead .legend { order: 9; flex-basis: 100%; }
  .legend span { white-space: nowrap; }
  .banner .forms { flex-basis: 100%; }
  .banner .formpill { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 8px; width: 100%; }
  .banner .formpill > b { grid-column: 1; grid-row: 1; white-space: nowrap; }
  .banner .formpill > .muted { grid-column: 1; grid-row: 2; font-size: 12px; white-space: nowrap; }
  .banner .formpill > :nth-child(n+3) { grid-row: 1 / span 2; align-self: center; }
  .btn.sm { min-height: 34px; }
  .monthnav .btn { min-width: 34px; justify-content: center; }
  .tablewrap > table.t { min-width: 640px; }   /* 좁히면 이름이 한 글자씩 세로로 — 표는 옆으로 밀어 보기 */
  .tablewrap > table.t:has(td.empty) { min-width: 0; }   /* 빈 표는 안내 글이 화면 안에 */
}
