/* Work Ledger application styles on Foundry 2.
   Colors, type, spacing and radii come from foundry/foundry.css and
   foundry/work-ledger.css (ink blue-gray product roles). Do not hard-code
   palette values here; add roles as custom properties when needed. */

@font-face {
  font-family: Inter;
  src: url("../fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root[data-product="work-ledger"] {
  --fd-font-interface: "Inter", "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --wl-content: 820px;
  --wl-gutter: var(--fd-gutter-desktop);
  --wl-brand-font: Arial, Helvetica, sans-serif;
  --wl-danger-text: #151715;
  --wl-shadow: 0 12px 40px #0000004d;
  --wl-row-date: 104px;
}
:root[data-product="work-ledger"][data-theme="light"] {
  --wl-danger-text: #fffaf2;
  --wl-shadow: 0 12px 40px #1c1b1626;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fd-surface-canvas);
  color: var(--fd-text-primary);
  font: var(--fd-font-weight-regular) var(--fd-font-size-body)/var(--fd-line-height-body) var(--fd-font-interface);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--fd-font-display); font-weight: var(--fd-font-weight-medium); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--fd-border-focus);
  outline-offset: 3px;
}
::selection { background: var(--fd-action-primary); color: var(--fd-action-primary-text); }
[hidden] { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 20px; height: 20px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.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;
}
.skip-link {
  position: absolute; left: var(--fd-space-4); top: -100px; z-index: 20;
  padding: var(--fd-space-3) var(--fd-space-4); border-radius: var(--fd-radius-control);
  background: var(--fd-action-primary); color: var(--fd-action-primary-text);
}
.skip-link:focus { top: var(--fd-space-4); }
.meta { color: var(--fd-text-secondary); font-size: var(--fd-font-size-meta); }
.eyebrow {
  color: var(--fd-text-secondary); font-size: var(--fd-font-size-label);
  letter-spacing: .08em; text-transform: uppercase;
}

/* ---------- Shell ---------- */
.shell { width: min(100%, calc(var(--wl-content) + 2 * var(--wl-gutter))); margin-inline: auto; padding-inline: var(--wl-gutter); }
.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--fd-space-4);
  min-height: 80px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; }
.brand-mark { width: 30px; height: 30px; color: var(--fd-accent); }
.brand-name { font: 700 22px/1 var(--wl-brand-font); letter-spacing: -.6px; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: var(--fd-space-2); }
.sign-out { margin: 0; }

.tabs {
  display: flex; gap: 28px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--fd-border-default);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: inline-flex; align-items: center; flex-shrink: 0; min-height: 52px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--fd-text-secondary); font-size: var(--fd-font-size-body);
}
.tabs a[aria-current="page"] { color: var(--fd-accent); border-bottom-color: var(--fd-accent); font-weight: var(--fd-font-weight-medium); }
@media (hover: hover) { .tabs a:hover { color: var(--fd-text-primary); } }

main { outline: none; padding-bottom: calc(var(--fd-space-16) + env(safe-area-inset-bottom)); }

.page-heading {
  display: flex; align-items: center; justify-content: space-between; gap: var(--fd-space-4);
  margin: var(--fd-space-8) 0 var(--fd-space-6);
}
.page-heading h1 { font-size: var(--fd-title-base); line-height: var(--fd-line-height-title); letter-spacing: -.02em; }

