:root {
  color-scheme: light dark;

  /* Ink & Paper — warm stock, oxblood, pine */
  --bg: #f4f0e6;
  --surface: #fffdf8;
  --surface-2: #ece6da;
  --border: #ddd3c4;
  --fg: #211d18;
  --muted: #6b6257;

  --accent: #9a3d35;
  --accent-strong: #7c2e27;
  --accent-soft: #f1ddd7;
  --accent-ink: #73251f;
  --accent-fill: #7c2e27;
  --accent-fill-ink: #fffaf5;

  --leave: #335c52;
  --leave-bright: #4f8173;
  --leave-soft: #dce8e2;
  --leave-ink: #fdfbf6;
  --leave-ring: rgba(51, 92, 82, 0.16);

  --weekend: #ece5d9;
  --today: #1f1b16;
  --error: #9b2c2c;

  --wash-1: rgba(154, 61, 53, 0.08);
  --wash-2: rgba(51, 92, 82, 0.07);
  --wash-3: rgba(138, 90, 31, 0.05);

  --grad-hero: linear-gradient(135deg, #2e1d1a 0%, #4a2823 58%, #5c2e26 100%);

  --radius: 14px;
  --shadow: 0 1px 2px rgba(33, 29, 24, 0.05), 0 14px 34px -22px rgba(33, 29, 24, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141210;
    --surface: #1d1a17;
    --surface-2: #27221d;
    --border: #3a332c;
    --fg: #f2ece2;
    --muted: #b0a597;

    --accent: #d98a72;
    --accent-strong: #e8a48e;
    --accent-soft: #3b241f;
    --accent-ink: #f0b6a3;
  --accent-fill: #8f4436;
  --accent-fill-ink: #fff8f4;

    --leave: #7fb7a2;
    --leave-bright: #9acbb7;
    --leave-soft: #1d332c;
    --leave-ink: #0f1f1a;
    --leave-ring: rgba(127, 183, 162, 0.18);

    --weekend: #221f1b;
    --today: #f2ece2;
    --error: #e59a8f;

    --wash-1: rgba(217, 138, 114, 0.09);
    --wash-2: rgba(127, 183, 162, 0.07);
    --wash-3: rgba(215, 174, 114, 0.05);

      --grad-hero: linear-gradient(135deg, #1a120f 0%, #2f1d18 58%, #3d241d 100%);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 38px -22px rgba(0, 0, 0, 0.8);
  }
}

/* Harbor — cool fog, deep teal, rust */
:root[data-palette="harbor"] {
  --bg: #eef2f3;
  --surface: #ffffff;
  --surface-2: #e4eaec;
  --border: #d2dde0;
  --fg: #162629;
  --muted: #5e7075;

  --accent: #a34f3b;
  --accent-strong: #853b2c;
  --accent-soft: #f0ded7;
  --accent-ink: #7a3427;
  --accent-fill: #853b2c;
  --accent-fill-ink: #fffaf5;

  --leave: #225e6b;
  --leave-bright: #3b7c88;
  --leave-soft: #d8e7e9;
  --leave-ink: #ffffff;
  --leave-ring: rgba(34, 94, 107, 0.16);

  --weekend: #e2eaec;
  --today: #132a30;
  --error: #a13731;

  --wash-1: rgba(34, 94, 107, 0.07);
  --wash-2: rgba(163, 79, 59, 0.06);
  --wash-3: rgba(140, 106, 47, 0.05);

  --grad-hero: linear-gradient(135deg, #173b44 0%, #1d4c57 58%, #225e6b 100%);
  --shadow: 0 1px 2px rgba(22, 38, 41, 0.05), 0 14px 34px -22px rgba(22, 38, 41, 0.26);
}

@media (prefers-color-scheme: dark) {
  :root[data-palette="harbor"] {
    --bg: #0c1416;
    --surface: #111d20;
    --surface-2: #18272b;
    --border: #283b40;
    --fg: #e8f0f1;
    --muted: #9bb0b5;

    --accent: #d68a70;
    --accent-strong: #e3a28b;
    --accent-soft: #37221d;
    --accent-ink: #f0b09a;
  --accent-fill: #8a4434;
  --accent-fill-ink: #fff8f4;

    --leave: #7fc0c9;
    --leave-bright: #a1d5dc;
    --leave-soft: #17343a;
    --leave-ink: #07191c;
    --leave-ring: rgba(127, 192, 201, 0.18);

    --weekend: #162327;
    --today: #e8f0f1;
    --error: #e59a8f;

    --wash-1: rgba(127, 192, 201, 0.08);
    --wash-2: rgba(214, 138, 112, 0.07);
    --wash-3: rgba(208, 170, 106, 0.05);

      --grad-hero: linear-gradient(135deg, #0e2a31 0%, #174951 58%, #1d5a63 100%);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 38px -22px rgba(0, 0, 0, 0.8);
  }
}

/* Olive Grove — parchment, olive, clay */
:root[data-palette="olive"] {
  --bg: #f3f1e6;
  --surface: #fffef7;
  --surface-2: #e9e6d6;
  --border: #d8d3c0;
  --fg: #20241c;
  --muted: #6b7060;

  --accent: #a4502f;
  --accent-strong: #833b20;
  --accent-soft: #f0ddd2;
  --accent-ink: #73301a;
  --accent-fill: #833b20;
  --accent-fill-ink: #fffaf5;

  --leave: #4f5f36;
  --leave-bright: #6e7f4f;
  --leave-soft: #e4e8d5;
  --leave-ink: #fbfaf2;
  --leave-ring: rgba(79, 95, 54, 0.16);

  --weekend: #e8e6d8;
  --today: #22261c;
  --error: #9d342f;

  --wash-1: rgba(79, 95, 54, 0.07);
  --wash-2: rgba(164, 80, 47, 0.06);
  --wash-3: rgba(138, 102, 31, 0.05);

  --grad-hero: linear-gradient(135deg, #2f3624 0%, #414b2d 58%, #4b5636 100%);
  --shadow: 0 1px 2px rgba(32, 36, 28, 0.05), 0 14px 34px -22px rgba(32, 36, 28, 0.26);
}

@media (prefers-color-scheme: dark) {
  :root[data-palette="olive"] {
    --bg: #11130e;
    --surface: #191d15;
    --surface-2: #22271d;
    --border: #353b2b;
    --fg: #ecebdd;
    --muted: #a8ac97;

    --accent: #d39172;
    --accent-strong: #e2a98c;
    --accent-soft: #38241b;
    --accent-ink: #f0b79e;
  --accent-fill: #7c452c;
  --accent-fill-ink: #fff8f4;

    --leave: #a9bd7a;
    --leave-bright: #c2d397;
    --leave-soft: #26301b;
    --leave-ink: #10160a;
    --leave-ring: rgba(169, 189, 122, 0.18);

    --weekend: #1e2419;
    --today: #ecebdd;
    --error: #e59a8f;

    --wash-1: rgba(169, 189, 122, 0.07);
    --wash-2: rgba(211, 145, 114, 0.06);
    --wash-3: rgba(204, 175, 114, 0.05);

      --grad-hero: linear-gradient(135deg, #171a11 0%, #2b321f 58%, #3a432a 100%);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 38px -22px rgba(0, 0, 0, 0.8);
  }
}

/* Graphite — neutral stock, slate, vermilion */
:root[data-palette="graphite"] {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #e9e9e6;
  --border: #d9d9d4;
  --fg: #1c1c1a;
  --muted: #6d6d66;

  --accent: #b23a2e;
  --accent-strong: #8e2a21;
  --accent-soft: #f2dedb;
  --accent-ink: #78221a;
  --accent-fill: #8e2a21;
  --accent-fill-ink: #fffaf5;

  --leave: #3f4a52;
  --leave-bright: #5c6b76;
  --leave-soft: #e1e6e8;
  --leave-ink: #ffffff;
  --leave-ring: rgba(63, 74, 82, 0.16);

  --weekend: #e9e9e6;
  --today: #1b1b19;
  --error: #9f2f27;

  --wash-1: rgba(28, 28, 26, 0.05);
  --wash-2: rgba(178, 58, 46, 0.05);
  --wash-3: rgba(63, 74, 82, 0.05);

  --grad-hero: linear-gradient(135deg, #242422 0%, #363632 58%, #41413c 100%);
  --shadow: 0 1px 2px rgba(28, 28, 26, 0.05), 0 14px 34px -22px rgba(28, 28, 26, 0.26);
}

@media (prefers-color-scheme: dark) {
  :root[data-palette="graphite"] {
    --bg: #0f0f0e;
    --surface: #171716;
    --surface-2: #20201e;
    --border: #33332f;
    --fg: #efefea;
    --muted: #a6a69e;

    --accent: #e07a63;
    --accent-strong: #ea957f;
    --accent-soft: #34201c;
    --accent-ink: #f0a58f;
  --accent-fill: #8c3d32;
  --accent-fill-ink: #fff8f4;

    --leave: #a9b6bf;
    --leave-bright: #c2ccd2;
    --leave-soft: #232b30;
    --leave-ink: #0f1518;
    --leave-ring: rgba(169, 182, 191, 0.18);

    --weekend: #1c1c1a;
    --today: #efefea;
    --error: #e59a8f;

    --wash-1: rgba(239, 239, 234, 0.035);
    --wash-2: rgba(224, 122, 99, 0.06);
    --wash-3: rgba(169, 182, 191, 0.05);

      --grad-hero: linear-gradient(135deg, #141413 0%, #222220 58%, #2d2d29 100%);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 38px -22px rgba(0, 0, 0, 0.8);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(780px 430px at 6% -6%, var(--wash-1), transparent 68%),
    radial-gradient(720px 400px at 98% 2%, var(--wash-2), transparent 66%),
    radial-gradient(840px 540px at 55% 108%, var(--wash-3), transparent 66%);
  background-attachment: fixed;
  color: var(--fg);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", "Noto Sans HK", "Microsoft JhengHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  z-index: 150;
  pointer-events: none;
}

body.modal-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--leave);
}

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 32px) 36px;
}

/* ---------- header ---------- */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-fill);
  color: var(--accent-fill-ink);
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.32);
}

.brand-text {
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.brand p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

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

.control {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.control-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 2px;
}

.control select {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--fg);
  font-size: 12.5px;
  cursor: pointer;
  max-width: 168px;
}

.control select:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 1px;
}

.palette-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
}

