:root {
  --ink: #1c2833;
  --muted: #5e6d7b;
  --line: #d7dee6;
  --bg: #e7edf2;
  --sidebar: #14202b;
  --sidebar-text: #d5dee7;
  --accent: #1280b0;
  --green: #2f9e44;
  --green-dark: #217a34;
  --sheet: #ffffff;
  --danger: #9d2c2c;
  --shadow: 0 10px 30px rgba(20, 32, 43, 0.08);
  /* Schedule page palette. Other pages use these tokens; schedule rules keep the same values. */
  --sched-navy: #14202b;
  --sched-blue: #2457d6;
  --sched-blue-dark: #1c46b4;
  --sched-lavender: #e7e4fb;
  --sched-lavender-ink: #2a2460;
  --sched-lavender-deep: #3d348b;
  --sched-pill: #eceff3;
  --sched-chip: #f4f7fa;
  --sched-gold: #e0a100;
  --sched-fab-ink: #241b4a;
  --sched-radius-card: 16px;
  --sched-radius-action: 14px;
  --sched-radius-control: 12px;
  --sched-radius-pill: 999px;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--sched-blue); }
h1 { font-size: 1.55rem; margin: 0 0 0.6rem; font-weight: 750; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 0.6rem; }
p { line-height: 1.45; }

.app-shell { min-height: 100vh; }
.layout-desktop .app-shell { display: flex; align-items: stretch; }
.layout-desktop .sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
}
.layout-desktop .content { flex: 1; padding: 28px 32px 64px; min-width: 0; }
.layout-desktop .mobile-top,
.layout-desktop .mobile-tabbar,
.layout-mobile .sidebar { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 22px 18px 12px;
}
.brand .mark { color: #3eb5e6; display: flex; }
.brand-dark { color: var(--ink); padding: 0 0 8px; }
.brand-dark .mark { color: var(--sched-blue); }

.main-menu { display: flex; flex-direction: column; padding: 8px 12px; gap: 4px; }
.main-menu a {
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}
.main-menu a.active,
.main-menu a:hover { background: #243140; color: white; }
.menu-row { display: flex; align-items: center; gap: 4px; }
.menu-row > a { flex: 1 1 auto; min-width: 0; }
.main-menu .submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 4px 14px;
  padding-left: 10px;
  border-left: 2px solid #2c3b4b;
}
.submenu[hidden],
.fold-body[hidden],
.group-body[hidden] { display: none !important; }
.fold-head,
.group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  position: relative;
}
.fold-head > .fold-toggle,
.group-head > .group-toggle {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  z-index: 0;
}
.fold-head > :is(h2, h3, h4, .takeoff-grand),
.group-head > :is(h2, h3, h4) {
  grid-column: 1;
  grid-row: 1;
  z-index: 1;
  pointer-events: none;
  margin: 0;
  min-width: 0;
}
.menu-row > a {
  pointer-events: auto;
  position: relative;
  z-index: 2;
}
.expense-list-fold-head h2 {
  font-size: inherit;
  font-weight: 750;
  line-height: 1.35;
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.project-screen .fold-section { margin: 18px 0; }
.project-screen .fold-head h2 { flex: 1 1 auto; min-width: 0; }
.project-screen .fold-body { margin-top: 8px; }
.quote-revision-list { list-style: none; padding: 0; margin: 8px 0 16px; }
.quote-revision-list .quote-revision {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.quote-revision-list .quote-revision a { min-height: 44px; display: inline-flex; align-items: center; }
.quote-revision-separator {
  margin: 16px 0 4px;
  padding: 10px 0 0;
  border-top: 2px solid var(--ink);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}
.fold-toggle:focus-visible,
.group-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.fold-toggle {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.main-menu .fold-toggle {
  color: var(--sidebar-text);
  background: transparent;
  border-color: #3d5164;
}
.main-menu .submenu a { padding: 7px 12px; font-size: 0.92rem; }
.sidebar-extra { display: flex; flex-direction: column; padding: 8px 12px; gap: 4px; border-top: 1px solid #2c3b4b; margin-top: 12px; }
.sidebar-extra a { color: #b7c5d2; text-decoration: none; padding: 8px 12px; font-size: 0.92rem; border-radius: 8px; }
.sidebar-extra a.active,
.sidebar-extra a:hover { background: #243140; color: white; }
.list-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin: 8px 0 14px; }
.search-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.search-form label { min-width: 240px; }
.search-form .check-row { min-width: 0; margin-bottom: 8px; }
.mapping-transfer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fbf8;
}
.mapping-transfer form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 0; }
.mapping-transfer label { min-width: 0; flex: 1 1 180px; }
.mapping-transfer input[type="file"] { width: auto; max-width: 100%; font-weight: 450; }
.mapping-import-row { margin: 0 0 12px; }
.mapping-restore-summary { margin: 0 0 16px; }
.mapping-restore-summary h2 { margin: 0 0 6px; font-size: 1.05rem; }
.mapping-restore-summary ul { margin: 0; padding-left: 18px; }
.mapping-section, .mapping-group, #mapping-unmapped { margin: 18px 0; }
.mapping-section h2, .mapping-group h2, #mapping-unmapped h2 { margin-bottom: 8px; }
.category-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0;
  min-width: 0;
}
.category-inline select {
  width: auto;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 8rem;
}
.category-inline .btn-save {
  min-height: 36px;
  padding: 4px 10px;
  font-size: 0.85rem;
}
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: #d94841;
  color: white;
  font-size: 0.75rem;
  font-weight: 750;
  vertical-align: middle;
}
.sidebar-user { margin-top: auto; padding: 16px 18px 20px; border-top: 1px solid #2c3b4b; }
.sidebar-user strong, .who strong { display: block; }
.sidebar-user span, .who span { color: #93a4b5; font-size: 0.85rem; }
.sidebar-user button, .mobile-top button {
  margin-top: 8px;
  background: transparent;
  color: inherit;
  border: 1px solid #3d5164;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

.layout-mobile { background: #f4f7fa; }
.layout-mobile .content { padding: 76px 14px 96px; max-width: 520px; margin: 0 auto; }
.layout-mobile .mobile-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--sidebar);
  color: white;
  z-index: 5;
  padding-right: 10px;
}
.layout-mobile .mobile-top .brand { padding: 10px 12px; }
.layout-mobile .who { margin-left: auto; text-align: right; font-size: 0.82rem; }
.layout-mobile .who span { display: block; }
.layout-mobile .mobile-tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-wrap: wrap;
  background: white;
  border-top: 1px solid var(--line);
  z-index: 5;
}
.layout-mobile .mobile-tabbar > a,
.layout-mobile .mobile-tabbar > .menu-row { flex: 1 0 0; min-width: 0; }
.layout-mobile .mobile-tabbar .menu-row > a { padding: 12px 2px 14px; }
.layout-mobile .mobile-tabbar .fold-toggle {
  color: var(--muted);
  background: transparent;
  border: 0;
  min-width: 44px;
}
.layout-mobile .mobile-tabbar a {
  text-align: center;
  text-decoration: none;
  color: var(--muted);
  padding: 12px 4px 14px;
  font-size: 0.78rem;
  font-weight: 650;
  min-height: 52px;
}
.layout-mobile .mobile-tabbar a.active { color: var(--accent); }
.layout-mobile .mobile-tabbar .submenu {
  flex: 1 0 100%;
  display: flex;
  gap: 4px;
  padding: 0 8px 8px;
}
.layout-mobile .mobile-tabbar .submenu a {
  flex: 1;
  min-height: 44px;
  padding: 10px 8px;
  border-radius: 8px;
  background: #f4f7fa;
}

.panel, .sheet {
  background: var(--sheet);
  border-radius: var(--sched-radius-card);
  box-shadow: var(--shadow);
  padding: 22px;
}
.panel:not(.schedule-page) { border: 1px solid var(--line); }
.coming-soon { color: var(--muted); font-size: 1.05rem; }
.muted, .hint { color: var(--muted); font-size: 0.88rem; }
.hint { margin: 4px 0 10px; }
.pre { white-space: pre-wrap; margin: 0; }
.form-error, .banner {
  background: #fdecec;
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
}
.banner { background: #e8f6ec; color: #176634; }
.won-banner { background: #fff4e5; color: #7a3e00; border: 1px solid #e6c48a; }
.variation-label {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e7f0fb;
  color: #1d4e89;
  font-size: 0.78rem;
  font-weight: 700;
}
.revision-select { display: grid; gap: 4px; max-width: 280px; margin: 0 0 12px; font-weight: 650; }
.revision-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin: 0 0 12px;
}
.revision-bar .revision-select { margin: 0; }
.revision-bar form { margin: 0; }
.revision-sync { margin: 0 0 8px; font-weight: 650; }
.change-step { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.change-step h3, .change-step h4 { margin: 8px 0 4px; }
.included-variation { margin-top: 16px; }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.check-row input { width: auto; }
.notice {
  background: #fff8e8;
  color: #6b4e00;
  border: 1px solid #e6d39a;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
}

.choice-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; min-width: 0; }
.section-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.section-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
  background: var(--sched-pill);
  border-radius: var(--sched-radius-pill);
  padding: 8px 14px;
  font-weight: 700;
}
.section-tabs a.active { background: var(--sched-lavender); color: var(--sched-lavender-ink); }
.import-counts { margin: 0 0 12px; padding-left: 18px; }
.import-match { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0; }
.import-match legend { font-weight: 700; padding: 0 6px; }
.alias-edit { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  text-decoration: none;
  color: var(--ink);
  border: 1.5px solid #d5d0f2;
  background: #f8f7fd;
  border-radius: var(--sched-radius-card);
  padding: 16px;
  text-align: left;
}
a.choice:hover { border-color: var(--sched-lavender-deep); background: var(--sched-lavender); }
button.choice:disabled { opacity: 0.6; cursor: not-allowed; background: #f3f5f7; border-color: var(--line); }

.data { width: 100%; border-collapse: collapse; }
.data th, .data td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data th { color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em; background: var(--sched-chip); }
.data tbody tr:hover { background: var(--sched-chip); }
.num { text-align: right; }
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--sched-radius-card); background: white; }
.takeoff-list td { overflow-wrap: anywhere; }

.stack-form { display: grid; gap: 12px; max-width: 640px; }
.settings-nav { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 14px; }
.settings-nav a { font-weight: 750; }
.settings-nav a[aria-current="page"] { color: inherit; text-decoration: none; }
#backup-page .backup-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 18px; }
#backup-page h2 { margin: 18px 0 8px; font-size: 1.15rem; }
label { display: grid; gap: 4px; font-size: 0.92rem; font-weight: 650; }
input, select, textarea {
  width: 100%;
  border: 1px solid #c5d0da;
  border-radius: var(--sched-radius-control);
  padding: 8px 10px;
  background: white;
  font-weight: 450;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--sched-blue);
  outline-offset: 1px;
  border-color: var(--sched-blue);
}
textarea { resize: vertical; }