/* ---------- Controls ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--fd-space-2);
  min-height: var(--fd-control-min); padding: 10px 16px;
  border: 1px solid transparent; border-radius: var(--fd-radius-control);
  font-size: var(--fd-font-size-body); font-weight: var(--fd-font-weight-medium); line-height: 1.2;
  white-space: nowrap;
}
.button .icon { width: 18px; height: 18px; }
.button.primary { background: var(--fd-action-primary); color: var(--fd-action-primary-text); font-weight: 600; }
.button.secondary { background: var(--fd-surface-base); border-color: var(--fd-border-default); color: var(--fd-text-primary); }
.button.danger { background: var(--fd-feedback-danger); color: var(--wl-danger-text); }
.button:disabled, .button[aria-disabled="true"] { opacity: .6; cursor: default; }
@media (hover: hover) {
  .button.primary:hover { background: var(--fd-action-primary-hover); }
  .button.secondary:hover { background: var(--fd-surface-raised); }
  .button.danger:hover { background: color-mix(in srgb, var(--fd-feedback-danger) 86%, var(--fd-text-primary)); }
}
.icon-button {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0;
  border: 1px solid var(--fd-border-default); border-radius: var(--fd-radius-control);
  background: var(--fd-surface-base); color: var(--fd-text-secondary);
}
@media (hover: hover) { .icon-button:hover { color: var(--fd-text-primary); background: var(--fd-surface-raised); } }
.text-button {
  display: inline-flex; align-items: center; gap: var(--fd-space-2); min-height: 44px;
  padding: 0; border: 0; background: none; color: var(--fd-accent); font-weight: var(--fd-font-weight-medium);
}
.text-button.quiet { color: var(--fd-text-secondary); font-weight: var(--fd-font-weight-regular); padding: 0 var(--fd-space-2); white-space: nowrap; }
.danger-text { color: var(--fd-feedback-danger); }
@media (hover: hover) { .text-button:hover { text-decoration: underline; text-underline-offset: 4px; } }

input, select, textarea {
  width: 100%; min-width: 0; min-height: var(--fd-control-min);
  padding: 10px 12px; border: 1px solid var(--fd-border-default); border-radius: var(--fd-radius-control);
  background: var(--fd-surface-base); color: var(--fd-text-primary);
  font-size: var(--fd-font-size-input);
}
select { cursor: pointer; }
textarea { resize: vertical; min-height: 88px; line-height: var(--fd-line-height-body); }
::placeholder { color: var(--fd-text-tertiary); opacity: 1; }
[aria-invalid="true"], .date-control:has([aria-invalid="true"]) { border-color: var(--fd-feedback-danger); }

/* iOS WebKit adds date-input padding outside width:100% (WebKit bug 301648):
   pad the wrapper and keep the native control unpadded (same fix as Orbit). */
.date-control {
  display: flex; align-items: center; gap: var(--fd-space-2); width: 100%; min-width: 0;
  min-height: var(--fd-control-min); padding: 0 12px;
  border: 1px solid var(--fd-border-default); border-radius: var(--fd-radius-control);
  background: var(--fd-surface-base); color: var(--fd-text-primary);
}
.date-control .icon { width: 18px; height: 18px; color: var(--fd-text-secondary); }
.date-control input[type="date"] {
  display: block; flex: 1 1 0%; width: 0; min-width: 0; height: 42px; min-height: 42px;
  padding: 0; border: 0; border-radius: 0; background: transparent;
  -webkit-appearance: none; appearance: none; line-height: 24px;
}
.date-control input[type="date"]::-webkit-date-and-time-value { display: flex; align-items: center; height: 100%; min-height: 42px; text-align: start; }
.date-control input[type="date"]::-webkit-datetime-edit { padding: 0; }
.date-control:focus-within { outline: 2px solid var(--fd-border-focus); outline-offset: 1px; }
.date-control input[type="date"]:focus { outline: none; }

.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label { font-size: var(--fd-font-size-body); font-weight: var(--fd-font-weight-medium); }
.optional { color: var(--fd-text-tertiary); font-weight: var(--fd-font-weight-regular); }
.field-error { color: var(--fd-feedback-danger); font-size: var(--fd-font-size-meta); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fd-space-2); }
.form-actions form { margin: 0; }

.tag {
  display: inline-flex; align-items: center; min-height: 22px; padding: 0 7px;
  border: 1px solid var(--fd-border-default); border-radius: var(--fd-radius-chip);
  color: var(--fd-text-secondary); font-size: var(--fd-font-size-label); white-space: nowrap;
}

/* ---------- Feedback ---------- */
.notice, .form-error {
  display: flex; align-items: flex-start; gap: var(--fd-space-3);
  padding: var(--fd-space-3) var(--fd-space-4); border-radius: var(--fd-radius-control);
  border: 1px solid var(--fd-border-default); font-size: var(--fd-font-size-body);
}
.notice p, .form-error p { flex: 1; min-width: 0; padding-top: 1px; overflow-wrap: anywhere; }
.notice { margin-top: var(--fd-space-6); background: var(--fd-accent-soft); border-color: transparent; }
.notice.success .icon { color: var(--fd-accent); }
.notice.error, .form-error {
  color: var(--fd-feedback-danger);
  background: color-mix(in srgb, var(--fd-feedback-danger) 8%, transparent);
  border-color: color-mix(in srgb, var(--fd-feedback-danger) 32%, transparent);
}
.notice.error p, .form-error p { color: var(--fd-text-primary); }
.notice-close { width: 32px; height: 32px; margin: -6px -8px -6px 0; border: 0; background: transparent; }
.notice-close .icon { width: 16px; height: 16px; }
.empty-state {
  display: grid; justify-items: start; gap: var(--fd-space-4);
  padding: var(--fd-space-8) 0; border-top: 1px solid var(--fd-border-default);
  color: var(--fd-text-secondary);
}

