:root {
  --navy: #0b1f3a;
  --navy-light: #142d52;
  --accent: #2e6bd6;
  --green: #1a8f4c;
  --red: #c23b3b;
  --gray: #6b7280;
  --border: #e2e5ea;
  --bg: #f6f7f9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: #1c1f26;
}

header.site-header {
  background: var(--navy);
  color: #fff;
  padding: 20px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

header.site-header .brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

header.site-header .brand h1 {
  font-size: 1.3rem;
  margin: 0;
  letter-spacing: 0.5px;
}

header.site-header .brand span {
  color: #9db4dd;
  font-size: 0.85rem;
}

nav.site-nav a {
  color: #cfdcf5;
  text-decoration: none;
  margin-left: 20px;
  font-size: 0.9rem;
  font-weight: 500;
}

nav.site-nav a:hover,
nav.site-nav a.active {
  color: #fff;
  text-decoration: underline;
}

main {
  max-width: 880px;
  margin: 32px auto;
  padding: 0 20px 60px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 18px;
}

.status-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.available { background: var(--green); }
.status-dot.booked { background: var(--red); }
.status-dot.unknown { background: var(--gray); }

.status-text h2 {
  margin: 0 0 4px;
  font-size: 1.4rem;
}

.status-text p {
  margin: 0;
  color: var(--gray);
  font-size: 0.9rem;
}

h3.section-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray);
  margin: 0 0 14px;
}

.booking-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.booking-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.booking-list li:last-child { border-bottom: none; }

.booking-list .dates { font-weight: 600; }
.booking-list .source { color: var(--gray); font-size: 0.85rem; }

.empty-state {
  color: var(--gray);
  font-size: 0.9rem;
  padding: 8px 0;
}

.footer-note {
  color: var(--gray);
  font-size: 0.85rem;
  margin-top: 24px;
  line-height: 1.5;
}

/* Dashboard */
#gate {
  max-width: 360px;
  margin: 80px auto;
  text-align: center;
}

#gate input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  margin: 14px 0;
}

#gate button,
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
}

#gate button:hover, .btn:hover { opacity: 0.9; }

#gate .error {
  color: var(--red);
  font-size: 0.85rem;
  min-height: 18px;
}

.ratio-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.ratio-pill {
  flex: 1;
  min-width: 180px;
  background: var(--bg);
  border-radius: 8px;
  padding: 14px 16px;
}

.ratio-pill .pct {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
}

.ratio-pill .who {
  font-size: 0.85rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table.breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.breakdown th, table.breakdown td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}

table.breakdown th { color: var(--gray); font-weight: 600; }
table.breakdown td.num, table.breakdown th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.breakdown tr.total td { font-weight: 700; border-top: 2px solid var(--navy); }

.net-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.net-card {
  flex: 1;
  min-width: 200px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.net-card .amount {
  font-size: 1.5rem;
  font-weight: 700;
}

.net-card .label {
  color: var(--gray);
  font-size: 0.85rem;
  text-transform: uppercase;
}

/* Calendar grid */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.calendar-month-label {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.cal-nav-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--navy);
}

.cal-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.cal-nav-btn:hover:not(:disabled) {
  background: #eceef2;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-weekday {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 6px;
}

.cal-day {
  min-height: 64px;
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
}

.cal-day:not(.empty):hover {
  filter: brightness(0.97);
}

.cal-day.selected {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  background: #e8f0fd;
}

.cal-day.empty {
  background: transparent;
  border: none;
}

.cal-day.free {
  background: #f0f9f3;
  border-color: #d6ecdc;
}

.cal-day.busy {
  background: #fdf1f0;
  border-color: #f6d9d6;
}

/* "Today" gets a small corner dot, not a border, so it's never confused
   with the much stronger blue outline used for the clicked/selected day. */
.cal-day.today {
  position: relative;
}

.cal-day.today::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-day-num {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1c1f26;
}

.cal-day-label {
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--red);
}

.calendar-legend {
  display: flex;
  gap: 20px;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--gray);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

.legend-dot.busy { background: #f6d9d6; border: 1px solid #e8b9b4; }
.legend-dot.free { background: #d6ecdc; border: 1px solid #b9dcc2; }

@media (max-width: 560px) {
  .cal-day { min-height: 46px; padding: 4px 5px; }
  .cal-day-label { font-size: 0.62rem; }
}

/* Chart controls */
.chart-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.layer-check {
  display: flex;
  align-items: center;
  gap: 6px;
}

.layer-check input[type="checkbox"] {
  margin: 0;
}

.swatch {
  display: inline-block;
  width: 22px;
  height: 4px;
  border-radius: 2px;
}

.swatch-total { background: #0b1f3a; }
.swatch-alok { background: #2e6bd6; }
.swatch-ron { background: #1a8f4c; }

/* Fixed-height wrapper so Chart.js's responsive resizing has a stable
   container to measure against -- without this, switching chart types
   (line/bar/stacked) can trigger a runaway canvas growth feedback loop. */
.chart-wrap {
  position: relative;
  height: 320px;
  width: 100%;
}

.chart-wrap canvas {
  max-width: 100%;
}

@media (max-width: 560px) {
  .chart-wrap { height: 260px; }
}

.layer-check {
  font-size: 0.88rem;
  color: #1c1f26;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.chart-controls select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  background: #fff;
}

/* Dashboard tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
}

.tab-btn:hover {
  color: var(--navy);
}

.tab-btn.active {
  color: var(--navy);
  border-bottom-color: var(--accent);
}
