/* ══════════════════════════════════════════════════════════════════════════
   Resfeberr Operations — application layer.
   Extends the Modernist design system. Every value comes from a token in
   ds/styles.css; nothing here invents a colour, a font or a radius.
   ══════════════════════════════════════════════════════════════════════ */

:root { --muted: color-mix(in srgb, var(--color-text) 62%, transparent); }

/* — shell — */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.shell > main { min-width: 0; position: relative; background: var(--color-bg) url('/images/bg-travel.jpg') no-repeat center center fixed; background-size: cover; }

.sidebar {
  border-right: 1px solid var(--color-divider); background: var(--color-neutral-100);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: auto;
}
.sidebar-brand {
  padding: 24px 14px 20px; border-bottom: 1px solid var(--color-divider);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.sidebar-brand strong {
  display: block; font-family: var(--font-heading); font-weight: 500;
  font-size: 20px; letter-spacing: 0.06em; color: var(--color-accent-700);
}
.sidebar-brand span {
  display: block; font-size: 11px; letter-spacing: .42em; text-transform: uppercase;
  color: var(--color-neutral-500); margin-top: 4px;
}
.sidebar-group {
  padding: 16px 14px 8px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--color-neutral-500);
  border-top: 1px solid var(--color-divider); margin-top: 8px;
}
.sidebar-group:first-of-type { border-top: 0; margin-top: 0; padding-top: 14px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px 10px 11px; font-size: 14px; text-decoration: none;
  border-left: 3px solid transparent; color: var(--color-neutral-800); font-weight: 400;
}
.sidebar-icon { flex: none; color: var(--color-accent); }
.sidebar-link:hover { background: var(--color-neutral-200); border-radius: var(--radius-sm); }
.sidebar-link.is-active {
  border-left-color: var(--color-accent); color: var(--color-accent-700);
  font-weight: 500; background: var(--color-accent-100); border-radius: var(--radius-sm);
}
.brand-logo { display: block; max-height: 100px; max-width: 180px; margin-bottom: 8px; position: relative; }
.brand-logo::after {
  content: "✦";
  position: absolute; top: -4px; right: -12px;
  font-size: 10px; color: var(--color-accent-500); pointer-events: none;
}
.logo-field { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.logo-preview { max-height: 40px; max-width: 160px; border: 1px solid var(--color-divider); padding: 4px; border-radius: var(--radius-sm); }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--color-divider); padding: 14px; background: var(--color-accent-100); border-radius: var(--radius-md); margin: auto 8px 8px; }
.sidebar-foot-profile { display: flex; align-items: center; gap: 12px; }
.sidebar-avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: var(--color-text); color: var(--color-accent-300);
  font-size: 14px; font-weight: 500; letter-spacing: .04em;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-foot .who { font-size: 14px; font-weight: 500; color: var(--color-text); }
