/* Fonts are self-hosted (SIL Open Font License, see static/fonts/OFL.txt): CSP allows only 'self'. */
@font-face { font-family: "Great Vibes"; src: url(/static/fonts/great-vibes.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url(/static/fonts/cormorant-garamond.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "Jost"; src: url(/static/fonts/jost.woff2) format("woff2"); font-weight: 300 600; font-display: swap; }

:root {
  --cream: #F3EDE2;
  --paper: #FBF8F2;
  --ink: #161514;
  --muted: #6f6a62;
  --line: #d9d0c1;
  --kraft: #a9845a;
  --ok: #2f5d50;
  --bad: #8a2f2a;
  --script: "Great Vibes", "Cormorant Garamond", Georgia, cursive;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --gold: #b08d57;
  --shadow: 0 1px 2px rgba(22, 21, 20, .04), 0 8px 24px -12px rgba(22, 21, 20, .12);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --mono: "Space Mono", "Courier Prime", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sans: "Jost", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 300 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
main { max-width: 1080px; margin: 0 auto; padding: 1.25rem; }
h1 { font-family: var(--script); font-weight: 400; font-size: 3rem; line-height: 1.1; margin: .75rem 0 1.25rem; letter-spacing: 0; }
h1::after { content: ""; display: block; width: 3.5rem; height: 1px; margin-top: .35rem; background: var(--gold); transform-origin: left; animation: rule-in .9s var(--ease) .15s both; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .18em; margin: 0 0 .9rem; }
strong, b, th, label { font-weight: 400; }
a { color: inherit; }
.mono { font-family: var(--mono); font-size: .88em; }
.muted { color: var(--muted); }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; padding: .9rem 1.25rem; background: var(--ink); color: var(--cream); }
.brand { font-family: var(--serif); font-size: 1.4rem; letter-spacing: .5em; text-decoration: none; }
.top nav { display: flex; gap: 1rem; flex: 1; }
.top nav a { text-decoration: none; opacity: .75; }
.top nav a[aria-current] { opacity: 1; border-bottom: 1px solid var(--kraft); }
.who { display: flex; gap: .75rem; align-items: center; margin: 0; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 1.1rem; margin-bottom: 1.25rem; }
.narrow { max-width: 380px; margin: 3rem auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: .85rem; }
.tile .label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.tile strong { font-family: var(--mono); font-size: 1.15rem; font-weight: 400; }

.stack { display: grid; gap: .8rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; }
.row > label { flex: 1 1 160px; }
.row .grow { flex: 4 1 260px; }
.row .qty { flex: 0 1 90px; }
label { display: grid; gap: .25rem; font-size: .85rem; }
input, select { font: inherit; padding: .55rem .6rem; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus { outline: 2px solid var(--kraft); outline-offset: 1px; }
button, .button { font: inherit; letter-spacing: .08em; padding: .65rem 1.1rem; border: 0; border-radius: 4px; background: var(--ink); color: var(--cream); cursor: pointer; text-decoration: none; display: inline-block; }
button.link { background: none; padding: 0; color: inherit; text-decoration: underline; letter-spacing: 0; }

.flash, .error { padding: .7rem .9rem; border-radius: 4px; }
.flash { background: #e3ece6; color: var(--ok); }
.error { background: #f3e1df; color: var(--bad); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--paper); }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 500; }
.num { text-align: right; white-space: nowrap; }
tr.muted td { opacity: .55; }
.tag { font-size: .7rem; border: 1px solid var(--kraft); color: var(--kraft); border-radius: 3px; padding: 0 .3rem; }
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.tile.accent { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.tile.accent .label { color: var(--kraft); }
tfoot th { color: var(--ink); }
tr.voided td { color: var(--muted); }
tr.voided td.num { text-decoration: line-through; }
.void-note { font-size: .78rem; color: var(--bad); margin-top: .2rem; }
.void-cell { white-space: nowrap; }
.void-cell summary { cursor: pointer; font-size: .8rem; color: var(--muted); }
.void-form { display: flex; gap: .35rem; margin-top: .35rem; }
.void-form input { width: 11rem; padding: .3rem .4rem; font-size: .85rem; }
.void-form button, button.small { padding: .3rem .6rem; font-size: .8rem; letter-spacing: .02em; }
button.secondary { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
button.danger { background: #8a2b1f; }
.danger-zone { margin-top: 1rem; }
.danger-zone summary { cursor: pointer; color: #8a2b1f; }
.void-form button { background: var(--bad); }
form.inline { display: inline; margin: 0; }
.tag.ok { border-color: var(--ok); color: var(--ok); }
.tag.bad { border-color: var(--bad); color: var(--bad); }
label.check { display: flex; align-items: center; gap: .5rem; flex-direction: row; }
label.check input { width: auto; }
.top .who a.link { color: inherit; font-size: .9rem; }
.notice { background: #f4ead7; border-left: 3px solid var(--kraft); padding: .6rem .8rem; }
.secret { border-color: var(--kraft); }
.big { font-size: 1.4rem; letter-spacing: .06em; user-select: all; }

.periods { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: -.5rem 0 1.25rem; }
.periods a { text-decoration: none; padding: .35rem .85rem; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; background: var(--paper); transition: background-color .25s, color .25s, border-color .25s; }
.periods a:hover { border-color: var(--gold); color: var(--ink); }
.periods a[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.period-range { margin-left: .5rem; font-size: .85rem; }

.line { position: relative; align-items: end; }
.line[hidden] { display: none; }
.remove-line { flex: 0 0 auto; align-self: end; background: none; color: var(--muted); padding: .55rem .5rem; font-size: 1rem; line-height: 1; }
.remove-line:hover { background: none; color: var(--bad); }
.remove-line[hidden], .add-line[hidden] { display: none; }
.add-line { justify-self: start; }
.live-total { margin: .25rem 0 0; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; letter-spacing: .04em; text-align: right; }
.line-in { animation: rise .4s var(--ease) both; }

.order-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.order-head .tag { margin-left: .35rem; }
.order-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.order-head .num { font-size: 1.1rem; }
.order-meta { font-size: .85rem; margin: .35rem 0; }
.order-lines { margin: .5rem 0; padding-left: 1.1rem; }
.order-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.order-actions .void-form { margin-top: 0; }
.order-actions .void-form select { width: auto; padding: .3rem .4rem; font-size: .85rem; }
.order-actions .deliver button { background: var(--ok); }
.order-actions details summary { cursor: pointer; font-size: .85rem; color: var(--muted); }
.order.status-cancelled { opacity: .7; }

/* ---- Elegance and motion: only opacity and transform animate, so it stays cheap on old phones. ---- */
.card, .tile { box-shadow: var(--shadow); border-color: rgba(176, 141, 87, .25); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.tile:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(22, 21, 20, .05), 0 16px 32px -16px rgba(22, 21, 20, .22); }
.tile.accent { background: linear-gradient(160deg, #1d1b19, var(--ink)); }
.tile.accent strong { color: #f7f1e6; }
.brand { transition: letter-spacing .6s var(--ease), color .3s; }
.brand:hover { letter-spacing: .6em; color: var(--gold); }
.top { border-bottom: 1px solid rgba(176, 141, 87, .45); }
.top nav a { position: relative; border-bottom: 0 !important; padding-bottom: 2px; transition: opacity .25s; }
.top nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--gold); transform: scaleX(0); transition: transform .35s var(--ease); }
.top nav a:hover { opacity: 1; }
.top nav a:hover::after, .top nav a[aria-current]::after { transform: scaleX(1); }
button, .button { transition: background-color .25s, color .25s, box-shadow .25s, transform .15s; }
button:hover, .button:hover { background-color: #2b2825; }
button:active, .button:active { transform: scale(.98); }
button.secondary:hover { background: var(--ink); color: var(--cream); }
button.link:hover { background: none; color: var(--gold); }
button.danger:hover, .void-form button:hover { background: #6e2219; }
input, select { transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176, 141, 87, .18); }
tbody tr { transition: background-color .2s; }
tbody tr:hover { background: rgba(176, 141, 87, .06); }
a { transition: color .2s; }
main a:hover { color: var(--gold); }

main > * { animation: rise .55s var(--ease) both; }
main > *:nth-child(2) { animation-delay: .06s; }
main > *:nth-child(3) { animation-delay: .12s; }
main > *:nth-child(4) { animation-delay: .18s; }
main > *:nth-child(n+5) { animation-delay: .24s; }
.tiles > .tile { animation: rise .5s var(--ease) both; }
.tiles > .tile:nth-child(2) { animation-delay: .04s; }
.tiles > .tile:nth-child(3) { animation-delay: .08s; }
.tiles > .tile:nth-child(4) { animation-delay: .12s; }
.tiles > .tile:nth-child(n+5) { animation-delay: .16s; }
.flash, .error { animation: slide-in .45s var(--ease) both; }
details[open] > :not(summary) { animation: fade .3s var(--ease) both; }
.secret .big { animation: glow 2.4s ease-in-out 2; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes rule-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes glow { 50% { color: var(--gold); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