/* ---------- Theme menu ---------- */
.theme-menu { position: relative; }
.theme-menu > summary { list-style: none; }
.theme-menu > summary::-webkit-details-marker { display: none; }
.theme-options {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; min-width: 160px;
  display: grid; padding: 4px; border: 1px solid var(--fd-border-default); border-radius: var(--fd-radius-control);
  background: var(--fd-surface-overlay); box-shadow: var(--wl-shadow);
}
.theme-options button {
  display: flex; align-items: center; gap: var(--fd-space-3); min-height: 44px; padding: 0 var(--fd-space-3);
  border: 0; border-radius: var(--fd-radius-chip); background: none; text-align: left; color: var(--fd-text-primary);
}
.theme-options button .icon { width: 18px; height: 18px; color: var(--fd-text-secondary); }
.theme-options button[aria-pressed="true"] { background: var(--fd-accent-soft); }
.theme-options button[aria-pressed="true"] .icon { color: var(--fd-accent); }
@media (hover: hover) { .theme-options button:hover { background: var(--fd-surface-raised); } }

/* ---------- Ledger: week ---------- */
.week-heading { align-items: flex-end; margin-bottom: var(--fd-space-4); }
.week-title { display: grid; gap: var(--fd-space-1); min-width: 0; }
.week-title h1 { font-size: var(--fd-title-base); line-height: var(--fd-line-height-title); letter-spacing: -.02em; }
.button.log-day { flex-shrink: 0; }

.week-controls { display: flex; align-items: center; flex-wrap: wrap; gap: var(--fd-space-2); }
.week-controls .text-button { margin-left: var(--fd-space-2); }
.week-jump { display: flex; align-items: center; gap: var(--fd-space-2); margin: 0; }
.week-jump-label { color: var(--fd-text-secondary); }
.week-jump-control { width: 172px; }
.no-js-only { display: initial; }
.js .no-js-only { display: none; }
.js .week-jump { gap: 0; }
.js .week-jump-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* With JavaScript the week picker is a 44px calendar button; the native date
   input stays in place, transparent, so taps open the platform picker. */
.js .week-jump-control {
  position: relative; justify-content: center; width: 44px; padding: 0;
  color: var(--fd-text-secondary); cursor: pointer;
}
.js .week-jump-control input[type="date"] {
  position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; opacity: 0; cursor: pointer;
}
.js .week-jump-control .icon { color: inherit; }
@media (hover: hover) { .js .week-jump-control:hover { color: var(--fd-text-primary); background: var(--fd-surface-raised); } }