.sidebar-foot .role { font-size: 12px; color: var(--color-neutral-500); margin-top: 2px; }
.sidebar-foot nav { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.sidebar-foot nav a, .sidebar-foot nav button {
  font-size: 12px; background: none; border: 0; padding: 0; text-align: left;
  font-family: inherit; cursor: pointer; color: var(--color-text); text-decoration: none;
}
.sidebar-foot nav a { color: var(--color-accent); }

.topbar {
  display: flex; align-items: center; gap: 16px; padding: 14px 32px;
  border-bottom: 1px solid var(--color-divider);
  position: sticky; top: 0; z-index: 5;
  background: rgba(253, 250, 245, 0.88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.topbar .spacer { margin-left: auto; display: flex; align-items: center; gap: 16px; }

/* — search with icon — */
.topbar-search { position: relative; display: flex; align-items: center; }
.topbar-search-icon { position: absolute; left: 10px; pointer-events: none; }
.topbar-search .input { padding-left: 34px; }

/* — notification bell — */
.topbar-bell {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none; text-decoration: none;
}
.topbar-bell:hover svg { stroke: var(--color-accent-700); }
.topbar-bell-badge {
  position: absolute; top: 0; right: 0;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 50%; background: var(--color-accent-2);
  color: #fff; font-size: 11px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* — profile avatar — */
.topbar-profile {
  display: flex; align-items: center; gap: 6px;
  text-decoration: none; color: inherit;
}
.topbar-who {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none; font-size: 13px; font-weight: 500;
  letter-spacing: .04em; color: var(--color-accent-300);
  background: var(--color-text); border-radius: 50%;
}
.topbar-profile:hover .topbar-who { background: var(--color-accent-700); }

/* — narrowing the sidebar —
   A desk that lives in the costing sheets wants the width back. The state is
   a checkbox so it works without script, and a cookie remembers the choice. */
.nav-collapse { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.rail-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: none; cursor: pointer; font-size: 14px; line-height: 1;
  border: 1px solid var(--color-divider); background: var(--color-bg); color: var(--muted);
  border-radius: var(--radius-sm);
}
.rail-button:hover { color: var(--color-accent); border-color: var(--color-accent); }
.rail-button-topbar { display: none; width: 34px; height: 34px; }
.nav-collapse:checked ~ .shell { grid-template-columns: 0 1fr; }
/* Kept as a grid item, only emptied — removing it would hand the main
   column the zero-width track. */
.nav-collapse:checked ~ .shell .sidebar {
  width: 0; overflow: hidden; border-right: 0; visibility: hidden;
}
.nav-collapse:checked ~ .shell .rail-button-topbar { display: inline-flex; }
.nav-collapse:focus-visible ~ .shell .rail-button { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* — settings — */
.setting-value { display: flex; align-items: baseline; gap: 8px; }
.setting-value .input { min-width: 0; flex: 1 1 auto; }
.setting-value span { white-space: nowrap; }
.setting-switch { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.setting-switch input { width: 15px; height: 15px; flex: none; accent-color: var(--color-accent); }
.setting-switch span { font-weight: 500; }
.page {
  padding: 32px;
  background: rgba(253, 250, 245, 0.92);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  min-height: calc(100vh - 70px);
  position: relative;
}
.page > * { position: relative; z-index: 1; }
.page::before {
  content: "";
  position: absolute; top: 40px; left: 0; right: 0; height: 420px;
  pointer-events: none; z-index: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1290 420' preserveAspectRatio='none'%3E%3Cpath d='M-40 300 C 240 210, 470 330, 700 268 S 1090 150, 1330 96' fill='none' stroke='%23D8BE8E' stroke-width='1.6' stroke-dasharray='5 9' opacity='0.55'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}
.page::after {
  content: "";
  position: absolute; top: 90px; right: 40px;
  width: 34px; height: 34px;
  pointer-events: none; z-index: 0;
  opacity: 0.6;
  transform: rotate(-8deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23C9A96B'%3E%3Cpath d='M21 16v-2l-8-2.5V6.5a1.5 1.5 0 0 0-3 0V11.5L2 14v2l8-1.5V19l-2.5 1.5V22L11.5 21 15.5 22v-1.5L13 19v-4.5z'/%3E%3C/svg%3E") no-repeat center / contain;
}
.page-wide { padding: 40px; max-width: 1180px; }

/* — page headers — */
.kicker { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--color-accent); }
.kicker-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.kicker-muted a { color: inherit; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-top: 6px;
}
.page-head h2 { margin: 0; }
.actions { display: flex; gap: 8px; }

/* — metric strip — */
.metrics { display: grid; border: 1px solid var(--color-divider); border-radius: var(--radius-md); overflow: hidden; }
.metrics-4 { grid-template-columns: repeat(4, 1fr); }
.metrics-3 { grid-template-columns: repeat(3, 1fr); }
.metrics-5 { grid-template-columns: repeat(5, 1fr); }
.metrics-6 { grid-template-columns: repeat(6, 1fr); }
.metric { padding: 18px 20px; border-right: 1px solid var(--color-divider); }
.metric:last-child { border-right: 0; }
.metric-label {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}
.metric-value {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 29px; letter-spacing: -.02em; margin-top: 8px;
}
.metric-value-sm { font-size: 24px; margin-top: 6px; }
.metric-note { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* — data tables (the rt- rows the design uses) — */
.rt { width: 100%; border-collapse: collapse; }
.rt-head {
  padding: 8px 12px; border-bottom: 1px solid var(--color-divider);
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent); text-align: left;
}
.rt-cell { padding: 10px 12px; border-bottom: 1px solid var(--color-divider); font-size: 13.5px; }
.rt-row:hover { background: color-mix(in srgb, var(--color-text) 5%, transparent); }
.rt-row.is-clickable { cursor: pointer; }
.rt-foot-sticky tfoot {
  position: sticky; bottom: 0; z-index: 2;
  background: var(--color-surface);
}
.rt-foot-sticky tfoot .rt-cell {
  border-top: 1px solid var(--color-divider);
  border-bottom: none; font-weight: 600;
}
.num { text-align: right; }
.strong { font-weight: 600; }
.ref { color: var(--color-accent-700); }
.due { color: var(--color-accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.empty { padding: 22px 12px; font-size: 13.5px; color: var(--muted); }

/* — definition lists — */
.deflist { border-top: 1px solid var(--color-divider); }
.deflist > div {
  display: flex; gap: 16px; padding: 10px 0;
  border-bottom: 1px solid var(--color-divider); font-size: 13.5px;
}
.deflist .k { width: 150px; flex: none; color: var(--muted); margin: 0; }
.deflist .v { font-weight: 500; margin: 0; }
.deflist.split > div { justify-content: space-between; }
.deflist.split .k { width: auto; }

/* — feed (alerts, activity, comms) — */
.feed { border-top: 1px solid var(--color-divider); }
.feed-item { padding: 12px 0; border-bottom: 1px solid var(--color-divider); }
.feed-kind { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--color-accent); }
.feed-kind.row { display: flex; justify-content: space-between; }
.feed-kind .when { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.feed-text { font-size: 13.5px; margin-top: 3px; }
.feed-when { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* — boards (pipeline, tasks) — */
.board { display: grid; border: 1px solid var(--color-divider); border-radius: var(--radius-lg); overflow: hidden; }
.board-col { border-right: 1px solid var(--color-divider); padding: 14px 12px; min-height: 380px; }
.board-col:last-child { border-right: 0; }
.board-head { display: flex; justify-content: space-between; align-items: baseline; }
.board-head .name {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}
.board-head .count { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 14px; }
.board-sub { font-size: 11.5px; color: var(--color-accent-700); margin-top: 2px; }
.board-items { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.board-card {
  display: block; background: var(--color-surface); padding: 11px 12px;
  text-decoration: none; color: inherit; border-radius: var(--radius-md);
}
.board-card:hover { box-shadow: var(--shadow-sm); }
.board-card .t { font-size: 13.5px; font-weight: 600; }
.board-card .s { font-size: 12px; color: color-mix(in srgb, var(--color-text) 70%, transparent); margin-top: 2px; }
.board-card hr { height: 1px; border: 0; background: var(--color-divider); margin: 9px 0; }
.board-card .f { display: flex; justify-content: space-between; font-size: 11.5px; }
.board-card .n { font-size: 11px; color: var(--color-accent); margin-top: 5px; }

/* — layout helpers — */
.cols { display: grid; gap: 32px; }
/* Grid and flex children default to min-width:auto, which refuses to shrink
   below their content and pushes the page sideways. Nothing here needs that. */
.cols > *, .grid-4 > *, .metric, .board-col, .totals-wrap > *,
.deflist > div > *, .feed-item > *, .linklist > div > * { min-width: 0; }
.deflist .v, .totals > div > span:last-child { overflow-wrap: anywhere; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.cols-main { grid-template-columns: 1.55fr 1fr; }
.cols-detail { grid-template-columns: 1fr 320px; }
.cols-form { grid-template-columns: 1fr 320px; }
.cols-history { grid-template-columns: 1.4fr 1fr; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-2 > * { min-width: 0; }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filters .input { width: auto; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 20px; }
.mt-6 { margin-top: 32px; } .mb-2 { margin-bottom: 10px; }
.section-title { margin: 32px 0 10px; }
.section-title.first { margin-top: 0; }
.title-row { display: flex; align-items: baseline; justify-content: space-between; }
.panel { border: 1px solid var(--color-divider); padding: 16px 18px; border-radius: var(--radius-md); }
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.note { background: var(--color-surface); padding: 14px; font-size: 13.5px; border-radius: var(--radius-md); }
.totals { border-top: 1px solid var(--color-divider); }
.totals > div {
  display: flex; justify-content: space-between; padding: 9px 0;
  border-bottom: 1px solid var(--color-divider); font-size: 13.5px;
}
.totals > div > span:first-child { color: color-mix(in srgb, var(--color-text) 70%, transparent); }
.totals > div > span:last-child { font-weight: 600; }
.totals .grand { padding: 12px 0; border-bottom: 1px solid var(--color-divider); }
.totals .grand span:first-child {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 16px; color: inherit;
}
.totals .grand span:last-child {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 20px;
}
.totals .accent { border-bottom: 0; color: var(--color-accent-700); }
.totals-wrap { display: grid; grid-template-columns: 1fr 340px; margin-top: 24px; }
.pager {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center;
  margin-top: 16px; font-size: 13px; color: var(--muted);
}
.pager > * { min-width: 0; }
.pager nav { display: flex; gap: 6px; }
.pager .pagination {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px;
  list-style: none; margin: 0; padding: 0; min-width: 0;
}
.pager .pagination a, .pager .pagination span {
  display: inline-block; padding: 5px 10px; border: 1px solid var(--color-divider);
  text-decoration: none; color: var(--color-text); font-size: 13px; border-radius: var(--radius-sm);
}
.pager .pagination .active span { background: var(--color-accent); color: var(--color-bg); border-color: var(--color-accent); }

/* — charts — */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 220px; border-bottom: 1px solid var(--color-divider); }
.bars > div { flex: 1; display: flex; gap: 3px; align-items: flex-end; height: 100%; }
.bar-a { flex: 1; background: var(--color-neutral-400); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.bar-b { flex: 1; background: var(--color-accent); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.bar-labels { display: flex; gap: 14px; margin-top: 8px; }
.bar-labels > div { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); }
.legend { display: flex; gap: 18px; margin-top: 12px; font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; display: block; border-radius: 2px; }
.meter { height: 6px; background: var(--color-neutral-300); margin-top: 7px; border-radius: 3px; overflow: hidden; }
.meter > i { display: block; height: 6px; background: var(--color-accent); border-radius: 3px; }
.ageing-bar { height: 6px; background: var(--color-accent); margin-top: 8px; border-radius: 3px; }

/* — flash + validation — */
.flash {
  border: 1px solid var(--color-accent); padding: 12px 16px; font-size: 13.5px; margin-bottom: 20px;
  background: var(--color-accent-100); color: var(--color-accent-800); border-radius: var(--radius-md);
}
.flash-neutral { border-color: var(--color-divider); background: var(--color-surface); color: var(--color-text); }
.field .error { display: block; font-size: 12px; color: var(--color-accent-700); margin-top: 4px; }
.field .input.has-error { border-color: var(--color-accent); }

/* — auth — */
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-brand {
  background: var(--color-accent-700) url('/images/bg-travel.jpg') no-repeat center center;
  background-size: cover;
  background-blend-mode: overlay;
  color: var(--color-accent-100); padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-brand .mark {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 15px; letter-spacing: .14em; text-transform: uppercase;
}
.auth-brand .claim {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 56px; line-height: 1.02; letter-spacing: -.02em; max-width: 11em;
}
.auth-brand .rule { height: 2px; background: color-mix(in srgb, var(--color-bg) 50%, transparent); margin: 28px 0 20px; max-width: 320px; }
.auth-brand .lede { font-size: 14px; max-width: 34em; opacity: .9; }
.auth-brand .foot { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.auth-form {
  padding: 48px; display: flex; flex-direction: column; justify-content: center; max-width: 520px;
  background: var(--color-bg);
}
.auth-form .fields { display: grid; gap: 16px; }
.auth-logo { display: block; height: 100px; width: auto; object-fit: contain; margin-bottom: 24px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }

/* — client portal — */
.portal-nav {
  display: flex; align-items: center; gap: 24px; padding: 14px 40px;
  border-bottom: 1px solid var(--color-divider);
  background: rgba(253, 250, 245, 0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.portal-nav .brand { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 17px; margin-right: auto; }
.portal-nav .brand span {
  font-weight: 400; font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.portal-nav a { font-size: 13.5px; text-decoration: none; padding-bottom: 3px; color: var(--color-text); border-bottom: 2px solid transparent; }
.portal-nav a.is-active { color: var(--color-accent); font-weight: 600; border-bottom-color: var(--color-accent); }
.trip-hero { border: 1px solid var(--color-divider); display: grid; grid-template-columns: 1.2fr 1fr; border-radius: var(--radius-lg); overflow: hidden; }
.trip-hero .lead { padding: 28px 32px; }
.trip-hero .title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 38px; line-height: 1.05; letter-spacing: -.02em; margin-top: 14px;
}
.trip-hero .glance { border-left: 1px solid var(--color-divider); }
.trip-hero .glance > div {
  display: flex; justify-content: space-between; padding: 14px 24px;
  border-bottom: 1px solid var(--color-divider); font-size: 13.5px;
}
.balance { border: 1px solid var(--color-divider); padding: 24px 28px; display: flex; align-items: center; justify-content: space-between; gap: 32px; border-radius: var(--radius-lg); }
.balance .amount {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 40px; letter-spacing: -.02em; margin-top: 4px;
}
.itin-day { border-top: 1px solid var(--color-divider); padding-top: 14px; margin-bottom: 26px; }
.itin-day header { display: flex; justify-content: space-between; align-items: baseline; }
.itin-day header .d { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 19px; }
.itin-item { display: flex; gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--color-divider); }
.itin-item .time { width: 64px; flex: none; font-size: 12.5px; color: var(--color-accent); font-weight: 600; }
.itin-item .body { flex: 1; }
.itin-item .body .t { font-size: 13.5px; font-weight: 600; }
.itin-item .body .s { font-size: 12.5px; color: color-mix(in srgb, var(--color-text) 70%, transparent); margin-top: 2px; }

/* — day-wise outline / links list — */
.daylist { border-top: 1px solid var(--color-divider); }
.daylist > div { display: flex; gap: 20px; padding: 11px 0; border-bottom: 1px solid var(--color-divider); }
.daylist .d { width: 74px; flex: none; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--color-accent); }
.daylist .t { font-size: 13.5px; }
.linklist { border-top: 1px solid var(--color-divider); }
.linklist > div {
  display: flex; justify-content: space-between; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--color-divider); font-size: 13px;
}
.checklist { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--color-divider); align-items: flex-start; }
.checklist input[type=checkbox] { width: 14px; height: 14px; margin-top: 4px; flex: none; accent-color: var(--color-accent); }
.inline-form { display: inline; }

/* — calendar — a month grid on the dashboard: each day shows the count of
   bookings taken, departures leaving and tasks due; clicking a day opens the
   three lists below. */
.calendar { border: 1px solid var(--color-divider); border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--color-neutral-200); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--color-neutral-600); }
.cal-weekdays > div { padding: 6px 8px; text-align: center; border-right: 1px solid var(--color-divider); }
.cal-weekdays > div:last-child { border-right: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day {
  min-height: 76px; padding: 6px 8px 8px; border-right: 1px solid var(--color-divider); border-top: 1px solid var(--color-divider);
  display: flex; flex-direction: column; gap: 4px; color: var(--color-text); text-decoration: none; position: relative;
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: color-mix(in srgb, var(--color-accent) 6%, transparent); }
.cal-day .num { font-size: 12.5px; font-weight: 600; color: var(--color-neutral-700); }
.cal-day.is-out { background: color-mix(in srgb, var(--color-neutral-300) 40%, transparent); }
.cal-day.is-out .num { color: var(--color-neutral-500); }
.cal-day.is-today .num { color: var(--color-accent); }
.cal-day.is-today .num::after { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--color-accent); margin-left: 5px; vertical-align: middle; }
.cal-day.is-selected { background: color-mix(in srgb, var(--color-accent) 14%, transparent); box-shadow: inset 0 0 0 2px var(--color-accent); }
.cal-day .dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.cal-day .dot {
  font-size: 10.5px; font-weight: 600; line-height: 1; padding: 3px 6px; border-radius: 999px;
  min-width: 18px; text-align: center; color: var(--color-neutral-900);
}
.dot-booked    { background: var(--color-accent-200); }
.dot-departing { background: var(--color-accent-400); color: var(--color-accent-900); }
.dot-tasks     { background: var(--color-neutral-400); color: var(--color-neutral-900); }
.dot-todos     { background: var(--color-accent-700); color: #fff; }
.cal-legend { display: flex; gap: 14px; padding: 8px 12px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--color-divider); background: var(--color-neutral-100); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.cal-day-panels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.cal-panel-head { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--color-accent); margin-bottom: 6px; }
.cal-panel-row {
  display: block; padding: 8px 10px; border: 1px solid var(--color-divider); border-radius: var(--radius-sm);
  margin-bottom: 6px; font-size: 12.5px; color: var(--color-text); text-decoration: none; background: var(--color-surface);
}
.cal-panel-row .ref { display: block; font-size: 10.5px; letter-spacing: .06em; color: var(--color-accent); }
.cal-panel-row .strong { display: block; font-weight: 600; }
.cal-panel-row .muted { display: block; font-size: 11.5px; color: var(--muted); }
a.cal-panel-row:hover { background: color-mix(in srgb, var(--color-accent) 5%, transparent); }
.cal-panel-empty { font-size: 12px; color: var(--muted); padding: 6px 0; }

/* — wide content scrolls inside its own box, never the page — */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ══════════════════════════════════════════════════════════════════════════
   Responsive
   The desk is built for a wide screen, so each step down folds the grid
   rather than shrinking it: side-by-side columns stack, the sidebar becomes
   a drawer, and the dense listings turn into one labelled card per row.
   ══════════════════════════════════════════════════════════════════════ */

/* The drawer control and its state live here; both are invisible on desktop. */
.nav-toggle { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.nav-button { display: none; }
.nav-scrim { display: none; }

@media (max-width: 1200px) {
  .cols-main { grid-template-columns: 1.2fr 1fr; }
  .totals-wrap { grid-template-columns: 1fr 300px; }
}

@media (max-width: 1080px) {
  .cols { gap: 24px; }
  .cols-2, .cols-3, .cols-main, .cols-detail, .cols-form, .cols-history,
  .trip-hero { grid-template-columns: 1fr; }
  .trip-hero .glance { border-left: 0; border-top: 1px solid var(--color-divider); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .metrics-5, .metrics-6 { grid-template-columns: repeat(3, 1fr); }
  .metrics-5 .metric:nth-child(3n), .metrics-6 .metric:nth-child(3n) { border-right: 0; }
  .totals-wrap { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(2, 1fr) !important; }
  .board-col { min-height: 0; border-bottom: 1px solid var(--color-divider); }
  .cal-day-panels { grid-template-columns: 1fr; }
  .cal-day { min-height: 60px; }
}

@media (max-width: 900px) {
  /* — the sidebar becomes a drawer — */
  .shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(280px, 84vw);
    z-index: 60; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg);
    background: var(--color-neutral-100);
  }
  .nav-toggle:checked ~ .shell .sidebar { transform: none; }

  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: color-mix(in srgb, var(--color-neutral-900) 45%, transparent);
    opacity: 0; pointer-events: none; transition: opacity .22s ease;
  }
  .nav-toggle:checked ~ .shell .nav-scrim { opacity: 1; pointer-events: auto; }

  .nav-button {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 44px; height: 44px; flex: none; padding: 10px; cursor: pointer;
    border: 1px solid var(--color-divider); background: var(--color-bg);
    border-radius: var(--radius-sm);
  }
  .nav-button span { display: block; height: 2px; background: var(--color-text); }
  .rail-button { display: none; }
  .nav-collapse:checked ~ .shell { grid-template-columns: 1fr; }
  .nav-collapse:checked ~ .shell .sidebar {
    width: min(280px, 84vw); overflow: auto; visibility: visible; border-right: 1px solid var(--color-divider);
  }
  .nav-collapse:checked ~ .shell .rail-button-topbar { display: none; }
  .nav-toggle:focus-visible ~ .shell .nav-button { outline: 2px solid var(--color-accent); outline-offset: 2px; }

  /* — the top bar folds onto two rows — */
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 20px; }
  .topbar form { flex: 1 1 auto; min-width: 0; }
  .topbar .input { width: 100%; max-width: none !important; min-width: 0 !important; }
  .topbar .spacer { margin-left: 0; width: 100%; justify-content: space-between; }

  .page, .page-wide { padding: 20px; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 32px 24px; gap: 24px; }
  .auth-brand .claim { font-size: 34px; }
  .auth-form { padding: 32px 24px; max-width: none; }

  .metrics-4 { grid-template-columns: repeat(2, 1fr); }
  .metrics-4 .metric:nth-child(2n) { border-right: 0; }
  .metrics-4 .metric:nth-child(-n+2) { border-bottom: 1px solid var(--color-divider); }

  .page-head { flex-wrap: wrap; align-items: flex-start; gap: 12px; }
  .actions { flex-wrap: wrap; }
  .panel-row { flex-wrap: wrap; gap: 12px; }
  .balance { flex-wrap: wrap; gap: 16px; }
}

@media (max-width: 700px) {
  h2 { font-size: 26px; }
  h4 { font-size: 17px; }

  .page, .page-wide { padding: 16px; }
  .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .metrics-3, .metrics-4, .metrics-5, .metrics-6 { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--color-divider); }
  .metric:last-child { border-bottom: 0; }
  .board { grid-template-columns: 1fr !important; }
  .board-col:last-child { border-bottom: 0; }

  .deflist .k { width: 130px; }
  .deflist > div { gap: 12px; }

  .filters { gap: 8px; }
  .filters .input, .filters .seg { width: 100%; }
  .seg { flex-wrap: wrap; }
  .seg-opt { flex: 1 1 auto; justify-content: center; }
  .seg-opt + .seg-opt { border-left: 0; }

  .portal-nav { flex-wrap: wrap; gap: 12px 18px; padding: 12px 16px; }
  .portal-nav .brand { flex: 1 0 100%; margin-right: 0; }
  .trip-hero .title { font-size: 28px; }
  .balance .amount { font-size: 30px; }
  .itin-item { gap: 12px; }
  .itin-item .time { width: 52px; }

  /* Every control stays a comfortable thumb target. */
  .btn { padding: 10px 14px; min-height: 40px; }
  .btn-ghost { min-height: 36px; }
  .input { min-height: 40px; }

  .auth-brand .claim { font-size: 28px; }

  /*
   * Listing tables become one card per row. Each cell carries its column
   * name in data-label, so the header can be dropped without losing meaning.
   * Dense numeric tables (costings, cost sheets) keep their grid and scroll
   * sideways instead — reading those side by side is the point of them.
   */
  .rt-stack thead { display: none; }
  .rt-stack, .rt-stack tbody, .rt-stack tr, .rt-stack td { display: block; width: 100%; }
  .rt-stack tr {
    border-bottom: 1px solid var(--color-divider);
    padding: 10px 0 12px;
  }
  .rt-stack tr:hover { background: none; }
  .rt-stack td {
    border: 0; padding: 3px 0; font-size: 13.5px;
    display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
    text-align: left;
  }
  .rt-stack td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
    color: color-mix(in srgb, var(--color-text) 55%, transparent);
  }
  .rt-stack td[data-label=""]::before { content: none; }
  .rt-stack td.num { text-align: right; }
  .rt-stack td > .btn { margin-left: auto; }
  .rt-stack .empty { display: block; text-align: left; }
  .rt-stack .empty::before { content: none; }

  .pager { flex-wrap: wrap; gap: 12px; }
}

@media (max-width: 420px) {
  .page, .page-wide { padding: 14px; }
  .topbar { padding: 10px 14px; }
  .auth-brand, .auth-form { padding: 24px 18px; }
  .rt-stack td { flex-wrap: wrap; gap: 2px 12px; }
}

/* Respect a reduced-motion preference on the drawer. */
@media (prefers-reduced-motion: reduce) {
  .sidebar, .nav-scrim { transition: none; }
}

/* — Export menu ————————————————————————————————————————————————
   A <details> rather than a scripted dropdown, so it opens on a page whose
   JavaScript has not loaded and closes on Escape without any help. */
.menu {
    position: relative;
    display: inline-block;
}

.menu > summary {
    list-style: none;
    cursor: pointer;
}

.menu > summary::-webkit-details-marker {
    display: none;
}

.menu > summary::after {
    content: "▾";
    margin-left: 6px;
    font-size: 10px;
}

.menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    min-width: 230px;
    padding: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.menu-list a {
    display: block;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}

.menu-list a span {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--color-neutral-700);
    margin-top: 1px;
}

.menu-list a:hover {
    background: var(--color-bg);
}

/* On a phone the menu is wide enough to run off the screen if it stays
   pinned to the button, so it sits under it across the full column. */
@media (max-width: 560px) {
    .menu {
        display: block;
    }

    .menu > summary {
        width: 100%;
        text-align: center;
    }

    .menu-list {
        position: static;
        min-width: 0;
        margin-top: 6px;
        box-shadow: none;
    }
}

/* ── Home ─────────────────────────────────────────────────────────────────
   The landing screen. A greeting, one tile per place the user may go, and
   nothing that needs a number fetched — the dashboard is where figures live. */

.home {
    max-width: 1080px;
    margin: 0 auto;
    padding: var(--space-8) 0 var(--space-6);
    position: relative;
}
.home::before {
    content: "";
    position: absolute; top: 0; left: -60px; right: -60px; bottom: 0;
    pointer-events: none;
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 600' preserveAspectRatio='none'%3E%3Cpath d='M-20 500 C 200 400, 380 480, 600 380 S 950 200, 1220 140' fill='none' stroke='%23D8BE8E' stroke-width='1.2' stroke-dasharray='4 8' opacity='0.45'/%3E%3Cpath d='M1200 550 C 950 480, 700 520, 500 450 S 200 300, -20 260' fill='none' stroke='%23D8BE8E' stroke-width='1' stroke-dasharray='3 7' opacity='0.3'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}

.home-head {
    text-align: center;
    margin-bottom: var(--space-8);
}

.home-kicker {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--color-accent-500);
}

/* A rule with the diamond sitting in the gap, drawn with two lines so it
   stays centred whatever the viewport is. */
.home-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin: var(--space-3) auto var(--space-4);
    max-width: 320px;
    color: var(--color-accent-400);
}

.home-rule::before,
.home-rule::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, rgba(190,163,113,0), var(--color-accent-400));
}

.home-rule::after {
    background: linear-gradient(to left, rgba(190,163,113,0), var(--color-accent-400));
}

.home-rule span {
    font-size: 9px;
    line-height: 1;
}

.home-head h1 {
    font-size: clamp(30px, 5vw, 55px);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-neutral-900);
    margin: 0 0 var(--space-3);
}

.home-head p {
    margin: 0;
    font-size: 16px;
    color: var(--color-neutral-700);
}

.home-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-4);
}

