/* JOURNAL — 휴대폰 먼저(360px~), 넓은 화면(1024px~)에서는 두 열 */
:root {
  --container-wide: 1280px;
  --container-pad: 16px;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eaf1f1;
  --text: #17262a;
  --muted: #4f6166;
  --line: #d3dedf;
  --primary: #1f5f6b;
  --primary-dark: #154751;
  --on-primary: #ffffff;
  --accent: #e8a33d;
  --radius: 10px;
  --neg: #a3231b; --neg-bg: #fdecea;
  --ok: #1b6e3a;
  --sea: #e3eef3;
  --land: #f3efe6;
  --land-line: #c9c2b2;
  --visited: #3f9c8f;
  --visited-soft: #cfe7e2;
}
@media (min-width: 640px) { :root { --container-pad: 28px; } }
@media (min-width: 1024px) { :root { --container-pad: 40px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  font-size: 16px; line-height: 1.6;
  word-break: keep-all; overflow-wrap: break-word;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; margin-top: 1em; }
p { margin: 0 0 .6em; }
a { color: var(--primary); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 50; }

.inner {
  max-width: calc(var(--container-wide) + 2 * var(--container-pad));
  margin: 0 auto; padding: 0 var(--container-pad);
}

/* 머리 */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
/* 휴대폰에서는 머리가 화면의 1/4 을 차지해 고정하지 않는다 */
@media (min-width: 1024px) { .site-header { position: sticky; top: 0; z-index: 20; } }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding-top: 10px; padding-bottom: 6px; }
.brand { display: flex; flex-direction: column; }
.brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: .12em; color: var(--primary); }
.brand-sub { font-size: .84rem; color: var(--muted); }
.trip-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.trip-bar select { min-width: 0; flex: 1 1 180px; max-width: 100%; }
.save-state { font-size: .82rem; color: var(--muted); }
.save-state.bad { color: var(--neg); font-weight: 700; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px 4px; padding-bottom: 0; }
.tabs [role=tab] {
  border: 0; background: none; padding: 8px 10px; border-bottom: 3px solid transparent;
  font-weight: 600; color: var(--muted); cursor: pointer; font-size: .95rem;
}
.tabs [role=tab][aria-selected=true] { color: var(--primary); border-bottom-color: var(--primary); }

