/* 국내 메리어트 5성급 요금 달력 — hotel-lux "Guest Folio" 테마를 따른다
   Porcelain(배경) · Lacquer(상단 바·선택) · Ink(본문) · Brass(전체 최저에만) · Fall/Rise(가격 방향, 항상 기호와 함께) */

:root {
  color-scheme: light;
  --page: #f5f7f5;
  --surface: #ffffff;
  --surface-2: #eef2ef;
  --lacquer: #183a2e;
  --lacquer-ink: #f2f5f2;
  --lacquer-mute: #a9bdb3;
  --ink: #16201b;
  --ink-2: #44514a;
  --muted: #6b7871;
  --rule: #dde4df;
  --rule-strong: #b9c5be;
  --brass: #a9802f;
  --brass-wash: rgba(169, 128, 47, 0.10);
  --fall: #16775a;
  --fall-wash: rgba(22, 119, 90, 0.09);
  --rise: #a3372f;
  --rise-wash: rgba(163, 55, 47, 0.08);
  --mix-wash: rgba(169, 128, 47, 0.08);
  --focus: #2a6fd6;
  --shadow: 0 12px 32px rgba(22, 32, 27, 0.16);
  --accent: #1f6b52;
  --border: rgba(22, 32, 27, 0.10);
  --na: #e3e9e5;
  /* 순차 색: 녹색 한 색, 진할수록 유리(현금·포인트는 쌈, 포인트 가치는 높음) */
  --s1: #d9ecdf; --s2: #a9d3b5; --s3: #6fb486; --s4: #2f8550; --s5: #0b5f2e;
  --s-ink-dark: #0b1a12; --s-ink-light: #ffffff;

  --sans: "Pretendard Variable", Pretendard, -apple-system, "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
  --serif: "Newsreader", "Pretendard Variable", Pretendard, "Iowan Old Style", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0e1411; --surface: #141c18; --surface-2: #1b2520;
    --lacquer: #1d3b30; --lacquer-ink: #edf2ee; --lacquer-mute: #93ab9f;
    --ink: #e6ece8; --ink-2: #b8c4bd; --muted: #8b9a92;
    --rule: #24302a; --rule-strong: #3a4842;
    --brass: #d2ae62; --brass-wash: rgba(210, 174, 98, 0.12);
    --fall: #3dbb8c; --fall-wash: rgba(61, 187, 140, 0.12);
    --rise: #e07a70; --rise-wash: rgba(224, 122, 112, 0.12); --mix-wash: rgba(210, 174, 98, 0.10);
    --focus: #6aa2ff; --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    --accent: #5fc79d; --border: rgba(230, 236, 232, 0.10); --na: #232d28;
    --s1: #1d3328; --s2: #24513a; --s3: #2f7a50; --s4: #46ad6c; --s5: #6fd897;
    --s-ink-dark: #e6ece8; --s-ink-light: #0b1a12;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0e1411; --surface: #141c18; --surface-2: #1b2520;
  --lacquer: #1d3b30; --lacquer-ink: #edf2ee; --lacquer-mute: #93ab9f;
  --ink: #e6ece8; --ink-2: #b8c4bd; --muted: #8b9a92;
  --rule: #24302a; --rule-strong: #3a4842;
  --brass: #d2ae62; --brass-wash: rgba(210, 174, 98, 0.12);
  --fall: #3dbb8c; --fall-wash: rgba(61, 187, 140, 0.12);
  --rise: #e07a70; --rise-wash: rgba(224, 122, 112, 0.12); --mix-wash: rgba(210, 174, 98, 0.10);
  --focus: #6aa2ff; --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --accent: #5fc79d; --border: rgba(230, 236, 232, 0.10); --na: #232d28;
  --s1: #1d3328; --s2: #24513a; --s3: #2f7a50; --s4: #46ad6c; --s5: #6fd897;
  --s-ink-dark: #e6ece8; --s-ink-light: #0b1a12;
}

/* ---------- 기본 */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page); color: var(--ink);
  font: 400 14px/1.5 var(--sans); letter-spacing: -0.005em; -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; color: inherit; }
