/* Hotel compare: calm, dense-where-it-matters UI. Light + dark from the same tokens. */
:root {
  --bg: #f3f5fa; --panel: #ffffff; --panel-2: #f8f9fc; --text: #141a2b; --muted: #5d6679; --faint: #b4bccb;
  --line: #e3e7ef; --line-2: #eef1f6;
  --brand: #3451d1; --brand-2: #2a42ad; --brand-soft: #e8ecfd; --on-brand: #ffffff;
  --best-bg: #e3f6ea; --best-text: #0b6b34; --best-line: #b9e6c8;
  --warn-bg: #fff3d6; --warn-text: #8a5800; --bad-bg: #fde8e8; --bad-text: #b02121;
  --star: #e2a400; --chip: #eef1f6;
  --shadow: 0 1px 2px rgba(20, 26, 43, .05), 0 4px 16px rgba(20, 26, 43, .05);
  --radius: 14px; --radius-s: 9px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1220; --panel: #151c2e; --panel-2: #1a2236; --text: #e7ebf4; --muted: #9aa5ba; --faint: #4b566c;
    --line: #262f45; --line-2: #1f2739;
    --brand: #7b93ff; --brand-2: #96a9ff; --brand-soft: #222c4d; --on-brand: #0d1220;
    --best-bg: #123a26; --best-text: #8be3ac; --best-line: #1f5c3a;
    --warn-bg: #3b3013; --warn-text: #f2c86b; --bad-bg: #431f22; --bad-text: #ff9c9c;
    --star: #f2c86b; --chip: #212a3f; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1220; --panel: #151c2e; --panel-2: #1a2236; --text: #e7ebf4; --muted: #9aa5ba; --faint: #4b566c;
  --line: #262f45; --line-2: #1f2739;
  --brand: #7b93ff; --brand-2: #96a9ff; --brand-soft: #222c4d; --on-brand: #0d1220;
  --best-bg: #123a26; --best-text: #8be3ac; --best-line: #1f5c3a;
  --warn-bg: #3b3013; --warn-text: #f2c86b; --bad-bg: #431f22; --bad-text: #ff9c9c;
  --star: #f2c86b; --chip: #212a3f; --shadow: none;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.num, td, .price { font-variant-numeric: tabular-nums; }

/* ---------- controls ---------- */
button { font: inherit; border: 0; border-radius: var(--radius-s); padding: 9px 15px; cursor: pointer; font-weight: 600;
  background: var(--chip); color: var(--text); transition: background .15s, transform .05s; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--brand); color: var(--on-brand); }
button.primary:hover:not(:disabled) { background: var(--brand-2); }
button.ghost { background: transparent; color: var(--brand); padding: 6px 10px; font-weight: 500; }
button.ghost:hover { background: var(--brand-soft); }
button.small { padding: 4px 9px; font-size: 12.5px; }
button.big { padding: 12px 20px; font-size: 15px; }
input, select { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 9px 11px; min-width: 0; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 10px 20px; background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand);
  color: var(--on-brand); font-weight: 800; font-size: 15px; }
.logo.big { width: 46px; height: 46px; border-radius: 13px; font-size: 22px; }
.sub { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.right { display: flex; align-items: center; gap: 8px; }
.badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--chip); white-space: nowrap; }
.badge:empty { display: none; }
.badge.saved { background: var(--warn-bg); color: var(--warn-text); }
.badge.live { background: var(--best-bg); color: var(--best-text); }
.badge.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  margin-right: 6px; vertical-align: 1px; }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 16px 8px; }
.panel-head h2 { font-size: 14px; }
.count { font-size: 12px; color: var(--muted); }

/* ---------- sign in ---------- */
.login { display: flex; justify-content: center; padding: 72px 16px; }
.login form { width: 100%; max-width: 380px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 22px; }
.login p { margin: 0; }
.login label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.login input { padding: 11px 12px; }
.msg { color: var(--bad-text); font-size: 13px; min-height: 1em; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; max-width: 1640px; margin: 0 auto;
  padding: 20px; align-items: start; }