.main { padding-top: 16px; padding-bottom: 32px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1024px) { .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tab > .panel + .panel { margin-top: 16px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.empty { text-align: left; }
.hint { color: var(--muted); font-size: .9rem; }
.small { font-size: .88rem; color: var(--muted); }
.note { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-size: .9rem; margin: 10px 0; }
.note.bad { background: var(--neg-bg); color: var(--neg); }
.tag { font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 2px 8px; vertical-align: middle; }
.err { color: var(--neg); font-size: .82rem; font-weight: 600; min-height: 0; }
.err:empty { display: none; }

/* 폼 */
label { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; font-weight: 600; min-width: 0; margin-bottom: 10px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.inline-label { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
.field { margin-bottom: 10px; }
.field-label { display: block; font-size: .92rem; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=date], input[type=time], input[type=password], input:not([type]), select, textarea {
  width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 400;
}
textarea { resize: vertical; line-height: 1.55; }
textarea[readonly] { background: var(--surface-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .pin:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
@media (max-width: 380px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.inline { display: flex; gap: 6px; }
.inline > select, .inline > input { flex: 1 1 auto; }
.inline > .btn { flex: 0 0 auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 8px 14px; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text);
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: none; }
.btn.danger { color: var(--neg); }
.btn.small { padding: 5px 10px; font-size: .86rem; }
.btn.tiny { padding: 2px 8px; font-size: .8rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.btn { font-size: .95rem; line-height: 1.4; }
label.btn { flex-direction: row; margin: 0; font-size: .95rem; font-weight: 600; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: .88rem; }
.chip button { border: 0; background: none; cursor: pointer; font-size: .82rem; padding: 2px 6px; color: var(--muted); }
.chip.plain { padding: 3px 10px; }

/* 통계 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.stat b { display: block; font-size: 1.15rem; }
.stat span { font-size: .82rem; color: var(--muted); }

/* 여행 목록 */
.trip-list { display: flex; flex-direction: column; gap: 8px; }
.trip-card { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.trip-card[aria-current=true] { border-color: var(--primary); box-shadow: inset 4px 0 0 var(--primary); }
.trip-card b { display: block; }
.trip-card span { font-size: .85rem; color: var(--muted); }

/* 지도 */
.map-box { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--sea); }
.map-svg { display: block; width: 100%; height: auto; }
.map-svg .sea { fill: var(--sea); }
.map-svg .land { fill: var(--land); stroke: var(--land-line); stroke-width: .6; }
.map-svg .visited { fill: var(--visited); stroke: #fff; stroke-width: .6; }
.map-svg .visited.tiny { stroke: #fff; stroke-width: 1.5; }
.map-svg .visited-soft { fill: var(--visited-soft); stroke: var(--land-line); stroke-width: .6; }
.map-svg .dot { fill: var(--accent); stroke: #7a4d00; stroke-width: .6; }
.map-svg.trip .land, .map-svg.trip .visited-soft { stroke-width: 1; }
.map-svg .route { fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-opacity: .85; }
.map-svg .pin { cursor: pointer; }
.map-svg .pin text { font-size: 12px; font-weight: 700; fill: #fff; pointer-events: none; }
.map-svg .pin.on circle { stroke: #17262a; stroke-width: 3.5; }
.map-svg .thumb { cursor: pointer; }
.map-svg .scale line { stroke: var(--text); stroke-width: 2; }
.map-svg .scale text { font-size: 11px; fill: var(--text); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: .86rem; color: var(--muted); margin: 8px 0; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; }
.sw.visited { background: var(--visited); }
.sw.dot { background: var(--accent); border-radius: 50%; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 10px; }
.toolbar select { width: auto; max-width: 100%; }
.pin-info { margin-top: 8px; }
.pin-card { display: flex; flex-wrap: wrap; gap: 12px; background: var(--surface-2); border-radius: 8px; padding: 10px; }
.pin-card img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; }
.pin-card .txt { flex: 1 1 200px; min-width: 0; }
.route-row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; border-bottom: 1px solid var(--line); padding: 6px 0; }
.stop-btns { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.route-row .dotc { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* 날짜별 기록 */
.day { border-top: 1px solid var(--line); padding: 12px 0; }
.day:first-child { border-top: 0; padding-top: 0; }
.day-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; }
.day-head h3 { margin: 0; }
.day-no { font-weight: 800; color: var(--primary); }
.entry { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.entry-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; align-items: baseline; }
.entry-title { font-weight: 700; }
.entry-body { white-space: pre-line; margin: 6px 0 0; }
.entry-kw { font-size: .88rem; color: var(--muted); margin: 4px 0 0; }
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; margin-top: 8px; }
.ph { position: relative; margin: 0; background: #dfe7e8; border-radius: 6px; overflow: hidden; aspect-ratio: 4 / 3; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph figcaption { position: absolute; left: 0; right: 0; bottom: 0; font-size: .7rem; line-height: 1.3; color: #fff; background: rgba(0, 0, 0, .55); padding: 2px 4px; }
.ph .nopos { position: absolute; top: 3px; left: 3px; font-size: .66rem; background: #fff; color: var(--neg); border-radius: 4px; padding: 0 4px; font-weight: 700; }
.ph .del { position: absolute; top: 2px; right: 2px; border: 0; border-radius: 4px; background: rgba(255, 255, 255, .9); font-size: .72rem; cursor: pointer; padding: 1px 5px; }
.ph .noimg { display: flex; align-items: center; justify-content: center; height: 100%; font-size: .72rem; color: var(--muted); padding: 4px; text-align: center; }
.undated { margin-top: 8px; }
.undated-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0; font-size: .9rem; }
.undated-row input { width: auto; }
.helper { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.helper summary { cursor: pointer; font-weight: 700; color: var(--primary); }

/* 경비 */
.rate-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 8px; }
.rate-row input { width: 130px; flex: 0 1 130px; }
.rate-row .missing { color: var(--neg); font-weight: 700; font-size: .85rem; }
.total-big { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin: 0; }
.bars { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.bar-row { display: grid; grid-template-columns: 5.5em minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: .9rem; }
.bar { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--visited); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }
td.num, th.num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.x-row td .btn { margin: 0 0 2px 4px; }
.missing { color: var(--neg); font-weight: 700; }

/* 2026-09-30 — 머리 줄 · 보기 전환 */
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }
.panel-head select { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn { border: 0; background: var(--surface); padding: 5px 12px; font-size: .86rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn[aria-pressed=true] { background: var(--primary); color: var(--on-primary); }

/* 사진 중심 앨범 */
.g-day { margin-bottom: 18px; }
.g-day h3 { margin: 0 0 4px; }
.g-places { font-weight: 500; color: var(--muted); font-size: .9rem; }
.g-title { color: var(--primary); font-weight: 600; margin: 0 0 6px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.g-item { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: #dfe7e8; aspect-ratio: 4 / 3; cursor: zoom-in; }
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-item .noimg { display: flex; align-items: center; justify-content: center; height: 100%; font-size: .8rem; color: var(--muted); padding: 6px; }
.g-cap { position: absolute; left: 0; right: 0; bottom: 0; text-align: left; font-size: .76rem; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); padding: 14px 6px 4px; }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(10, 18, 20, .88); display: flex; align-items: center; justify-content: center; padding: 16px; }
.lb-inner { width: 100%; max-width: 960px; display: flex; flex-direction: column; gap: 10px; max-height: 100%; }
.lb-inner img { width: 100%; max-height: calc(100vh - 140px); object-fit: contain; border-radius: 8px; background: #000; }
.lb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lb-cap { flex: 1 1 200px; color: #fff; margin: 0; font-size: .9rem; }

/* 지도 따라가기 */
.stepper { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }

/* 경비 한눈에(미니멀 대시보드) */
.dash-panel { margin-bottom: 16px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.tile b { display: block; font-size: 1.3rem; color: var(--primary); overflow-wrap: anywhere; }
.tile span { font-size: .82rem; color: var(--muted); }
.eq { margin: 10px 0 6px; font-weight: 600; }
.eq > span { white-space: nowrap; margin-left: 6px; color: var(--muted); font-weight: 500; }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.stack i { display: block; height: 100%; }
.stack-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .84rem; color: var(--muted); margin: 6px 0 0; }

/* 정산 */
.who { border-top: 1px dashed var(--line); padding-top: 8px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.checks label.check { margin: 0; }
.transfers { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
.transfers li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }
.transfers .amt { margin-left: auto; font-weight: 800; color: var(--primary); }
td.pos { color: var(--ok); font-weight: 700; }
td.neg { color: var(--neg); font-weight: 700; }
.st-item { border-bottom: 1px solid var(--line); padding: 8px 0; }
.st-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; }
.st-row { margin-top: 6px; }
.st-row select { width: auto; }
.st-row .check .small { margin-left: 2px; }

/* 요약 카드 */
.card-canvas { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; display: block; margin: 8px 0; background: #fff; }

/* 알림 */
.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: #17262a; color: #fff; border-radius: 8px; padding: 8px 12px; display: flex; gap: 10px; align-items: center; max-width: calc(100vw - 32px); z-index: 60; font-size: .9rem; }
.toast .btn { background: #fff; color: var(--text); }

.site-footer { color: var(--muted); font-size: .8rem; padding-bottom: 24px; }

/* 인쇄용 여행기 */
.print-view { display: none; }
@media print {
  body { background: #fff; font-size: 11pt; }
  .site-header, .main, .site-footer, .toast, .skip, .lightbox { display: none !important; }
  .print-view { display: block; color: #000; }
  .print-view h1 { font-size: 20pt; margin: 0 0 4pt; }
  .print-view h2 { font-size: 14pt; margin: 14pt 0 6pt; border-bottom: 1px solid #999; padding-bottom: 2pt; }
  .print-view .p-meta { color: #333; }
  .print-view .p-report { white-space: pre-line; border: 1px solid #ccc; padding: 8pt; border-radius: 6pt; }
  .print-view .p-day { break-inside: avoid-page; }
  .print-view .p-text { white-space: pre-line; }
  .print-view .p-photos { display: flex; flex-wrap: wrap; gap: 4pt; margin: 4pt 0; }
  .print-view .p-photos img { width: 30mm; height: 22mm; object-fit: cover; }
  .print-view .map-svg { width: 100%; max-height: 110mm; }
  .print-view table { font-size: 9.5pt; }
}

/* 여행 일정 (2026-09-30) */
.plan-day { border-top: 1px solid var(--line); padding: 10px 0; }
.plan-day:first-child { border-top: 0; padding-top: 0; }
.plan-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.plan-item.done { background: #eef5f0; }
.plan-item.done .plan-title { color: var(--muted); text-decoration: line-through; }
.plan-item.overlap { box-shadow: inset 4px 0 0 var(--accent); }
.plan-item input[type=checkbox] { width: 20px; height: 20px; margin: 2px 0 0; }
.plan-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.plan-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-type { font-size: .78rem; font-weight: 700; border: 1px solid var(--text); border-radius: 4px; padding: 0 5px; }
.plan-title { font-weight: 700; }
.plan-meta { font-size: .86rem; color: var(--muted); margin: 2px 0 0; }
.plan-item .actions { margin: 4px 0 0; }
.plan-warn { color: #7a4d00; font-weight: 700; font-size: .84rem; }
.map-svg .plan-route { fill: none; stroke: #17262a; stroke-width: 2; stroke-dasharray: 6 5; stroke-opacity: .75; }
.map-svg .plan-pin { cursor: pointer; }
.map-svg .plan-pin rect { fill: #fff; stroke: #17262a; stroke-width: 2; }
.map-svg .plan-pin text { font-size: 11px; font-weight: 700; fill: #17262a; pointer-events: none; }
.map-svg .plan-pin.done rect { fill: #e7f1ec; }
.map-svg .plan-pin.on rect { stroke-width: 3.5; fill: #fff4dc; }
.sw.plan { background: #fff; border: 2px solid #17262a; border-radius: 3px; }
.sw.planline { width: 22px; height: 0; border-top: 2px dashed #17262a; border-radius: 0; vertical-align: 3px; }
.map-svg .plan-lead { stroke: #17262a; stroke-width: 1.5; }
