/* ============================================================
   PriceMeter — Ballito Revenue Console
   Navy / gold brand, high-contrast health signalling
   ============================================================ */
:root {
  --navy: #0d2240;
  --navy-2: #16345e;
  --navy-3: #1f4278;
  --gold: #d9a441;
  --gold-soft: #f7ecd7;
  --green: #147a45;
  --green-soft: #e4f5ec;
  --amber: #b06a10;
  --amber-soft: #fdf1de;
  --red: #c0392b;
  --red-soft: #fdeae7;
  --ink: #17222e;
  --ink-2: #51606f;
  --ink-3: #8a97a5;
  --bg: #eef1f6;
  --card: #ffffff;
  --line: #dde4ee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(13, 34, 64, .06), 0 8px 24px -12px rgba(13, 34, 64, .18);
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
.topbar {
  background: linear-gradient(115deg, var(--navy) 0%, var(--navy-2) 62%, var(--navy-3) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 28px;
  min-height: 62px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 2px 14px rgba(13, 34, 64, .35);
}

.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark { width: 30px; height: 30px; align-self: center; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: .3px; }
.brand-name em { font-style: normal; color: var(--gold); }
.brand-sub { font-size: 11.5px; color: rgba(255,255,255,.62); font-weight: 500; letter-spacing: .4px; text-transform: uppercase; }

.tabs { display: flex; gap: 4px; margin-left: 8px; align-self: stretch; align-items: stretch; }
.tabs a {
  display: flex; align-items: center; padding: 0 16px;
  color: rgba(255,255,255,.75); text-decoration: none; font-weight: 600; font-size: 13.5px;
  border-bottom: 3px solid transparent; border-top: 3px solid transparent;
  transition: color .15s, border-color .15s;
}
.tabs a:hover { color: #fff; }
.tabs a.active { color: #fff; border-bottom-color: var(--gold); }

.top-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; padding: 10px 0; }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 9px; padding: 9px 16px; font-weight: 700; font-size: 13px;
  cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 7px;
  transition: transform .08s, box-shadow .15s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-gold { background: var(--gold); color: var(--navy); box-shadow: 0 2px 10px -2px rgba(217,164,65,.55); }
.btn-gold:hover:not(:disabled) { background: #e4b356; }
.btn-ghost { background: rgba(255,255,255,.10); color: #fff; border: 1px solid rgba(255,255,255,.28); }
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.btn-navy { background: var(--navy-2); color: #fff; }
.btn-navy:hover:not(:disabled) { background: var(--navy-3); }

/* ---------- layout ---------- */
.view { flex: 1; width: 100%; max-width: 1420px; margin: 0 auto; padding: 26px 28px 40px; }

.foot {
  text-align: center; color: var(--ink-3); font-size: 12px; padding: 16px 24px 22px;
}

/* ---------- hero ---------- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.hero h2 { margin: 0 0 4px; font-size: 24px; font-weight: 800; letter-spacing: -.2px; color: var(--navy); }
.hero .sub { color: var(--ink-2); font-size: 13.5px; }
.hero .sub strong { color: var(--ink); }
.hero-controls { display: flex; gap: 10px; align-items: center; }

.seg { display: flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.seg button {
  background: transparent; border: 0; padding: 8px 15px; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: 13px; color: var(--ink-2);
}
.seg button.active { background: var(--navy); color: #fff; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-bottom: 26px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 18px 20px 16px;
  box-shadow: var(--shadow); border-top: 4px solid var(--navy); position: relative; overflow: hidden;
}
.stat.gold  { border-top-color: var(--gold); }
.stat.green { border-top-color: var(--green); }
.stat.red   { border-top-color: var(--red); }
.stat .label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-3); }
.stat .value { font-size: clamp(19px, 1.55vw, 26px); font-weight: 800; letter-spacing: -.4px; margin: 6px 0 2px; color: var(--navy); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat.red .value { color: var(--red); }
.stat.green .value { color: var(--green); }
.stat .hint { font-size: 12px; color: var(--ink-2); }
.stat .meter { height: 6px; border-radius: 4px; background: #e6ebf3; margin-top: 10px; overflow: hidden; }
.stat .meter i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--navy-2), var(--gold)); }

/* ---------- panels & tables ---------- */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h3 { margin: 0; font-size: 15.5px; font-weight: 800; color: var(--navy); display: flex; align-items: center; gap: 9px; }
.panel-head .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.panel-head .desc { color: var(--ink-2); font-size: 12.5px; }
.panel-head .spacer { margin-left: auto; }
.panel.green-edge { border-left: 5px solid var(--green); }
.panel.red-edge   { border-left: 5px solid var(--red); }
.panel.gold-edge  { border-left: 5px solid var(--gold); }

.count-badge {
  font-size: 12px; font-weight: 800; border-radius: 20px; padding: 2px 10px;
  background: var(--navy); color: #fff;
}
.count-badge.green { background: var(--green); }
.count-badge.red { background: var(--red); }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13.5px; white-space: nowrap; }
td.wrap { white-space: normal; min-width: 200px; }
th {
  background: #f7f9fc; color: var(--ink-2); font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px; position: sticky; top: 0;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f4f7fc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.strong { font-weight: 700; }

/* health / band pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-good  { background: var(--green-soft); color: var(--green); }
.pill-under { background: var(--amber-soft); color: var(--amber); }
.pill-over  { background: var(--red-soft); color: var(--red); }

.band { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; color: #fff; }
.band-DecemberPeak { background: var(--red); }
.band-WinterPeak { background: var(--amber); }
.band-LowSeason { background: #4a6785; }
.band-Weekend { background: var(--navy-2); }
.band-Standard { background: #6b7a8c; }

/* occupancy bar cell */
.occ { display: flex; align-items: center; gap: 9px; min-width: 130px; }
.occ .bar { flex: 1; height: 7px; background: #e6ebf3; border-radius: 4px; overflow: hidden; }
.occ .bar i { display: block; height: 100%; border-radius: 4px; }
.occ .pct { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 12.5px; width: 46px; text-align: right; }
.occ-high i { background: var(--green); }
.occ-mid  i { background: var(--gold); }
.occ-low  i { background: var(--red); }

.var-up { color: var(--green); font-weight: 700; }
.var-down { color: var(--red); font-weight: 700; }

.gap-chip { display: inline-block; min-width: 26px; text-align: center; padding: 2px 8px; border-radius: 8px; font-weight: 800; font-size: 12.5px; }
.gap-warn { background: var(--red-soft); color: var(--red); }
.gap-ok { color: var(--ink-3); }

/* ---------- states ---------- */
.empty {
  padding: 46px 24px; text-align: center; color: var(--ink-2);
}
.empty h4 { margin: 0 0 6px; font-size: 16px; color: var(--navy); }
.empty .btn { margin-top: 14px; }

.skeleton { padding: 18px 20px; }
.skeleton .sk-row {
  height: 15px; border-radius: 6px; margin: 13px 0;
  background: linear-gradient(90deg, #e8edf4 25%, #f4f7fb 45%, #e8edf4 65%);
  background-size: 300% 100%; animation: shimmer 1.15s infinite linear;
}
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -80% 0; } }

.error-banner {
  background: var(--red-soft); border: 1px solid #f2c4bc; color: var(--red);
  border-radius: 10px; padding: 12px 16px; font-weight: 600; margin-bottom: 18px;
}

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--navy); color: #fff; padding: 11px 20px; border-radius: 10px;
  font-weight: 600; font-size: 13.5px; box-shadow: 0 8px 30px -6px rgba(13,34,64,.5);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }

/* ---------- variance / approvals extras ---------- */
.meta-line { display: flex; gap: 16px; align-items: center; color: var(--ink-2); font-size: 13px; padding: 0 2px 12px; flex-wrap: wrap; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--navy-2); cursor: pointer; }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- calendar view ---------- */
.cal-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.cal-select-wrap { position: relative; }
.cal-select {
  appearance: none; -webkit-appearance: none;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2351606f' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 11px center;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 34px 8px 13px; font-family: var(--font); font-size: 13.5px; font-weight: 600;
  color: var(--ink); cursor: pointer; min-width: 220px; max-width: 340px;
  box-shadow: var(--shadow);
}
.cal-select:focus { outline: 2px solid var(--navy-2); outline-offset: 2px; }

.cal-summary {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px;
}
.cal-sum-chip {
  background: var(--card); border-radius: 10px; padding: 10px 16px;
  box-shadow: var(--shadow); border-top: 3px solid var(--navy);
  font-size: 13px; min-width: 130px;
}
.cal-sum-chip.gold   { border-top-color: var(--gold); }
.cal-sum-chip.green  { border-top-color: var(--green); }
.cal-sum-chip.red    { border-top-color: var(--red); }
.cal-sum-chip.amber  { border-top-color: var(--amber); }
.cal-sum-chip .cs-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--ink-3); margin-bottom: 3px; }
.cal-sum-chip .cs-val   { font-size: 20px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.cal-sum-chip.red .cs-val { color: var(--red); }
.cal-sum-chip.green .cs-val { color: var(--green); }

.cal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 20px; }
.cal-month { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cal-month-head {
  background: var(--navy); color: #fff; padding: 10px 14px;
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
}
.cal-week-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: #f7f9fc; border-bottom: 1px solid var(--line);
}
.cal-dow {
  text-align: center; padding: 5px 2px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-3);
}
.cal-days {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--line);
}
.cal-day {
  min-height: 52px; padding: 4px 5px 3px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-size: 11px; position: relative; vertical-align: top;
  display: flex; flex-direction: column; gap: 1px;
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.cal-empty { background: #f9fafc; }
.cal-day .cd-num {
  font-size: 10.5px; font-weight: 700; color: var(--ink-3); line-height: 1;
}
.cal-day .cd-price {
  font-size: 10px; font-weight: 600; color: var(--ink-2);
  font-variant-numeric: tabular-nums; line-height: 1.1;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

/* booked night */
.cal-day.cal-booked { background: var(--navy); }
.cal-day.cal-booked .cd-num  { color: rgba(255,255,255,.65); }
.cal-day.cal-booked .cd-price { color: rgba(255,255,255,.75); }

/* orphan gap */
.cal-day.cal-orphan { outline: 2px solid var(--red); outline-offset: -2px; background: var(--red-soft); }
.cal-day.cal-orphan .cd-num { color: var(--red); }
.cal-day.cal-orphan .cd-price { color: var(--red); }
.cal-day .cd-gap-marker {
  font-size: 9px; font-weight: 800; color: var(--red);
  background: rgba(192,57,43,.12); border-radius: 3px;
  padding: 0 3px; line-height: 1.4; align-self: flex-start;
}

/* clamped */
.cal-day .cd-clamped {
  font-size: 9px; font-weight: 800; color: var(--gold);
  line-height: 1; align-self: flex-start;
}

/* min-stay badge */
.cal-day .cd-minstay {
  font-size: 9px; font-weight: 800;
  background: var(--navy-2); color: #fff;
  border-radius: 4px; padding: 0 3px; line-height: 1.4; align-self: flex-start;
}

/* today highlight */
.cal-day.cal-today .cd-num {
  background: var(--gold); color: var(--navy);
  border-radius: 50%; width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
}
.cal-day.cal-booked.cal-today .cd-num { background: var(--gold); color: var(--navy); }

.cal-legend {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  background: var(--card); border-radius: 10px; padding: 10px 16px;
  box-shadow: var(--shadow); margin-bottom: 12px; font-size: 12px;
}
.cal-legend-title { font-weight: 700; color: var(--ink-2); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; margin-right: 4px; }
.cal-leg { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 500; }
.cal-leg-swatch {
  width: 14px; height: 14px; border-radius: 3px; flex: 0 0 auto;
}
.cl-booked   { background: var(--navy); }
.cl-orphan   { background: var(--red-soft); outline: 2px solid var(--red); outline-offset: -2px; }
.cl-clamped  { background: var(--gold-soft); }
.cl-minstay  { background: var(--navy-2); border-radius: 3px; }

/* ---------- write-back section ---------- */
.wb-status-strip {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 12px 20px; background: #f7f9fc; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
}
.wb-status-strip strong { color: var(--ink); }
.wb-explainer {
  padding: 28px 20px; color: var(--ink-2); font-size: 13.5px;
}
.wb-skipped-head {
  padding: 10px 20px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--ink-3); border-top: 1px solid var(--line);
}
.wb-skipped-row {
  display: flex; gap: 12px; align-items: baseline;
  padding: 5px 20px; font-size: 13px; border-bottom: 1px solid var(--line);
}
.wb-skipped-row:last-child { border-bottom: 0; }
.wb-cmd-caption {
  padding: 12px 20px 4px; font-size: 12px; font-weight: 600; color: var(--ink-3);
}
.cmd-block {
  margin: 0 20px 16px; background: var(--navy); color: #c9d8e8;
  border-radius: 8px; padding: 12px 16px; font-family: "Consolas", "Cascadia Code", "Fira Code", monospace;
  font-size: 12.5px; line-height: 1.65; overflow-x: auto; white-space: pre;
  cursor: pointer; position: relative; border: 1px solid var(--navy-3);
}
.cmd-block:hover::after {
  content: "Click to copy"; position: absolute; top: 8px; right: 12px;
  font-family: var(--font); font-size: 11px; font-weight: 600;
  background: var(--navy-3); color: rgba(255,255,255,.75);
  padding: 2px 8px; border-radius: 6px;
}
.pill-enabled  { background: var(--green-soft); color: var(--green); display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.pill-disabled { background: var(--red-soft);   color: var(--red);   display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }

/* ---------- channel variance grid ---------- */
.cv-toggle {
  display: flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink-2);
}
.cv-toggle input { cursor: pointer; }
.cv-cell { min-width: 130px; }
.cv-var { font-weight: 800; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.cv-vals { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; margin-top: 3px; }
.thumb-up { color: var(--green); }
.thumb-down { color: var(--red); }
.cv-legend {
  padding: 10px 20px 14px; font-size: 12px; color: var(--ink-3);
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
}
.cv-season { min-width: 170px; }

/* ---------- market & demand intelligence ---------- */
.intel-edge {
  align-self: center; background: var(--gold-soft); color: var(--amber);
  border: 1px solid #ecd6a8; border-radius: 999px; padding: 7px 14px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.stats.intel-stats { grid-template-columns: repeat(4, 1fr); }
.intel-two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.intel-two .panel { margin-bottom: 24px; }

.chart-wrap { padding: 10px 20px 16px; }
svg.chart { width: 100%; height: auto; display: block; }
.chart-legend {
  display: flex; gap: 20px; flex-wrap: wrap; align-items: center;
  font-size: 12.5px; color: var(--ink-2); padding: 8px 4px 0;
}
.lg-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }

.lt-chart { padding: 14px 20px 20px; }
.lt-row { display: grid; grid-template-columns: 116px 1fr 128px; align-items: center; gap: 14px; padding: 7px 0; }
.lt-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.lt-bar { background: var(--bg); border-radius: 6px; height: 18px; overflow: hidden; }
.lt-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #1e9e63); border-radius: 6px; }
.lt-val { font-size: 12.5px; text-align: right; color: var(--ink); font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 1300px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats.intel-stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1080px) {
  .intel-two { grid-template-columns: 1fr; }
  .stats.intel-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cal-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .topbar { padding: 0 16px; gap: 12px; }
  .brand-sub { display: none; }
  .view { padding: 18px 14px 32px; }
  .stats { grid-template-columns: 1fr; }
  .cal-grid { grid-template-columns: 1fr; }
}