h1, h2 { margin: 0; }
a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
.num { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); font-optical-sizing: auto; letter-spacing: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
select {
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 8px; padding: 6px 10px; min-height: 34px; cursor: pointer;
}
select:hover { border-color: var(--ink-2); }
input[type="checkbox"] { accent-color: var(--lacquer); width: 16px; height: 16px; }

/* ---------- 상단 바 (Lacquer) */
header.top { background: var(--lacquer); color: var(--lacquer-ink); }
.top-inner { max-width: 1440px; margin: 0 auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 24px; }
header.top h1 { font: 600 17px/1.2 var(--sans); letter-spacing: -0.01em; }
/* 대표 이름 「이때다」: 두 탭(hotel-lux, marriott-rates) 같은 모양 */
header.top h1 a { color: inherit; text-decoration: none; }
header.top h1 .brand { font-family: var(--sans); font-weight: 800; font-size: 22px; letter-spacing: -0.04em; margin-right: 10px; }
header.top h1 .tagline { font-weight: 500; font-size: 14px; color: var(--lacquer-mute); }
@media (max-width: 480px) { header.top h1 .tagline { display: none; } }
header.top .sub { color: var(--lacquer-mute); font-size: 12.5px; }
header.top .spacer { flex: 1; }
header.top .last { color: var(--lacquer-mute); font-size: 12.5px; white-space: nowrap; }
header.top .theme {
  width: 34px; min-height: 34px; padding: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--lacquer-ink); border: 1px solid rgba(255, 255, 255, 0.28);
}
header.top .theme:hover { border-color: rgba(255, 255, 255, 0.6); }