.week-summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--fd-space-4) var(--fd-space-6); flex-wrap: wrap;
  margin-top: var(--fd-space-6); padding: var(--fd-space-4) 0;
  border-top: 1px solid var(--fd-border-default);
}
.coverage { display: grid; gap: var(--fd-space-2); min-width: 0; }
.coverage-count { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--fd-space-2); }
.coverage-count strong {
  font-size: var(--fd-font-size-operational); line-height: var(--fd-line-height-value);
  font-weight: var(--fd-font-weight-medium); font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.coverage-count strong span { color: var(--fd-text-tertiary); }
.coverage-text { color: var(--fd-text-secondary); }
meter {
  display: block; width: 180px; height: 4px; border: 0; border-radius: 4px;
  background: var(--fd-surface-raised); -webkit-appearance: none; appearance: none;
}
meter::-webkit-meter-bar { height: 4px; border: 0; border-radius: 4px; background: var(--fd-surface-raised); }
meter::-webkit-meter-optimum-value,
meter::-webkit-meter-suboptimum-value,
meter::-webkit-meter-even-less-good-value { border-radius: 4px; background: var(--fd-accent); }
meter::-moz-meter-bar { border-radius: 4px; background: var(--fd-accent); }
.timesheet { display: flex; align-items: center; gap: var(--fd-space-4); margin: 0; }
.timesheet-copy { display: grid; justify-items: end; text-align: right; }
.timesheet-status { display: inline-flex; align-items: center; gap: 6px; color: var(--fd-text-secondary); }
.timesheet-status.filled { color: var(--fd-text-primary); font-weight: var(--fd-font-weight-medium); }
.timesheet-status .icon { width: 18px; height: 18px; color: var(--fd-accent); }
.week .form-error { margin-bottom: var(--fd-space-4); }
.form-error:focus { outline: none; }

/* ---------- Ledger: days ---------- */
.days { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--fd-border-default); }
.day {
  display: grid; grid-template-columns: var(--wl-row-date) minmax(0, 1fr) auto; align-items: center; gap: var(--fd-space-4);
  min-height: 64px; border-bottom: 1px solid var(--fd-border-default);
}
.day-date { display: flex; align-items: baseline; gap: var(--fd-space-2); }
.weekday {
  width: 34px; color: var(--fd-text-secondary); font-size: var(--fd-font-size-label);
  font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.day-number { color: var(--fd-text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-main { display: flex; align-items: center; flex-wrap: wrap; gap: 6px var(--fd-space-2); min-width: 0; padding-block: var(--fd-space-3); }
.client-name { font-size: 16px; font-weight: var(--fd-font-weight-medium); overflow-wrap: anywhere; }
.day-status { color: var(--fd-text-tertiary); }
.status-missing .day-status { color: var(--fd-text-primary); font-weight: var(--fd-font-weight-medium); }
.status-time_off .day-status { color: var(--fd-text-secondary); }
.today-tag {
  display: inline-flex; align-items: center; min-height: 22px; padding: 0 7px; border-radius: var(--fd-radius-chip);
  background: var(--fd-accent-soft); color: var(--fd-accent); font-size: var(--fd-font-size-label); font-weight: var(--fd-font-weight-medium);
}
.is-today .weekday, .is-today .day-number { color: var(--fd-accent); font-weight: 600; }
.day { position: relative; }
.is-today::before {
  content: ""; position: absolute; left: calc(-1 * var(--fd-space-3)); top: 8px; bottom: 8px;
  width: 3px; border-radius: 2px; background: var(--fd-accent);
}
.is-weekend { min-height: 52px; }
.is-weekend .weekday, .is-weekend .day-number { color: var(--fd-text-tertiary); }
.row-action {
  display: inline-flex; align-items: center; justify-content: flex-end; min-width: 64px; min-height: 44px;
  padding: 0 var(--fd-space-2); margin-right: calc(-1 * var(--fd-space-2));
  color: var(--fd-text-secondary); font-weight: var(--fd-font-weight-medium); border-radius: var(--fd-radius-control);
}
.status-upcoming .row-action, .status-weekend .row-action,
.status-time_off .row-action, .status-pre_launch .row-action { color: var(--fd-text-tertiary); font-weight: var(--fd-font-weight-regular); }
/* Missing workdays are the only rows whose action looks like a button. */
.status-missing .row-action {
  justify-content: center; min-width: 72px; margin-right: 0; padding: 0 var(--fd-space-4);
  border: 1px solid var(--fd-border-default); background: var(--fd-surface-base);
  color: var(--fd-accent); font-weight: 600;
}
@media (hover: hover) { .status-missing .row-action:hover { border-color: var(--fd-accent); background: var(--fd-accent-soft); color: var(--fd-accent); } }
.row-action[aria-current="true"] { color: var(--fd-text-primary); }
@media (hover: hover) { .row-action:hover { color: var(--fd-text-primary); background: var(--fd-surface-raised); } }
.is-open { border-bottom-color: transparent; }
.day-editor { padding: 0 0 var(--fd-space-4); border-bottom: 1px solid var(--fd-border-default); }

/* ---------- Entry editor ---------- */
.editor {
  display: grid; gap: var(--fd-space-4);
  padding: var(--fd-space-5, 20px); border: 1px solid var(--fd-border-default); border-radius: var(--fd-radius-card);
  background: var(--fd-surface-base); scroll-margin-top: var(--fd-space-6);
}
.page-ledger main > .editor { margin-bottom: var(--fd-space-6); }
.editor-heading { display: flex; align-items: baseline; justify-content: space-between; gap: var(--fd-space-3); flex-wrap: wrap; }
.editor-heading h2 { font-size: 20px; line-height: var(--fd-line-height-heading); }
.editor-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--fd-space-4); margin: 0; }
.editor-form .field-wide { grid-column: 1 / -1; }
.editor-form:not(:has(.date-control)) .field:first-of-type { grid-column: 1 / -1; }
.conflict { margin-top: calc(-1 * var(--fd-space-2)); }
.editor-delete { padding-top: var(--fd-space-4); border-top: 1px solid var(--fd-border-subtle); }
.confirm { display: grid; gap: var(--fd-space-3); }

/* ---------- Shared page pieces ---------- */
.button.wide { width: 100%; margin-top: var(--fd-space-4); }
.notice-inline { padding: var(--fd-space-4) 0; color: var(--fd-text-secondary); }
.page-intro { margin: calc(-1 * var(--fd-space-3)) 0 var(--fd-space-6); max-width: 60ch; }
.section-heading {
  display: flex; align-items: baseline; gap: var(--fd-space-2);
  margin: var(--fd-space-8) 0 var(--fd-space-3); font-size: var(--fd-font-size-heading);
  line-height: var(--fd-line-height-heading);
}
.count { color: var(--fd-text-tertiary); font-family: var(--fd-font-interface); font-size: var(--fd-font-size-body); font-variant-numeric: tabular-nums; }
.section-intro { margin: calc(-1 * var(--fd-space-2)) 0 var(--fd-space-3); }
.is-empty { color: var(--fd-text-tertiary); }
code { font-size: .92em; padding: 1px 4px; border-radius: var(--fd-radius-chip); background: var(--fd-surface-raised); }

/* Disclosures (native details/summary). */
.disclosure { border-top: 1px solid var(--fd-border-default); border-bottom: 1px solid var(--fd-border-default); }
.disclosure + .disclosure { border-top: 0; }
.disclosure > summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--fd-space-3);
  min-height: 56px; cursor: pointer; list-style: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure-title { display: inline-flex; align-items: center; gap: var(--fd-space-2); font-weight: var(--fd-font-weight-medium); }
