:root {
  --berry: #7f1d1d;
  --berry-dark: #4c0519;
  --berry-soft: #fff1f2;
  --ink: #1c1917;
  --muted: #6b7280;
  --line: #e7e5e4;
  --surface: #ffffff;
  --page: #fafaf9;
  --success: #166534;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.site-header { background: var(--berry-dark); color: white; min-height: 64px; padding: 0 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; position: sticky; top: 0; z-index: 10; }
.brand { color: white; font-weight: 800; font-size: 1.2rem; text-decoration: none; }
nav { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
nav a, .link-button { color: white; text-decoration: none; padding: .5rem; background: none; border: 0; }
nav form { display: inline; }
.page { max-width: 960px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.site-footer { max-width: 960px; margin: 0 auto; padding: 0 1rem 1.5rem; color: var(--muted); font-size: .78rem; text-align: right; }
.page-heading, .section-heading, .order-card-header, .order-card-footer, .total-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.page-heading { margin-bottom: 1.25rem; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.65rem, 5vw, 2.25rem); margin-bottom: .15rem; }
h2 { font-size: 1.1rem; margin-bottom: .9rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; color: var(--muted); margin-bottom: .35rem; font-weight: 700; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; box-shadow: 0 1px 2px rgb(0 0 0 / .03); }
.button { min-height: 44px; border-radius: 9px; padding: .65rem 1rem; border: 1px solid transparent; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .25rem; }
.button.primary { background: var(--berry); color: white; }
.button.secondary { background: var(--berry-soft); color: var(--berry-dark); border-color: #fecdd3; }
.button.ghost { background: white; color: var(--ink); border-color: #d6d3d1; }
.button.danger { color: #991b1b; border-color: #fecaca; background: #fff1f2; margin-top: .5rem; }
.button.small { min-height: 38px; padding: .45rem .7rem; font-size: .85rem; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.summary-list { list-style: none; padding: 0; margin: 0; }
.summary-list li { display: flex; justify-content: space-between; gap: .75rem; padding: .45rem 0; border-bottom: 1px solid #f0eeec; }
.summary-list li:last-child { border: 0; }
.order-list { display: grid; gap: .75rem; }
.order-card { text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.order-card:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgb(0 0 0 / .08); }
.order-card-header strong { display: block; font-size: 1.05rem; }
.order-card-header span:not(.status) { color: var(--muted); font-size: .8rem; }
.status { display: inline-block; color: var(--berry-dark); background: var(--berry-soft); border-radius: 999px; padding: .28rem .55rem; font-size: .77rem; font-weight: 700; white-space: nowrap; }
.order-items { margin: .8rem 0; color: #44403c; }
.order-card-footer { color: var(--muted); font-size: .86rem; }
.order-card-footer strong { color: var(--ink); }
.empty-state { text-align: center; padding: 2rem 1rem; }
.messages { margin-bottom: 1rem; }
.message { border-radius: 9px; padding: .75rem 1rem; background: #ecfdf5; color: var(--success); border: 1px solid #bbf7d0; }
.message.error { background: #fff1f2; color: #991b1b; border-color: #fecaca; }
.form-section { margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.full-width { grid-column: 1 / -1; }
.field { display: grid; gap: .35rem; align-content: start; }
.field label { font-weight: 700; font-size: .9rem; }
.field small { color: var(--muted); }
.week-number { font-weight: 700; color: var(--berry-dark) !important; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid #d6d3d1; border-radius: 8px; padding: .55rem .65rem; background: white; }
textarea { min-height: 75px; resize: vertical; }
input[type="checkbox"] { width: 20px; min-height: auto; }
.checkbox-field { display: flex; align-items: center; gap: .5rem; }
.checkbox-field label { font-weight: 500; }
.errorlist { margin: 0; padding-left: 1.1rem; color: #b91c1c; font-size: .84rem; }
.order-line { display: grid; grid-template-columns: 1.4fr 1fr .8fr .8fr minmax(130px, auto); gap: .7rem; align-items: end; border-bottom: 1px solid var(--line); padding: .85rem 0; }
.order-line[hidden], .order-line.is-removed { display: none !important; }
.order-line:first-child { padding-top: 0; }
.order-line:last-child { border: 0; }
.remove-field { width: auto; }
.remove-field input { display: none; }
.remove-button { min-height: 44px; border: 1px solid #fecaca; border-radius: 8px; background: #fff1f2; color: #991b1b; padding: .45rem .65rem; font-weight: 700; white-space: nowrap; }
.remove-button:disabled { border-color: #e7e5e4; background: #f5f5f4; color: #a8a29e; cursor: not-allowed; }
.heading-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.25rem; }
.customer-card { margin-bottom: 1rem; }
.contact-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.contact-grid span { display: block; color: var(--muted); font-size: .8rem; margin-bottom: .15rem; }
.contact-grid strong { overflow-wrap: anywhere; }
.note { padding: .7rem; margin: .8rem 0 0; background: #fafaf9; border-radius: 8px; }
.line-detail-list { display: grid; gap: .55rem; }
.line-detail { display: flex; justify-content: space-between; gap: 1rem; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: .75rem; }
.line-detail.is-cleaned { border-color: #bbf7d0; background: #f0fdf4; }
.line-detail span { display: block; color: var(--muted); font-size: .88rem; margin-top: .2rem; }
.line-actions { display: flex; align-items: center; gap: .7rem; }
.total-row { padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--line); }
.total { font-size: 1.25rem; }
.actions-card, .message-preview { margin-top: 1rem; }
.action-grid { display: flex; flex-wrap: wrap; gap: .65rem; }
.cancel-details { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.cancel-details summary { color: #991b1b; cursor: pointer; font-weight: 700; }
.cancel-details form { margin-top: .75rem; display: grid; gap: .4rem; max-width: 380px; }
.message-preview p { margin-bottom: 0; padding: .75rem; background: var(--berry-soft); border-radius: 8px; }
.login-card { max-width: 430px; margin: 10vh auto 0; }
.stacked-form { display: grid; gap: 1rem; }
.stacked-form > div { display: grid; gap: .35rem; }

@media (max-width: 820px) {
  .site-header { align-items: flex-start; padding-top: .7rem; padding-bottom: .7rem; flex-direction: column; }
  nav { width: 100%; overflow-x: auto; }
  nav a, .link-button { padding: .35rem; }
  .summary-grid, .form-grid, .contact-grid { grid-template-columns: 1fr; }
  .order-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .remove-field { grid-column: 1 / -1; width: auto; }
  .remove-button { width: 100%; }
  .page-heading { align-items: flex-start; }
  .line-detail { align-items: stretch; flex-direction: column; }
  .line-actions { justify-content: space-between; }
  .action-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .action-grid form:first-child, .action-grid form:nth-child(2), .action-grid form:nth-child(3) { grid-column: 1 / -1; }
  .action-grid .button { width: 100%; }
}