/* 사이트 탭 (hotel-lux public/static/style.css와 같은 규칙) */
.site-tabs { background: var(--lacquer); border-top: 1px solid rgba(255, 255, 255, 0.12); }
.site-tabs .in { max-width: 1440px; margin: 0 auto; padding: 0 24px; display: flex; gap: 4px; overflow-x: auto; }
.site-tabs a {
  padding: 9px 14px 8px; color: var(--lacquer-mute); text-decoration: none; font-size: 13.5px; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.site-tabs a:hover { color: var(--lacquer-ink); }
.site-tabs a[aria-current="page"] { color: var(--lacquer-ink); border-bottom-color: var(--brass); font-weight: 600; }
@media (max-width: 760px) { .site-tabs .in { padding: 0 8px; } .site-tabs a { padding: 8px 10px 7px; font-size: 13px; } }
/* 탭 가격 기준 안내 (hotel-lux와 같은 규칙) */
.site-tabs .in { align-items: center; }
.site-tabs .basis { margin-left: auto; font-size: 12px; color: var(--lacquer-mute); white-space: nowrap; padding-left: 12px; }
@media (max-width: 760px) { .site-tabs .basis { display: none; } }
.seg-label { font-size: 13px; color: var(--ink-2); cursor: help; text-decoration: underline dotted var(--rule-strong); text-underline-offset: 3px; }
.taxb { display: inline-block; font-size: 10.5px; font-weight: 600; line-height: 1; padding: 2px 5px; border-radius: 4px; margin-left: 5px;
  border: 1px solid var(--rule-strong); color: var(--ink-2); vertical-align: 2px; letter-spacing: 0; }
.note { font-size: 12.5px; color: var(--ink-2); margin: 6px 0 10px; padding: 6px 10px; background: var(--surface-2); border-radius: 6px; }
details.algo { font-size: 12.5px; color: var(--ink-2); }
details.algo > summary { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
details.algo p { position: absolute; z-index: 20; right: 18px; max-width: 520px; margin: 6px 0 0; padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: 8px; box-shadow: var(--shadow); line-height: 1.6; }
.list-meta { position: relative; }
.reason { font-size: 12px; color: var(--ink-2); margin-top: 3px; max-width: 220px; }
.more-dates { font-size: 12px; color: var(--accent); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.warn { font-size: 12px; color: var(--rise); margin-top: 4px; }
.day.out { background: none; border-style: dashed; color: var(--muted); cursor: default; }
.day.fail { background: var(--rise-wash); color: var(--muted); }
.vipcard { border-left: 3px solid var(--brass) !important; }
.vipcard .t a { color: inherit; }
.grid-m { display: none; }
.grid-m .gm-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 9px 2px; border-bottom: 1px solid var(--rule); }
.grid-m .gm-rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.grid-m .gm-v { font-weight: 650; font-variant-numeric: tabular-nums; }
.grid-m .gm-row.na .gm-v { color: var(--muted); font-weight: 400; }
@media (max-width: 760px) { #grid, #g-color, #g-hint { display: none; } .grid-m { display: block; } }
.xlink { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--accent); text-decoration: underline dotted; text-underline-offset: 3px; }
.xlink:hover { text-decoration: underline; }

main { max-width: 1440px; margin: 0 auto; padding: 14px 24px 48px; }

/* ---------- 오늘의 요약 (원장 한 줄) */
.ledger {
  display: flex; align-items: stretch; flex-wrap: wrap;
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule-strong); margin-bottom: 18px;
}
.ledger:empty { display: none; }
.ledger .lg { padding: 12px 22px 12px 0; margin-right: 22px; border-right: 1px solid var(--rule); min-width: 0; }
.ledger .lg:last-child { border-right: 0; margin-right: 0; }
.ledger .lg-title { display: flex; flex-direction: column; justify-content: center; padding-right: 26px; }
.ledger .lg-title b { font: 650 17px/1.2 var(--sans); letter-spacing: -0.01em; }
.ledger .lg-title span { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ledger .v { font: 650 26px/1.1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ledger .k { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.ledger .h { font-size: 11.5px; color: var(--muted); }
.ledger .h a { cursor: pointer; }
.ledger .lg.is-rec .v { color: var(--brass); }
.ledger .lg.is-fall .v { color: var(--fall); }
.ledger .v .arr { font-size: 15px; margin-right: 3px; vertical-align: 2px; }

/* ---------- 보드 (탭 + 필터 + 내용) */
.board { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; }
.board-head { border-bottom: 1px solid var(--rule); padding: 0 18px; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; }
.tabs button {
  border: 0; background: none; padding: 14px 12px 11px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; font-size: 14px;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--lacquer); font-weight: 650; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-left: auto; padding: 8px 0; }
.filters label, .best-bar label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.view { padding: 16px 18px 18px; }

.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; color: var(--ink-2); font-size: 13px; min-height: 32px; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button:hover { background: var(--surface-2); }
.seg button[aria-pressed="true"] { background: var(--lacquer); color: var(--lacquer-ink); }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 12px; }
.chk { display: inline-flex; gap: 6px; align-items: center; }

/* 호텔 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink-2);
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--lacquer); border-color: var(--lacquer); color: var(--lacquer-ink); }
.chip.nodata { color: var(--muted); border-style: dashed; }
.chip .t { font-size: 11.5px; opacity: .7; }
details.more { flex-basis: 100%; }
details.more summary { cursor: pointer; color: var(--ink-2); font-size: 12.5px; padding: 2px 0; }
details.more .chips { margin: 6px 0 0; }

/* ---------- 요금 달력 */
.cal-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 960px) { .cal-layout { grid-template-columns: 1fr; } .cal-main { order: -1; } }   /* 좁은 화면: 달력 먼저 */
.side { border-top: 2px solid var(--ink); padding-top: 12px; }
.side h3 { margin: 0 0 4px; font: 500 24px/1.15 var(--serif); font-optical-sizing: auto; letter-spacing: -0.005em; }
.side .en { font-size: 12px; color: var(--muted); }
.side .sub { color: var(--ink-2); font-size: 12.5px; margin: 6px 0 4px; }
.side .blk { border-top: 1px solid var(--rule); padding-top: 10px; margin-top: 12px; }
.side .blk h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.dates { color: var(--muted); font-size: 12px; }
a.datelink { color: var(--accent); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
a.datelink:hover { text-decoration: underline; }
.delta-up { color: var(--rise); }
.delta-down { color: var(--fall); }
.btn-book {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font: 600 13.5px/1.2 var(--sans);
  text-decoration: none; white-space: nowrap; background: var(--lacquer); color: var(--lacquer-ink); border: 1px solid var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
.btn-book:hover { background: var(--accent); color: #fff; }
.btn {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border: 1px solid var(--rule-strong); border-radius: 8px;
  text-decoration: none; color: var(--ink-2); background: var(--surface); font-size: 13px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-2); }

.cal-main { min-width: 0; }
.cal-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.cal-bar h2 { min-width: 120px; text-align: center; font: 500 22px/1.2 var(--serif); }
.cal-bar .seg { margin-left: auto; }
.nav { border: 1px solid var(--rule-strong); background: var(--surface); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 18px; color: var(--ink-2); }
.nav:hover:not(:disabled) { border-color: var(--ink-2); color: var(--ink); }
.nav:disabled { opacity: .35; cursor: default; }
.month-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.month-pills button {
  border: 1px solid var(--rule); background: var(--surface); border-radius: 999px; padding: 3px 10px; cursor: pointer;
  font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.month-pills button:hover { border-color: var(--rule-strong); color: var(--ink); }
.month-pills button[aria-pressed="true"] { background: var(--lacquer); border-color: var(--lacquer); color: var(--lacquer-ink); font-weight: 600; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.dow { text-align: center; font-size: 11.5px; color: var(--muted); padding: 2px 0 4px; }
.dow.sun { color: var(--rise); }
.dow.sat { color: var(--accent); }
.day {
  min-height: 76px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); padding: 5px 7px;
  cursor: pointer; display: flex; flex-direction: column; gap: 1px; position: relative; text-align: left; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.day:hover:not(.empty):not(.past) { box-shadow: 0 0 0 1px var(--ink-2); }
.day.empty { background: none; border: 0; cursor: default; }
.day.past { background: none; opacity: .4; cursor: default; }
.day.na { background: repeating-linear-gradient(45deg, transparent 0 4px, var(--na) 4px 5px); color: var(--muted); }
.day .d { font-size: 11.5px; color: var(--ink-2); display: flex; justify-content: space-between; }
.day .c { font-size: 13px; font-weight: 650; white-space: nowrap; }
.day .p { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.day .c.low, .day .p.low { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 2px; }
.day .star { color: var(--brass); }
.day .chg { font-size: 10px; }
.day[aria-selected="true"] { box-shadow: 0 0 0 2px var(--ink); }
.day.s1 { background: var(--s1); } .day.s2 { background: var(--s2); } .day.s3 { background: var(--s3); }
.day.s4 { background: var(--s4); } .day.s5 { background: var(--s5); }
.day.s1, .day.s2 { color: var(--s-ink-dark); }
.day.s3, .day.s4, .day.s5 { border-color: transparent; }
.day.s4, .day.s5, .day.s4 .d, .day.s5 .d, .day.s4 .p, .day.s5 .p, .day.s4 .chg, .day.s5 .chg, .day.s4 .star, .day.s5 .star { color: var(--s-ink-light); }
@media (max-width: 560px) { .day { min-height: 60px; padding: 3px 4px; } .day .c { font-size: 11.5px; } .day .p { font-size: 10.5px; } .cal { gap: 2px; } }

.legend { display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin: 12px 0 4px; }
.legend .sw { display: inline-block; width: 16px; height: 12px; border-radius: 3px; vertical-align: -2px; border: 1px solid var(--border); }
.legend .ramp { display: inline-flex; gap: 2px; align-items: center; }
.legend .star { color: var(--brass); }

/* 날짜 상세 */
.detail { border-top: 2px solid var(--ink); margin-top: 18px; padding-top: 12px; }
.detail h3 { margin: 0 0 10px; font: 500 22px/1.2 var(--serif); }
.detail .cmp3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule); margin-bottom: 12px; }
.detail .cmp3 > div { padding: 10px 14px 10px 0; }
.detail .cmp3 > div + div { padding-left: 14px; border-left: 1px solid var(--rule); }
.detail .cmp3 .t { font-size: 12px; color: var(--muted); }
.detail .cmp3 .v { font: 650 20px/1.2 var(--sans); font-variant-numeric: tabular-nums; margin-top: 2px; }
.detail .links { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .charts { grid-template-columns: 1fr; } .detail .cmp3 { grid-template-columns: 1fr; } .detail .cmp3 > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); } }
.chart h4, .detail h4 { margin: 0 0 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.chart svg { width: 100%; height: 150px; display: block; }
.chart .grid-line { stroke: var(--rule); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .na-band { fill: var(--na); }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .empty { fill: var(--muted); font-size: 12px; }

/* ---------- 표 */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); background: var(--surface);
  padding: 10px 12px; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
td { padding: 8px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
td.r, th.r { text-align: right; }
tbody tr:hover td { background: var(--surface-2); }
table.cmp td, table.cmp th { font-size: 13px; padding: 6px 10px; }
tr.me td { font-weight: 650; background: var(--brass-wash); }
.hname { font: 500 16px/1.25 var(--serif); font-optical-sizing: auto; cursor: pointer; text-decoration: underline dotted var(--muted); text-underline-offset: 4px; }
.hname:hover { text-decoration: underline; }
.tag { display: inline-block; font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 5px; margin-left: 6px; border: 1px solid currentColor; white-space: nowrap; vertical-align: 2px; font-weight: 600; }
.tag.drop { color: var(--fall); }
.tag.err { color: var(--brass); }
tr.up td:first-child { box-shadow: inset 3px 0 0 var(--rise); }
tr.down td:first-child { box-shadow: inset 3px 0 0 var(--fall); }
tr.mix td:first-child { box-shadow: inset 3px 0 0 var(--brass); }
.best td .h { font: 650 17px/1.2 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.best td .m { color: var(--muted); font-size: 12px; margin-top: 2px; }
.best .was { font-size: 12px; margin-top: 2px; font-variant-numeric: tabular-nums; font-weight: 600; }
.best-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }

/* ---------- 전체 비교 */
.grid-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.grid-bar .month-pills { margin: 0; }
.grid-bar .seg { margin-left: auto; }
.grid-wrap { overflow: auto; border: 1px solid var(--rule); border-radius: 8px; max-height: 75vh; }
table.grid { width: max-content; min-width: 100%; font-size: 12px; }
table.grid th, table.grid td { padding: 0; border-right: 1px solid var(--rule); text-align: center; }
table.grid th.h, table.grid td.h {
  position: sticky; left: 0; background: var(--surface); text-align: left; padding: 4px 10px; z-index: 1;
  min-width: 190px; max-width: 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px;
}
table.grid td.h { font-family: var(--serif); font-size: 14px; }
table.grid th.h { z-index: 2; }
table.grid th { padding: 4px 2px; min-width: 46px; }
table.grid th .w { display: block; font-size: 10px; color: var(--muted); }
table.grid td.v { font-size: 11.5px; height: 32px; cursor: pointer; font-variant-numeric: tabular-nums; }
table.grid tbody tr:hover td.h { background: var(--surface-2); }
table.grid td.v.na { background: repeating-linear-gradient(45deg, transparent 0 4px, var(--na) 4px 5px); cursor: default; }
table.grid td.s1 { background: var(--s1); color: var(--s-ink-dark); } table.grid td.s2 { background: var(--s2); color: var(--s-ink-dark); }
table.grid td.s3 { background: var(--s3); } table.grid td.s4 { background: var(--s4); color: var(--s-ink-light); }
table.grid td.s5 { background: var(--s5); color: var(--s-ink-light); }
table.grid td.low { font-weight: 700; text-decoration: underline; }
table.grid th.we, table.grid th.we .w { color: var(--rise); }

/* ---------- 전체 내역 (대표 화면) */
input[type="date"], input[type="number"] {
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 8px; padding: 5px 8px; min-height: 34px; color: var(--ink);
}
input[type="number"] { width: 92px; }
input[type="date"]:hover, input[type="number"]:hover { border-color: var(--ink-2); }
.filterbar { border-bottom: 1px solid var(--rule); margin: -16px -18px 0; padding: 14px 18px 10px; }
.filterbar .row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.filterbar .row + .row { margin-top: 10px; }
.filterbar label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.filterbar .unit { font-size: 12px; color: var(--muted); font-weight: 500; }
.seg-lg button { padding: 7px 16px; font-weight: 600; font-size: 13.5px; }
.pick { position: relative; }
.pick > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 12px;
  border: 1px solid var(--rule-strong); border-radius: 8px; font-size: 13px; color: var(--ink); background: var(--surface);
}
.pick > summary::-webkit-details-marker { display: none; }
.pick > summary::after { content: "▾"; color: var(--muted); }
.pick[open] > summary { border-color: var(--lacquer); box-shadow: 0 0 0 1px var(--lacquer); }
.pick .chips {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(560px, 90vw); margin: 0; padding: 12px;
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 10px; box-shadow: var(--shadow);
}
button.link { border: 0; background: none; color: var(--ink-2); text-decoration: underline; cursor: pointer; font-size: 12.5px; padding: 4px; }
.chips.quick { margin: 12px 0 0; }
.chip .n { font-variant-numeric: tabular-nums; font-size: 12px; opacity: .72; }
.chip.rec { border-color: var(--brass); color: var(--brass); }
.chip.rec[aria-pressed="true"] { background: var(--brass); border-color: var(--brass); color: #fff; }
.list-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 6px; font-size: 13px; color: var(--ink-2); }
.list-meta #l-count { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.list-meta .spacer { flex: 1; }
.small { font-size: 12px; color: var(--muted); }
.sortbar { display: none; }

table.data th[data-sort] { cursor: pointer; user-select: none; }
table.data th[data-sort]::after { content: " ↕"; opacity: .3; }
table.data th.asc::after { content: " ↑"; opacity: 1; }
table.data th.desc::after { content: " ↓"; opacity: 1; }
table.data td { padding: 9px 12px; }
table.data tr.rec td { background: var(--brass-wash); }
table.data tr.rec td:first-child { box-shadow: inset 3px 0 0 var(--brass); }
table.data tr.rec:hover td { background: var(--surface-2); }
table.data .c-hotel { min-width: 200px; }
table.data .c-date { white-space: nowrap; }
table.data .c-price { text-align: right; white-space: nowrap; }
.hmeta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.ci { font-weight: 550; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price { font: 650 18px/1.15 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.015em; }
.price .star, .star { color: var(--brass); }
.price-sub { font-size: 12px; color: var(--ink-2); margin-top: 3px; font-variant-numeric: tabular-nums; }
.delta { display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.delta .arr { font-size: 11px; }
.delta.down { color: var(--fall); }
.delta.up { color: var(--rise); }
.delta.flat, .delta.na { color: var(--muted); font-weight: 500; }
.dsub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 3px; white-space: nowrap; }
.meter { display: inline-grid; grid-template-columns: repeat(5, 12px); gap: 2px; vertical-align: middle; }
.meter i { height: 8px; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--rule); }
.meter i.on { border-color: transparent; }
.rank { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 550; }
.rank-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 3px; white-space: nowrap; }
.badge {
  display: inline-block; font-size: 11.5px; line-height: 1; padding: 4px 7px; border-radius: 5px; margin: 0 3px 3px 0;
  border: 1px solid var(--rule-strong); color: var(--ink-2); white-space: nowrap;
}
.badge.off { border-color: transparent; background: var(--surface-2); margin: 0 0 0 6px; padding: 2px 6px; }
.keytag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; margin: 0 4px 4px 0;
  border: 1px solid var(--brass); border-radius: 4px 11px 11px 4px; color: var(--brass); font-size: 11.5px; font-weight: 650; line-height: 1.3; white-space: nowrap;
}
.keytag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; border: 1.5px solid currentColor; }
.why { font-size: 11.5px; color: var(--muted); max-width: 200px; }
table.data .c-link { white-space: nowrap; width: 1%; }
.ext {
  display: inline-flex; align-items: center; justify-content: center; height: 28px; padding: 0 10px; margin-left: 4px; cursor: pointer;
  border: 1px solid var(--rule-strong); border-radius: 6px; text-decoration: none; color: var(--ink-2); background: var(--surface); font-size: 12.5px; white-space: nowrap;
}
.ext:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-2); }
.more { padding: 14px; text-align: center; }
.more button { padding: 8px 18px; border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--surface); cursor: pointer; }
.more button:hover { border-color: var(--ink-2); }