.palette-select {
  min-width: 124px;
}

.palette-preview {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.palette-preview i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.palette-preview i:nth-child(1) {
  background: var(--accent);
  border-color: transparent;
}

.palette-preview i:nth-child(2) {
  background: var(--leave);
  border-color: transparent;
}

.palette-preview i:nth-child(3) {
  background: var(--fg);
  border-color: transparent;
}

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}

.seg button:hover {
  color: var(--fg);
}

.seg button.on {
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1);
}

.seg button:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 1px;
}

.count {
  margin-left: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

.help-btn {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}

.help-btn:hover {
  color: var(--fg);
  border-color: var(--accent);
  background: var(--surface);
}

.help-btn:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 2px;
}

.help-q {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 800;
}

/* ---------- stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 0;
  box-shadow: var(--shadow);
}

.stat::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0.4;
}

#used {
  color: var(--accent-strong);
}

#remaining {
  color: var(--leave);
}

#remaining.negative {
  color: var(--error);
}

#remaining.zero {
  color: var(--muted);
}

#longest {
  color: var(--fg);
}

#nextHoliday {
  color: var(--fg);
}

.stat-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-value.negative {
  color: var(--error);
}

.stat-value.zero {
  color: var(--muted);
}

.stat-sub {
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.stat:first-child .stat-label {
  color: var(--leave);
}

.balance-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.balance-wrap input {
  width: 82px;
  padding: 3px 8px;
  border: 2px solid var(--leave);
  border-radius: 9px;
  background: var(--leave-soft);
  color: var(--leave);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 4px var(--leave-ring);
}

.balance-wrap input:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 3px;
}

.balance-wrap span {
  font-size: 11px;
  color: var(--muted);
}

/* ---------- views ---------- */