.home-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-2);
    padding: var(--space-6) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-neutral-300);
    border-radius: var(--radius-lg);
    color: var(--color-text);
    text-decoration: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.home-tile:hover {
    border-color: var(--color-accent-400);
    box-shadow: 0 8px 22px rgba(120,95,55,0.09);
}

.home-tile-icon {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--color-accent-100);
    color: var(--color-accent-700);
    margin-bottom: var(--space-2);
}

.home-tile-icon svg {
    width: 30px;
    height: 30px;
}

.home-tile-label {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 18px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--color-neutral-900);
}

.home-tile-blurb {
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-neutral-600);
}

.home-tile-go {
    margin-top: var(--space-3);
    font-size: 18px;
    line-height: 1;
    color: var(--color-accent);
}

.home-quote {
    margin: var(--space-8) 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
}

.home-quote::before,
.home-quote::after {
    content: "";
    width: 90px;
    height: 1px;
    background: linear-gradient(to right, rgba(190,163,113,0), var(--color-accent-400));
}

.home-quote::after {
    background: linear-gradient(to left, rgba(190,163,113,0), var(--color-accent-400));
}

.home-quote blockquote {
    margin: 0;
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 22px;
    text-align: center;
    color: var(--color-accent);
}

@media (max-width: 900px) {
    .home-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-quote::before, .home-quote::after { width: 24px; }
}