/* ---------- 공통 */
.tip {
  position: fixed; z-index: 40; background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow); pointer-events: none; max-width: 260px; font-variant-numeric: tabular-nums;
}
.foot { max-width: 1440px; margin: 0 auto; padding: 0 24px 32px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.empty-msg { color: var(--muted); padding: 40px 12px; text-align: center; }

/* ---------- 모바일 */
@media (max-width: 760px) {
  .top-inner { padding: 10px 14px; gap: 8px; }
  header.top .sub { display: none; }
  main { padding: 10px 10px 32px; }
  .ledger { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger .lg { padding: 8px 0 8px 10px; margin: 0; border-right: 0; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
  .ledger .lg:nth-child(2n) { border-left: 0; padding-left: 0; }
  .ledger .lg-title { grid-column: 1 / -1; border: 0; padding: 8px 0 6px; flex-direction: row; align-items: baseline; gap: 10px; }
  .ledger .v { font-size: 19px; }
  .ledger .k { font-size: 11.5px; }
  .board-head { padding: 0 10px; }
  .filters { margin-left: 0; }
  .view { padding: 12px 10px 14px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .side h3 { font-size: 21px; }
  .foot { padding: 0 12px 24px; }

  /* 전체 내역: 표 → 카드 */
  .filterbar { margin: -12px -10px 0; padding: 12px 10px 10px; }
  .filterbar label { flex-wrap: wrap; }
  input[type="number"] { width: 78px; }
  .chips.quick { flex-wrap: nowrap; overflow-x: auto; }
  .list-meta .small { display: none; }
  .sortbar { display: flex; gap: 6px; margin: 0 0 8px; overflow-x: auto; }
  .sortbar button { flex: none; padding: 5px 11px; font-size: 13px; border-radius: 999px; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; }
  .sortbar button[aria-pressed="true"] { background: var(--lacquer); border-color: var(--lacquer); color: var(--lacquer-ink); }
  table.data thead { display: none; }
  table.data, table.data tbody { display: block; width: 100%; }
  table.data tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 4px;
    padding: 10px 4px; border-bottom: 1px solid var(--rule);
  }
  table.data td { display: block; border: 0; padding: 0; background: none !important; min-width: 0; }
  table.data tr.rec { box-shadow: inset 3px 0 0 var(--brass); background: var(--brass-wash); padding-left: 10px; }
  table.data tr.rec td:first-child { box-shadow: none; }
  table.data td.c-hotel { grid-column: 1; grid-row: 1; }
  table.data td.c-hotel .hmeta { display: none; }
  table.data td.c-date { grid-column: 1; grid-row: 2; }
  table.data td.c-price { grid-column: 2; grid-row: 1 / span 2; }
  table.data td.c-prev, table.data td.c-level, table.data td.c-day {
    grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  }
  table.data td.c-prev { grid-row: 3; }
  table.data td.c-level { grid-row: 4; }
  table.data td.c-day { grid-row: 5; }
  table.data td[data-label]::before { content: attr(data-label); font-size: 11px; color: var(--muted); width: 38px; flex: none; }
  table.data td .dsub:not(.ci + .dsub), table.data td .rank-sub { display: inline; margin: 0 0 0 6px; }
  table.data td.c-prev > div { display: inline-flex; align-items: baseline; gap: 6px; }
  table.data td.c-tags { grid-column: 1; grid-row: 6; }
  table.data td.c-tags .why { display: none; }
  table.data td.c-tags:empty { display: none; }
  table.data td.c-link { grid-column: 2; grid-row: 6; align-self: end; width: auto; }
  .price { font-size: 17px; }
}