.disclosure-title .icon { width: 18px; height: 18px; color: var(--fd-accent); }
.disclosure > summary::after {
  content: ""; width: 8px; height: 8px; margin-right: 6px; flex-shrink: 0;
  border-right: 1.6px solid var(--fd-text-secondary); border-bottom: 1.6px solid var(--fd-text-secondary);
  transform: rotate(45deg) translateY(-3px); transition: transform var(--fd-motion-fast);
}
.disclosure[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.disclosure-hint { margin-left: auto; color: var(--fd-text-secondary); font-size: var(--fd-font-size-meta); }
.disclosure[open] .disclosure-hint { display: none; }
.disclosure-body { padding: 0 0 var(--fd-space-6); }
@media (hover: hover) { .disclosure > summary:hover .disclosure-title { color: var(--fd-accent); } }

/* ---------- History ---------- */
.missing { margin-bottom: var(--fd-space-6); }
.missing-disclosure .disclosure-title strong { color: var(--fd-accent); font-size: 18px; font-variant-numeric: tabular-nums; }
.missing-disclosure .disclosure-body > .meta { margin-bottom: var(--fd-space-2); max-width: 64ch; }
.month-label {
  margin: var(--fd-space-4) 0 var(--fd-space-2); font-family: var(--fd-font-interface);
  font-size: var(--fd-font-size-label); font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fd-text-secondary);
}
.day-chips { display: flex; flex-wrap: wrap; gap: var(--fd-space-2); margin: 0; padding: 0; list-style: none; }
.day-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 76px; min-height: 44px; padding: 0 var(--fd-space-3);
  border: 1px solid var(--fd-border-default); border-radius: var(--fd-radius-control); background: var(--fd-surface-base);
  font-variant-numeric: tabular-nums; font-weight: var(--fd-font-weight-medium);
}
.day-chip span { color: var(--fd-text-secondary); font-weight: var(--fd-font-weight-regular); }
@media (hover: hover) { .day-chip:hover { border-color: var(--fd-accent); background: var(--fd-accent-soft); color: var(--fd-accent); } }
.all-clear { display: flex; align-items: center; gap: var(--fd-space-2); padding: var(--fd-space-4) 0; border-bottom: 1px solid var(--fd-border-default); color: var(--fd-text-secondary); }
.all-clear .icon { color: var(--fd-accent); width: 18px; height: 18px; }

