/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
  --ned-green:      #1a4731;
  --ned-green-mid:  #235c40;
  --ned-green-lite: #2e7a56;
  --ned-gold:       #c9a84c;
  --ned-gold-lite:  #e8c97a;

  --bg:             #f5f5f3;
  --surface:        #ffffff;
  --surface-raised: #ffffff;
  --border:         #dddbd6;
  --border-lite:    #eceae5;

  --text-primary:   #1a1a18;
  --text-muted:     #6b6860;
  --text-on-dark:   #ffffff;

  --ly-bg:          #fdf4e7;
  --ly-col:         #7a4a00;
  --budget-bg:      #f0f7f2;
  --budget-col:     #2c6e4a;
  --fc-bg:          #f0f4fc;
  --fc-col:         #2c4a8a;

  --success:        #196b38;
  --warning:        #875a00;
  --error:          #8b1e1e;
  --info:           #1a4062;

  --sidebar-w:      220px;
  --topbar-h:       64px;
  --strip-h:        84px;
  --radius:         8px;
  --radius-sm:      4px;
  --shadow:         0 1px 4px rgba(0,0,0,.08);
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, textarea { font-family: inherit; }

/* ── App Shell ──────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--ned-green);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ned-gold-lite);
}
.brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,.55);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.side-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: rgba(255,255,255,.75);
  transition: background .15s, color .15s;
}
.nav-item svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.15); color: var(--ned-gold-lite); }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: 11px;
}
.api-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.65);
  margin-bottom: 4px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot--checking { background: var(--ned-gold);  animation: pulse 1.2s infinite; }
.dot--ok        { background: #4caf7d; }
.dot--err       { background: #e05c5c; }
@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:.35 } }

.total-rooms { color: rgba(255,255,255,.4); font-size: 10px; }

/* ── Main ───────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}
.topbar-left h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--ned-green);
}
.page-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.topbar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ctrl-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.ctrl-input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
}
.ctrl-input:focus { border-color: var(--ned-green-lite); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: opacity .15s, background .15s;
}
.btn svg { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--ned-green);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--ned-green-mid); }

.btn-success {
  background: #196b38;
  color: #fff;
}
.btn-success:hover:not(:disabled) { background: #14532a; }

.btn-ly {
  background: #7a4a00;
  color: #fff;
}
.btn-ly:hover:not(:disabled) { background: #5e3800; }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-outline:hover:not(:disabled) { background: var(--bg); }

/* ── KPI Strip ──────────────────────────────────────────────────────────── */
.kpi-strip {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kpi-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  border-right: 1px solid var(--border-lite);
}
.kpi-card:last-child { border-right: none; }
.kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--ned-green);
  letter-spacing: -.01em;
}