.side { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 16px;
  max-height: calc(100vh - 92px); overflow: auto; }
.main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ---------- sidebar lists ---------- */
.list { list-style: none; margin: 0; padding: 0 8px 8px; }
.item { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 10px; border-radius: 10px;
  cursor: pointer; transition: background .12s; }
.item:hover, .item:focus-visible { background: var(--panel-2); }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .title.wrap { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-height: 1.3; }
.item { align-items: flex-start; }
.item .price { padding-top: 1px; }
.item .meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .price { font-weight: 700; text-align: right; white-space: nowrap; }
.item .price small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }
.item .x { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; padding: 0; border-radius: 6px;
  background: var(--panel); color: var(--muted); font-size: 14px; line-height: 1; opacity: 0; }
.item:hover .x, .item:focus-within .x { opacity: 1; }
.item.running { background: var(--brand-soft); }
.down { color: var(--best-text); }
.up { color: var(--bad-text); }
.empty { margin: 0; padding: 4px 18px 16px; color: var(--muted); font-size: 13px; }

/* ---------- search ---------- */
.search { padding: 20px; }
.search-title { margin-bottom: 14px; }
.search-title h1 { font-size: 21px; }
.search-title p { margin: 4px 0 0; }
.fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.f { display: flex; flex-direction: column; gap: 5px; }
.f span { font-size: 12px; font-weight: 600; color: var(--muted); }
.f.city { flex: 1 1 220px; }
.f.city input { width: 100%; font-size: 15px; font-weight: 600; }
.f.num input { width: 76px; }

/* ---------- tabs (phones) ---------- */
.tabs { display: none; }

/* ---------- welcome ---------- */
.welcome { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); padding: 18px; }
.step b { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-size: 13px; margin-bottom: 8px; }
.step h3 { font-size: 15px; margin-bottom: 4px; }
.step p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- progress ---------- */
.progress { padding: 14px 16px; }
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.summary { font-weight: 600; }
.bar { height: 6px; background: var(--chip); border-radius: 4px; overflow: hidden; margin-top: 10px; }
#barFill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .4s; }
.searching #barFill { background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
  background-image: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 50%, var(--brand) 100%); }
@keyframes shimmer { to { background-position: -200% 0; } }
.chipsbox { margin-top: 8px; }
.chipsbox summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.chipsbox summary:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.chip.ok { background: var(--best-bg); color: var(--best-text); }
.chip.running { color: var(--brand); }
.chip.error, .chip.wrong_dates { background: var(--bad-bg); color: var(--bad-text); }
.chip.empty, .chip.no_saved_search, .chip.skipped { background: var(--warn-bg); color: var(--warn-text); }

.focus { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px;
  background: var(--brand-soft); border-radius: var(--radius-s); color: var(--text); }

/* ---------- toolbar ---------- */
.tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; }
.tool-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tools input[type=search] { width: 230px; }
.inline { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.inline input { width: 64px; }

/* ---------- results grid ---------- */
.tablewrap { overflow: auto; max-height: calc(100vh - 140px); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); }
#grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 760px; }
#grid th, #grid td { border-bottom: 1px solid var(--line-2); padding: 10px 12px; text-align: right; white-space: nowrap;
  background: var(--panel); vertical-align: top; }
#grid th { position: sticky; top: 0; z-index: 2; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; background: var(--panel-2); border-bottom: 1px solid var(--line); }
#grid th:first-child, #grid td:first-child { position: sticky; left: 0; z-index: 1; text-align: left; white-space: normal;
  min-width: 270px; max-width: 340px; border-right: 1px solid var(--line-2); }
