:root {
  color-scheme: light;
  --ink: #233742;
  --muted: #536876;
  --nav: #334C59;
  --accent: #406578;
  --paper: #FCFDFE;
  --canvas: #EEF3F5;
  --line: #D2DFE4;
  --soft: #E1EBEF;
  --soft-ink: #365462;
  --nav-active: #476370;
  --control-line: #C5D5DC;
  --danger: #9b352b;
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 15px; line-height: 1.48; }
a { color: var(--accent); text-underline-offset: .22em; }
:focus-visible { outline: 3px solid #406578; outline-offset: 3px; }
h1, h2, p, dl { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.08; letter-spacing: -.055em; overflow-wrap: anywhere; }
h2 { font-size: 1.18rem; line-height: 1.3; letter-spacing: -.018em; }
small { display: block; color: var(--muted); font-size: .87rem; }
button, input, select, textarea { font: inherit; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 44px; padding: .62rem .75rem;
  border: 1px solid #7E969F; border-radius: 9px; color: var(--ink); background: var(--paper);
  font-size: 16px;
}
input[type=date] { -webkit-appearance: none; appearance: none; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 51%), linear-gradient(135deg, var(--accent) 49%, transparent 50%);
  background-position: right 17px center, right 12px center; background-size: 5px 5px; background-repeat: no-repeat;
}
[data-search-message]:empty { display: none; }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: 19px; height: 19px; accent-color: var(--accent); flex: none; }
label { display: grid; align-content: start; gap: .32rem; min-width: 0; font-weight: 600; font-size: .92rem; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .62rem 1rem; min-height: 44px; border: 1px solid transparent; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 650; text-decoration: none; cursor: pointer; line-height: 1.22;
}
button:not(:disabled):hover, .button:hover { filter: brightness(.93); }
button.secondary, .button.secondary { background: var(--soft); color: var(--ink); border-color: var(--control-line); }
button.subtle { background: transparent; color: var(--muted); border-color: var(--line); }
button.danger { color: var(--danger); }
button:disabled { cursor: default; color: #526875; background: #EDF2F4; border-color: var(--line); }
small, .hint { color: var(--muted); overflow-wrap: anywhere; }
.hint { font-size: .9rem; }
.skip { position: absolute; left: .75rem; top: -4rem; z-index: 5; background: white; padding: .5rem; }
.skip:focus { top: .5rem; }
.layout { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; gap: 2.4rem; min-width: 0; background: var(--nav); color: #fff; padding: 1.75rem 1.15rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; padding: .2rem .42rem; color: inherit; font-size: 1.15rem; font-weight: 750; text-decoration: none; line-height: 1.12; }
/* The original artwork includes transparent margins around the white mark. */
.brand-mark {
  display: block; flex: none; width: 46px; aspect-ratio: 1; border-radius: 8px;
  background: var(--nav) 64% 30% / 126% auto no-repeat url("/static/surfenjoy-logo-white.png");
}
.brand small { margin-top: .19rem; color: #D9E6EB; font-size: .73rem; font-weight: 550; letter-spacing: .06em; }
.sidebar nav { display: grid; gap: .27rem; }
.sidebar nav a, .sign-out button { min-height: 44px; display: flex; align-items: center; padding: .52rem .8rem; border-radius: 10px; color: #E9F1F4; text-decoration: none; font-weight: 620; }
.sidebar nav a:hover, .sidebar nav a[aria-current=page] { color: white; background: var(--nav-active); }
.sign-out { margin-top: auto; }
.sign-out button { border-color: #8EA4AD; background: transparent; }
.sidebar :focus-visible { outline-color: var(--soft); }
.workspace { width: 100%; max-width: 1340px; padding: clamp(1rem, 4vw, 3.25rem); min-width: 0; }
.workspace > * + * { margin-top: 1.3rem; }
.page-heading, .section-heading, .actions { display: flex; align-items: center; justify-content: space-between; gap: .65rem 1rem; flex-wrap: wrap; }
.actions { justify-content: flex-start; }
.heading-note { color: var(--muted); font-size: .62em; white-space: nowrap; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem; min-width: 0; }
.panel > h2 + *, .panel > .section-heading + *, .panel > .actions + *, .facts + .actions { margin-top: .85rem; }
.narrow { max-width: 760px; }
.form-stack, .stack { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.spaced { margin-top: .75rem; }
.filters, .filter-grid { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.filters .grow { flex: 1 1 17rem; }
.filters .reset { align-self: center; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wide { grid-column: span 2; }
.reset, .back { display: inline-flex; min-height: 44px; align-items: center; font-weight: 600; }
.back { margin-bottom: -.8rem; }
.rows { padding: 0; }
.rows.inset { border-top: 1px solid var(--line); }
.list-row { display: flex; align-items: center; justify-content: space-between; min-height: 65px; gap: .7rem; padding: .75rem 1.1rem; text-decoration: none; color: var(--ink); }
.list-row > span:first-child { overflow-wrap: anywhere; min-width: 0; }
.list-row + .list-row { border-top: 1px solid var(--line); }
.list-row:hover { background: #F1F6F8; }
.rows > .list-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.rows > .list-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.rows > .list-row:only-child { border-radius: var(--radius); }
.rows.inset .list-row { padding-left: .15rem; padding-right: .15rem; }
.row-arrow { font-size: 1.35rem; color: var(--accent); }
.empty { padding: 1.25rem; color: var(--muted); }
.pill { display: inline-flex; align-items: center; border-radius: 20px; background: var(--soft); color: var(--ink); padding: .26rem .62rem; font-size: .8rem; font-weight: 650; max-width: 48%; overflow-wrap: anywhere; }
dd .pill { max-width: 100%; margin: 0 .25rem .15rem 0; }
.pager { display: flex; gap: .7rem; align-items: center; justify-content: center; color: var(--muted); margin-top: .8rem; }
.detail-grid, .two-up, .settings-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-grid { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.jump { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.jump a { display: inline-flex; min-height: 44px; align-items: center; font-weight: 625; }
.facts, .diff { display: grid; gap: .58rem; overflow-wrap: anywhere; }
.facts > div, .diff > div { min-width: 0; }
dt { color: var(--muted); font-size: .86rem; }
dd { margin: .13rem 0 0; }
.multiline { white-space: pre-wrap; }
.duplicate, .timeline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .45rem; padding: .45rem 0; }
.duplicate a:first-child { overflow-wrap: anywhere; }
.timeline { display: grid; gap: .25rem; }
.history details { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.history details:last-child { border-bottom: 0; }
details summary { cursor: pointer; min-height: 44px; align-content: center; }
details summary small { margin-left: 1rem; }
details > .diff { margin-top: .5rem; padding-left: .75rem; border-left: 2px solid var(--line); }
.diff ul { margin: .15rem 0; padding-left: 1.2rem; }
fieldset { min-width: 0; margin: 0; padding: .65rem .8rem .8rem; border: 1px solid var(--line); border-radius: 10px; }
legend { padding: 0 .25rem; font-weight: 700; }
.contact-row { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr) auto; gap: .5rem; align-items: end; margin-bottom: .55rem; }
.radio-group { display: flex; flex-wrap: wrap; gap: .3rem .85rem; }
.radio-group label, .checkbox { display: flex; align-items: center; min-height: 44px; gap: .4rem; }
.form-details { border: 1px solid var(--line); border-radius: 10px; padding: 0 .8rem .35rem; }
.alert { padding: .7rem .85rem; border-radius: 8px; background: #fff1eb; color: #7d2b23; }
.border-top { border-top: 1px solid var(--line); padding-top: .8rem; }
.anon { background: var(--canvas); }
.entry { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-wrap, .error-page { width: min(100%, 426px); }
.login-wrap .brand { margin: 0 0 1rem; }
.login-wrap .brand small { color: var(--muted); }
.login-wrap .panel, .error-page { padding: clamp(1.1rem, 5vw, 2rem); }
.error-page > * + * { margin-top: 1rem; }
@media (max-width: 960px) {
  .layout { grid-template-columns: 171px minmax(0, 1fr); }
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .layout { display: block; }
  .sidebar { padding: .72rem max(1rem, env(safe-area-inset-right)) .45rem max(1rem, env(safe-area-inset-left)); display: grid; grid-template-columns: 1fr auto; gap: .48rem; }
  .brand-mark { width: 40px; }
  .sidebar nav { grid-row: 2; grid-column: 1 / -1; display: flex; gap: .35rem; flex-wrap: wrap; }
  .sign-out { margin: 0; }
  .detail-grid, .settings-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
}
@media (max-width: 460px) {
  .form-stack .two-up { grid-template-columns: 1fr; }
  .contact-row { grid-template-columns: minmax(0, 1fr) auto; }
  .contact-row label:first-child { grid-column: 1 / -1; }
  .contact-row button { padding-inline: .55rem; }
  .panel { padding: .85rem; }
  .rows { padding: 0; }
  .list-row { padding-inline: .85rem; }
}

.stage-filters label { flex: 1 1 9rem; min-width: 0; }
.stage-filters button { flex: 0 0 auto; }
.section-tabs, .list-heading { margin-block: 1rem; }
.section-tabs, .load-summary, .day-heading { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .85rem; }
.day-heading { justify-content: space-between; }
.day-heading h2 { margin: 0; }
.load-summary { font-size: .89rem; }
.load-summary span { padding: .25rem .52rem; border-radius: .45rem; background: var(--soft); }
.trip-tentative { background: #fff0c8; color: #69470c; }
.trip-confirmed { background: #d6eee2; color: #124d39; }
.trip-completed { background: #e1eaf5; color: #2c4e71; }
.trip-cancelled { background: #f6e3e2; color: #842b2a; }
.section-tabs [aria-current], .period-links [aria-pressed=true] { background: var(--soft); color: var(--soft-ink); }
.ledger-row { flex-wrap: wrap; overflow-wrap: anywhere; }
.cost-fields { border: 1px solid #D2DFE4; border-radius: .7rem; padding: .8rem; min-width: 0; }
.cost-fields legend { padding-inline: .4rem; font-weight: 650; }
.comment { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 600px) {
  .sidebar nav a { padding-inline: .45rem; }
  .stage-filters label { flex-basis: 8rem; }
}
.rows-label { font-size: 1rem; margin: 0; padding: .8rem 1rem; }
[data-other-currency][hidden] { display: none; }

.payment-date .date-unknown { display: flex; align-items: center; min-height: 44px; gap: .4rem; }
.payment-date input:disabled { background: var(--soft); }

.timeline-layout .workspace {
  padding-inline-start: max(clamp(1rem, 4vw, 3.25rem), env(safe-area-inset-left));
  padding-inline-end: max(clamp(1rem, 4vw, 3.25rem), env(safe-area-inset-right));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}
.timeline-filters {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.25rem), 1fr));
  padding: .8rem;
}
.timeline-toolbar, .timeline-period, .timeline-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .85rem;
}
.timeline-toolbar { margin-bottom: .65rem; }
.timeline-period { gap: .35rem; }
.timeline-arrow { min-width: 44px; padding-inline: .65rem; font-size: 1.4rem; }
.timeline-range { font-size: .9rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.timeline-scroll {
  --name-width: 12rem;
  --day-width: 4.25rem;
  position: relative;
  max-width: 100%;
  max-height: clamp(15rem, 62vh, 42rem);
  max-height: clamp(15rem, 62dvh, 42rem);
  margin-top: 0;
  overflow: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}
.timeline-grid {
  width: max-content;
  table-layout: fixed;
  border-collapse: separate; border-spacing: 0;
  font-size: .87rem;
  font-variant-numeric: tabular-nums;
}
.timeline-name-col { width: var(--name-width); }
.timeline-day-col { width: var(--day-width); }
.timeline-grid th, .timeline-grid td { padding: 0; border: solid var(--line); border-width: 0 1px 1px 0; }
.timeline-grid .timeline-fixed {
  position: sticky; inset-inline-start: 0; z-index: 2;
  width: var(--name-width); min-width: var(--name-width); max-width: var(--name-width);
  background: var(--paper);
  text-align: left;
  overflow-wrap: anywhere;
}
.timeline-grid thead th { position: sticky; top: 0; z-index: 3; background: var(--soft); }
.timeline-grid thead .timeline-fixed { z-index: 5; padding-inline: .7rem; background: var(--soft); }
.timeline-date { min-width: var(--day-width); height: 48px; text-align: center; }
.timeline-date time { display: grid; line-height: 1.15; }
.timeline-date time > span { font-size: .74rem; }
.timeline-grid .timeline-weekend { color: #745322; background: #f7f2e8; }
.timeline-grid .timeline-today { color: #fff; background: var(--accent); }
.timeline-client, .timeline-trip-link {
  display: flex; align-items: center; min-height: 44px; min-width: 44px; padding: .2rem .65rem;
}
.timeline-client { font-weight: 740; }
.timeline-trip-link { color: var(--muted); font-size: .78rem; font-weight: 550; }
.timeline-trip td { text-align: center; vertical-align: middle; }
.timeline-presence { background: #F2F6F8; }
.timeline-bar, .timeline-event {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px; text-decoration: none;
}
.timeline-bar { margin-inline: .15rem; border-radius: .45rem; border-bottom: 2px solid currentColor; }
.timeline-bar-days { display: flex; width: 100%; }
.timeline-bar-day { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: .25rem; }
.timeline-event { margin-inline: .15rem; border-radius: .4rem; font-size: .75rem; font-weight: 650; }
.timeline-trip a:focus-visible { outline-offset: -3px; }
.timeline-load { text-align: center; vertical-align: top; background: var(--soft); padding-block: .25rem !important; }
.timeline-label-short { display: none; text-decoration: none; }
.timeline-load > span { display: block; min-height: 1.15rem; line-height: 1.15rem; }
.timeline-grid .timeline-load.timeline-fixed { padding-inline: .65rem; background: var(--soft); }
.timeline-grid .timeline-empty { padding: .65rem; }
.timeline-legend { margin-top: .65rem; padding: 0; list-style: none; font-size: .8rem; color: var(--muted); }
.timeline-legend li { display: flex; align-items: center; gap: .28rem; }
.timeline-legend li > span { width: .78rem; height: .78rem; border-radius: .2rem; border: 1px solid rgb(0 0 0 / .12); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (min-height: 540px) {
  .timeline-grid tfoot td, .timeline-grid tfoot th { position: sticky; bottom: 0; z-index: 3; }
  .timeline-grid tfoot .timeline-fixed { z-index: 4; }
}
@media (max-width: 520px) {
  .timeline-scroll { --name-width: clamp(6.7rem, 34vw, 8rem); --day-width: 3.6rem; }
  .timeline-label-full { display: none; }
  .timeline-label-short { display: inline; }
  .timeline-layout .workspace > * + * { margin-top: .8rem; }
  .timeline-layout .workspace > .timeline-scroll { margin-top: 0; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .timeline-layout .sidebar { padding-inline-start: max(1rem, env(safe-area-inset-left)); }
  .timeline-scroll { max-height: max(11rem, 65vh); max-height: max(11rem, 65dvh); }
}

.timeline-filter-disclosure > summary { display: none; }

@media (max-width: 520px) and (orientation: portrait) {
  .timeline-filter-disclosure { scroll-margin-top: max(.5rem, env(safe-area-inset-top)); }
  .timeline-filter-disclosure > summary {
    display: list-item;
    min-height: 44px;
    padding: .65rem .8rem;
    border: 1px solid var(--control-line);
    border-radius: 9px;
    background: var(--soft);
    font-weight: 650;
    cursor: pointer;
  }
  .timeline-filter-disclosure[open] > summary { margin-bottom: .5rem; }
}

.attendance-days { display: flex; flex-wrap: wrap; list-style: none; gap: .4rem; padding: 0; }
.timeline-bar-day { min-height: 44px; min-width: 44px; text-decoration: none; color: inherit; }
.timeline-bar-day + .timeline-bar-day { border-inline-start: 1px solid rgb(0 0 0 / .12); }
.timeline-bar-day.attending, .timeline-event.attending, .timeline-legend .attending {
  background: #155a62;
  color: #fff;
}
.timeline-legend .attending { border-color: #155a62; }

.transfer-panel, .transfer-row {
  margin-block: 1rem;
  overflow-wrap: anywhere;
}
.transfer-form { display: grid; gap: 1rem; min-width: 0; }
.transfer-grid, .transfer-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: .8rem;
}
.transfer-grid label, .transfer-form > label { min-width: 0; }
.transfer-grid input, .transfer-grid select, .transfer-form input[type=file] { width: 100%; }
.transfer-grid small { display: block; overflow-wrap: anywhere; }
.transfer-row summary { cursor: pointer; font-weight: 700; min-height: 44px; align-content: center; }
.transfer-summary, .transfer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
}
.transfer-summary { list-style: none; padding: 0; }
.transfer-summary li { border-radius: .5rem; border: 1px solid currentColor; padding: .35rem .65rem; }
.transfer-facts dd { margin-inline-start: 0; }
.transfer-list { padding-inline-start: 1.3rem; }
.transfer-list li { margin-block: .35rem; }
.transfer-panel details > .transfer-grid { margin-block-start: .8rem; }