@media (max-width: 480px) {
    .home-tiles { grid-template-columns: 1fr; }
}

.home-logo {
    display: block;
    height: 100px;
    width: auto;
    margin: 0 auto var(--space-6);
}

@media (max-width: 480px) {
    .home-logo { height: 60px; }
}

/* Searchable select (combobox.js). The native <select> is kept in the
   DOM but hidden so the form submits unchanged. */
.combo {
    position: relative;
    width: 100%;
}
.combo-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
.combo-input {
    width: 100%;
    cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--color-muted) 50%),
                      linear-gradient(135deg, var(--color-muted) 50%, transparent 50%);
    background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 28px;
}
.combo-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    margin: 2px 0 0;
    padding: 4px 0;
    list-style: none;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #d6d3c9);
    border-radius: var(--radius-2, 6px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    max-height: 240px;
    overflow-y: auto;
}
.combo-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.35;
}
.combo-item:hover,
.combo-item.is-active {
    background: var(--color-surface-alt, #f4f1e8);
}
.combo-item[aria-selected="true"] {
    font-weight: 500;
}
.combo-empty {
    padding: 6px 12px;
    color: var(--color-muted, #8a8577);
    font-size: 13px;
    font-style: italic;
}

/* -------------------------------------------------------------------------
   Quotation service picker & line cards
   ------------------------------------------------------------------------- */
.service-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}
.service-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--color-text);
    text-align: center;
    transition: background-color 100ms ease-out, border-color 100ms ease-out;
    font: inherit;
}
.service-tile:hover {
    background: var(--color-accent-100);
    border-color: var(--color-accent);
}
.service-tile__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent);
}
.service-tile__label {
    font-size: 13px;
    line-height: 1.2;
    font-weight: 500;
}