.view-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.view-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.view-tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}

.view-tabs button:hover {
  color: var(--fg);
}

.view-tabs button[aria-selected="true"] {
  background: var(--accent-fill);
  color: var(--accent-fill-ink);
  box-shadow: 0 8px 18px -12px rgba(0, 0, 0, 0.32);
}

.view-tabs button:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 2px;
}

.clear-bookings {
  border-color: var(--border);
}

.clear-bookings:not(:disabled) {
  color: var(--accent-ink);
  border-color: var(--accent);
}

.clear-bookings:not(:disabled):hover {
  background: var(--accent-soft);
}

.clear-bookings:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.view {
  min-width: 0;
}

.planner-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-areas: "explorer combo";
  gap: 14px;
  align-items: start;
}

.explorer-card {
  grid-area: explorer;
}

.combo-card {
  grid-area: combo;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.calendar-side {
  position: sticky;
  top: 16px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.calendar-wrap {
  min-width: 0;
}

.months {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(222px, 1fr));
  gap: 12px;
}

.month {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.month::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.55;
}

.month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  min-height: 16px;
}

.month-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.month-badge {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 6px;
  white-space: nowrap;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.dow {
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-bottom: 2px;
  user-select: none;
}

.day {
  appearance: none;
  aspect-ratio: 1;
  min-height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--fg);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, box-shadow 0.1s;
}

