:root {
  color-scheme: light;
  --ink: #132126;
  --muted: #66777d;
  --line: #d8e1df;
  --page: #f6f2eb;
  --surface: #ffffff;
  --surface-strong: #eff7f5;
  --brand: #12323b;
  --brand-2: #0d766b;
  --coral: #d65d46;
  --gold: #c58b24;
  --green: #2d7f55;
  --blue: #375f9d;
  --shadow: 0 18px 45px rgba(24, 37, 41, 0.12);
  --radius: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(18, 50, 59, 0.08), rgba(246, 242, 235, 0) 290px),
    var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

.is-locked {
  overflow: hidden;
}

.is-locked .app-shell,
.is-locked .toast {
  visibility: hidden;
}

.passcode-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--page);
}

.passcode-screen[hidden] {
  display: none !important;
}

.passcode-card {
  display: grid;
  width: min(100%, 360px);
  gap: 12px;
  text-align: center;
}

.passcode-card .brand-mark {
  margin: 0 auto 4px;
}

.passcode-copy {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.passcode-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  text-align: left;
}

.passcode-form label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.passcode-form input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  padding: 0 16px;
  text-align: center;
}

.passcode-form input:focus {
  outline: 3px solid rgba(13, 118, 107, 0.2);
  border-color: var(--brand-2);
}

.passcode-form .primary-action {
  width: 100%;
}

.passcode-unlock-button {
  touch-action: manipulation;
}

.passcode-error {
  min-height: 1.25em;
  margin: -2px 0 0;
  color: #a7362c;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
  max-width: 100%;
  min-width: 0;
}

button {
  color: inherit;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top, 0px)) 14px calc(88px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 14px;
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  flex: 1 1 180px;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.brand-mark {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  font-weight: 800;
  font-size: 0.86rem;
  box-shadow: 0 10px 24px rgba(18, 50, 59, 0.22);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: var(--brand);
  font-size: 1.12rem;
  line-height: 1.1;
}

h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1.1;
}

h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.content {
  display: block;
}

.view {
  display: none;
  animation: view-in 150ms ease;
}

.view.is-active {
  display: block;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 14px;
}

.sync-pill,
.small-count {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 10px;
  white-space: nowrap;
}

.primary-action,
.ghost-button,
.text-button,
.icon-button,
.filter-chip,
.tab {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 8px;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  padding: 0 14px;
  box-shadow: 0 10px 22px rgba(18, 50, 59, 0.18);
}

.primary-action:active,
.icon-button:active,
.tab:active,
.filter-chip:active,
.ghost-button:active,
.text-button:active {
  transform: translateY(1px);
}

.icon-button {
  display: inline-grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand);
}

.ghost-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--brand);
  font-weight: 800;
  padding: 0 14px;
}

.ghost-button.danger {
  color: #a7362c;
}

.text-button {
  background: transparent;
  color: var(--brand-2);
  font-weight: 800;
  padding: 8px 0 8px 8px;
}

.next-card,
.event-card,
.inventory-card,
.empty-card {
  border: 1px solid rgba(216, 225, 223, 0.95);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.next-card {
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(13, 118, 107, 0.12), rgba(214, 93, 70, 0.08)),
    #fff;
}

.next-topline,
.card-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.date-block {
  display: grid;
  flex: 0 0 54px;
  min-height: 58px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  text-align: center;
}