#grid th:first-child { z-index: 3; }
#grid tbody tr:hover td { background: var(--panel-2); }
#grid td.best, #grid tbody tr:hover td.best { background: var(--best-bg); color: var(--best-text); font-weight: 700; }
#grid td.na { color: var(--faint); }
#grid tr.tracked td:first-child { box-shadow: inset 3px 0 0 var(--star); }
.hotel { display: flex; gap: 8px; align-items: flex-start; }
.hotel .info { flex: 1; min-width: 0; }
.name { font-weight: 650; }
.meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.stars { color: var(--star); letter-spacing: -1px; }
.save { color: var(--best-text); font-weight: 650; }
.pick { margin-top: 3px; }
.trk { padding: 2px 4px; background: none; color: var(--faint); font-size: 18px; line-height: 1; font-weight: 400; }
.trk:hover { color: var(--star); background: none; }
.trk.on { color: var(--star); }
tr.new td, .card.new { animation: flash 1.4s ease-out; }
@keyframes flash { from { box-shadow: inset 0 0 0 999px var(--warn-bg); } }

.tag { display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 5px; margin-left: 5px;
  background: var(--chip); color: var(--muted); vertical-align: 1px; font-weight: 600; }
.tag.incl { background: var(--best-bg); color: var(--best-text); }
.tag.warn, .tag.portal_total, .tag.ex_taxes { background: var(--warn-bg); color: var(--warn-text); }
.tag.q { background: none; color: var(--faint); padding: 0 2px; cursor: help; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; }
.swatch.best { background: var(--best-bg); border: 1px solid var(--best-line); }

/* ---------- phone cards ---------- */
.cards { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card.tracked { border-color: var(--star); }
.prices { list-style: none; margin: 10px 0 0; padding: 0; }
.prices li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; }
.prices li + li { border-top: 1px solid var(--line-2); }
.prices li.best { background: var(--best-bg); color: var(--best-text); font-weight: 700; border-top-color: transparent; }

/* ---------- folds ---------- */
.fold { padding: 12px 16px; }
.fold summary { cursor: pointer; font-weight: 650; }
.legend-list { padding-left: 4px; list-style: none; }
.legend-list li { margin: 6px 0; }
.healthwrap { overflow-x: auto; margin-top: 10px; }
table.plain { border-collapse: collapse; width: 100%; font-size: 13px; }
table.plain th, table.plain td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.plain th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; padding: 10px 16px;
  border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  max-width: calc(100vw - 32px); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .side { display: none; position: static; max-height: none; }
  .side.show { display: flex; }
  .tabs { display: flex; gap: 4px; padding: 4px; background: var(--chip); border-radius: 12px; }
  .tabs button { flex: 1; background: transparent; color: var(--muted); padding: 8px; }
  .tabs button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
  .layout.tab-tracked .main > :not(.search):not(.tabs),
  .layout.tab-history .main > :not(.search):not(.tabs) { display: none !important; }
  .layout.tab-tracked, .layout.tab-history { display: flex; flex-direction: column; }
  .layout.tab-tracked .side, .layout.tab-history .side { display: flex; order: 2; align-self: stretch; width: 100%; }
  .layout.tab-tracked .side > section:last-child, .layout.tab-history .side > section:first-child { display: none; }
}
@media (max-width: 760px) {
  .top { padding: 10px 16px; }
  .sub { display: none; }
  .search { padding: 16px; }
  .search-title h1 { font-size: 18px; }
  .search-title p { display: none; }
  .f { flex: 1 1 40%; }
  .f input { width: 100%; }
  .f.num { flex: 1 1 20%; }
  .f.num input { width: 100%; }
  #go { flex: 1 1 100%; }
  .welcome { grid-template-columns: 1fr; }
  .tools input[type=search] { width: 100%; }
  .tool-group { width: 100%; }
  #copy { flex: 1; }
  .item .x { opacity: 1; }
}
@media (hover: none) {
  .item:has(.x) { padding-right: 34px; }
  .item .x { opacity: 1; top: 50%; transform: translateY(-50%); }
}