/* KPI actual-highlight cards */
.kpi-card--actual {
  border-top: 3px solid var(--ned-green-lite);
}
.kpi-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Notice bar ─────────────────────────────────────────────────────────── */
.notice-bar {
  padding: 10px 24px;
  font-size: 13px;
  flex-shrink: 0;
}
.notice-info    { background: #e8f0fb; color: var(--info);    border-bottom: 1px solid #c4d7f0; }
.notice-success { background: #e8f5ec; color: var(--success); border-bottom: 1px solid #b3dcc2; }
.notice-warning { background: #fff8e1; color: var(--warning); border-bottom: 1px solid #fce49a; }
.notice-error   { background: #fdeaea; color: var(--error);   border-bottom: 1px solid #f5b8b8; }

/* ── Views ──────────────────────────────────────────────────────────────── */
.view { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.view.active { display: flex; }

/* ── Table wrapper ──────────────────────────────────────────────────────── */
.table-wrap {
  flex: 1;
  overflow: auto;
  padding: 0;
}

/* ── Data grid ──────────────────────────────────────────────────────────── */
.grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.grid-table thead th {
  background: var(--ned-green);
  color: var(--text-on-dark);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 8px 10px;
  text-align: right;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.08);
  position: sticky;
  top: 0;
  z-index: 2;
}
.grid-table thead th.col-date { text-align: left; }
.grid-table thead th.col-sep  { width: 6px; background: var(--ned-green-mid); border: none; }

/* Column colour bands in header */
.grid-table thead th.col-ly     { background: #8a5a00; }
.grid-table thead th.col-budget { background: var(--budget-col); }
.grid-table thead th.col-fc     { background: var(--fc-col); }

/* Sticky first column */
.sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: inherit;
}
.grid-table thead .sticky-col { z-index: 3; }

.grid-table tbody tr {
  border-bottom: 1px solid var(--border-lite);
  transition: background .1s;
}
.grid-table tbody tr:hover { background: #f0ede8; }
.grid-table tbody tr.weekend { background: #f9f7f2; }
.grid-table tbody tr.weekend:hover { background: #f0ede8; }
.grid-table tbody tr.today { background: #fff8e1; }
.grid-table tbody tr.today .date-num { color: var(--ned-green); font-weight: 700; }
.grid-table tbody tr.no-data { opacity: .6; }

.grid-table tbody td {
  padding: 7px 10px;
  border-right: 1px solid var(--border-lite);
  white-space: nowrap;
}
.grid-table tbody .sticky-col { background: var(--surface); border-right: 1px solid var(--border); }
.grid-table tbody tr.weekend .sticky-col { background: #f9f7f2; }
.grid-table tbody tr.today .sticky-col   { background: #fff8e1; }

.col-date  { min-width: 70px; }
.col-day   { min-width: 36px; text-align: center; color: var(--text-muted); }
.col-num   { text-align: right; }
.col-sep   { width: 6px; background: var(--border-lite); padding: 0 !important; border: none; }
.col-ly    { background: var(--ly-bg);     color: var(--ly-col); }
.col-budget{ background: var(--budget-bg); color: var(--budget-col); }
.col-fc    { background: var(--fc-bg);     color: var(--fc-col); }

.date-num  { font-weight: 600; }

/* Occupancy colouring */
.occ-high  { color: #196b38; font-weight: 600; }
.occ-mid   { color: #875a00; }
.occ-low   { color: #8b1e1e; }

/* Grid legend strip */
.grid-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-lite);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-item::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-actual::before { background: var(--ned-green); }
.legend-pace::before   { background: var(--border); border: 1px dashed var(--text-muted); }

/* Pace rows — future dates sourced from reservations, not stat */
.grid-table tbody tr.pace-row { opacity: .82; }
.grid-table tbody tr.pace-row .col-num:not(.col-ly):not(.col-budget):not(.col-fc) {
  color: var(--text-muted);
}
/* Occupancy on a pace (future reservation) row — muted italic to distinguish from actuals */
.occ-pace  { color: var(--text-muted); font-style: italic; font-size: 11.5px; }

/* Variance indicators */
.var-pos { color: #196b38; font-size: 10px; }
.var-neg { color: #8b1e1e; font-size: 10px; }

/* Footer totals */
.totals-row td {
  background: var(--ned-green) !important;
  color: var(--text-on-dark) !important;
  padding: 8px 10px;
  position: sticky;
  bottom: 0;
  font-size: 12px;
}
.totals-row .sticky-col { z-index: 2; }

/* Placeholder */
.placeholder {
  text-align: center;
  padding: 40px 20px !important;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Budget entry table ──────────────────────────────────────────────────── */
.budget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-shrink: 0;
}
.hint {
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 520px;
}
.budget-actions { display: flex; gap: 8px; flex-shrink: 0; }

.col-ly-auto { background: #f7ece0; }
.auto-val {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--ly-col);
  opacity: .75;
  font-style: italic;
}

.entry-table .cell-input {
  width: 82px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 12px;
  text-align: right;
  background: transparent;
  outline: none;
  transition: border-color .15s, background .15s;
}
.entry-table .col-ly     .cell-input { background: var(--ly-bg); }
.entry-table .col-budget .cell-input { background: var(--budget-bg); }
.entry-table .col-fc     .cell-input { background: var(--fc-bg); }
.entry-table .cell-input:focus {
  border-color: var(--ned-green-lite);
  background: #fff;
}

/* ── Loading overlay ────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  gap: 14px;
  font-size: 14px;
  color: var(--ned-green);
  backdrop-filter: blur(2px);
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--ned-green);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Weekly & Pace views — scrollable column layout ────────────────────── */
#view-weekly,
#view-pace {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 32px;
  gap: 28px;
}
#view-weekly .table-wrap,
#view-pace   .table-wrap {
  flex: none;
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.chart-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.chart-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ned-green);
  margin-bottom: 4px;
}
.chart-section .hint {
  margin-bottom: 10px;
}
.chart-wrap {
  position: relative;
  height: 240px;
}

/* ── Scrollbar styling ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #bbb9b4; }

/* ── Compare toggle ────────────────────────────────────────────────────── */
.compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  user-select: none;
}
.compare-toggle input { display: none; }
.compare-toggle-pill {
  width: 32px; height: 17px;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.compare-toggle-pill::after {
  content: "";
  width: 13px; height: 13px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px; left: 2px;
  transition: transform .2s;
}
.compare-toggle input:checked + .compare-toggle-pill { background: var(--ned-green); }
.compare-toggle input:checked + .compare-toggle-pill::after { transform: translateX(15px); }

/* ── Comparison tooltip ────────────────────────────────────────────────── */
.cmp-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--ned-green);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  padding: 0;
  min-width: 220px;
  pointer-events: none;
  font-size: 12px;
}
.cmp-header {
  background: var(--ned-green);
  color: #fff;
  padding: 6px 12px;
  border-radius: 7px 7px 0 0;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .04em;
}
.cmp-table {
  width: 100%;
  border-collapse: collapse;
  padding: 6px 0;
}
.cmp-table td {
  padding: 4px 12px;
  border: none;
  white-space: nowrap;
}
.cmp-table tr.cmp-otb td { font-weight: 700; color: var(--ned-green); background: rgba(26,71,49,.06); }
.cmp-table .cmp-label { color: var(--text-muted); font-size: 11px; }
.cmp-table .cmp-val { text-align: right; font-variant-numeric: tabular-nums; }
.cmp-table .cmp-delta { text-align: right; font-size: 10px; }

/* Hoverable OTB cell highlight */
.compare-on .can-compare:hover {
  background: rgba(26,71,49,.12) !important;
  cursor: crosshair;
}

/* ── Segment view ──────────────────────────────────────────────────────── */
#view-segments.active {
  overflow-y: auto;
  padding: 20px 24px 32px;
  gap: 24px;
  display: flex;
  flex-direction: column;
}
.seg-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.seg-kpis {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.seg-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 150px;
}
.seg-kpi--trans { border-top: 3px solid var(--ned-green); }
.seg-kpi--grp   { border-top: 3px solid var(--gold); }
.seg-kpi-label  { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.seg-kpi-value  { font-size: 20px; font-weight: 700; color: var(--text); margin: 2px 0; }
.seg-kpi-sub    { font-size: 11px; color: var(--text-muted); }

th.seg-trans, td.seg-trans { color: var(--ned-green); }
th.seg-grp,   td.seg-grp   { color: #7a6000; }
.seg-mix-pct { font-size: 10px; color: var(--text-muted); }

/* ── Chart series toggle pills ────────────────────────────────────────── */
.chart-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0 2px;
}
.series-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 8px;
  border-radius: 20px;
  border: 1.5px solid var(--s-color, #888);
  background: #fff;
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s, background .15s, text-decoration .1s;
  line-height: 1.2;
  font-family: inherit;
}
/* Colour swatch dot */
.series-btn::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--s-color, #888);
  flex-shrink: 0;
}
.series-btn:hover {
  background: color-mix(in srgb, var(--s-color, #888) 10%, white);
}
/* Inactive / toggled-off state */
.series-btn.series-off {
  opacity: .42;
  background: transparent;
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
}

/* ── Projected revenue note (footer only) ─────────────────────────────── */
/* Cells render projected OTB values as plain numbers — the pace-row        */
/* row background already distinguishes future dates from closed actuals.   */
.proj-note {
  font-style: italic;
  color: var(--text-muted);
  font-size: 10px;
}

/* ── Export modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal-box {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  padding: 28px 32px 24px;
  width: 380px;
  max-width: 95vw;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ned-green);
}
.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--bg); }
.export-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0 24px;
}
.export-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-lite);
  transition: background .12s;
}
.export-options label:hover { background: var(--bg); }
.export-options input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--ned-green);
  flex-shrink: 0;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-export {
  background: var(--ned-green);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-export:hover { background: var(--ned-green-mid); }
.btn-export svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