.date-block span:first-child {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.date-block span:last-child {
  margin-top: -4px;
  font-size: 1.35rem;
  font-weight: 900;
}

.event-main {
  min-width: 0;
  flex: 1 1 auto;
}

.event-main h3,
.event-main h2 {
  margin: 0;
}

.event-main h2 {
  font-size: 1.35rem;
}

.subline {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
  padding: 0 9px;
  white-space: nowrap;
}

.status.ready {
  background: rgba(45, 127, 85, 0.14);
  color: var(--green);
}

.status.paid {
  background: rgba(13, 118, 107, 0.14);
  color: var(--brand);
}

.status.booked {
  background: rgba(55, 95, 157, 0.13);
  color: var(--blue);
}

.status.needs-contract {
  background: rgba(197, 139, 36, 0.16);
  color: #875e11;
}

.status.payment-due,
.status.balance-due {
  background: rgba(214, 93, 70, 0.14);
  color: #a3402f;
}

.status.delivered {
  background: rgba(112, 73, 173, 0.14);
  color: #6942a3;
}

.quick-facts,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.fact {
  min-width: 0;
  border-radius: var(--radius);
  background: rgba(239, 247, 245, 0.78);
  padding: 10px;
}

.fact span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.fact strong {
  display: block;
  margin-top: 3px;
  font-size: 0.92rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.metric {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  padding: 12px 10px;
}

.metric-value {
  display: block;
  color: var(--brand);
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
}

.metric-label {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
}

.panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  padding: 14px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.daily-route {
  display: grid;
  gap: 10px;
}

.route-stop {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid rgba(216, 225, 223, 0.95);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.route-stop-time {
  display: grid;
  min-height: 58px;
  align-content: center;
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--brand);
  text-align: center;
}

.route-stop-time strong {
  font-size: 0.95rem;
  line-height: 1.1;
}

.route-stop-time span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.route-stop-body {
  min-width: 0;
}

.route-stop-title {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  line-height: 1.25;
  padding: 0;
  text-align: left;
}

.route-stop-links {
  display: grid;
  gap: 3px;
  margin-top: 6px;
}

.route-stop-links a,
.route-stop-links span {
  color: var(--brand-2);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.route-stop-body p {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.35;
}

.route-stop-body > span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.timeline-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.timeline-time {
  color: var(--brand);
  font-size: 0.84rem;
  font-weight: 900;
}

.timeline-body {
  min-width: 0;
}

.timeline-body strong {
  display: block;
  font-size: 0.92rem;
  line-height: 1.25;
}

.timeline-body span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.notes-box,
textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: 0;
}

.notes-box,
textarea {
  resize: vertical;
  line-height: 1.4;
  padding: 12px;
}

input,
select {
  min-height: 44px;
  padding: 0 11px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(13, 118, 107, 0.13);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.filter-chip {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
  padding: 0 8px;
}

.filter-chip.is-selected {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
}

.event-list,
.inventory-list,
.pickup-list {
  display: grid;
  gap: 10px;
}

.schedule-date-group {
  display: grid;
  gap: 8px;
}

.schedule-date-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 0;
}

.schedule-date-heading h3 {
  margin: 0;
  color: var(--brand);
  font-size: 1rem;
}

.schedule-date-heading span,
.pickup-count {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.schedule-cards {
  display: grid;
  gap: 10px;
}

.event-card {
  display: block;
  width: 100%;
  padding: 14px;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.pickup-card {
  padding: 14px;
  cursor: pointer;
}

.pickup-card h3 {
  margin: 4px 0 0;
}

.pickup-items {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 11px;
}

.pickup-items span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.pickup-items strong {
  line-height: 1.4;
}

.pickup-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 12px;
}

.pickup-links a {
  color: var(--brand-2);
  font-weight: 800;
}

.event-card:focus-visible,
.map-link:focus-visible,
.phone-link:focus-visible {
  outline: 3px solid rgba(13, 118, 107, 0.22);
  outline-offset: 3px;
}

.event-card .quick-facts {
  margin-top: 12px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0 8px;
}

.signed-chip {
  background: rgba(45, 127, 85, 0.14);
  color: var(--green);
}

.return-chip.returned {
  background: rgba(45, 127, 85, 0.14);
  color: var(--green);
}

.return-chip.damaged,
.return-chip.missing,
.return-chip.dirty {
  background: rgba(214, 93, 70, 0.14);
  color: #a3402f;
}

.inventory-card {
  padding: 14px;
}

.inventory-date-card {
  display: grid;
  gap: 10px;
}

.inventory-date-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(216, 225, 223, 0.8);
  padding-bottom: 10px;
}

.inventory-date-head h3 {
  color: var(--brand);
}

.inventory-date-head span:not(.small-count) {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.inventory-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  border-top: 1px solid rgba(216, 225, 223, 0.75);
}

.inventory-line:first-child {
  border-top: 0;
}

.inventory-name {
  min-width: 0;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.inventory-qty {
  min-width: 42px;
  border-radius: 999px;
  background: rgba(214, 93, 70, 0.12);
  color: #a3402f;
  font-weight: 900;
  padding: 5px 9px;
  text-align: center;
}

.map-link,
.phone-link {
  color: var(--brand-2);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.empty-card {
  padding: 18px;
  color: var(--muted);
  line-height: 1.4;
}

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  border-top: 1px solid rgba(216, 225, 223, 0.9);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  box-shadow: 0 -14px 32px rgba(24, 37, 41, 0.1);
}

.time-clock-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 72px;
  border: 1px solid rgba(13, 118, 107, 0.2);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 9px 14px;
}

.time-clock-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  row-gap: 3px;
  min-width: 0;
}

.time-clock-summary label {
  grid-column: 1 / -1;
  gap: 0;
  font-size: 0.7rem;
  line-height: 1;
  text-transform: uppercase;
}

.time-clock-summary select {
  min-width: 0;
  height: 28px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--brand);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 900;
}