.btn { border: 0; border-radius: var(--sched-radius-pill); padding: 8px 16px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; font-weight: 700; }
.btn-save { background: var(--sched-blue); color: white; font-weight: 800; border-radius: var(--sched-radius-action); min-height: 44px; justify-content: center; }
.btn-save:hover { background: var(--sched-blue-dark); }
.btn-cancel { background: var(--sched-pill); color: #243140; border-radius: var(--sched-radius-pill); }
.btn:disabled { opacity: 0.6; cursor: wait; }

.signin-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin-card { width: min(420px, 100%); background: white; border-radius: var(--sched-radius-card); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 28px; }
.signin-card h1 { margin-top: 8px; }
.signin-card form { display: grid; gap: 8px; }
.lede { color: var(--muted); margin-top: 0; }

.quote-toolbar, .view-tools {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.view-note, .totals-note { text-align: center; }
.sheet { max-width: 1040px; margin: 0 auto; padding: 28px 32px 36px; }
.sheet-head { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-bottom: 18px; }
.wordmark { display: flex; align-items: center; gap: 8px; color: var(--sched-blue); font-size: 1.4rem; letter-spacing: 0.08em; text-transform: uppercase; }
.company-block p { margin: 4px 0; }
.meta-block { display: grid; gap: 8px; }
.client-add, .add-line {
  width: 100%;
  border: 1.5px dashed var(--sched-blue);
  color: var(--sched-lavender-deep);
  background: white;
  border-radius: var(--sched-radius-action);
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
}
.client-add { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 74px; }
.person { color: var(--sched-blue); display: flex; }
.client-fields { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.field-title { margin: 0; font-weight: 700; }
.address-row { display: grid; grid-template-columns: 1.4fr 0.6fr 0.7fr; gap: 8px; }
.group-toggle { display: flex; align-items: center; gap: 8px; margin: 8px 0 12px; font-weight: 650; }
.group-toggle input { width: auto; }
.line-section { margin-bottom: 14px; }
.section-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.section-head .fold-toggle { margin-left: auto; }
.section-head .linkish { white-space: nowrap; }
.section-head input { font-weight: 700; }
.section-notes { margin-top: 8px; min-height: 70px; }
.lines { width: 100%; border-collapse: collapse; }
.lines th { text-align: left; font-size: 0.78rem; color: var(--muted); font-weight: 700; letter-spacing: 0.02em; padding: 8px 6px; border-bottom: 1px solid var(--line); background: var(--sched-chip); }
.lines td { padding: 6px; vertical-align: top; }
.lines th:nth-child(1), .lines td:nth-child(1) { width: 34%; }
.lines th:nth-child(n+2), .lines td:nth-child(n+2) { width: 11%; }
.lines input { padding: 7px 8px; }
.linkish { background: none; border: 0; color: var(--sched-blue); cursor: pointer; padding: 0; font-weight: 650; }
.add-section { margin-top: 8px; }
.totals { width: min(420px, 100%); margin: 18px 0 0 auto; display: grid; gap: 6px; }
.total-row, .doc-totals div { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.total-actions { display: flex; align-items: center; gap: 8px; }
.mini { width: 120px; }
.grand { border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 8px; font-weight: 800; font-size: 1.15rem; }

.quote-doc { max-width: 860px; }
.doc-kicker { text-align: center; letter-spacing: 0.18em; font-size: 1.3rem; }
.doc-top { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 18px; }
.doc-company { font-size: 1.35rem; font-weight: 750; margin: 0 0 4px; }
.doc-label { font-weight: 750; margin-bottom: 4px; }
.doc-prepared { text-align: right; }
.doc-company-col { min-width: 0; }
.doc-line { margin: 0; line-height: 1.35; }
.doc-client { margin: 0; }
.doc-site {
  width: fit-content;
  max-width: 100%;
  margin: 0.9em 0 0 auto;
  padding: 6px 8px;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  text-align: left;
  line-height: 1.35;
}
.doc-site strong { font-weight: 750; }
.doc-logo, .logo-preview {
  display: block;
  width: auto;
  height: auto;
  max-height: 80px;
  max-width: 240px;
  object-fit: contain;
  margin: 0 0 8px;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.logo-preview { max-height: 64px; }
.logo-settings { display: grid; gap: 10px; margin-bottom: 18px; max-width: 640px; }
.doc-meta {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 16px;
  row-gap: 2px;
  width: max-content;
  max-width: 100%;
  margin: 12px 0 0 auto;
  text-align: left;
}
.doc-meta dt { font-weight: 650; margin: 0; white-space: nowrap; }
.doc-meta dd { margin: 0; text-align: right; white-space: nowrap; }
.doc-description { margin: 8px 0 0; font-weight: 800; }
.doc-rule { border: 0; border-top: 2px solid var(--ink); margin: 6px 0 12px; height: 0; }
.doc-lines th { text-align: left; font-size: 0.82rem; color: var(--muted); font-weight: 650; padding: 4px 8px 4px 0; }
.doc-lines th.num, .doc-lines td.num { text-align: right; }
.quote-doc { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.validity-wrap { position: relative; display: grid; gap: 4px; }
.validity-toggle {
  width: 100%;
  text-align: left;
  border: 1px solid #c5d0da;
  border-radius: 6px;
  padding: 8px 10px;
  background: white;
  font-weight: 450;
  cursor: pointer;
}
.validity-menu {
  position: absolute;
  z-index: 4;
  top: 100%;
  left: 0;
  min-width: 180px;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.validity-menu [role="option"] { padding: 8px 10px; cursor: pointer; border-radius: 6px; }
.validity-menu [role="option"]:hover { background: var(--sched-lavender); }
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input { width: auto; }
.site-block { display: grid; gap: 8px; }
.view-tools form { margin: 0; }
.doc-section { margin: 16px 0; }
.doc-section h2 { margin-bottom: 6px; }
.doc-group {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}
.doc-group-name { min-width: 0; }
.doc-group-total {
  margin-left: auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.doc-lines { width: 100%; border-collapse: collapse; }
.doc-lines td { padding: 2px 8px 2px 0; vertical-align: top; }
.doc-lines .qty { width: 48px; text-align: right; }
.doc-lines .times { width: 16px; color: var(--muted); }
.section-notes { color: #31414f; }
.doc-totals { width: min(320px, 100%); margin: 18px 0 18px auto; display: grid; gap: 4px; }
.valid { font-weight: 750; }
.exclusions { margin-top: 0; }
.row-actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.row-actions form { margin: 0; }
#expenses-page .row-actions { flex-wrap: wrap; white-space: normal; }
#import-data-page { min-width: 0; max-width: 100%; }
#import-data-page .import-form {
  display: grid;
  gap: 12px;
  width: min(640px, 100%);
  max-width: 100%;
  justify-items: start;
}
#import-data-page .import-form > label {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
#import-data-page .import-form input[type="file"],
#import-data-page .import-form select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
#import-data-page .import-form .btn-save {
  width: 260px;
  max-width: 100%;
}
#expense-import-summary { margin: 0 0 16px; }
#expense-import-summary h2 { margin: 0 0 6px; font-size: 1.05rem; }
#expense-import-summary h3 { margin: 10px 0 6px; font-size: 1rem; }
#expense-import-summary ul { margin: 0; padding-left: 18px; }
#project-client-form { margin: 0 0 12px; flex-wrap: wrap; align-items: flex-end; }
#project-client-form .picker-field { flex: 1 1 20rem; min-width: 0; }
#project-client-form .picker-head { grid-template-columns: minmax(12rem, 1fr) auto auto; }
#project-client-form .picker-head > .btn-save { grid-column: 3; grid-row: 1; align-self: end; }
#project-list .row-actions,
#project-page .row-actions { flex-wrap: wrap; white-space: normal; }
#project-record-actions { margin: 0 0 12px; }
#project-client-form select { min-width: 12rem; }
.is-inactive { color: var(--muted); }
.category-heading th {
  background: #f4f7fa;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 750;
  padding-top: 14px;
}
.category-heading .tag {
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
}
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { max-width: 320px; }
.page-heading { display: flex; align-items: center; gap: 8px; }
.desc-wrap { position: relative; display: flex; flex-direction: column; gap: 4px; }
.line-item-description { font-weight: 450; }
.desc-cell { position: relative; z-index: 1; }
.lines tr.suggest-open .desc-cell { z-index: 6; }
.suggest {
  position: absolute;
  z-index: 6;
  left: 0;
  top: calc(100% + 4px);
  min-width: 100%;
  width: max-content;
  max-width: 420px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 4px;
}
.suggest-item, .suggest-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  width: 100%;
  text-align: left;
  border: 0;
  background: white;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 650;
}
.suggest-category { font-style: italic; }
.suggest-item small, .suggest-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 450;
}
.suggest-note { margin: 4px 8px; }
.suggest-price { color: var(--muted); font-weight: 650; }
.suggest-item:hover, .suggest-add:hover { background: var(--sched-lavender); }
.suggest-add { color: var(--sched-lavender-deep); }
.line-override { margin: 4px 0 0; color: #8a5a12; font-size: 0.75rem; font-weight: 650; }
.lines, .lines tbody, .lines tr, .lines td, .line-section, .sheet { overflow: visible; }

.unmapped {
  display: inline-block;
  margin-left: 6px;
  background: #fde8e8;
  color: var(--danger);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.75rem;
  font-weight: 750;
  white-space: nowrap;
  vertical-align: middle;
}
a.map-link {
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
a.map-link:hover { color: var(--sched-blue); }
a.unmapped.map-link {
  color: var(--danger);
  text-decoration: underline;
}
a.unmapped.map-link:hover { background: #f6d0d0; color: var(--danger); }
.takeoff-sheet { max-width: 1040px; margin: 0 auto; min-width: 0; }
#takeoff-notes { margin: 8px 0 16px; }
#takeoff-notes .stack-form { max-width: none; }
.takeoff-sheet h1 { margin-bottom: 0.3rem; }
.takeoff-block {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  padding: 12px 14px;
  margin: 0 0 12px;
}
.takeoff-awaiting { background: #fff8e8; border-color: #e6d39a; }
.takeoff-floor { margin: 8px 0 8px 8px; }
.takeoff-area { margin: 8px 0 8px 8px; }
.takeoff-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: start;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.takeoff-line .muted { margin: 4px 0; overflow-wrap: anywhere; }
.takeoff-qty { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.15rem; }
.group-total { margin: 8px 0 0; font-weight: 750; }
.group-toggle {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.takeoff-edit > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  list-style: none;
  cursor: pointer;
}
.takeoff-edit > summary::-webkit-details-marker { display: none; }
.takeoff-edit > summary::before {
  content: '+';
  font-size: 1.35rem;
  font-weight: 700;
  width: 1.25rem;
  text-align: center;
}
.takeoff-edit[open] > summary::before { content: '−'; }
.takeoff-group.is-collapsed > .group-body { display: none; }
.mapping-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 8px 0; }
.mapping-row label { display: grid; gap: 4px; }
.stage-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px 28px;
  align-items: start;
}
#task-mappings .stage-columns { grid-template-columns: minmax(0, 1fr); }
.stage-column h3, .stage-column h4 { margin: 0 0 8px; font-size: 1rem; }
.stage-column .mapping-row label { flex: 1 1 140px; min-width: 0; }
.stage-column input, .stage-column select { width: 100%; max-width: 100%; }
.stage-line,
.stage-add {
  --stage-btn: 5.5rem;
  margin: 0 0 8px;
}
.stage-line-task,
.stage-add-task {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(6.5rem, 0.7fr) var(--stage-btn) var(--stage-btn);
  column-gap: 8px;
  row-gap: 8px;
  align-items: end;
}
.stage-line-material,
.stage-add-material {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(7rem, 0.8fr) var(--stage-btn) var(--stage-btn);
  column-gap: 8px;
  row-gap: 8px;
  align-items: end;
}
.stage-line-edit {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(7rem, 0.7fr) minmax(0, 1fr) minmax(6.5rem, 0.7fr) var(--stage-btn) var(--stage-btn);
  column-gap: 8px;
  row-gap: 8px;
  align-items: end;
}
.stage-line > .stage-main,
.stage-add > .stage-line {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -2;
  column-gap: 0;
  row-gap: 0;
  align-items: end;
  min-width: 0;
  margin: 0;
}
.stage-line > .stage-remove {
  grid-column: -2 / -1;
  display: flex;
  align-items: end;
  margin: 0;
}
.stage-add > .stage-add-btn {
  grid-column: -2;
  grid-row: 1;
  margin: 0;
}
.stage-line label,
.stage-add label {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
}
.stage-line input,
.stage-line select,
.stage-add input,
.stage-add select,
.stage-line .btn,
.stage-add .btn {
  height: 38px;
  min-height: 38px;
  box-sizing: border-box;
}
.stage-line .btn,
.stage-add .btn {
  width: 100%;
  padding: 0 8px;
  justify-content: center;
}
.task-stage { color: var(--muted); font-size: 0.85rem; margin-right: 6px; }
.task-place { font-weight: 750; white-space: nowrap; }
.allowed-time { color: var(--muted); }
.expected-stages { list-style: none; padding: 0; margin: 8px 0 16px; max-width: 24rem; }
.expected-stages li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.expected-stages .expected-time { font-weight: 700; }
@media (max-width: 720px) {
  .stage-columns { grid-template-columns: minmax(0, 1fr); }
  .stage-line-task,
  .stage-line-material,
  .stage-line-edit,
  .stage-add-task,
  .stage-add-material {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
  }
  .stage-line > .stage-main,
  .stage-line > .stage-remove,
  .stage-add > .stage-line {
    display: contents;
  }
  .stage-line label,
  .stage-add label { flex: 1 1 100%; }
  .stage-line-material label,
  .stage-add-material label { flex: 1 1 calc(50% - 8px); }
  .stage-line::after,
  .stage-add::after {
    content: '';
    order: 1;
    flex-basis: 100%;
    height: 0;
  }
  .stage-line label,
  .stage-add label { order: 0; }
  .stage-line .btn,
  .stage-add .btn {
    order: 2;
    width: auto;
    flex: 0 0 auto;
  }
}
.quotes-catalogue { margin: 0 0 12px; }
.quotes-catalogue h3 { margin: 0 0 2px; }
.takeoff-names { margin: 0; color: var(--muted); }
.material-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.material-edit select { min-width: 12rem; width: auto; }
.supplier-code-edit { display: grid; gap: 6px; }
.supplier-code-edit select { min-width: 9rem; width: 9rem; }
.material-pick { position: relative; width: 100%; min-width: 0; }
.material-pick-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.material-pick-error { margin: 4px 0 0; }
.material-pick-suggestions {
  position: absolute;
  z-index: 30;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 12rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  background: white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.material-pick-option {
  padding: 8px 10px;
  cursor: pointer;
}
.material-pick-option[aria-selected="true"],
.material-pick-option:hover {
  background: var(--sched-blue-soft, #eef4ff);
}
.supplier-code-tools { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; justify-content: space-between; margin: 0 0 12px; }
.supplier-code-categories-link { margin: 0; }
.group-by { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 0; }
.group-by select { min-width: 10rem; }
.supplier-code-group { margin: 0 0 10px; border: 1px solid var(--line); border-radius: var(--sched-radius-card); background: white; }
.supplier-code-group > summary.supplier-code-group-toggle {
  display: list-item;
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 750;
  list-style: none;
}
.supplier-code-group-line {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  pointer-events: none;
}
.supplier-code-group > summary.supplier-code-group-toggle::-webkit-details-marker { display: none; }
.supplier-code-group > summary.supplier-code-group-toggle::marker { content: ''; }
.supplier-code-group > summary.supplier-code-group-toggle:focus-visible {
  outline: 2px solid var(--sched-blue);
  outline-offset: -2px;
}
.supplier-code-table { width: 100%; table-layout: fixed; }
.supplier-code-table th:nth-child(1) { width: 12%; }
.supplier-code-table th:nth-child(2) { width: 11%; }
.supplier-code-table th:nth-child(3) { width: 14%; }
.supplier-code-table th:nth-child(4) { width: 15%; }
.supplier-code-table th:nth-child(5) { width: 19%; }
.supplier-code-table th:nth-child(6) { width: 8%; }
.supplier-code-table th:nth-child(7) { width: 13%; }
.supplier-code-table th:nth-child(8) { width: 8%; }
#supplier-codes .supplier-code-table select,
#supplier-codes .supplier-code-table .material-pick-input,
#supplier-codes .supplier-code-table input[name="unitQty"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.supplier-code-group-icon { width: 1rem; flex: 0 0 auto; text-align: center; pointer-events: none; }
.supplier-code-group-icon::before { content: '+'; }
.supplier-code-group[open] > summary .supplier-code-group-icon::before { content: '\2212'; }
.supplier-code-group-name { flex: 1 1 auto; min-width: 0; pointer-events: none; }
.supplier-code-group-count { color: var(--muted); font-weight: 650; pointer-events: none; }
.supplier-code-group-body { padding: 0 8px 8px; }
.material-unit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.material-unit select,
#supplier-codes select[name="unit"] { width: 5rem; min-width: 5rem; }
#supplier-codes input[name="unitQty"],
#add-supplier-code input[name="unitQty"] { width: 6rem; }
.supplier-item-list { list-style: none; padding: 0; margin: 0; }
.supplier-item-list li + li { margin-top: 4px; }
.average-missing { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.mapping-item { margin: 0 0 16px; padding: 12px; border: 1px solid var(--line); border-radius: var(--sched-radius-card); background: white; }
.takeoff-grand { font-size: 1.25rem; font-weight: 800; margin: 8px 0 16px; }
.takeoff-sheet .fold-head { flex-wrap: wrap; }
.takeoff-grand-head { margin: 8px 0 16px; }
.takeoff-grand-head .takeoff-grand,
.takeoff-sheet .fold-head h2 { margin: 0; min-width: 0; flex: 1 1 10rem; }
.takeoff-summary { list-style: none; padding: 0; margin: 0; }
.takeoff-summary li {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.takeoff-summary li > span { min-width: 0; overflow-wrap: anywhere; }
.takeoff-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
}
.takeoff-fields label { display: grid; gap: 4px; font-size: 0.92rem; min-width: 0; }
.takeoff-fields input { width: 100%; min-width: 0; }
.takeoff-fields .check-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 650;
  white-space: nowrap;
}
.takeoff-fields .check-row input { width: auto; }
.takeoff-fields.takeoff-add-line,
form.entry-form.takeoff-fields {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}
.takeoff-add-line .entry-line {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(11rem, 1.4fr) minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  column-gap: 10px;
  row-gap: 4px;
  align-items: stretch;
}
form.entry-form:not(.takeoff-add-line) .entry-line {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
}
.takeoff-add-line .entry-line > .takeoff-field,
.takeoff-add-line .entry-line > .add-action {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 2;
  align-items: end;
  min-width: 0;
}
.takeoff-add-line .entry-line > .desc-wrap {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 3;
  align-items: end;
  gap: 0;
  min-width: 0;
}
.entry-lines { display: grid; gap: 12px; }
.entry-line {
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  padding: 12px 14px;
  background: white;
}
.entry-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.takeoff-add-line .suggest { position: absolute; }
.import-new-names { margin: 12px 0; padding: 12px; }
.takeoff-edit { margin-top: 4px; }
.takeoff-edit summary { cursor: pointer; color: var(--sched-blue); }
.takeoff-sheet .suggest { max-width: min(420px, 100%); }
.takeoff-fields > .catalogue-missing { grid-column: 1 / -1; }
.catalogue-missing {
  margin: 0;
  color: var(--danger);
  font-size: 0.92rem;
  font-weight: 650;
}
.catalogue-missing a { color: inherit; text-decoration: underline; }

@media screen and (max-width: 860px) {
  .sheet-head, .doc-top, .choice-row, .address-row, .alias-edit { grid-template-columns: 1fr; }
  .choice { overflow-wrap: anywhere; }
  .doc-prepared, .doc-meta { text-align: left; }
  .doc-meta { margin-left: 0; }
  .layout-desktop .sidebar { width: 196px; flex-basis: 196px; }
  .takeoff-line, .takeoff-fields { grid-template-columns: 1fr; }
  .lines th:nth-child(1), .lines td:nth-child(1) { width: 28%; }
  .lines th:nth-child(n+2), .lines td:nth-child(n+2) { width: 16%; }
  .lines input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
    padding-left: 4px;
    padding-right: 4px;
  }
  .lines input[type="number"]::-webkit-outer-spin-button,
  .lines input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  .takeoff-add-line .entry-line,
  form.entry-form .entry-line {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
  .takeoff-add-line .entry-line > .takeoff-field,
  .takeoff-add-line .entry-line > .add-action,
  .takeoff-add-line .entry-line > .desc-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    grid-row: auto;
    align-items: stretch;
  }
  .takeoff-add-line .check-row { white-space: normal; }
  .takeoff-floor, .takeoff-area { margin-left: 0; }
  .takeoff-summary li { align-items: flex-start; }
  .takeoff-list thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .takeoff-list,
  .takeoff-list tbody,
  .takeoff-list tr,
  .takeoff-list td {
    display: block;
    width: auto;
  }
  .takeoff-list tr {
    border-bottom: 1px solid var(--line);
    padding: 8px 0 10px;
  }
  .takeoff-list td {
    border: 0;
    padding: 4px 0;
    text-align: left;
  }
  .takeoff-list td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 650;
  }
  .takeoff-list td.num { text-align: left; }
}

#invoice-settings {
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  margin: 8px 0 16px;
  padding: 8px 14px 4px;
}
#invoice-settings legend { padding: 0 6px; font-weight: 650; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.filter-row a {
  text-decoration: none;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.88rem;
}
.filter-row a.active { background: var(--sched-lavender); color: var(--sched-lavender-ink); border-color: transparent; }
.status-overdue { color: var(--danger); font-weight: 700; }
.status-paid { color: var(--green-dark); font-weight: 700; }
.payment-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin: 8px 0 16px;
}
.payment-form label { display: grid; gap: 4px; font-size: 0.88rem; }
.payment-form input, .payment-form select { width: 100%; }

@media (max-width: 800px) {
  .payment-form { grid-template-columns: 1fr; }
}

.project-screen .btn,
.project-screen .tick,
.project-screen .project-tabs a,
.project-screen .linkish { min-height: 44px; display: inline-flex; align-items: center; }
.project-screen input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.project-screen textarea,
.project-screen select { min-height: 44px; }
.site-variation-list, .site-variation-lines, .office-variation-list { list-style: none; padding: 0; margin: 8px 0 16px; }
.site-variation-list li, .site-variation-lines li, .office-variation-list li {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  background: white;
  min-width: 0;
}
.site-variation-detail, .site-variation-list a, .file-list a, .note-list p { overflow-wrap: anywhere; }
.office-variation-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.office-variation-actions .btn { min-height: 44px; }
#variation-date-row { margin: 0; }
.project-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 12px; }
#project-links a { overflow-wrap: anywhere; }
.project-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 0.6rem;
  min-width: 0;
  max-width: 100%;
}
.project-heading h1 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.view-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--sched-pill);
}
.view-toggle a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  padding: 8px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.view-toggle a + a { border-left: 1px solid var(--line); }
.view-toggle a.active { background: var(--sched-lavender); color: var(--sched-lavender-ink); }
.project-tabs { display: flex; gap: 8px; max-width: 420px; margin: 0 0 16px; }
.project-tabs a {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: var(--sched-radius-pill);
  background: var(--sched-pill);
  color: var(--ink);
  font-weight: 700;
  padding: 8px 12px;
}
.project-tabs a.active { background: var(--sched-lavender); color: var(--sched-lavender-ink); }
#project-tasks-link { margin: 4px 0 16px; }
.project-tasks-button { background: var(--sched-blue); color: white; font-weight: 800; border-radius: var(--sched-radius-action); }
.project-tasks-button:hover { background: var(--sched-blue-dark); }
.recent-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.recent-list li {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  background: white;
}
.recent-list a { font-weight: 700; }
.upload-form, .staff-tick { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.upload-form label, .staff-tick { flex: 1; min-width: 0; }
.file-list, .note-list, .task-list, .staff-list { list-style: none; padding: 0; margin: 8px 0 16px; }
.file-list li, .task-row, .staff-row, .note-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  background: white;
}
.note-list li { align-items: flex-start; }
.note-copy { flex: 1 1 160px; min-width: 0; }
.note-copy p { margin: 0 0 4px; overflow-wrap: anywhere; }
.note-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.note-actions form { margin: 0; }
.note-actions .btn { min-height: 44px; }
.note-task { margin: 0; font-weight: 700; }
.task-row form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.task-row.is-done .task-title,
.task-row.is-done .task-name,
.task-row.is-done .task-qty,
.task-row.is-done .task-location,
.task-row.is-done .task-place,
.task-row.is-done .task-stage,
.task-row.is-done .task-progress {
  text-decoration: line-through;
  color: #5c6b7a;
}
.not-in-takeoff {
  display: inline-block;
  background: #fff3cd;
  color: #6b4e00;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.75rem;
  font-weight: 750;
  white-space: nowrap;
}
.task-row.is-done .not-in-takeoff { text-decoration: none; }
.revision-stamp {
  display: inline-block;
  background: #e7f0ff;
  color: #1a3d7c;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.75rem;
  font-weight: 750;
  white-space: nowrap;
}
.revision-note {
  color: #6b4e00;
  font-size: 0.85rem;
  font-weight: 700;
}
.task-row.is-done .revision-stamp,
.task-row.is-done .revision-note { text-decoration: none; }
.tick {
  border: 1px solid var(--line);
  background: var(--sched-chip);
  border-radius: var(--sched-radius-pill);
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.task-screen, #project-tasks-page, #my-tasks, #project-tasks { max-width: 100%; overflow-x: hidden; }
.task-copy { min-width: 0; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.task-actions .btn, .task-actions button, .task-actions .tick { min-height: 44px; }
.task-new {
  background: #d94841;
  color: white;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 750;
}
.subcontractor-mark { font-weight: 750; }
.assign-all, .reassign-form, .add-task-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 8px 0 16px;
}
.assign-all label, .reassign-form label, .add-task-line label { display: grid; gap: 4px; min-width: 0; flex: 1 1 140px; }
.task-dialog {
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  padding: 16px;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
}
.task-dialog::backdrop { background: rgba(20, 32, 43, 0.45); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dialog-actions .btn { min-height: 44px; }
.task-actions .complete-form { flex: 1 1 100%; }
.task-actions .complete-tick {
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
  min-height: 56px;
  font-size: 1.05rem;
  background: var(--sched-blue);
  color: #fff;
  border-color: transparent;
}
.task-actions .complete-tick input { width: 1.15rem; height: 1.15rem; }
.stage-filter { margin: 8px 0 12px; }
.stage-filter summary {
  cursor: pointer;
  font-weight: 750;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.stage-filter-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.stage-option {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-pill);
  background: var(--sched-chip);
  font-weight: 700;
}
.stage-option.is-selected { background: var(--sched-lavender); color: var(--sched-lavender-ink); }
.stage-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
}
.stage-heading h2 { margin: 0; }
.stage-heading form { margin: 0; }
@media (max-width: 420px) {
  .task-row { flex-direction: column; align-items: stretch; }
  .task-actions { align-items: stretch; }
  .task-actions form, .task-actions .btn, .task-actions button { width: 100%; }
  .task-actions .tick, .task-actions .btn, .task-actions button { justify-content: center; }
  .task-actions .complete-form,
  .task-actions .complete-tick { width: 100%; }
  .task-actions .partial-btn {
    width: auto;
    max-width: 9rem;
    min-height: 36px;
    align-self: flex-start;
    padding: 4px 12px;
    font-size: 0.85rem;
  }
  .task-screen .task-place { flex: 1 1 100%; }
  .assign-all, .reassign-form, .add-task-line { display: grid; }
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin: 8px 0 16px;
}
.photo-card { margin: 0; display: grid; gap: 6px; }
.photo-thumb {
  padding: 0;
  border: 0;
  background: #d7dee6;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  width: 100%;
}
.photo-thumb img { width: 100%; height: 104px; object-fit: cover; display: block; }
#photo-lightbox { border: 0; border-radius: var(--sched-radius-card); padding: 12px; max-width: calc(100vw - 24px); background: var(--sched-navy); color: white; }
#photo-lightbox img { display: block; max-width: 100%; max-height: calc(100vh - 96px); margin: 8px auto 0; }
#photo-heic-note { margin: 8px 0 0; }
.staff-tick { align-items: center; }

@media (max-width: 420px) {
  .project-screen { max-width: 100%; }
  .project-tabs { max-width: none; gap: 6px; }
  .project-tabs a { padding: 8px 6px; font-size: 0.92rem; }
  .project-heading { gap: 6px; }
  .view-toggle a { padding: 8px 10px; font-size: 0.92rem; }
  .project-screen .stack-form,
  .project-screen .entry-form { max-width: none; }
  .project-screen .entry-line { grid-template-columns: 1fr; }
  .project-screen input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .project-screen textarea,
  .project-screen select { width: 100%; font-size: 16px; }
  .project-screen .btn,
  .project-screen .upload-form,
  .project-screen .file-list li,
  .project-screen .note-list li,
  .project-screen .task-row { max-width: 100%; }
  .office-variation-actions .btn { width: 100%; justify-content: center; }
}

@media (max-width: 800px) {
  .project-tabs { max-width: none; }
  .project-list thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .project-list, .project-list tbody, .project-list tr, .project-list td { display: block; width: auto; }
  .project-list tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .project-list td { border: 0; padding: 4px 0; }
  .project-list td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 650;
  }
  .upload-form, .staff-row, .task-row { align-items: stretch; }
  .upload-form, .staff-tick { display: grid; }
}