.filters { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--fd-space-3); align-items: start; margin: 0; }
.filters .search-field input { background: var(--fd-surface-base); }
.filter-options { grid-column: 1 / -1; grid-row: 2; }
.filter-options > summary {
  display: inline-flex; align-items: center; gap: var(--fd-space-2); min-height: 44px; cursor: pointer; list-style: none;
  color: var(--fd-text-secondary); font-weight: var(--fd-font-weight-medium);
}
.filter-options > summary::-webkit-details-marker { display: none; }
.filter-options > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--fd-motion-fast);
}
.filter-options[open] > summary::before { transform: rotate(45deg); }
.filter-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--fd-space-6);
  padding: var(--fd-space-4); margin-bottom: var(--fd-space-2);
  border: 1px solid var(--fd-border-default); border-radius: var(--fd-radius-card); background: var(--fd-surface-base);
}
.filter-grid fieldset, fieldset.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.filter-grid legend, fieldset.field > legend { padding: 0; margin-bottom: 6px; font-weight: var(--fd-font-weight-medium); }
.filter-actions { display: flex; align-items: center; gap: var(--fd-space-3); }
.filters .filter-actions { grid-column: 2; grid-row: 1; }
.date-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--fd-space-3); margin-top: var(--fd-space-3); }
.date-range.is-inline { margin-top: 0; }
.date-range .field > span:first-child { color: var(--fd-text-secondary); font-size: var(--fd-font-size-meta); }
.check-list { display: grid; gap: 2px; max-height: 264px; overflow-y: auto; }
.check { display: flex; align-items: center; gap: var(--fd-space-3); min-height: 44px; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; margin: 0; flex-shrink: 0; accent-color: var(--fd-action-primary); }
.check span { overflow-wrap: anywhere; }
.filter-summary { margin-top: var(--fd-space-3); color: var(--fd-text-secondary); font-size: var(--fd-font-size-meta); }
.result-count { margin: var(--fd-space-6) 0 0; color: var(--fd-text-secondary); font-size: var(--fd-font-size-meta); }

