:root {
  color-scheme: light;
  --forest: #18354d;
  --forest-2: #214e6b;
  --forest-3: #35748a;
  --mint: #e6f1f4;
  --lime: #d6edf0;
  --cream: #f3f6f8;
  --paper: #ffffff;
  --ink: #192d3d;
  --muted: #778591;
  --line: #e1e8ed;
  --line-dark: #d3dfe6;
  --warning: #946112;
  --warning-bg: #fff5dc;
  --danger: #a2443a;
  --shadow: 0 14px 42px rgba(24, 61, 47, .055);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html { background: var(--cream); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 94% 8%, rgba(196, 225, 234, .2), transparent 28rem),
    var(--cream);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(114, 158, 76, .3);
  outline-offset: 2px;
}

.boot {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--forest);
  font-weight: 800;
  font-size: 20px;
}

.app-shell { min-height: 100vh; }
.topbar { background: var(--forest); color: white; }
.topbar-inner {
  max-width: 1180px;
  height: 76px;
  margin: 0 auto;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-lockup { display: flex; align-items: center; gap: 13px; color: var(--forest); }
.brand-lockup b { font-size: 20px; letter-spacing: -.04em; }
.brand-lockup small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 500; }
.brand-lockup.compact { color: white; gap: 10px; }
.brand-lockup.compact b { font-size: 18px; }
.brand-mark {
  position: relative;
  width: 37px;
  height: 37px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px 12px 12px 4px;
  background: transparent;
}
.brand-mark img { width: 68px; height: 68px; max-width: none; object-fit: contain; }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,.74);
  font-size: 12px;
}
.sync-chip i, .autosave-label i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #a8d678;
  box-shadow: 0 0 0 4px rgba(168, 214, 120, .12);
}
.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  color: white;
  background: rgba(255,255,255,.06);
  font-size: 20px;
  line-height: 1;
  transform: rotate(90deg);
}