@media (max-width: 720px) {
  .layout-desktop .app-shell { display: block; }
  .layout-desktop .sidebar { display: none; }
  .layout-desktop .mobile-top { display: flex; }
  .layout-desktop .content { padding: 76px 14px 32px; }
  #mapping-page .mapping-items thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  #mapping-page .mapping-items,
  #mapping-page .mapping-items tbody,
  #mapping-page .mapping-items tr,
  #mapping-page .mapping-items td {
    display: block;
    width: auto;
  }
  #mapping-page .mapping-items tr {
    padding: 8px 0 10px;
    border-bottom: 1px solid var(--line);
  }
  #mapping-page .mapping-items td { border: 0; padding: 4px 0; }
  #mapping-page .mapping-items td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 650;
  }
  #mapping-page .category-inline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  #mapping-page .category-inline select { width: 100%; }
  #mapping-page .table-scroll { overflow-x: visible; }
}

.mark-unallocated, .mark-review {
  display: inline-block;
  margin: 0 6px 4px 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.mark-unallocated { background: #fff3bf; color: #7a5b00; }
.mark-review { background: #ffe3e3; color: #9d2c2c; }
.mark-unmapped {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: var(--sched-radius-pill);
  border: 1px solid var(--line);
  background: var(--sched-pill);
  color: var(--ink);
  font-weight: 700;
}
.line-material { min-width: 8rem; }
.material-map-link,
#unmapped-codes a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-left: 8px;
  padding: 4px 12px;
  border-radius: var(--sched-radius-pill);
  background: var(--sched-chip);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  white-space: nowrap;
}
.material-map-link:hover,
#unmapped-codes a:hover { background: var(--sched-lavender); color: var(--sched-lavender-ink); }
#create-tasks-from-takeoff-form { margin: 0 0 14px; }
.task-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.task-edit select, .task-edit input { min-width: 12rem; width: auto; }
.group-row td { font-weight: 750; background: #f4f7fa; }
.group-row .fold-head { min-height: 44px; }
.group-row .fold-head h2 { overflow-wrap: anywhere; }
#expenses-page .table-scroll { container-type: inline-size; }
#expenses-page .expense-list-fold-head {
  position: sticky;
  left: 0;
  width: calc(100cqw - 20px);
  max-width: 100%;
  box-sizing: border-box;
}
#expenses-page .expense-list-fold-head > .expense-group-label {
  grid-column: 1;
  grid-row: 1;
  z-index: 1;
  pointer-events: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  min-width: 0;
  max-width: 100%;
  padding-right: 52px;
  box-sizing: border-box;
}
#expenses-page .expense-group-total {
  margin: 0;
  font-weight: 450;
  min-width: 0;
}
#expenses-page .expense-tick-col { width: 2.4rem; }
#expenses-page .expense-tick { width: 2.4rem; }
#expenses-page .expense-tick-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
}
#expenses-page .expense-select-all-label {
  pointer-events: auto;
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-weight: 450;
}
#expenses-page input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  min-height: 1.15rem;
  margin: 0;
  padding: 0;
}
#expenses-page .expense-project-cell {
  position: relative;
  width: 11.5rem;
  max-width: 11.5rem;
}
#expenses-page .expense-project-cell .project-pick {
  display: block;
  width: 11.5rem;
  max-width: 100%;
  min-width: 0;
}
#expenses-page .expense-project-cell .project-pick-input,
#expenses-page .expense-project-cell .expense-project-select {
  width: 11.5rem;
  max-width: 100%;
  min-width: 0;
}
#expenses-page .project-pick.is-enhanced .expense-project-select {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
#expenses-page .expense-project-form:has(.is-enhanced) + .mark-unallocated {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
}
#expenses-page .project-set-fallback { margin-top: 6px; }
.expense-bulk-bar {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  background: white;
  max-width: 100%;
}
.expense-bulk-bar form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: 0;
  max-width: 100%;
}
#expense-bulk-count { margin: 0; font-weight: 700; }
#expense-bulk-bar .project-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: 1 1 16rem;
  min-width: 0;
  max-width: 100%;
}
#expense-bulk-bar .project-pick-input,
#expense-bulk-bar .expense-project-select {
  flex: 1 1 12rem;
  width: 12rem;
  max-width: 100%;
  min-width: 0;
}
#set-project-for-selected { max-width: 100%; }
.expense-bulk-bar.has-selection { border-color: var(--sched-blue); }
.project-pick-list {
  position: fixed;
  z-index: 40;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: auto;
  box-sizing: border-box;
}
.project-pick-list [role="option"] {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.project-pick-list [role="option"]:hover,
.project-pick-list [role="option"][aria-selected="true"] { background: var(--sched-lavender); }
.expense-project-dialog {
  width: min(28rem, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  padding: 16px;
  box-shadow: var(--shadow);
}
.expense-project-dialog::backdrop { background: rgba(20, 32, 43, 0.45); }
.expense-project-dialog h2 { margin-top: 0; }
.expense-project-dialog form { display: grid; gap: 12px; margin: 0; }
.expense-project-dialog input,
.expense-project-dialog select { max-width: 100%; min-width: 0; }
@media (max-width: 420px) {
  .expense-project-dialog .picker-head { grid-template-columns: minmax(0, 1fr); }
  .expense-project-dialog .picker-head .inline-add,
  .expense-project-dialog .picker-head .inline-add[open] {
    grid-column: 1;
    grid-row: auto;
  }
  .expense-project-dialog .dialog-actions { align-items: stretch; }
  .expense-project-dialog .dialog-actions .btn { justify-content: center; }
  #expense-bulk-bar .project-pick,
  #set-project-for-selected { flex-basis: 100%; }
}
.expense-form { display: grid; gap: 16px; position: relative; }
.expense-fields { display: grid; gap: 12px; max-width: 640px; }
.submit-proxy {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.picker-field { display: grid; gap: 8px; }
.picker-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: end;
}
.picker-head > label { grid-column: 1; grid-row: 1; min-width: 0; }
.picker-head .inline-add { grid-column: 2; grid-row: 1; align-self: end; }
.picker-head .inline-add[open] { grid-column: 1 / -1; grid-row: 2; }
.inline-add summary {
  cursor: pointer;
  color: var(--sched-blue);
  font-weight: 750;
  min-height: 44px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  list-style: none;
}
.inline-add summary::-webkit-details-marker { display: none; }
.inline-add summary::marker { content: ''; }
.inline-add[open] {
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  background: #f8f7fd;
  padding: 4px 12px 12px;
}
.inline-add-fields { display: grid; gap: 10px; }
.inline-add-fields .btn { justify-self: start; }
.picker-field .notice,
.picker-field .form-error { margin: 0; }
.totals-box {
  display: grid;
  gap: 8px;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  background: #f8f7fd;
}
.expense-total-line { margin: 0; font-size: 1.05rem; }
.expense-lines input, .expense-lines select { min-width: 96px; }
.expense-lines input[data-gst] { min-width: 72px; width: 88px; }

@media (max-width: 720px) {
  #project-client-form .picker-head { grid-template-columns: minmax(0, 1fr) auto; }
  #project-client-form .picker-head > .btn-save { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  #project-client-form .picker-head .inline-add[open] { grid-column: 1 / -1; grid-row: 3; }
  #expense-lines thead,
  #material-links thead,
  #unmapped-codes thead,
  #task-mappings thead { display: none; }
  #expense-lines, #expense-lines tbody, #expense-lines tr, #expense-lines td,
  #material-links, #material-links tbody, #material-links tr, #material-links td,
  #unmapped-codes, #unmapped-codes tbody, #unmapped-codes tr, #unmapped-codes td,
  #task-mappings, #task-mappings tbody, #task-mappings tr, #task-mappings td {
    display: block;
    width: auto;
  }
  #expense-lines tr, #material-links tr, #unmapped-codes tr, #task-mappings tr {
    padding: 12px 14px;
    margin: 0 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--sched-radius-card);
    background: white;
  }
  #expense-lines td, #material-links td, #unmapped-codes td, #task-mappings td {
    border: 0;
    padding: 4px 0;
  }
  #expense-lines td[data-label]::before,
  #material-links td[data-label]::before,
  #unmapped-codes td[data-label]::before,
  #task-mappings td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 650;
  }
  #expense-lines input,
  #task-mappings select,
  #task-mappings input,
  #material-links select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .task-edit, .material-edit, .material-unit { display: grid; }
  #supplier-codes thead,
  .supplier-code-table thead,
  #materials thead { display: none; }
  .supplier-code-table,
  .supplier-code-table tbody,
  .supplier-code-table tr,
  .supplier-code-table td,
  #materials, #materials tbody, #materials tr, #materials td {
    display: block;
    width: auto;
    max-width: 100%;
  }
  .supplier-code-table tr, #materials tr {
    padding: 12px 14px;
    margin: 0 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--sched-radius-card);
    background: white;
  }
  .supplier-code-table td, #materials td { border: 0; padding: 4px 0; }
  .supplier-code-table td[data-label]::before,
  #materials td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 650;
  }
  #supplier-codes select,
  #supplier-codes input,
  .supplier-code-table select,
  .supplier-code-table input,
  #materials select,
  #add-material input,
  #add-material select,
  .supplier-code-group,
  .supplier-code-group-toggle {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  #mapping-page .table-scroll,
  #supplier-code-category-page .table-scroll { overflow-x: hidden; }
}
.expense-sum-list { list-style: none; padding: 0; margin: 0 0 12px; }
.expense-sum-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
#receipt-form input,
#receipt-form select,
#receipt-form button { min-height: 44px; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: white; }
  .sidebar, .mobile-top, .mobile-tabbar, .view-tools, .view-note, .quote-toolbar, .sidebar-user, .notice, .won-banner, .section-tabs, .fab-wrap, .no-print { display: none !important; }
  .app-shell, .content { display: block; padding: 0; margin: 0; max-width: none; }
  .sheet { box-shadow: none; max-width: none; }
  .doc-top {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    align-items: start;
    break-inside: avoid;
  }
  .doc-prepared { text-align: right !important; }
  .doc-meta { margin-left: auto !important; text-align: left !important; }
  .doc-site {
    margin-left: auto !important;
    border: 1px solid #000 !important;
    background: #fff !important;
    color: #000 !important;
  }
  .doc-logo {
    display: block !important;
    visibility: visible !important;
    max-height: 80px !important;
    max-width: 240px !important;
  }
  .doc-section h2.doc-group {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }
  .doc-group-total { color: #000; }
}

