/* ===== Meridian — Global Holiday Calendar ===== */

:root {
  --bg: #ebe9e2;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #1a1a17;
  --ink-2: #3f3e39;
  --muted: #8a8780;
  --muted-2: #bab6ac;
  --line: #e6e3d9;
  --line-2: #efece3;
  --accent: #c15a3a;
  --accent-soft: #f5e7df;
  --accent-ink: #a04225;
  --clean: #3a6b37;
  --clean-bg: #eef4ec;
  --clean-line: #d4e3d2;
  --weekend: #f3f1e9;
  --font-sans: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body, #root { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}
#root { padding: 14px; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
input { font-family: inherit; }

/* ===== App shell ===== */
.app {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 680px;
}

.app-header {
  display: grid;
  grid-template-columns: 240px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  min-height: 56px;
}

.app-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-logo {
  width: 30px; height: 30px;
  background: var(--ink);
  color: var(--surface);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.app-brand-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; }
.app-brand-sub {
  font-size: 9.5px;
  color: var(--muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.app-controls { display: flex; justify-content: center; }

.seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.seg-btn {
  padding: 5px 12px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 4px;
  font-weight: 500;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.app-header-right { text-align: right; min-width: 0; }
.app-today-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.app-today-date { font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; }

.app-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px 1fr 300px;
}

.app-sidebar {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  min-width: 0;
}
.app-main {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
}
.app-rail {
  border-left: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  min-width: 0;
}

/* ===== Region picker ===== */
.rp { padding: 14px 12px; }
.rp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.rp-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.rp-count { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.rp-search {
  position: relative;
  margin-bottom: 10px;
}
.rp-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: flex;
}
.rp-search input {
  display: block;
  width: 100%;
  padding: 7px 26px 7px 28px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 5px;
  font-size: 12px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.12s, background 0.12s;
}
.rp-search input:focus { border-color: var(--ink-2); background: var(--surface); }
.rp-search input::placeholder { color: var(--muted-2); }
.rp-clear-search {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  border-radius: 3px;
}
.rp-clear-search:hover { background: var(--line-2); color: var(--ink); }

.rp-bulk {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.rp-bulk-btn {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  transition: all 0.12s;
}
.rp-bulk-btn:hover:not(:disabled) {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.rp-bulk-btn:disabled {
  color: var(--muted-2);
  cursor: not-allowed;
  background: var(--surface-2);
}

.rp-empty {
  padding: 20px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.rp-group { margin-bottom: 12px; }
.rp-group-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rp-group-meta {
  color: var(--muted);
  opacity: 0.7;
  font-weight: 500;
}
.rp-group-toggle {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.rp-group-toggle:hover {
  background: rgba(0,0,0,0.05);
  color: var(--fg);
  border-color: rgba(0,0,0,0.25);
}
.rp-items { display: flex; flex-direction: column; gap: 1px; }
.rp-item {
  position: relative;
  cursor: pointer;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background 0.1s;
  border: 1px solid transparent;
  min-height: 36px;
}
.rp-item:hover { background: var(--surface-2); }
.rp-item.is-on {
  background: var(--accent-soft);
  border-color: rgba(193,90,58,0.18);
}
.rp-flag { font-size: 16px; line-height: 1; }
.rp-text { min-width: 0; }
.rp-name {
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}
.rp-src {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  font-size: 10px;
  line-height: 1;
  color: var(--muted-2);
  text-decoration: none;
  opacity: 0;
  transition: opacity 120ms, background 120ms, color 120ms;
}
.rp-item:hover .rp-src,
.rp-item.is-on .rp-src { opacity: 0.6; }
.rp-src:hover {
  opacity: 1 !important;
  background: rgba(0,0,0,0.06);
  color: var(--accent);
}
.rp-meta {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
  margin-top: 1px;
}
.rp-check {
  font-size: 11px;
  color: var(--muted-2);
  transition: opacity 0.1s;
}
.rp-item.is-on .rp-check { color: var(--accent); }
.rp-solo {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 3px 7px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--surface);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s, all 0.12s;
}
.rp-item:hover .rp-solo { opacity: 1; pointer-events: auto; }
.rp-item:hover .rp-check { opacity: 0; }
.rp-solo:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ===== Date nav ===== */
.datenav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}
.datenav-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  padding: 0;
  flex-shrink: 0;
}
.datenav-btn:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.datenav-today {
  height: 28px;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-2);
  margin: 0 4px;
  transition: all 0.12s;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}
.datenav-today:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.datenav { position: relative; }
.datenav-range {
  margin-left: 12px;
  padding: 5px 10px 5px 14px;
  border: 1px solid transparent;
  border-left: 1px solid var(--line);
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
  background: transparent;
}
.datenav-range:hover { background: var(--surface-2); border-color: var(--line); }
.datenav-range.is-custom { background: var(--accent-soft); border-color: rgba(193,90,58,0.25); color: var(--accent-ink); }
.datenav-range-text { overflow: hidden; text-overflow: ellipsis; }
.datenav-range-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  padding: 1px 5px;
  background: var(--surface-2);
  border-radius: 3px;
}
.datenav-range.is-custom .datenav-range-meta { background: rgba(193,90,58,0.15); color: var(--accent-ink); }
.datenav-range-edit { font-size: 10px; opacity: 0.4; }
.datenav-range:hover .datenav-range-edit { opacity: 0.9; }
.datenav-clear {
  width: 22px; height: 22px;
  margin-left: 4px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.datenav-clear:hover { background: var(--surface-2); color: var(--ink); }

/* ===== Data range banner (out-of-range / coming soon) ===== */
.drb {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: var(--accent-soft);
  border-bottom: 1px solid rgba(193,90,58,0.18);
  color: var(--accent-ink);
  flex-shrink: 0;
}
.drb-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(193,90,58,0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.drb-text { flex: 1; min-width: 0; }
.drb-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.25;
}
.drb-message {
  font-size: 11.5px;
  color: var(--ink-2);
  margin-top: 2px;
  line-height: 1.4;
}
.drb-action {
  height: 26px;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid rgba(193,90,58,0.35);
  border-radius: 5px;
  background: var(--surface);
  color: var(--accent-ink);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.12s;
}
.drb-action:hover { background: var(--accent-ink); color: var(--surface); border-color: var(--accent-ink); }

/* Out-of-range cells in the timeline — subtle striped pattern */
.ght-cell.is-no-data {
  background: repeating-linear-gradient(
    135deg,
    var(--surface) 0,
    var(--surface) 4px,
    var(--line-2) 4px,
    var(--line-2) 5px
  );
  cursor: default;
}
.ght-cell.is-no-data.is-weekend {
  background: repeating-linear-gradient(
    135deg,
    var(--weekend) 0,
    var(--weekend) 4px,
    var(--line) 4px,
    var(--line) 5px
  );
}

.rangepop {
  position: absolute;
  top: calc(100% + 8px);
  right: 18px;
  z-index: 50;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  padding: 14px;
}
.rangepop-arrow {
  position: absolute;
  top: -6px;
  right: 80px;
  width: 10px; height: 10px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}
.rangepop-head {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.rangepop-row { display: flex; gap: 8px; margin-bottom: 10px; }
.rangepop-field { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.rangepop-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.rangepop-field input[type="date"] {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--surface);
  width: 100%;
  box-sizing: border-box;
}
.rangepop-field input[type="date"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.rangepop-presets {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.rangepop-presets-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-right: 4px;
}
.rangepop-presets button {
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.rangepop-presets button:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.rangepop-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.rangepop-span {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.rangepop-cancel,
.rangepop-apply {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
}
.rangepop-cancel:hover { background: var(--surface-2); }
.rangepop-apply {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.rangepop-apply:hover { background: var(--accent); border-color: var(--accent); }

/* ===== Timeline ===== */
.ght-wrap { flex: 1; min-height: 0; overflow: hidden; display: flex; }
.ght-scroll {
  flex: 1;
  overflow: auto;
  padding: 16px;
}
.ght-grid {
  display: grid;
  grid-template-columns: var(--label-w) 1fr;
  grid-auto-rows: auto;
  min-width: min-content;
}

.ght-corner {
  grid-row: 1;
  grid-column: 1;
  padding: 8px 12px 8px 4px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ght-corner-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.ght-corner-sub {
  font-size: 10.5px;
  color: var(--ink-2);
  margin-top: 2px;
  font-family: var(--font-mono);
}

.ght-overlap-row {
  grid-row: 1;
  grid-column: 2;
  display: flex;
  height: 44px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  align-items: flex-end;
}
.ght-overlap-cell {
  width: var(--cell-w);
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 3px 3px 3px;
  position: relative;
}
.ght-overlap-bar {
  width: 100%;
  background: var(--accent);
  border-radius: 1px;
  min-height: 3px;
  position: relative;
}
.ght-overlap-count {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent-ink);
  font-weight: 600;
}

.ght-month-corner { grid-column: 1; background: var(--surface); }
.ght-month-row {
  grid-column: 2;
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--line-2);
}
.ght-month {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 8px 6px;
  border-left: 1px solid var(--line);
  overflow: hidden;
}
.ght-month:first-child { border-left: none; }
.ght-month-name { font-size: 12px; font-weight: 600; color: var(--ink); }
.ght-month-year { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }

.ght-day-corner { grid-column: 1; background: var(--surface); border-bottom: 1px solid var(--line); }
.ght-day-row {
  grid-column: 2;
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.ght-day {
  width: var(--cell-w);
  padding: 6px 2px;
  text-align: center;
  border-left: 1px solid var(--line-2);
  position: relative;
  flex-shrink: 0;
}
.ght-day.is-weekend { background: var(--weekend); }
.ght-day.is-today { background: var(--ink); color: var(--surface); }
.ght-day.is-today .ght-day-dow { color: rgba(255,255,255,0.7); }
.ght-day-num { font-size: 11.5px; font-weight: 500; font-family: var(--font-mono); }
.ght-day-dow { font-size: 9px; color: var(--muted); margin-top: 2px; font-family: var(--font-mono); }

.ght-row-label {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 4px;
  border-bottom: 1px solid var(--line-2);
  background: var(--surface);
  height: var(--row-h);
  overflow: hidden;
  min-width: 0;
}
.ght-flag { font-size: 20px; line-height: 1; flex-shrink: 0; }
.ght-row-text { min-width: 0; flex: 1; overflow: hidden; }
.ght-row-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ght-row-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ght-row-cells {
  grid-column: 2;
  display: flex;
  border-bottom: 1px solid var(--line-2);
  height: var(--row-h);
}
.ght-cell {
  width: var(--cell-w);
  border-left: 1px solid var(--line-2);
  position: relative;
  background: var(--surface);
  flex-shrink: 0;
  overflow: hidden;
}
.ght-cell.is-weekend { background: var(--weekend); }
.ght-cell.is-today::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 2px;
  background: var(--ink);
  pointer-events: none;
  z-index: 1;
}
.ght-cell.is-holiday {
  background: var(--accent-soft);
  cursor: pointer;
  transition: background 0.12s;
}
.ght-cell.is-holiday.is-weekend { background: var(--accent-soft); }
.ght-cell.is-holiday:hover { background: #efd4c4; }
.ght-cell.is-highlighted {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 2;
}
.ght-holiday {
  padding: 5px 6px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ght-holiday-dot {
  width: 5px; height: 5px;
  background: var(--accent);
  border-radius: 50%;
}
.ght-holiday-name {
  font-size: 10px;
  color: var(--accent-ink);
  font-weight: 500;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Density */
.ght-grid.density-compact .ght-holiday { padding: 3px 5px; gap: 2px; }
.ght-grid.density-compact .ght-holiday-name { font-size: 9.5px; -webkit-line-clamp: 1; }
.ght-grid.density-compact .ght-flag { font-size: 16px; }
.ght-grid.density-compact .ght-row-name { font-size: 11.5px; }

/* ===== Empty state ===== */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  color: var(--muted);
  gap: 14px;
}
.empty-icon {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-2);
}
.empty-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.empty-sub { font-size: 12px; color: var(--muted); max-width: 260px; line-height: 1.5; }

/* ===== Popover ===== */
.popover {
  position: fixed;
  z-index: 1000;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.04);
  overflow: hidden;
  animation: popover-in 0.15s ease-out;
}
@keyframes popover-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.popover-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-2);
  background: var(--surface-2);
}
.popover-flag { font-size: 22px; }
.popover-country { font-size: 13px; font-weight: 600; color: var(--ink); }
.popover-tz { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-top: 1px; }
.popover-close {
  width: 22px; height: 22px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.popover-close:hover { background: var(--line-2); color: var(--ink); }
.popover-body { padding: 12px; }
.popover-holiday {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  line-height: 1.25;
}
.popover-date { font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.popover-tag {
  display: inline-block;
  padding: 3px 8px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.popover-src {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  transition: color 120ms;
}
.popover-src:hover { color: var(--accent); }
.popover-src-label { font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-2); }
.popover-src-host { font-family: var(--font-mono); font-size: 11px; color: inherit; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popover-src-arrow { font-size: 12px; color: inherit; }

/* ===== Right rail (meeting finder + upcoming) ===== */
.mf { padding: 14px 12px; border-bottom: 1px solid var(--line); }
.mf-head { margin-bottom: 10px; }
.mf-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.mf-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
  margin-top: 3px;
}
.mf-list { display: flex; flex-direction: column; gap: 5px; }
.mf-item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  text-align: left;
  width: 100%;
  transition: all 0.12s;
  cursor: pointer;
  align-items: center;
}
.mf-item:hover { border-color: var(--muted-2); background: var(--surface); }
.mf-item.is-clean { background: var(--clean-bg); border-color: var(--clean-line); }
.mf-item.is-clean:hover { border-color: #a9c2a7; }
.mf-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-mono);
}
.mf-dow { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.mf-dnum { font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1; margin-top: 2px; }
.mf-dmon { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 3px; }
.mf-status { min-width: 0; }
.mf-clean-badge {
  font-size: 11.5px;
  color: var(--clean);
  font-weight: 500;
}
.mf-conflict-count {
  font-size: 10px;
  color: var(--accent-ink);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.mf-conflict-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}
.mf-conflict {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
}
.mf-conflict-name { overflow: hidden; text-overflow: ellipsis; }
.mf-conflict-more { font-size: 10px; color: var(--muted); font-style: italic; }

.up { padding: 14px 12px; }
.up-head {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.up-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.up-sub { font-family: var(--font-mono); font-size: 9.5px; color: var(--muted); margin-top: 3px; }

.up-list { display: flex; flex-direction: column; }
.up-empty {
  padding: 16px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}
.up-day {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  padding: 9px 6px;
  border-bottom: 1px dashed var(--line-2);
  text-align: left;
  cursor: pointer;
  background: transparent;
  border-radius: 4px;
  transition: background 0.1s;
  width: 100%;
}
.up-day:hover { background: var(--surface-2); }
.up-day:last-child { border-bottom: none; }
.up-day.is-overlap .up-date-num { color: var(--accent-ink); }
.up-date-col { text-align: center; font-family: var(--font-mono); }
.up-date-num { font-size: 18px; font-weight: 600; color: var(--ink); line-height: 1; }
.up-date-mon { font-size: 9px; color: var(--muted); text-transform: uppercase; margin-top: 2px; letter-spacing: 0.08em; }
.up-date-dow { font-size: 9px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.08em; }
.up-date-rel { font-size: 9px; color: var(--muted-2); margin-top: 2px; }

.up-overlap-tag {
  display: inline-block;
  padding: 2px 6px;
  background: var(--accent);
  color: var(--surface);
  font-size: 9px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 2px;
  margin-bottom: 5px;
  font-weight: 500;
}
.up-body { min-width: 0; }
.up-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 1px 0;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
}
.up-flag { font-size: 13px; flex-shrink: 0; }
.up-country { font-weight: 500; color: var(--ink); font-family: var(--font-mono); font-size: 10px; }
.up-sep { color: var(--muted-2); }
.up-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* Responsive — when app is narrower */
@media (max-width: 1200px) {
  .app-body { grid-template-columns: 220px 1fr 280px; }
}
@media (max-width: 1000px) {
  .app-body { grid-template-columns: 220px 1fr; }
  .app-rail { display: none; }
}

/* ===== Ad slots (Ezoic placeholders, ?ads=preview to toggle) ===== */
.ad-slot {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-sans);
  color: var(--muted);
  box-sizing: border-box;
}
.ad-slot-tag {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  font-weight: 500;
  font-family: var(--font-mono);
}
.ad-slot-body { text-align: center; line-height: 1.35; padding: 14px; }
.ad-slot-title { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.ad-slot-meta { font-size: 10px; color: var(--muted-2); margin-top: 3px; font-family: var(--font-mono); }

.ad-slot--top {
  width: 100%;
  max-width: 728px;
  margin: 12px auto 0;
}
.ad-slot--rail-mid,
.ad-slot--rail-bot {
  width: calc(100% - 20px) !important;
  max-width: 300px !important;
  margin: 10px 10px;
  height: 100px !important;
}
.ad-slot--footer {
  width: 100%;
  max-width: 728px;
  margin: 12px auto;
}

/* Mobile: shrink leaderboards, hide rail (rail is hidden anyway < 1000px) */
@media (max-width: 768px) {
  .ad-slot--top, .ad-slot--footer {
    height: 100px !important;
    max-width: 320px !important;
  }
}

/* ===== App footer nav (links to legal/info pages) ===== */
.app-foot {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: var(--muted);
  flex-shrink: 0;
}
.app-foot a {
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.12s;
}
.app-foot a:hover { color: var(--ink); text-decoration: underline; }
.app-foot-sep { color: var(--muted-2); }
.app-foot-spacer { flex: 1; }
.app-foot-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted-2); }

/* ===== Static document pages (privacy / about / contact / sources) ===== */
body.docpage {
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body.docpage #root { display: none; }
.doc-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.doc-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.doc-brand-mark {
  font-size: 18px;
  color: var(--accent);
  line-height: 1;
}
.doc-brand-text {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.doc-nav {
  display: inline-flex;
  align-items: center;
  gap: 18px;
}
.doc-nav a {
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.12s;
}
.doc-nav a:hover { color: var(--accent-ink); }
.doc-nav a[aria-current="page"] {
  color: var(--accent-ink);
  border-bottom: 1.5px solid var(--accent);
  padding-bottom: 2px;
}
.doc-main {
  flex: 1;
  max-width: 720px;
  margin: 32px auto 48px;
  padding: 0 24px;
  width: 100%;
}
.doc-main h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.doc-main h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 32px 0 10px;
  color: var(--ink);
}
.doc-main p {
  line-height: 1.65;
  font-size: 14.5px;
  color: var(--ink-2);
  margin: 12px 0;
}
.doc-main ul {
  line-height: 1.65;
  font-size: 14.5px;
  color: var(--ink-2);
  padding-left: 22px;
  margin: 12px 0;
}
.doc-main li { margin: 6px 0; }
.doc-main a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-color: rgba(160,66,37,0.4);
  text-underline-offset: 2px;
}
.doc-main a:hover { text-decoration-color: var(--accent-ink); }
.doc-main code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--line);
}
.doc-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 24px !important;
}

/* Sources page list */
.src-list {
  list-style: none !important;
  padding: 0 !important;
  margin: 12px 0 24px !important;
  border-top: 1px solid var(--line);
}
.src-list li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line-2);
  margin: 0 !important;
}
.src-flag { font-size: 18px; line-height: 1; }
.src-name { font-size: 14px; color: var(--ink); }
.src-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-ink) !important;
  text-decoration: none !important;
  white-space: nowrap;
}
.src-link:hover { text-decoration: underline !important; }

/* Contact page card */
.doc-contact-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  margin: 18px 0;
}
.doc-contact-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.doc-contact-value {
  font-family: var(--font-mono);
  font-size: 15px;
  margin-top: 4px;
}

/* Doc page footer */
.doc-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 18px 24px;
  margin-top: auto;
}
.doc-footer-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.doc-footer-inner a {
  color: var(--ink-2);
  text-decoration: none;
}
.doc-footer-inner a:hover { color: var(--accent-ink); text-decoration: underline; }
.doc-footer-sep { color: var(--muted-2); }
