:root {
  --bg: #0f1712;
  --panel: #16211a;
  --panel-2: #1d2c23;
  --line: #26382c;
  --text: #e8f0ea;
  --muted: #9db3a5;
  --accent: #4caf6d;
  --accent-2: #7fd4a0;
  --warn: #e0a458;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f7f4; --panel: #fff; --panel-2: #eef3ee; --line: #dbe5dc;
    --text: #142018; --muted: #5d6f63; --accent: #2e7d4f; --accent-2: #1f5c39;
    --shadow: 0 6px 20px rgba(20,50,30,.12);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.topbar { padding: 18px 24px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 14px; }
.leaf { font-size: 30px; }
h1 { margin: 0; font-size: 20px; letter-spacing: -.2px; }
.meta { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
main { padding: 20px 24px 60px; max-width: 1360px; margin: 0 auto; }

.status { margin-top: 6px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px; border-radius: 999px; }
.status.collecting { color: var(--accent-2); background: color-mix(in srgb, var(--accent) 16%, transparent); border: 1px solid var(--line); }
.status.idle { color: var(--muted); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); }
  70%  { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}

.filters {
  display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field.checkbox { justify-content: end; }
.field.checkbox label { display: flex; align-items: center; gap: 6px; color: var(--text); font-weight: 500; }
select, input {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 14px; min-width: 120px;
}
input[type=number] { min-width: 100px; }
button {
  background: var(--accent); color: #06140b; border: none; border-radius: 8px;
  padding: 9px 14px; font-weight: 700; cursor: pointer; font-size: 14px;
}
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 600; }
button:hover { filter: brightness(1.06); }

.summary { display: flex; gap: 18px; flex-wrap: wrap; margin: 18px 2px 10px; color: var(--muted); font-size: 13px; }
.summary b { color: var(--accent-2); }

.table-wrap { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
/* Fixed layout so all columns fit the width with no horizontal scroll. */
table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
thead th {
  text-align: left; padding: 11px 12px; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line);
  background: var(--panel);
}
th.num, td.num { text-align: right; }
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--panel-2); cursor: pointer; }
tbody tr:last-child td { border-bottom: none; }

/* Column widths (lodge flexes to fill the rest). */
.col-thumb   { width: 68px; }
.col-beds    { width: 58px; }
.col-arrival { width: 138px; }
.col-nights  { width: 62px; }
.col-price   { width: 116px; }
.col-rooms   { width: 82px; }
.col-trend   { width: 96px; }
.col-book    { width: 96px; text-align: right; }
.col-lodge   { overflow: hidden; }

.col-lodge .lodge-link, .col-lodge > span { }
.sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 1px;
       white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-price .price { font-size: 16px; font-weight: 800; color: var(--accent-2); display: block; }
.price { font-weight: 800; color: var(--accent-2); }
.soldout { color: var(--warn); font-weight: 700; }
.thumb { width: 54px; height: 38px; object-fit: cover; border-radius: 6px; display: block; background: var(--panel-2); }

/* ---- Phone: reflow the table into glanceable cards ---- */
@media (max-width: 680px) {
  main { padding: 14px 12px 50px; }
  .table-wrap { border: none; background: transparent; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  table { table-layout: auto; }
  tbody tr {
    position: relative; background: var(--panel); border: 1px solid var(--line);
    border-radius: 14px; margin-bottom: 12px; padding: 14px 16px; box-shadow: var(--shadow);
  }
  tbody td { border: none; padding: 2px 0; text-align: left; white-space: normal; }
  td.num { text-align: left; }

  .col-thumb { position: absolute; top: 14px; right: 14px; width: 84px; }
  .col-thumb .thumb { width: 84px; height: 60px; }
  .col-lodge { font-size: 17px; font-weight: 700; padding-right: 96px; margin-bottom: 8px; }
  .col-lodge .sub { font-size: 12px; }

  /* Big, glanceable price */
  .col-price { margin: 4px 0; }
  .col-price .price { font-size: 30px; line-height: 1; }
  .col-price .sub { font-size: 13px; margin-top: 3px; }

  /* Facts as inline label: value chips */
  .col-arrival { font-size: 15px; font-weight: 600; margin-top: 4px; }
  .col-arrival .sub { display: inline; font-weight: 400; }
  .col-arrival .sub::before { content: " · "; }
  .col-beds, .col-nights, .col-rooms { display: inline-block; width: auto; margin: 6px 18px 2px 0; font-size: 13px; color: var(--text); }
  .col-beds::before  { content: attr(data-label) ": "; color: var(--muted); }
  .col-nights::before { content: attr(data-label) ": "; color: var(--muted); }
  .col-rooms::before { content: attr(data-label) ": "; color: var(--muted); }
  .col-trend { display: none; }

  .col-book { margin-top: 10px; }
  .col-book a.book { display: block; text-align: center; padding: 11px; font-size: 15px; }
}
.empty { text-align: center; color: var(--muted); padding: 30px; }
.lodge-link { color: var(--text); text-decoration: none; font-weight: 600; }
.lodge-link:hover { color: var(--accent-2); text-decoration: underline; }
a.book {
  display: inline-block; background: var(--accent); color: #06140b; border-radius: 7px;
  padding: 4px 10px; font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap;
}
a.book:hover { filter: brightness(1.08); }
a.book.big { padding: 9px 14px; font-size: 14px; margin-top: 12px; }
.spark { display: block; }

.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; justify-content: flex-end; z-index: 20; }
.drawer[hidden] { display: none; }
.drawer-inner {
  width: min(460px, 92vw); height: 100%; background: var(--panel); border-left: 1px solid var(--line);
  padding: 22px; overflow-y: auto; box-shadow: var(--shadow); position: relative;
}
.drawer h2 { margin: 0 30px 2px 0; font-size: 18px; }
.close { position: absolute; top: 16px; right: 16px; }
.history { width: 100%; margin-top: 14px; }
.history th, .history td { padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
#drawer-chart { margin-top: 16px; }