.schedule-page { padding-bottom: 88px; }
.planner { display: grid; gap: 16px; }
.planner-cal, .planner-day { min-width: 0; }
.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.cal-range { flex: 1; text-align: center; font-weight: 750; }
.cal-nav-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--sched-radius-pill);
  background: var(--sched-pill);
  color: var(--ink);
  text-decoration: none;
  font-size: 1.4rem;
  line-height: 1;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}
.cal-dow {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 0;
}
.cal-day {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
}
.cal-day span {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.cal-day.has-schedule span { box-shadow: inset 0 0 0 2px var(--sched-gold); }
.cal-day.is-selected span { background: var(--sched-navy); color: white; }
.cal-day.is-selected.has-schedule span { box-shadow: inset 0 0 0 2px var(--sched-gold); }
.cal-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
  text-align: center;
}
.cal-summary strong { display: block; font-size: 1.35rem; }
.cal-summary span { color: var(--muted); font-size: 0.85rem; }
.schedule-people-group { margin-top: 10px; }
.schedule-group-heading {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sched-pill);
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}
.schedule-group-heading:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.schedule-group-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: white;
  font-size: 1.1rem;
  line-height: 1;
}
.schedule-group-meta { margin-left: auto; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.schedule-people-group .schedule-group-body { margin-top: 8px; }
.schedule-people-group.is-collapsed > .schedule-group-body { display: none; }
.people-field .schedule-people-group { margin-top: 8px; }
.people-field .schedule-group-body .check-row { margin-left: 4px; }
.schedule-tabs { display: flex; gap: 8px; margin: 8px 0 14px; }
.schedule-tabs a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  text-decoration: none;
  border-radius: 999px;
  background: var(--sched-pill);
  color: var(--ink);
  font-weight: 700;
  padding: 8px 12px;
}
.schedule-tabs a.active { background: var(--sched-lavender); color: var(--sched-lavender-ink); }
.tab-count {
  display: inline-flex;
  min-width: 1.4rem;
  height: 1.4rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--sched-navy);
  color: white;
  font-size: 0.75rem;
}
.schedule-tabs a.active .tab-count { background: var(--sched-lavender-deep); }
.shift-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin: 0 0 12px;
  display: grid;
  gap: 8px;
}
.shift-times {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 750;
}
.shift-hours {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 750;
}
.timesheet-total { margin: 0 0 12px; font-weight: 650; }
.shift-person { display: flex; align-items: center; gap: 10px; }
.initials {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 750;
  flex: 0 0 auto;
}
.badge-0 { background: var(--sched-blue); }
.badge-1 { background: #0f766e; }
.badge-2 { background: #b45309; }
.badge-3 { background: #9d2c2c; }
.badge-4 { background: #6d28d9; }
.badge-5 { background: var(--sched-navy); }
.person-name, .person-company { display: block; }
.person-company { color: var(--muted); font-weight: 650; font-size: 0.88rem; }
.shift-project { font-weight: 750; }
.shift-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f4f7fa;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
}
.manual-badge { background: #fff4e5; border-color: #e6c48a; }
.shift-address, .shift-location a { font-weight: 650; overflow-wrap: anywhere; }
.shift-address { display: inline-block; padding-right: 56px; }
.shift-note, .shift-location, .original-clock { margin: 0; }
.original-clock { color: var(--muted); font-size: 0.88rem; }
.no-location { font-weight: 750; }
.clock-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 12px; }
.btn-clock, .btn-clock-out {
  min-height: 52px;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 800;
  border-radius: 14px;
  color: white;
}
#day-title { font-size: 1.55rem; margin: 0 0 8px; }
.btn-clock { background: var(--sched-blue); }
.btn-clock-out { background: var(--sched-navy); }
.time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.people-field { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.people-field legend { font-weight: 750; padding: 0 4px; }
.inline-form { margin-top: 16px; }
.rate-form { display: flex; gap: 8px; align-items: center; }
.rate-form input { max-width: 120px; }
.fab-wrap {
  position: fixed;
  right: 16px;
  bottom: 24px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.layout-mobile .fab-wrap { bottom: 84px; }
.fab-wrap > summary {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sched-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(20, 32, 43, 0.25);
  list-style: none;
}
.fab-wrap > summary::-webkit-details-marker { display: none; }
.fab-close { display: none; }
.fab-wrap[open] .fab-plus { display: none; }
.fab-wrap[open] .fab-close { display: inline; }
.fab-menu { display: none; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.fab-wrap[open] .fab-menu { display: flex; }
.fab-menu a {
  background: var(--sched-lavender);
  color: var(--sched-fab-ink);
  text-decoration: none;
  font-weight: 750;
  border-radius: 999px;
  min-height: 48px;
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  box-shadow: var(--shadow);
}
@media (min-width: 960px) {
  .planner { grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); align-items: start; }
  .planner-day { grid-column: 2; grid-row: 1; }
  .clock-actions { grid-template-columns: 200px 200px; }
  .layout-mobile .planner { grid-template-columns: 1fr; }
  .layout-mobile .planner-day { grid-column: auto; grid-row: auto; }
}
@media (max-width: 720px) {
  .cal-day span { width: 34px; height: 34px; }
  .data .rate-form { flex-wrap: wrap; }
}

/* Nav on every page except Schedule picks up the schedule lavender active state.
   Schedule keeps the original navy sidebar and teal mobile tab. */
.app-shell:not(:has(.schedule-page)) .main-menu a.active,
.app-shell:not(:has(.schedule-page)) .sidebar-extra a.active {
  background: var(--sched-lavender);
  color: var(--sched-lavender-ink);
}
.app-shell:not(:has(.schedule-page)) .mobile-tabbar a.active {
  color: var(--sched-lavender-deep);
}

/* Schedule pages keep the look they had before the shared theme. */
.schedule-page h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: normal; }
.schedule-page a { color: var(--accent); }
.schedule-page a.chip,
.schedule-page .chip { color: var(--ink); }
.schedule-page a.cal-day,
.schedule-page a.cal-nav-btn { color: var(--ink); }
.schedule-page a.btn-cancel,
.schedule-page button.btn-cancel { color: #243140; }
.schedule-page a.btn-clock,
.schedule-page a.btn-clock-out,
.schedule-page button.btn-clock,
.schedule-page button.btn-clock-out { color: white; }
.schedule-page .fab-menu a { color: var(--sched-fab-ink); }
.schedule-page .panel,
.schedule-page.panel { border: 0; border-radius: 12px; }
.create-project-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sched-chip);
  padding: 14px;
  display: grid;
  gap: 12px;
  margin: 0 0 4px;
}
.create-project-panel h2 { margin: 0; }
.create-project-panel .muted { margin: 0; }
.create-project-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.create-project-actions .btn { min-height: 44px; }
@media (max-width: 420px) {
  .create-project-actions .btn { flex: 1 1 100%; justify-content: center; }
}
.schedule-page .btn { border-radius: 8px; font-weight: 400; }
.schedule-page .btn-save {
  background: var(--green);
  color: white;
  font-weight: 700;
  border-radius: 8px;
  min-height: 0;
  justify-content: flex-start;
}
.schedule-page .btn-save:hover { background: var(--green-dark); }
.schedule-page .create-project-actions .btn { min-height: 44px; justify-content: center; }
.schedule-page .btn-cancel { border-radius: var(--sched-radius-pill); font-weight: 400; }
.schedule-page .btn-clock,
.schedule-page .btn-clock-out { border-radius: var(--sched-radius-action); font-weight: 800; }
.schedule-page .table-scroll { border: 0; border-radius: 0; background: transparent; }
.schedule-page .data th,
.schedule-page .data td { padding: 10px 8px; }
.schedule-page .data th { background: transparent; font-size: 0.82rem; font-weight: 650; letter-spacing: normal; }
.schedule-page .data tbody tr:hover { background: transparent; }
.schedule-page input,
.schedule-page select,
.schedule-page textarea { border-radius: 6px; }
.schedule-page input:focus-visible,
.schedule-page select:focus-visible,
.schedule-page textarea:focus-visible {
  outline: revert;
  border-color: #c5d0da;
}

.detail-list {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px 16px;
  margin: 8px 0 0;
}
.detail-list dt { color: var(--muted); font-weight: 700; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.merge-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form[data-merge-form] { display: contents; }
.merge-col { width: 72px; }
.merge-col input[type="checkbox"] { width: 20px; height: 20px; }
.merge-dialog {
  border: 1px solid var(--line);
  border-radius: var(--sched-radius-card);
  padding: 20px;
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  box-shadow: var(--shadow);
}
.merge-dialog::backdrop { background: rgba(20, 32, 43, 0.45); }
.merge-dialog h2 { margin-top: 0; }
.merge-dialog .merge-actions { margin-top: 4px; }
.merge-rows { margin: 0 0 12px; padding-left: 18px; }
#merge-summary { font-weight: 700; }
@media (max-width: 420px) {
  .merge-dialog .merge-actions { align-items: stretch; }
  .merge-dialog .btn { justify-content: center; }
  .search-form label { min-width: 0; width: 100%; }
}
.clients-page .search-form { flex: 1; min-width: 0; }
.clients-page .field-error { margin: 0; }
#client-form input[aria-invalid="true"] {
  border-color: var(--danger);
  background: #fff6f6;
}

@media (max-width: 720px) {
  .clients-page .search-form label { min-width: 0; width: 100%; }
  .detail-list { grid-template-columns: 1fr; gap: 2px; }
  .detail-list dd { margin-bottom: 10px; }
  .client-list thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .client-list,
  .client-list tbody,
  .client-list tr,
  .client-list td { display: block; width: auto; }
  .client-list tr { border-bottom: 1px solid var(--line); padding: 8px 0 10px; }
  .client-list td { border: 0; padding: 4px 0; }
  .client-list td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 650;
  }
  .clients-page .table-scroll { border: 0; background: transparent; }
}
@media (max-width: 390px) {
  #backup-page { padding: 16px; }
  #backup-page .btn { width: 100%; justify-content: center; }
  #backup-page .stack-form { max-width: none; }
}