.time-clock-summary span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clock-button {
  min-width: 92px;
  min-height: 42px;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 900;
}

.clock-button.is-active {
  border-color: #a3402f;
  background: #a3402f;
}

.time-clock-history-panel {
  margin-top: 14px;
}

.time-clock-history {
  display: grid;
  gap: 8px;
}

.shift-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.shift-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.shift-row div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.shift-row strong,
.shift-row b {
  color: var(--ink);
  font-size: 0.92rem;
}

.shift-row span {
  color: var(--muted);
  font-size: 0.78rem;
}

.shift-row.is-active b {
  color: var(--brand);
}

.tab {
  display: grid;
  min-width: 0;
  min-height: 54px;
  place-items: center;
  gap: 3px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.tab svg {
  width: 21px;
  height: 21px;
}

.tab.is-active {
  background: var(--surface-strong);
  color: var(--brand);
}

.today-event-section {
  border-color: rgba(13, 118, 107, 0.35);
}

.today-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal {
  width: min(calc(100vw - 22px), 640px);
  width: min(calc(100dvw - 22px), 640px);
  max-height: min(90vh, 820px);
  max-height: min(90dvh, 820px);
  margin: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 26px 72px rgba(19, 33, 38, 0.24);
}

.modal::backdrop {
  background: rgba(19, 33, 38, 0.38);
  backdrop-filter: blur(6px);
}

.event-form,
.detail-modal {
  padding: 16px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.paste-toggle-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.paste-toggle {
  min-height: 36px;
  padding: 0 12px;
}

.paste-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  border: 1px solid rgba(13, 118, 107, 0.2);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 12px;
}

.paste-panel[hidden] {
  display: none;
}

.paste-panel textarea {
  min-height: 124px;
  background: #fff;
}

.paste-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.paste-actions .primary-action,
.paste-actions .ghost-button {
  min-height: 38px;
  box-shadow: none;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field-row.wide {
  grid-column: 1 / -1;
}

.payment-status-control {
  align-content: start;
}

.paid-toggle {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(13, 118, 107, 0.22);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 0 12px;
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 850;
}

.paid-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

label {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

label.wide {
  grid-column: 1 / -1;
}

.modal-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.order-total-preview {
  display: grid;
  min-width: 132px;
  min-height: 42px;
  margin-right: auto;
  align-content: center;
  border: 1px solid rgba(13, 118, 107, 0.2);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 7px 10px;
}

.order-total-preview span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.order-total-preview strong {
  margin-top: 3px;
  color: var(--brand);
  font-size: 1rem;
  line-height: 1;
}

.balance-preview strong {
  color: #a3402f;
}

.balance-preview.is-paid {
  border-color: rgba(13, 118, 107, 0.3);
  background: rgba(13, 118, 107, 0.09);
}

.balance-preview.is-paid strong {
  color: var(--brand);
}

.detail-body {
  display: grid;
  gap: 12px;
}

.detail-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.detail-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.detail-section h3 {
  margin-bottom: 8px;
}

.detail-action-grid {
  display: grid;
  gap: 10px;
}

.contract-entry-button,
.calendar-entry-button {
  display: grid;
  width: 100%;
  min-height: 62px;
  border: 1px solid rgba(13, 118, 107, 0.22);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 12px;
  text-align: left;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.contract-entry-button {
  background: var(--brand);
  color: #fff;
}

.calendar-entry-button {
  appearance: none;
  background: #fff;
  color: var(--brand);
  font: inherit;
}

.contract-entry-button span,
.calendar-entry-button span {
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.contract-entry-button strong,
.calendar-entry-button strong {
  margin-top: 4px;
  font-size: 1rem;
  line-height: 1.25;
}

.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.detail-section-head h3 {
  margin-bottom: 0;
}

.return-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 7px;
}

.return-check-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--brand);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 0 8px;
  -webkit-tap-highlight-color: transparent;
}

.return-check-button.is-selected {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
}

.review-request-button {
  display: grid;
  width: 100%;
  min-height: 58px;
  margin-top: 10px;
  border: 1px solid rgba(13, 118, 107, 0.22);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--brand);
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.review-request-button span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.review-request-button strong {
  margin-top: 3px;
  font-size: 0.96rem;
}

.contract-signed-line {
  margin: 0 0 8px;
  border-radius: var(--radius);
  background: rgba(45, 127, 85, 0.12);
  color: var(--green);
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.35;
  padding: 9px 10px;
}

.detail-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 9px 10px;
}

.detail-list span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-list strong {
  flex: 0 0 auto;
}

.contract-modal {
  width: min(calc(100vw - 18px), 760px);
  width: min(calc(100dvw - 18px), 760px);
}

.contract-document {
  display: grid;
  gap: 12px;
}

.contract-card {
  display: grid;
  gap: 14px;
}

.contract-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.contract-topline h3 {
  font-size: 1.18rem;
}

.contract-status {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(197, 139, 36, 0.16);
  color: #875e11;
  font-size: 0.75rem;
  font-weight: 900;
  padding: 7px 10px;
}

.contract-status.is-signed {
  background: rgba(45, 127, 85, 0.14);
  color: var(--green);
}

.contract-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.contract-field,
.signed-panel {
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 10px;
}

.contract-field span,
.signed-panel span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.contract-field strong,
.signed-panel strong {
  display: block;
  margin-top: 3px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.contract-list,
.contract-terms {
  margin: 0;
  padding: 0;
}

.contract-list {
  display: grid;
  gap: 7px;
  list-style: none;
}

.contract-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 9px 10px;
}

.contract-totals {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.contract-totals span,
.contract-totals strong {
  font-weight: 850;
}

.contract-totals span:last-of-type,
.contract-totals strong:last-of-type {
  color: var(--brand);
  font-size: 1.08rem;
}

.contract-terms {
  display: grid;
  gap: 7px;
  padding-left: 20px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.4;
}

.signed-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(45, 127, 85, 0.2);
}

.signed-panel img {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  border-radius: var(--radius);
  background: #fff;
}

.signature-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.signature-box {
  min-height: 156px;
  border: 1px dashed rgba(13, 118, 107, 0.42);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.signature-box canvas {
  display: block;
  width: 100%;
  height: 156px;
  touch-action: none;
}

.contract-actions {
  position: sticky;
  bottom: -1em;
  margin-right: -1em;
  margin-bottom: -1em;
  margin-left: -1em;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 1em calc(10px + var(--safe-bottom));
  backdrop-filter: blur(12px);
}

.print-preview-open {
  overflow: hidden;
}

.print-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: auto;
  background: #fff;
  padding: max(14px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

.print-preview-actions {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: -14px -14px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 14px;
  backdrop-filter: blur(12px);
}

.print-preview-body {
  width: min(100%, 760px);
  margin: 0 auto;
}

.agree-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.35;
}

.agree-row input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--brand-2);
}

