/* ops.makipatisserie.com/delivery · the parent operational spec
   (reference/design_system_operational.md): ink + paper, hairlines, mono for
   ids, money and tags, one soft radius for controls, data stays square.
   Tight density (§7): an operator surface, scanned on a phone. */

:root {
  --ink:         #102A38;
  --ink-2:       #4C6472;
  --ink-3:       #8A9AA4;
  --paper:       #FFFFFF;
  --paper-1:     #F4F8FA;
  --paper-2:     #E9EFF3;
  --rule:        #D3DDE3;
  --rule-strong: #B4C2CB;
  --urgent:      #C81E14;
  --urgent-bg:   #FBE9E7;
  --ok:          #2A7340;
  --dijon:       #FDAA1C;   /* the wordmark only */
  --r-2:         8px;
  --sans: 'Archivo', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --page: 720px;
  --gutter: max(16px, calc((100% - var(--page)) / 2 + 16px));
  --fast: 120ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button, input { font-family: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

/* header band: the same as the ops root, the kitchen and sales links */
header {
  background: var(--ink);
  display: flex; align-items: center; gap: 16px;
  padding: 10px var(--gutter);
  min-height: 60px;
}
.wordmark {
  font-size: 13px; font-weight: 600; font-stretch: 112%;
  letter-spacing: 0.2em; line-height: 1; color: var(--dijon);
  text-decoration: none;
}
.hdr-tag {
  flex: 1;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; color: var(--rule-strong);
}

main { max-width: var(--page); margin: 0 auto; padding: 0 0 48px; }

#loading-state { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 72px 16px; }
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--rule); border-top-color: var(--ink); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-caption { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 1px; color: var(--ink-3); }

#error-region {
  background: var(--urgent-bg); color: var(--urgent);
  padding: 12px 16px; font-size: 14px; cursor: pointer; white-space: pre-line;
}

/* one delivery day: a mono tag, then its orders as bands */
.day-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 24px 16px 8px;
  border-bottom: 1px solid var(--rule-strong);
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; color: var(--ink-2);
}
.day-head .count { font-variant-numeric: tabular-nums; color: var(--ink-3); }
.day-head.is-today { color: var(--ink); }

.orders { list-style: none; }
.order { padding: 14px 16px 16px; border-bottom: 1px solid var(--rule); transition: opacity var(--fast) var(--ease); }
.order.saving { opacity: 0.55; pointer-events: none; }
.order.is-cancelled .name, .order.is-cancelled .money { color: var(--ink-3); }

.line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 4px; }
.line:first-child { margin-top: 0; justify-content: space-between; }
.id    { font-family: var(--mono); font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.name  { font-size: 16px; font-weight: 500; }
.tel   { font-family: var(--mono); font-size: 13px; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.money { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.meta  { font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.mono  { font-family: var(--mono); font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* status: a dot and a mono label (§4.3). The dot takes a colour only for a
   real state: delivered ok, cancelled faint, no pin urgent. */
.flag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink); white-space: nowrap;
}
.flag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.flag.is-ok { color: var(--ok); }
.flag.is-off { color: var(--ink-3); }
.flag.is-urgent { color: var(--urgent); }
.porter { font-family: var(--mono); font-size: 11px; letter-spacing: 0.5px; color: var(--ink-2); text-transform: uppercase; }
.flags { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }

/* the Porter line: fixed slots, each with a mono tag; an empty slot is not drawn */
.slots { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; }
.slot { display: inline-flex; align-items: baseline; gap: 6px; }
.slot .tag {
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink-3);
}

/* buttons: ink primary, ink-bordered secondary, 8px, 44px targets */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 14px; border-radius: var(--r-2);
  font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
  border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
  white-space: nowrap;
  transition: background-color var(--fast) var(--ease);
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-hdr { min-height: 44px; background: transparent; color: var(--paper); border-color: var(--rule-strong); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* one inline panel per row: a field, its action, close */
.panel { margin-top: 12px; padding: 12px; background: var(--paper-1); }
.panel .label {
  display: block; margin-bottom: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; color: var(--ink-2);
}
.field {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--rule-strong); border-radius: var(--r-2);
  font-size: 16px; background: var(--paper); outline: none;
}
.field:focus { border-color: var(--ink); }
.fare { font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums; }
.hint { margin-top: 8px; font-size: 13px; color: var(--urgent); white-space: pre-line; overflow-wrap: anywhere; }
.hint:empty { display: none; }

.empty { font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding: 24px 16px; }

footer {
  max-width: var(--page); margin: 0 auto; padding: 16px 16px 32px;
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: 4px 12px;
}

@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):not(.btn-primary):not(.btn-hdr):hover { background: var(--paper-1); }
  .btn-hdr:not(:disabled):hover { background: rgba(255, 255, 255, 0.08); }
}