.month-heading { margin: var(--fd-space-6) 0 var(--fd-space-2); font-size: 20px; line-height: var(--fd-line-height-heading); }
.entries { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--fd-border-default); }
.entry {
  display: grid; grid-template-columns: var(--wl-row-date) minmax(0, 1fr) auto; gap: var(--fd-space-4); align-items: start;
  padding: var(--fd-space-4) 0; border-bottom: 1px solid var(--fd-border-default);
}
.entry-date { display: grid; gap: 2px; padding-top: 1px; }
.entry-day { font-variant-numeric: tabular-nums; font-weight: var(--fd-font-weight-medium); }
.entry-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--fd-space-2); min-width: 0; }
.entry-notes {
  flex-basis: 100%; color: var(--fd-text-secondary); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.entry .row-action { margin-top: -10px; }
.entry.is-open { border-bottom-color: transparent; }
.entry-editor { padding: 0 0 var(--fd-space-4); border-bottom: 1px solid var(--fd-border-default); }
.history-month + .button.wide, .entries + .editor { margin-top: var(--fd-space-6); }

/* ---------- Requests ---------- */
.page-requests .filters { grid-template-columns: minmax(0, 1fr) auto; }
.page-requests .filters .date-range { grid-column: 1; }
.page-requests .filters .filter-actions { align-self: end; }
.rule-note { margin-top: var(--fd-space-3); max-width: 64ch; }
.request-summary { margin: var(--fd-space-8) 0 var(--fd-space-4); padding-top: var(--fd-space-6); border-top: 1px solid var(--fd-border-default); }
.request-total { margin: var(--fd-space-1) 0; font-size: 18px; color: var(--fd-text-secondary); }
.request-total strong {
  color: var(--fd-text-primary); font-size: var(--fd-font-size-hero); line-height: 1.1;
  font-weight: var(--fd-font-weight-medium); font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.request-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.request-table th, .request-table td { padding: var(--fd-space-3) var(--fd-space-3); text-align: left; vertical-align: baseline; border-bottom: 1px solid var(--fd-border-default); }
.request-table th:first-child, .request-table td:first-child { padding-left: 0; }
.request-table th:last-child, .request-table td:last-child { padding-right: 0; }
.request-table thead th { color: var(--fd-text-secondary); font-size: var(--fd-font-size-label); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.request-table tbody th { font-weight: var(--fd-font-weight-regular); }
.request-table .num { text-align: right; }
.request-table .days-cell strong { font-size: 16px; font-weight: 600; }
.request-table .pm-cell { color: var(--fd-text-secondary); overflow-wrap: anywhere; }
.request-table .pm-cell > span { display: block; }
.request-table .pm-email { font-size: var(--fd-font-size-meta); color: var(--fd-text-tertiary); }
.request-table .client-cell .client-name { font-size: 15px; }
.request-table .total-cell { color: var(--fd-text-secondary); }
.request-table .month-row th {
  padding-top: var(--fd-space-6); padding-bottom: var(--fd-space-2);
  font-family: var(--fd-font-display); font-size: 18px; font-weight: var(--fd-font-weight-medium);
}
.request-table .month-row th { display: table-cell; }
.request-table .month-row th > span:first-child { margin-right: var(--fd-space-3); }
.month-days { color: var(--fd-text-tertiary); font-family: var(--fd-font-interface); font-size: var(--fd-font-size-meta); font-weight: var(--fd-font-weight-regular); }
.mobile-only { display: none; }

/* ---------- Directory rows (Clients, Time off) ---------- */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--fd-border-default); }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--fd-space-4);
  min-height: 64px; padding: var(--fd-space-2) 0; border-bottom: 1px solid var(--fd-border-default);
}
.row-main { display: grid; gap: 2px; min-width: 0; padding-block: var(--fd-space-2); }
.row-title { font-size: 16px; font-weight: var(--fd-font-weight-medium); overflow-wrap: anywhere; }
.row-main .meta { overflow-wrap: anywhere; }
.row-count { color: var(--fd-text-secondary); font-size: var(--fd-font-size-meta); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { display: flex; align-items: center; gap: var(--fd-space-1); margin: 0; grid-column: -2 / -1; justify-self: end; }
.row-actions .row-action { min-width: 0; margin-right: 0; padding: 0 var(--fd-space-2); }
button.row-action { border: 0; background: none; font: inherit; font-weight: var(--fd-font-weight-medium); cursor: pointer; }
.row-actions .row-action:last-child { margin-right: calc(-1 * var(--fd-space-2)); }
.row-action.danger-text { color: var(--fd-feedback-danger); }
.row.is-open { border-bottom-color: transparent; }
.row-panel { padding: 0 0 var(--fd-space-4); border-bottom: 1px solid var(--fd-border-default); }
.row-panel > .inline-form, .row-panel > .confirm {
  padding: var(--fd-space-4); border: 1px solid var(--fd-border-default); border-radius: var(--fd-radius-card); background: var(--fd-surface-base);
}
.inline-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--fd-space-4); margin: 0; }
.inline-form .form-error, .inline-form .form-actions { grid-column: 1 / -1; }
.add-panel { margin-bottom: var(--fd-space-2); }
.add-panel .disclosure-body .inline-form { padding: var(--fd-space-4); border: 1px solid var(--fd-border-default); border-radius: var(--fd-radius-card); background: var(--fd-surface-base); }
.directory .section-heading:first-child { margin-top: var(--fd-space-6); }
.pm-directory .add-panel { margin-top: var(--fd-space-2); border-top: 0; }
#archived { margin-top: var(--fd-space-6); }

/* ---------- Time off ---------- */
.panel { padding: var(--fd-space-6); border: 1px solid var(--fd-border-default); border-radius: var(--fd-radius-card); background: var(--fd-surface-base); }
.panel-heading { font-size: 20px; line-height: var(--fd-line-height-heading); margin-bottom: var(--fd-space-4); }
.time-off-form { display: grid; gap: var(--fd-space-4); margin: 0; }
.segmented { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: fit-content; margin: 0; padding: 3px; border: 1px solid var(--fd-border-default); border-radius: var(--fd-radius-control); background: var(--fd-surface-raised); }
.segment { position: relative; }
.segment input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; cursor: pointer; }
.segment span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 var(--fd-space-4); border-radius: var(--fd-radius-chip); color: var(--fd-text-secondary); font-weight: var(--fd-font-weight-medium); white-space: nowrap; }
.segment input:checked + span { background: var(--fd-surface-base); color: var(--fd-text-primary); box-shadow: 0 1px 2px #0000001f, 0 0 0 1px var(--fd-border-default); }
.segment input:focus-visible + span { outline: 2px solid var(--fd-border-focus); outline-offset: 2px; }
.time-off-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--fd-space-4); }