.day.empty {
  visibility: hidden;
}

.day.weekend {
  background: var(--weekend);
  color: var(--muted);
}

.day.holiday {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
}

.day.makeup:not(.booked) {
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border);
}

.day.makeup:not(.booked):not(:focus-visible) {
  outline: 1px dashed var(--muted);
  outline-offset: -2px;
}

.day.makeup:not(.booked):hover {
  background: var(--leave-soft);
  color: var(--leave);
}

.day.booked {
  background: var(--leave);
  color: var(--leave-ink);
  font-weight: 700;
}

.day.today {
  box-shadow: inset 0 0 0 2px var(--today);
}

.day:not(:disabled):hover {
  background: var(--leave-soft);
  color: var(--leave);
}

.day.booked:hover {
  background: var(--leave);
  color: var(--leave-ink);
  filter: brightness(1.08);
}

.day:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 1px;
}

.day:disabled {
  cursor: default;
  opacity: 1;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 10px;
  padding: 0 2px;
  font-size: 10.5px;
  color: var(--muted);
}

.key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid transparent;
}

.sw.weekend {
  background: var(--weekend);
  border-color: var(--border);
}

.sw.holiday {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.sw.makeup {
  background: var(--surface-2);
  border-color: var(--muted);
  border-style: dashed;
}

.sw.booked {
  background: var(--leave);
}

.sw.today {
  box-shadow: inset 0 0 0 2px var(--today);
}

.hint {
  margin-left: auto;
}

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.card-sub {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.tip-text {
  margin: 0 0 12px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.filter-card {
  margin-bottom: 14px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-field select,
.filter-field input {
  min-width: 138px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-color: color-mix(in srgb, var(--fg) 20%, var(--border));
  border-radius: 9px;
  background: var(--surface);
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.filter-field input {
  width: 92px;
  min-width: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.filter-field select:focus-visible,
.filter-field input:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 2px;
}

.explorer-card {
  grid-area: explorer;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--leave-soft);
  color: var(--leave);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.explorer-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.mode-seg {
  padding: 3px;
}

.mode-seg button {
  padding: 5px 9px;
  font-size: 11px;
}

.break-section + .break-section {
  margin-top: 16px;
}

.break-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0 0 8px;
}

.break-section-title {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.break-section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.break-expand {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--leave);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.break-expand:hover {
  color: var(--leave-bright);
}

.break-expand:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 2px;
  border-radius: 2px;
}

.break-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.break-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s, transform 0.12s;
}

.break-item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.break-item.selected {
  background: var(--surface);
  border-color: transparent;
  box-shadow: inset 0 0 0 2px var(--accent), var(--shadow);
}

.break-item:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 2px;
}

.break-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.break-cost {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}

.break-length {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.break-dates {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.break-meta {
  font-size: 10px;
  color: var(--muted);
}

.plan-budget {
  padding: 2px 0 0;
}

.plan-budget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.plan-budget-head .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.plan-budget-label {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.plan-budget-label strong {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--leave);
}

#planBudget {
  width: 100%;
  margin: 10px 0 4px;
  accent-color: var(--leave);
  cursor: pointer;
}

#planBudget:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#planBudget:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 3px;
}

.budget-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}

.budget-presets button {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}

.budget-presets button:hover {
  border-color: var(--leave);
  color: var(--leave);
}

.budget-presets button.on {
  background: var(--leave-soft);
  border-color: var(--leave);
  color: var(--leave);
}

.budget-presets button:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 2px;
}