.quotation-lines {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.line-card {
    padding: var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-md);
}
.line-card__head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}
.line-card__icon {
    display: inline-flex;
    align-items: center;
    color: var(--color-accent);
}
.line-card__remove {
    margin-left: auto;
    font-size: 12px;
}
.line-card__alternates {
    margin-top: var(--space-2);
    font-size: 13px;
}
.line-card__alternates summary {
    cursor: pointer;
    padding: 4px 0;
    font-weight: 500;
    color: var(--color-accent);
}
.alternate-row {
    display: grid;
    grid-template-columns: 20px 1.3fr 96px 1fr 96px 140px 100px 28px;
    gap: var(--space-2);
    align-items: center;
    margin-top: var(--space-2);
    padding: 4px;
    border-radius: var(--radius-sm);
    background: var(--color-neutral-100);
}
.alternate-row.is-dragging {
    opacity: .45;
    background: var(--color-accent-100);
}
.alt-drag {
    cursor: grab;
    user-select: none;
    text-align: center;
    color: var(--color-neutral-500);
    line-height: 1;
    font-size: 14px;
}
.alt-drag:active {
    cursor: grabbing;
}
.alt-remove {
    padding: 4px 8px;
    line-height: 1;
    font-size: 16px;
}
.input-suffix {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-sm);
    background: #fff;
    overflow: hidden;
    min-width: 0;
}
.input-suffix .input {
    border: none;
    border-radius: 0;
    background: transparent;
    padding-right: 4px;
    min-width: 0;
    flex: 1;
}
.input-suffix > span {
    display: inline-flex;
    align-items: center;
    padding: 0 var(--space-2);
    background: var(--color-neutral-200);
    color: var(--color-neutral-700);
    font-size: 12px;
    border-left: 1px solid var(--color-divider);
}
@media (max-width: 900px) {
    .alternate-row {
        grid-template-columns: 20px 1fr 1fr 28px;
        row-gap: 4px;
    }
    .alternate-row > *:not(.alt-drag):not(.alt-remove) {
        grid-column: span 2;
    }
}
.costing-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-2);
    margin: var(--space-2) 0;
    padding: var(--space-2);
    background: var(--color-accent-100);
    border-radius: var(--radius-sm);
}
.costing-row .label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: color-mix(in srgb, var(--color-text) 60%, transparent);
    margin-bottom: 2px;
}
@media (max-width: 700px) {
    .costing-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