/* ---------- Login and error pages ---------- */
.solo { min-height: 100dvh; display: grid; place-items: center; padding: var(--fd-space-8) var(--wl-gutter); }
.solo-content { width: min(100%, 380px); display: grid; gap: var(--fd-space-4); }
.solo-brand { margin-bottom: var(--fd-space-8); }
.solo h1 { font-size: var(--fd-title-base); line-height: var(--fd-line-height-title); letter-spacing: -.02em; overflow-wrap: anywhere; }
.solo-text { color: var(--fd-text-secondary); }
.login-form { display: grid; gap: var(--fd-space-4); margin-top: var(--fd-space-2); }
.login-form .button.wide { margin-top: 0; min-height: 48px; }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  :root[data-product="work-ledger"] { --wl-gutter: var(--fd-gutter-mobile); --wl-row-date: 76px; }
  .app-header { min-height: 64px; }
  .brand-name { font-size: 20px; }
  .tabs { gap: 20px; margin-inline: calc(-1 * var(--wl-gutter)); padding-inline: var(--wl-gutter); }
  .page-heading { margin: var(--fd-space-6) 0 var(--fd-space-4); }
  .week-title h1 { font-size: 26px; }
  .button.log-day { width: 44px; padding: 0; }
  .button.log-day span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .week-summary { gap: var(--fd-space-4); }
  .coverage { width: 100%; }
  meter { width: 100%; }
  .timesheet { width: 100%; justify-content: space-between; }
  .timesheet-copy { justify-items: start; text-align: left; }
  .day { gap: var(--fd-space-3); }
  .day-date { flex-direction: column; gap: 0; }
  .editor { padding: var(--fd-space-4); }
  .editor-form { grid-template-columns: minmax(0, 1fr); }
  .form-actions .button { flex: 1; }
  .page-heading .button.secondary span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .page-heading .button.secondary { width: 44px; padding: 0; }
  .filter-grid { grid-template-columns: minmax(0, 1fr); padding: var(--fd-space-4) var(--fd-space-3); gap: var(--fd-space-4); }
  .page-requests .filters { grid-template-columns: minmax(0, 1fr); }
  .page-requests .filters .filter-actions, .page-requests .filters .date-range { grid-column: 1; grid-row: auto; }
  .entry { gap: var(--fd-space-3); }
  .request-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .request-table, .request-table tbody, .request-table tr, .request-table th, .request-table td { display: block; }
  .request-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--fd-space-3); padding: var(--fd-space-3) 0; border-bottom: 1px solid var(--fd-border-default); }
  .request-table th, .request-table td { padding: 0; border: 0; }
  .request-table .client-cell { grid-column: 1; }
  .request-table .days-cell { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; }
  .request-table td[data-label="Client total"] { display: none; }
  .request-table .pm-cell { grid-column: 1; font-size: var(--fd-font-size-meta); }
  .request-table .pm-cell > span { display: inline; }
  .request-table .pm-name + .pm-email::before { content: " · "; }
  .request-table .month-row { display: flex; align-items: baseline; padding: var(--fd-space-6) 0 var(--fd-space-2); }
  .request-table .month-row th { display: block; padding: 0; }
  .mobile-only { display: inline; color: var(--fd-text-secondary); font-weight: var(--fd-font-weight-regular); }
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .row .row-count { grid-column: 1; grid-row: 2; margin-top: -10px; padding-bottom: var(--fd-space-2); }
  .row .row-actions { grid-column: 2; grid-row: 1 / span 2; }
  .inline-form, .time-off-dates { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: var(--fd-space-4); }
  .segmented { width: 100%; }
}
@media (max-width: 400px) {
  .week-title h1 { font-size: 23px; }
  .week-controls .text-button { margin-left: 0; flex-basis: 100%; }
  .brand-name { font-size: 18px; }
  .brand-mark { width: 26px; height: 26px; }
}
@media (max-width: 360px) {
  .tabs { gap: 14px; }
  .tabs a { font-size: 13px; }
}

/* Foundry 2: the iOS home-screen top-clearance rule clears the system's blurred top edge. The 72px row box (24px clearance above it) puts the brand centre at the same height as Orbit (72px header) and RepUp. */
@media (display-mode: standalone) {
  @supports (-webkit-touch-callout: none) { .app-header { padding-top: calc(env(safe-area-inset-top, 0px) + 24px); min-height: calc(env(safe-area-inset-top, 0px) + 24px + 72px); } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