.plan-summary {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}

.combo-hint {
  margin: 8px 0 0;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--muted);
}

.metric-note {
  margin: 10px 0 0;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--muted);
}

.metric-note strong {
  color: var(--fg);
}

.combo-card {
  overflow-y: auto;
  overflow-x: hidden;
}

.combo-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.5;
}

.combo-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.year-map-wrap {
  margin: 10px 0 8px;
}

.year-map {
  display: block;
  width: 100%;
  height: 34px;
}

.ym-bg {
  fill: var(--surface-2);
}

.ym-tick {
  stroke: var(--border);
  stroke-width: 1;
}

.ym-holiday {
  fill: var(--accent);
  opacity: 0.85;
}

.ym-bar {
  fill: var(--leave);
  opacity: 0.92;
}

.year-map-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 9px;
  color: var(--muted);
}

.year-map-caption {
  margin: 3px 0 0;
  font-size: 9px;
  color: var(--muted);
  opacity: 0.9;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.opt-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.opt-number {
  font-size: 34px;
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-strong);
}

.opt-label {
  font-size: 12.5px;
  color: var(--muted);
}

.opt-sub {
  margin: 5px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.plan-list {
  list-style: none;
  margin: 10px 0 14px;
  padding: 0;
  max-height: 302px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.plan-list li {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.plan-list li:first-child {
  border-top: 0;
}

.plan-when {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
}

.plan-meta {
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
}

.plan-dates {
  display: block;
  margin-top: 1px;
  font-size: 10px;
  color: var(--muted);
  opacity: 0.92;
  overflow-wrap: anywhere;
}

.empty {
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, filter 0.12s;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 2px;
}

.btn.ghost {
  background: transparent;
}

.btn.primary {
  background: var(--leave);
  border-color: transparent;
  color: var(--leave-ink);
  box-shadow: 0 10px 22px -14px rgba(0, 0, 0, 0.35);
}

.btn.primary:hover {
  background: var(--leave);
  filter: brightness(1.06);
}

.btn.small {
  padding: 5px 8px;
  font-size: 11px;
  border-radius: 8px;
}

.btn.wide {
  width: 100%;
}

.booked-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
}

.booked-item + .booked-item {
  border-top: 1px solid var(--border);
}

.booked-main {
  min-width: 0;
}

.booked-when {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.booked-meta {
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.card-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

/* ---------- notes ---------- */

.notes-wrap {
  margin-top: 18px;
}

.notes h2 {
  margin-bottom: 4px;
}

.notes details {
  border-top: 1px solid var(--border);
  padding: 9px 0;
}

.notes summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
}

.notes p {
  margin: 7px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.notes p strong {
  color: var(--fg);
}

.notes .fine {
  font-size: 10.5px;
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--muted);
}

.inline select {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--fg);
  font-size: 12px;
}

.inline select:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 1px;
}

.notes select,
.notes summary:focus-visible {
  outline-color: var(--leave);
}

/* ---------- footer + toast ---------- */

.footer {
  display: flex;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  margin-top: 20px;
  font-size: 10.5px;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 18px);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .planner-body {
    display: flex;
    flex-direction: column;
  }

  .combo-card {
    position: relative;
    top: auto;
    max-height: none;
    overflow: visible;
  }

  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .calendar-side {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .app {
    padding: 16px 12px 30px;
  }

  .topbar {
    gap: 14px;
  }

  .controls {
    width: 100%;
    gap: 10px;
  }

  .control {
    flex: 1 1 100%;
  }

  .control select {
    width: 100%;
    max-width: none;
  }

  .palette-wrap {
    width: 100%;
  }

  .palette-select {
    flex: 1;
  }

  .seg {
    width: 100%;
  }

  .seg button {
    flex: 1;
    text-align: center;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat:first-child {
    grid-column: 1 / -1;
  }

  .view-tabs {
    width: 100%;
  }

  .view-tabs button {
    flex: 1;
    text-align: center;
  }

  .view-bar {
    align-items: stretch;
  }

  .clear-bookings {
    width: 100%;
  }

  .explorer-card .card-head {
    flex-wrap: wrap;
  }

  .explorer-actions {
    width: 100%;
    align-items: stretch;
  }

  .explorer-actions .pill {
    align-self: flex-start;
  }

  .filter-field {
    flex: 1 1 100%;
  }

  .filter-field select,
  .filter-field input {
    width: 100%;
  }

  .break-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hint {
    margin-left: 0;
    flex-basis: 100%;
  }

  .opt-number {
    font-size: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* ---------- onboarding ---------- */

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
}

.onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 20, 0.58);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.onboarding-card {
  position: relative;
  width: min(560px, 100%);
  max-height: min(92vh, 780px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 34px 80px -32px rgba(0, 0, 0, 0.65);
  animation: onboarding-pop 0.24s ease-out;
}

@keyframes onboarding-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.onboarding-hero {
  position: relative;
  overflow: hidden;
  padding: 24px 24px 22px;
  background: var(--grad-hero);
  color: #fff;
}

.onboarding-hero::after {
  content: "";
  position: absolute;
  top: -120px;
  right: -82px;
  width: 240px;
  height: 240px;
  border: 28px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}

.onboarding-kicker {
  position: relative;
  z-index: 1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

.onboarding-hero h2 {
  position: relative;
  z-index: 1;
  margin: 7px 0 7px;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.onboarding-hero p {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 42ch;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.88);
}

.onboarding-body {
  padding: 18px 24px 6px;
}

.onboarding-body h3 {
  margin: 0 0 10px;
  font-size: 15px;
  letter-spacing: -0.015em;
}

.steps {
  display: flex;
  gap: 5px;
  margin-bottom: 16px;
}

.steps .dot {
  width: 22px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}

.steps .dot.on {
  background: var(--accent-fill);
}

.onboard-balance {
  display: flex;
  align-items: center;
  gap: 8px;
}

.onboard-balance input {
  width: 104px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--fg);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.onboard-balance input::-webkit-outer-spin-button,
.onboard-balance input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.onboard-balance input:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 1px;
}

.onboard-balance button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--fg);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.onboard-balance button:hover {
  border-color: var(--leave);
  color: var(--leave);
}

.onboard-balance button:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 1px;
}

.onboard-balance span {
  font-size: 12px;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 8px;
}

.chips button {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.chips button:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.chips button.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.chips button:focus-visible {
  outline: 2px solid var(--leave);
  outline-offset: 1px;
}

.onboard-hint {
  margin: 8px 0 16px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.onboard-hint-tight {
  margin-top: 7px;
  margin-bottom: 2px;
}

.onboard-field {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.onboard-field legend {
  margin-bottom: 7px;
  padding: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.onboard-field select {
  width: 100%;
}

.onboard-step .seg {
  width: 100%;
}

.onboard-step .seg button {
  flex: 1;
  text-align: center;
}

.tour-title {
  margin-top: 18px !important;
}

.tour {
  display: grid;
  gap: 12px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.tour li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.tour-num {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--leave-soft);
  color: var(--leave);
  font-size: 12px;
  font-weight: 800;
}

.tour strong {
  display: block;
  font-size: 12.5px;
}

.tour p {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.onboarding-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px 18px;
  background: linear-gradient(180deg, transparent, var(--surface) 34%);
}

.onboarding-actions .spacer {
  flex: 1;
}

.onboarding-actions .onboard-lang {
  flex: 0 0 auto;
  width: auto;
  margin-left: 0;
}

.onboarding-actions .onboard-lang button {
  min-width: 34px;
  padding: 6px 8px;
  font-size: 11px;
}

.onboarding-actions .btn {
  min-width: 76px;
}

@media (max-width: 640px) {
  .help-btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .onboarding {
    padding: 10px;
  }

  .onboarding-hero {
    padding: 20px 18px 18px;
  }

  .onboarding-hero h2 {
    font-size: 21px;
  }

  .onboarding-body {
    padding: 16px 18px 4px;
  }

  .onboarding-actions {
    padding: 12px 18px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .onboarding-card {
    animation: none;
  }
}