.toast {
  position: fixed;
  right: 14px;
  bottom: calc(84px + var(--safe-bottom));
  left: 14px;
  z-index: 40;
  display: none;
  width: min(calc(100% - 28px), 532px);
  margin: 0 auto;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.toast.is-visible {
  display: block;
}

@media (min-width: 760px) {
  .app-shell {
    width: min(100%, 920px);
    padding-right: clamp(18px, 3vw, 28px);
    padding-left: clamp(18px, 3vw, 28px);
  }

  .tabbar {
    width: min(100%, 920px);
    padding-right: clamp(14px, 3vw, 22px);
    padding-left: clamp(14px, 3vw, 22px);
  }

  .inventory-list,
  .pickup-list,
  .schedule-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .detail-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-grid {
    gap: 12px;
  }

  .modal {
    width: min(calc(100vw - 40px), 720px);
    width: min(calc(100dvw - 40px), 720px);
  }

  .contract-modal {
    width: min(calc(100vw - 48px), 880px);
    width: min(calc(100dvw - 48px), 880px);
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding-right: clamp(10px, 3vw, 14px);
    padding-left: clamp(10px, 3vw, 14px);
  }

  .topbar,
  .section-heading,
  .panel-header,
  .inventory-date-head,
  .detail-section-head,
  .contract-topline {
    align-items: flex-start;
  }

  .field-grid,
  .contract-grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: 8px;
  }

  .modal {
    width: calc(100vw - 12px);
    width: calc(100dvw - 12px);
    max-height: calc(100vh - 18px - var(--safe-bottom));
    max-height: calc(100dvh - 18px - var(--safe-bottom));
  }

  .event-form,
  .detail-modal {
    padding: 14px;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .modal-actions > .ghost-button,
  .modal-actions > .primary-action {
    width: 100%;
  }

  .order-total-preview {
    grid-column: 1 / -1;
    width: 100%;
    margin-right: 0;
  }

  .paste-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .paste-actions .primary-action,
  .paste-actions .ghost-button {
    width: 100%;
  }

  .contract-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contract-list li,
  .detail-list li {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .contract-list strong,
  .detail-list strong {
    overflow-wrap: anywhere;
  }

  .contract-terms {
    padding-left: 18px;
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .brand-mark {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
  }

  .primary-action {
    padding: 0 10px;
  }

  .filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-stop {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .return-check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-facts,
  .detail-grid,
  .contract-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: letter portrait;
    margin: 0.3in;
  }

  html,
  body {
    width: 100%;
    height: auto;
    background: #fff !important;
  }

  body > * {
    display: none !important;
  }

  #printView {
    display: block !important;
    position: static !important;
    width: 100%;
    height: auto;
    max-height: none;
    margin: 0;
    border: 0;
    box-shadow: none;
    overflow: visible;
    background: #fff;
  }

  .print-preview-actions {
    display: none;
  }

  .contract-document,
  .contract-card {
    margin: 0;
    padding: 0;
    width: 100%;
  }

  .contract-card {
    break-inside: avoid;
    page-break-inside: avoid;
    font-size: 9px;
    line-height: 1.15;
  }

  .contract-topline {
    margin-bottom: 6px;
  }

  .contract-topline h3,
  .contract-card > h3 {
    margin: 5px 0 3px;
    font-size: 11px;
  }

  .contract-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
  }

  .contract-field,
  .contract-list li {
    padding: 3px 5px;
  }

  .contract-list,
  .contract-terms {
    margin: 3px 0;
  }

  .contract-totals {
    gap: 2px 10px;
    margin-top: 4px;
    padding: 5px;
  }

  .contract-terms {
    columns: 2;
    column-gap: 18px;
    padding-left: 16px;
  }

  .contract-terms li {
    break-inside: avoid;
    margin-bottom: 2px;
  }

  .signed-panel {
    margin-top: 5px;
    padding: 5px;
  }

  .signed-panel img {
    max-height: 42px;
  }
}