.main-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 60px;
  padding: 0 max(18px, calc((100vw - 1180px) / 2));
  display: flex;
  gap: 5px;
  align-items: stretch;
  background: rgba(255,255,255,.93);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 5px 20px rgba(23,44,38,.025);
  backdrop-filter: blur(12px);
}
.nav-button {
  position: relative;
  min-width: 105px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  color: #738078;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  transition: color .15s ease, background .15s ease;
}
.nav-button:hover { color: var(--forest); background: #f1f7f9; }
.nav-button.active { color: var(--forest); }
.nav-button.active::after {
  position: absolute;
  right: 15px;
  bottom: 0;
  left: 15px;
  height: 3px;
  border-radius: 4px 4px 0 0;
  background: #62a4b2;
  content: "";
}
.nav-icon { font-size: 17px; line-height: 1; }

.page-wrap { max-width: 1180px; min-height: calc(100vh - 180px); margin: 0 auto; padding: 38px 30px 56px; }
.app-footer {
  padding: 20px 24px 28px;
  color: #89958e;
  text-align: center;
  font-size: 12px;
}
.app-footer span { padding: 0 5px; }

.welcome-row, .section-heading, .editor-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}
.welcome-row { margin-bottom: 26px; }
.welcome-row h1, .editor-title h1, .auth-intro h1 {
  margin: 0;
  color: var(--forest);
  letter-spacing: -.055em;
  font-size: clamp(29px, 4vw, 40px);
  line-height: 1.12;
}
.welcome-row .lede, .editor-title .lede, .auth-intro p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.eyebrow {
  margin: 0 0 8px;
  color: #8b9a8e;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
}
.button {
  min-height: 43px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 750;
  transition: transform .12s ease, background .12s ease, border .12s ease;
}
.button:active { transform: scale(.985); }
.button.primary { color: white; background: var(--forest-2); box-shadow: 0 5px 14px rgba(18,59,49,.12); }
.button.primary:hover { background: var(--forest); }
.button.primary span { font-size: 17px; line-height: 1; }
.button.secondary { color: var(--forest); background: var(--lime); }
.button.secondary:hover { background: #c5e3e7; }
.button.outline { color: var(--forest-2); background: white; border-color: #cfdacf; }
.button.outline:hover, .button.light:hover { border-color: #8ab3bd; background: #f6fafb; }
.button.light { color: var(--forest-2); background: #f3f6f2; border-color: var(--line); }
.button.danger-light { color: var(--danger); background: #fff8f7; border-color: #f1ddda; }
.button.full { width: 100%; min-height: 48px; }
.text-button, .link-button {
  border: 0;
  color: var(--forest-3);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
}
.text-button span { margin-left: 5px; font-size: 16px; }
.text-button:hover, .link-button:hover { color: var(--forest); text-decoration: underline; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 21px; }
.stat-card {
  min-height: 130px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.8);
  box-shadow: 0 7px 22px rgba(18,59,49,.025);
}
.stat-card > span { color: #6e7e75; font-size: 12px; font-weight: 700; }
.stat-card strong { margin-top: auto; padding-top: 12px; color: var(--forest); font-size: 30px; letter-spacing: -.04em; }
.stat-card small { margin-top: 3px; color: #91a096; font-size: 11px; }
.accent-stat { border-color: #d6e6e9; background: linear-gradient(135deg, #eef7f8, #fff); }
.draft-banner {
  width: 100%;
  margin-bottom: 21px;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #eaddbb;
  border-radius: 15px;
  color: var(--ink);
  background: #fff9e9;
  text-align: left;
}
.draft-symbol { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: #81591b; background: #f4e5bd; font-size: 17px; }
.draft-banner > span:nth-child(2) { flex: 1; }
.draft-banner b, .draft-banner small { display: block; }
.draft-banner b { font-size: 13px; }
.draft-banner small { margin-top: 3px; color: #8b7e62; font-size: 12px; }
.arrow { color: #819087; font-size: 23px; line-height: 1; }

.panel {
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.section-heading { min-height: 42px; margin-bottom: 18px; }
.section-heading h2, .panel-title h2, .estimate-card h2 {
  margin: 0;
  color: var(--forest);
  font-size: 19px;
  letter-spacing: -.035em;
}
.section-heading .eyebrow { margin-bottom: 6px; }
.muted-label { color: #8b9790; font-size: 12px; text-align: right; }
.simple-shift-list { display: grid; }
.simple-shift-row {
  width: 100%;
  min-height: 76px;
  padding: 12px 4px;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 15px;
  border: 0;
  border-top: 1px solid #edf0ed;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.simple-shift-row:first-child { border-top: 0; }
.simple-shift-row:hover .route-summary b { color: #34728c; }
.date-pill b, .date-pill small, .route-summary b, .route-summary small { display: block; }
.date-pill b { color: var(--forest); font-size: 12px; }
.date-pill small { margin-top: 3px; color: #9aa69e; font-size: 10px; }
.route-summary { min-width: 0; }
.route-summary b { overflow: hidden; color: var(--forest); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.route-summary small { overflow: hidden; margin-top: 4px; color: #8a9790; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.row-amount { color: var(--forest); font-size: 13px; font-weight: 750; white-space: nowrap; }
.empty-state { padding: 27px 12px 17px; text-align: center; }
.empty-icon { width: 42px; height: 42px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 14px; color: var(--forest); background: #e9f2f6; font-size: 24px; }
.empty-state h3 { margin: 0; color: var(--forest); font-size: 16px; }
.empty-state p { max-width: 390px; margin: 8px auto 15px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.quick-card {
  position: relative;
  min-height: 112px;
  padding: 19px 55px 19px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--forest);
  background: #fff;
  text-align: left;
  box-shadow: 0 5px 20px rgba(18,59,49,.025);
}
.quick-card:hover { border-color: #b7d6dd; background: #fbfdfd; }
.quick-icon { color: #6b9daa; font-size: 19px; }
.quick-card b { margin-top: 2px; font-size: 14px; }
.quick-card small { color: #87958c; font-size: 12px; }
.quick-arrow { position: absolute; top: 50%; right: 20px; color: #829188; font-size: 22px; transform: translateY(-50%); }

.compact-welcome { margin-bottom: 22px; }
.search-panel { padding: 20px 22px; }
.search-label { display: block; margin-bottom: 9px; color: var(--forest); font-size: 13px; font-weight: 750; }
.search-row { display: flex; gap: 10px; }
.search-row input {
  width: 100%;
  min-width: 0;
  height: 47px;
  padding: 0 15px;
  border: 1px solid var(--line-dark);
  border-radius: 12px;
  color: var(--ink);
  background: #fbfcfb;
  font-size: 15px;
  -webkit-appearance: none;
}
.search-count { display: block; margin-top: 8px; color: #89958e; font-size: 12px; }
.history-panel { padding-top: 21px; }
.history-panel .section-heading { margin-bottom: 12px; }
.history-card { border-top: 1px solid #edf0ed; }
.history-card:first-child { border-top: 0; }
.history-summary {
  width: 100%;
  min-height: 79px;
  padding: 13px 1px;
  display: grid;
  grid-template-columns: 86px minmax(130px,1fr) 66px 78px 23px;
  gap: 12px;
  align-items: center;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.history-summary:hover .history-route b { color: var(--forest-3); }
.history-date b, .history-date small, .history-route b, .history-route small { display: block; }
.history-date b { color: var(--forest); font-size: 12px; }
.history-date small { margin-top: 3px; color: #92a097; font-size: 10px; }
.history-route { min-width: 0; }
.history-route b { overflow: hidden; color: var(--forest); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.history-route small { overflow: hidden; margin-top: 4px; color: #929d96; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.history-start { color: #738078; font-size: 12px; text-align: right; }
.history-pay { color: var(--forest); font-size: 12px; font-weight: 800; text-align: right; }
.expand-icon { color: #809087; font-size: 20px; text-align: right; }
.history-details { padding: 4px 0 20px 98px; }
.detail-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; padding: 12px 14px; border-radius: 12px; background: #f7f9f6; }
.detail-grid small, .detail-grid b { display: block; }
.detail-grid small { margin-bottom: 5px; color: #8a9790; font-size: 10px; }
.detail-grid b { color: var(--forest); font-size: 11px; }
.leg-detail-list { padding: 10px 0; }
.leg-detail { display: flex; gap: 10px; padding: 8px 0; }
.leg-index { width: 28px; height: 26px; display: grid; place-items: center; border-radius: 8px; color: #5e7c88; background: #edf4f6; font-size: 10px; font-weight: 800; }
.leg-detail b, .leg-detail small { display: block; }
.leg-detail b { color: var(--forest); font-size: 12px; }
.leg-detail small { margin-top: 4px; color: #818e86; font-size: 11px; }
.leg-detail small span { padding: 0 4px; color: #b0bab2; }
.leg-detail .detail-note { color: #a27731; }
.shift-note { margin: 2px 0 11px; color: #738078; font-size: 12px; }
.pay-strip { display: flex; align-items: baseline; gap: 11px; padding: 12px 14px; border-radius: 12px; background: #eff6f5; color: #70848b; font-size: 11px; }
.pay-strip b { color: var(--forest); font-size: 17px; }
.pay-strip span:last-child { margin-left: auto; color: #8a9787; }
.detail-actions { margin-top: 12px; display: flex; gap: 9px; }
.empty-small { min-height: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #849188; text-align: center; }
.empty-small > span { color: #96ae83; font-size: 25px; }
.empty-small b { color: var(--forest); font-size: 13px; }
.empty-small small { color: #96a098; font-size: 12px; }

.editor-head { margin-bottom: 19px; }
.back-button { margin: 0 0 18px; padding: 0; border: 0; color: var(--forest-3); background: transparent; font-size: 14px; font-weight: 750; }
.back-button span { margin-left: 5px; }
.editor-title { align-items: flex-end; }
.editor-title .lede { max-width: 600px; }
.autosave-label { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid #d5e5e9; border-radius: 99px; color: #5e828b; background: #eff7f7; font-size: 11px; white-space: nowrap; }
.autosave-label i { width: 6px; height: 6px; box-shadow: none; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: 18px; }
.editor-main { min-width: 0; }
.form-panel { padding: 22px; }
.panel-title { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 20px; }
.panel-step { width: 29px; height: 29px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: var(--forest-2); background: #e9f2f6; font-size: 11px; font-weight: 800; }
.panel-title h2 { margin: 1px 0 4px; }
.panel-title p { margin: 0; color: #8a9790; font-size: 11px; line-height: 1.45; }
.fields { display: grid; gap: 12px; }
.two-col { grid-template-columns: repeat(2,minmax(0,1fr)); }
.three-col { grid-template-columns: repeat(3,minmax(0,1fr)); }
.field { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.field > span { color: #66766d; font-size: 11px; font-weight: 750; }
.field > span small { margin-left: 3px; color: #99a49d; font-size: 10px; font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 11px;
  border: 1px solid #dfe6e0;
  border-radius: 10px;
  color: var(--ink);
  background: #fcfdfc;
  font-size: 13px;
  outline: none;
  transition: border .12s, box-shadow .12s;
}
.field textarea { height: auto; min-height: 70px; padding: 10px 11px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #86acb3; box-shadow: 0 0 0 3px rgba(98,164,178,.12); }
.field input::placeholder, .field textarea::placeholder { color: #b0bab3; }
.field input[type="date"], .field input[type="time"], .field input[type="number"] { color: #354a3f; }
.uppercase { text-transform: uppercase; }
.end-fields { margin-top: 13px; }
.form-panel > .field { margin-top: 14px; }
.legs-list { display: grid; gap: 12px; }
.leg-editor { position: relative; overflow: hidden; padding: 0; border: 1px solid #e3eae3; border-radius: 14px; background: #fbfcfa; }
.leg-disclosure > summary { list-style: none; }
.leg-disclosure > summary::-webkit-details-marker { display: none; }
.leg-summary { min-height: 65px; padding: 12px 46px 12px 13px; display: flex; align-items: center; gap: 11px; cursor: pointer; }
.leg-summary-copy { min-width: 0; flex: 1; }
.leg-summary-copy b, .leg-summary-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leg-summary-copy b { color: var(--forest); font-size: 12px; }
.leg-summary-copy small { margin-top: 4px; color: #87948b; font-size: 10px; }
.leg-disclosure-icon { color: #849188; font-size: 18px; transition: transform .15s; }
.leg-disclosure[open] .leg-disclosure-icon { transform: rotate(180deg); }
.leg-fields { padding: 0 13px 13px; }
.remove-leg { position: absolute; z-index: 2; top: 10px; right: 10px; }
.leg-number { color: #8297a1; font-size: 9px; font-weight: 850; letter-spacing: .13em; }
.remove-leg, .remove-line {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid #e4e9e3;
  border-radius: 9px;
  color: #8c9690;
  background: white;
  font-size: 20px;
  line-height: 1;
}
.remove-leg:hover, .remove-line:hover { color: var(--danger); border-color: #f0d2ce; }
.compact-field { margin-top: 11px; }
.vehicle-warning { display: none; margin: 5px 2px 0; color: var(--warning); font-size: 10px; line-height: 1.4; }
.vehicle-warning.show { display: block; }
.add-leg { width: 100%; margin-top: 12px; }
.editor-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 2px 0 22px; }
.editor-actions .button { min-height: 47px; }
.estimate-card {
  position: sticky;
  top: 82px;
  padding: 21px;
  border: 1px solid #d1e2e7;
  border-radius: 18px;
  background: linear-gradient(155deg, #eaf4f5, #fff 72%);
  box-shadow: var(--shadow);
}
.estimate-kicker { color: #708e99; font-size: 9px; font-weight: 850; letter-spacing: .13em; }
.estimate-card h2 { margin-top: 6px; font-size: 17px; }
.estimate-value { margin-top: 17px; display: flex; flex-direction: column; gap: 3px; }
.estimate-value b { color: var(--forest); font-size: 34px; letter-spacing: -.05em; }
.estimate-value small { color: #7e8d80; font-size: 11px; }
.estimate-lines { margin-top: 14px; display: grid; gap: 8px; }
.estimate-lines > span { color: #617a7d; font-size: 10px; }
.estimate-lines > span small { display: block; margin-top: 2px; color: #99a49b; font-size: 9px; }
.estimate-lines > b { margin-top: -22px; color: #3c5f6c; font-size: 10px; text-align: right; }
.estimate-rule { height: 1px; margin: 16px 0 13px; background: #dce9ec; }
.estimate-card > p { color: #84929a; font-size: 10px; line-height: 1.5; }
.estimate-card .text-button { margin-top: 5px; padding: 0; font-size: 11px; }
.estimate-foot { display: block; margin-top: 12px; color: #98a194; font-size: 9px; line-height: 1.4; }

.week-picker { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.period-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: min(100%, 380px); }
.period-picker .field { min-width: 0; width: 100%; }
.period-picker input[type="date"] { min-width: 0; width: 100%; }
.week-picker .field { width: min(300px, 100%); }
.week-picker > div:first-child > small { display: block; margin-top: 8px; color: #89958e; font-size: 11px; }
.week-totals { display: flex; gap: 23px; }
.week-totals span { display: flex; flex-direction: column; gap: 5px; }
.week-totals small { color: #88948c; font-size: 10px; }
.week-totals b { color: var(--forest); font-size: 18px; white-space: nowrap; }
.week-list { display: grid; }
.week-row { min-height: 66px; display: grid; grid-template-columns: 62px minmax(0,1fr) 74px 85px; align-items: center; gap: 14px; border-top: 1px solid #edf0ed; }
.week-row:first-child { border-top: 0; }
.week-day b, .week-day small, .week-route b, .week-route small { display: block; }
.week-day b { color: var(--forest); font-size: 12px; }
.week-day small, .week-route small { margin-top: 3px; color: #8e9a92; font-size: 10px; }
.week-route { min-width: 0; }
.week-route b { overflow: hidden; color: var(--forest); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.week-hours { color: #77867b; font-size: 11px; text-align: right; }
.week-gross { color: var(--forest); font-size: 12px; text-align: right; }
.copy-panel { border-color: #d8e7e9; background: #fbfdfd; }
.agency-preview { margin: 0; padding: 16px; border: 1px solid #e4ebe0; border-radius: 12px; color: #486050; background: white; font: 13px/1.8 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }

.invoice-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.invoice-toolbar > .field { width: min(300px,100%); }
.toolbar-actions { display: flex; gap: 9px; }
.invoice-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 23px; }
.invoice-block { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.invoice-block h3 { margin: 0 0 1px; color: var(--forest); font-size: 13px; }
.invoice-lines-head, .invoice-edit-row { display: grid; grid-template-columns: minmax(150px,1fr) 95px 110px 110px 30px; align-items: center; gap: 9px; }
.invoice-lines-head { padding: 0 0 8px; color: #829087; font-size: 10px; font-weight: 750; }
.invoice-edit-row { padding: 8px 0; border-top: 1px solid #edf0ed; }
.invoice-edit-row .field > span { display: none; }
.invoice-edit-row .field input { height: 39px; font-size: 12px; }
.invoice-total { display: flex; align-items: baseline; justify-content: flex-end; gap: 20px; padding-top: 16px; border-top: 1px solid var(--line-dark); color: #718078; font-size: 12px; }
.invoice-total b { color: var(--forest); font-size: 23px; }
.invoice-preview-panel { background: #f7f9f6; }
.invoice-paper { max-width: 850px; margin: 0 auto; padding: 34px; border: 1px solid #e2e8e2; border-radius: 8px; color: #19392f; background: white; }
.paper-head, .paper-meta { display: flex; justify-content: space-between; gap: 30px; }
.paper-head h2 { margin: 0 0 7px; color: #293a66; font-size: 25px; letter-spacing: -.03em; }
.paper-head p { margin: 4px 0; color: #4d5b54; font-size: 12px; line-height: 1.5; white-space: normal; }
.invoice-word { color: #344577; font-size: 27px; font-weight: 850; letter-spacing: .07em; }
.paper-meta { margin: 22px 0; padding: 18px 0; border-top: 1px solid #e2e7e2; border-bottom: 1px solid #e2e7e2; }
.paper-meta div { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.paper-meta p { margin: 0 0 6px; }
.paper-meta small, .paper-payment small { color: #8c9890; font-size: 9px; letter-spacing: .11em; }
.paper-meta b, .paper-meta span { color: #34483e; font-size: 11px; line-height: 1.5; }
.paper-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.paper-table th { padding: 10px 8px; color: #607482; background: #eef4f7; text-align: left; }
.paper-table td { padding: 10px 8px; border-bottom: 1px solid #e9ede9; color: #3e5046; }
.paper-total { display: flex; justify-content: flex-end; align-items: baseline; gap: 27px; padding: 17px 8px; border-bottom: 1px solid #e2e7e2; color: #748078; font-size: 11px; }
.paper-total b { color: var(--forest); font-size: 21px; }
.paper-payment { margin-top: 25px; color: #78847d; font-size: 10px; line-height: 1.6; }
.paper-payment p { margin: 7px 0; white-space: normal; }
.paper-driver { margin-top: 30px !important; color: #30473b; font-size: 12px; font-weight: 750; }

.settings-panel .section-heading { align-items: flex-start; }
.settings-panel .section-heading > .button { flex: 0 0 auto; }
.short-field { max-width: 420px; }
.rates-heading { margin: 25px 0 13px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.rates-heading h3 { margin: 0; color: var(--forest); font-size: 14px; }
.rates-heading p { margin: 5px 0 0; color: #87948b; font-size: 11px; }
.currency-tag { padding: 6px 9px; border-radius: 8px; color: #5b7f82; background: #edf5f2; font-size: 10px; font-weight: 800; white-space: nowrap; }
.rate-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; }
.settings-note { margin: 15px 0 0; padding: 12px; border-radius: 10px; color: #607b78; background: #eff6f4; font-size: 11px; line-height: 1.5; }
.settings-note span { margin-right: 5px; }
.settings-two { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; align-items: start; }
.settings-copy { margin: -8px 0 16px; color: #87938c; font-size: 11px; line-height: 1.55; }
.stack-form { display: grid; gap: 12px; }
.settings-list { margin-top: 15px; }
.settings-list-row { min-height: 39px; display: flex; align-items: center; gap: 8px; border-top: 1px solid #edf0ed; }
.settings-list-row b { color: var(--forest); font-size: 11px; }
.settings-list-row small { overflow: hidden; flex: 1; color: #87938c; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.settings-list-row > button { width: 27px; height: 27px; border: 0; border-radius: 8px; color: #8f9a92; background: transparent; font-size: 19px; }
.settings-list-row > button:hover { color: var(--danger); background: #fff3f1; }
.type-tag { padding: 4px 6px; border-radius: 6px; color: #5a7f84; background: #eff5f4; font-size: 8px; font-weight: 800; letter-spacing: .04em; }
.alias-arrow { color: #7298a1; font-size: 15px; }
.alias-result { margin-left: auto; color: #71847a; font-size: 10px; }
.empty-inline { color: #97a198; font-size: 11px; }
.backup-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.backup-panel h2 { margin: 0; color: var(--forest); font-size: 16px; }
.backup-panel p:last-child { margin: 6px 0 0; color: #87938c; font-size: 11px; }

.auth-shell { min-height: 100vh; padding: 30px 16px; display: grid; place-items: center; background: radial-gradient(circle at 50% 8%, #e1eef3, transparent 30rem), var(--cream); }
.auth-card { width: min(100%, 430px); padding: 30px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 22px 70px rgba(18,59,49,.1); }
.auth-intro { margin: 36px 0 22px; }
.auth-intro h1 { font-size: 31px; }
.auth-intro p:last-child { font-size: 13px; }
.auth-card .stack-form { gap: 13px; }
.inline-message { padding: 11px 12px; border-radius: 10px; color: #4f6c70; background: #eef6f3; font-size: 12px; line-height: 1.5; }
.link-button { display: block; margin: 15px auto 0; }
.link-button.muted { margin-top: 9px; color: #8a968e; font-size: 11px; font-weight: 600; }
.auth-foot { margin: 30px 0 0; padding-top: 16px; border-top: 1px solid #edf0ed; color: #97a199; font-size: 10px; line-height: 1.5; text-align: center; }
.toast { position: fixed; z-index: 20; right: 20px; bottom: 20px; max-width: min(390px,calc(100vw - 40px)); padding: 12px 16px; border-radius: 12px; color: white; background: var(--forest); box-shadow: 0 10px 35px rgba(14,48,37,.2); opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s; font-size: 12px; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: #903d34; }

@media (max-width: 780px) {
  .topbar-inner { height: 66px; padding: 0 18px; }
  .brand-lockup.compact b { font-size: 16px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-mark img { width: 62px; height: 62px; }
  .sync-chip { font-size: 0; gap: 0; }
  .sync-chip i { width: 8px; height: 8px; }
  .topbar-right { gap: 11px; }
  .main-nav { height: 58px; padding: 0 8px; justify-content: space-around; gap: 0; overflow-x: auto; }
  .nav-button { min-width: 0; flex: 1; padding: 0 7px; flex-direction: column; gap: 3px; font-size: 10px; }
  .nav-icon { font-size: 17px; }
  .nav-button.active::after { right: 18%; left: 18%; }
  .page-wrap { min-height: calc(100vh - 160px); padding: 27px 17px 40px; }
  .welcome-row { align-items: flex-start; }
  .welcome-row h1, .editor-title h1 { font-size: 31px; }
  .welcome-row .lede { max-width: 510px; font-size: 13px; }
  .stat-grid { gap: 9px; }
  .stat-card { min-height: 112px; padding: 15px; border-radius: 15px; }
  .stat-card > span { min-height: 29px; font-size: 10px; line-height: 1.35; }
  .stat-card strong { font-size: 25px; }
  .stat-card small { font-size: 9px; }
  .panel { padding: 19px; border-radius: 17px; }
  .simple-shift-row { grid-template-columns: 65px minmax(0,1fr) auto 18px; gap: 10px; }
  .row-amount { font-size: 11px; }
  .history-summary { grid-template-columns: 72px minmax(100px,1fr) 45px 58px 17px; gap: 7px; }
  .history-route b { font-size: 11px; }
  .history-route small { font-size: 9px; }
  .history-pay, .history-start { font-size: 10px; }
  .history-details { padding-left: 79px; }
  .detail-grid { grid-template-columns: repeat(2,1fr); }
  .editor-layout { grid-template-columns: minmax(0,1fr); }
  .estimate-card { position: static; grid-row: 1; }
  .estimate-lines { grid-template-columns: 1fr auto; }
  .estimate-lines > b { margin-top: 0; }
  .estimate-lines > span small { display: inline; margin-left: 3px; }
  .estimate-card > p, .estimate-card .text-button { display: none; }
  .estimate-rule { margin: 12px 0; }
  .settings-two { grid-template-columns: 1fr; }
  .rate-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 540px) {
  .topbar-inner { padding: 0 14px; }
  .page-wrap { padding: 23px 13px 34px; }
  .welcome-row { gap: 12px; margin-bottom: 19px; }
  .welcome-row h1, .editor-title h1 { font-size: 27px; }
  .welcome-row .lede { margin-top: 7px; font-size: 12px; }
  .welcome-row .button { min-height: 39px; padding: 0 11px; font-size: 11px; }
  .add-shift { align-self: center; white-space: nowrap; }
  .stat-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
  .stat-card { min-height: 101px; padding: 12px 10px; border-radius: 13px; }
  .stat-card strong { font-size: 21px; }
  .stat-card small { line-height: 1.3; }
  .panel { margin-bottom: 13px; padding: 16px; border-radius: 15px; }
  .section-heading { gap: 8px; margin-bottom: 13px; }
  .section-heading h2, .panel-title h2 { font-size: 16px; }
  .section-heading .text-button { padding: 6px 0; font-size: 11px; white-space: nowrap; }
  .simple-shift-row { min-height: 67px; grid-template-columns: 58px minmax(0,1fr) 17px; gap: 8px; }
  .simple-shift-row .row-amount { display: none; }
  .route-summary b { font-size: 11px; }
  .route-summary small { font-size: 10px; }
  .date-pill b { font-size: 11px; }
  .quick-grid { grid-template-columns: 1fr; gap: 9px; }
  .quick-card { min-height: 88px; padding: 14px 48px 14px 16px; }
  .quick-card .quick-icon { position: absolute; top: 17px; left: 16px; font-size: 16px; }
  .quick-card b { margin: 0 0 0 25px; font-size: 12px; }
  .quick-card small { margin-left: 25px; font-size: 10px; }
  .quick-arrow { right: 14px; font-size: 18px; }
  .compact-welcome { align-items: flex-start; }
  .search-panel { padding: 15px; }
  .search-row input { height: 44px; font-size: 16px; }
  .search-row .button { min-height: 44px; padding: 0 11px; font-size: 11px; }
  .history-panel { padding: 15px 12px; }
  .history-panel .section-heading { padding: 0 4px; }
  .history-panel .muted-label { max-width: 115px; font-size: 9px; line-height: 1.4; }
  .history-summary { min-height: 71px; padding: 10px 2px; grid-template-columns: 56px minmax(75px,1fr) 37px 15px; gap: 6px; }
  .history-date b { font-size: 10px; }
  .history-date small { font-size: 9px; }
  .history-route b { font-size: 10px; }
  .history-route small { max-width: 170px; font-size: 8px; }
  .history-start { display: none; }
  .history-pay { font-size: 9px; }
  .expand-icon { font-size: 17px; }
  .history-details { padding: 0 2px 14px; }
  .detail-grid { gap: 9px; padding: 11px; }
  .detail-grid small { font-size: 9px; }
  .detail-grid b { font-size: 10px; }
  .leg-detail b { font-size: 11px; }
  .leg-detail small { font-size: 10px; }
  .pay-strip { flex-wrap: wrap; gap: 7px 10px; padding: 10px; }
  .pay-strip span:last-child { width: 100%; margin-left: 0; }
  .detail-actions .button { flex: 1; padding: 0 8px; font-size: 10px; }
  .editor-title { align-items: flex-start; flex-direction: column; gap: 11px; }
  .editor-title h1 { font-size: 27px; }
  .editor-title .lede { font-size: 11px; }
  .autosave-label { padding: 6px 9px; font-size: 9px; }
  .form-panel { padding: 15px; }
  .panel-title { gap: 9px; margin-bottom: 15px; }
  .panel-step { width: 25px; height: 25px; font-size: 10px; }
  .panel-title p { font-size: 10px; }
  .fields { gap: 9px; }
  .three-col { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .three-col .field:nth-child(3) { grid-column: span 2; }
  .end-fields { margin-top: 9px; }
  .field { gap: 5px; }
  .field > span { font-size: 10px; }
  .field input, .field textarea, .field select { height: 41px; padding: 0 9px; font-size: 13px; }
  .field textarea { padding: 9px; }
  .leg-editor { padding: 0; }
  .leg-summary { min-height: 60px; padding: 10px 43px 10px 10px; gap: 8px; }
  .leg-summary-copy b { font-size: 10px; }
  .leg-summary-copy small { font-size: 8px; }
  .leg-fields { padding: 0 10px 10px; }
  .leg-editor .two-col { gap: 8px; }
  .leg-editor .field input { height: 39px; }
  .compact-field { margin-top: 9px; }
  .editor-actions { position: sticky; z-index: 4; bottom: 0; margin: 0 -13px; padding: 10px 13px calc(10px + env(safe-area-inset-bottom)); background: rgba(244,246,242,.95); backdrop-filter: blur(10px); }
  .editor-actions .button { flex: 1; min-height: 44px; padding: 0 8px; font-size: 11px; }
  .estimate-card { padding: 16px; }
  .estimate-value { margin-top: 11px; }
  .estimate-value b { font-size: 29px; }
  .estimate-lines { gap: 6px 9px; }
  .estimate-lines > span { font-size: 9px; }
  .week-picker { align-items: stretch; flex-direction: column; gap: 15px; }
  .week-picker .field { width: 100%; }
  .week-totals { justify-content: space-between; }
  .week-totals b { font-size: 17px; }
  .week-row { grid-template-columns: 45px minmax(0,1fr) 43px; gap: 7px; min-height: 62px; }
  .week-route b { font-size: 10px; }
  .week-route small { font-size: 9px; }
  .week-hours { font-size: 9px; }
  .week-gross { display: none; }
  .copy-panel .section-heading .button { min-height: 37px; padding: 0 10px; font-size: 11px; }
  .agency-preview { padding: 12px; font-size: 10px; line-height: 1.65; }
  .invoice-toolbar { align-items: stretch; flex-direction: column; }
  .invoice-toolbar > .field { width: 100%; }
  .toolbar-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
  .toolbar-actions .button { min-height: 40px; padding: 0 5px; font-size: 9px; }
  .invoice-fields { grid-template-columns: 1fr; gap: 22px; }
  .invoice-lines-head { display: none; }
  .invoice-edit-row { position: relative; padding: 12px 34px 12px 0; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
  .invoice-edit-row .field:first-child { grid-column: span 3; }
  .invoice-edit-row .field > span { display: block; font-size: 9px; }
  .invoice-edit-row .field input { height: 37px; font-size: 11px; }
  .invoice-edit-row .remove-line { position: absolute; top: 18px; right: 0; }
  .invoice-total { padding-top: 12px; }
  .invoice-total b { font-size: 20px; }
  .invoice-paper { padding: 17px; }
  .paper-head { gap: 10px; }
  .paper-head h2 { font-size: 18px; }
  .paper-head p { font-size: 9px; }
  .invoice-word { font-size: 17px; }
  .paper-meta { gap: 12px; margin: 14px 0; padding: 12px 0; }
  .paper-meta b, .paper-meta span { font-size: 9px; }
  .paper-table { font-size: 8px; }
  .paper-table th, .paper-table td { padding: 7px 4px; }
  .paper-total { padding: 11px 4px; }
  .paper-total b { font-size: 17px; }
  .rate-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .settings-panel .section-heading { align-items: flex-start; flex-direction: column; }
  .settings-panel .section-heading > .button { min-height: 38px; }
  .rates-heading { align-items: flex-start; }
  .rates-heading p { max-width: 230px; line-height: 1.5; }
  .rate-grid .field input { font-size: 12px; }
  .backup-panel { align-items: flex-start; flex-direction: column; }
  .backup-panel .button { width: 100%; }
  .auth-card { padding: 23px; }
  .toast { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
}

@media print {
  body { background: white; }
  .topbar, .main-nav, .app-footer, .welcome-row, .invoice-toolbar, .invoice-fields,
  .invoice-lines-head, .invoice-lines, .invoice-total, .invoice-preview-panel > .section-heading,
  .toast { display: none !important; }
  .page-wrap { max-width: none; min-height: 0; padding: 0; }
  .panel.invoice-preview-panel { margin: 0; padding: 0; border: 0; box-shadow: none; background: white; }
  .invoice-paper { max-width: none; padding: 0; border: 0; }
}
