@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@500;600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --ink: #142045;
  --muted: #495873;
  --blue: #1746b8;
  --deep-blue: #0c328f;
  --paper: #f9f8f3;
  --line: #dce3ed;
  --wash: #e9effe;
  --white: #fff;
  --yellow: #f7ce5d;
  --green: #17573b;
  --green-wash: #e6f6ec;
  --red: #8b292e;
  --red-wash: #fff0ed;
  --radius: 16px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 100%;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1,h2,h3,p { margin-top: 0; }
h1,h2,h3 { font-family: 'Bricolage Grotesque', system-ui, sans-serif; line-height: 1.09; }
h1 { font-size: clamp(2.2rem, 4vw, 3.4rem); letter-spacing: -.05em; margin-bottom: 10px; }
h2 { font-size: 1.55rem; letter-spacing: -.035em; margin-bottom: 10px; }
h3 { font-size: 1.2rem; letter-spacing: -.025em; margin-bottom: 8px; }
p { line-height: 1.55; }
p:last-child { margin-bottom: 0; }
a { color: var(--blue); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.skip { position: absolute; top: -5rem; left: 12px; padding: 10px; color: var(--white); background: var(--ink); z-index: 5; }
.skip:focus { top: 10px; }
.topbar { padding: 16px clamp(18px, 4vw, 54px); min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); background: var(--white); }
.brand { display: inline-flex; align-items: center; gap: 14px; font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-size: 1.1rem; font-weight: 800; letter-spacing: -.03em; color: var(--ink); text-decoration: none; }
.brand small { color: var(--muted); font: 600 .85rem/1.2 'DM Sans', system-ui, sans-serif; display: block; letter-spacing: 0; margin-top: 3px; }
.brand-mark { inline-size: 27px; block-size: 27px; flex: 0 0 auto; background: var(--blue); position: relative; clip-path: polygon(50% 0, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0 50%, 35% 35%); }
.brand-mark::after { content: ''; position: absolute; inset: 5px; background: var(--white); clip-path: inherit; }
.top-actions { display: flex; gap: 14px; align-items: center; }
.top-link { text-decoration: none; font-weight: 700; font-size: .94rem; }
.top-link:hover { text-decoration: underline; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 1510px; min-height: calc(100vh - 76px); margin: auto; }
.layout.signed-in { grid-template-columns: 226px minmax(0, 1fr); }
nav { padding: 32px 18px; border-right: 1px solid var(--line); }
nav a { display: block; padding: 12px 14px; margin-bottom: 3px; color: var(--muted); text-decoration: none; border-radius: 10px; font-weight: 700; white-space: nowrap; }
nav a:hover { background: #eef1f6; }
nav a[aria-current="page"] { color: var(--blue); background: var(--wash); }
main { min-width: 0; padding: clamp(24px, 4vw, 52px); outline: 0; }
.muted { color: var(--muted); }
.button { min-height: 42px; display: inline-flex; padding: 9px 16px; align-items: center; justify-content: center; gap: 8px; font: 700 .94rem/1.3 'DM Sans', system-ui, sans-serif; color: var(--white); border: 1px solid transparent; border-radius: 999px; background: var(--blue); text-decoration: none; cursor: pointer; }
.button:hover { background: var(--deep-blue); }
.button.secondary { color: var(--blue); border-color: var(--line); background: var(--white); }
.button.secondary:hover { background: var(--wash); }
.button[disabled] { opacity: .65; cursor: wait; }
.card, .table-card, .auth-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.card, .auth-card { padding: clamp(18px, 3vw, 30px); }
.auth-card { max-width: 520px; margin: 6vh auto; box-shadow: 0 14px 44px rgba(20, 32, 69, .075); }
.auth-card h1 { font-size: clamp(2rem, 4vw, 2.7rem); }
.page-heading { margin-bottom: 24px; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-heading p { margin-bottom: 0; }
.mode { display: flex; align-items: flex-start; gap: 14px; justify-content: space-between; border: 1px solid #e8d483; background: #fff7d8; border-radius: var(--radius); padding: 18px 20px; margin-bottom: 24px; }
.mode.live { border-color: #aedac2; background: var(--green-wash); }
.mode strong { display: block; margin-bottom: 4px; }
.mode p { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat p { font-size: .94rem; font-weight: 700; margin-bottom: 10px; }
.stat strong { display: block; color: var(--blue); font: 800 clamp(1.7rem, 2.8vw, 2.7rem)/1 'Bricolage Grotesque', system-ui, sans-serif; letter-spacing: -.06em; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.table-card { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; white-space: nowrap; }
td,th { text-align: left; padding: 14px 17px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); background: #f5f7fc; font-size: .875rem; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-stack { display: grid; gap: 3px; }
.cell-stack small { font-size: .875rem; }
.pill { display: inline-flex; align-items: center; border-radius: 99px; padding: 4px 9px; background: var(--wash); color: var(--deep-blue); font-size: .875rem; font-weight: 700; white-space: nowrap; }
.pill.success { color: var(--green); background: var(--green-wash); }
.pill.caution { color: #653d03; background: #fff1cc; }
.pill.danger { color: var(--red); background: var(--red-wash); }
.pill.subtle { color: var(--muted); background: #edf0f5; }
.empty { padding: 26px; color: var(--muted); margin: 0; }
.filters { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.filters label:first-child { flex: 1 1 230px; }
.filters label { min-width: 150px; }
label { display: grid; gap: 6px; font-size: .93rem; font-weight: 700; }
label span.help { font-size: .875rem; color: var(--muted); font-weight: 500; line-height: 1.43; }
input, select, textarea { font: inherit; font-weight: 500; color: var(--ink); border: 1px solid #aebbd0; border-radius: 9px; min-height: 44px; padding: 10px 12px; min-width: 0; width: 100%; background: var(--white); }
select { appearance: none; padding-right: 36px; background: linear-gradient(45deg, transparent 50%, var(--ink) 50%) calc(100% - 17px) 50%/6px 6px no-repeat, linear-gradient(135deg, var(--ink) 50%, transparent 50%) calc(100% - 11px) 50%/6px 6px no-repeat var(--white); }
textarea { resize: vertical; }
form { display: grid; gap: 14px; }
form .button { justify-self: start; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-wide { grid-column: 1/-1; }
.check { display: flex; align-items: flex-start; gap: 9px; }
.check input { accent-color: var(--blue); flex: 0 0 auto; padding: 0; margin-top: 3px; width: 17px; min-height: 0; height: 17px; }
.check > span { display: grid; gap: 3px; }
.settings-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-grid .card { display: grid; align-content: start; gap: 13px; }
.settings-grid .card h2, .settings-grid .card p { margin-bottom: 0; }
.callout-list { padding-left: 20px; margin: 0; color: var(--muted); line-height: 1.5; }
.notice { padding: 12px 16px; background: var(--green-wash); color: var(--green); border-radius: 10px; margin-bottom: 18px; }
.notice.error, .form-error { padding: 12px 16px; background: var(--red-wash); color: var(--red); border-radius: 10px; margin: 0; }
.notice.error { margin-bottom: 18px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dialog-head h2 { margin: 0; }
dialog { border-radius: var(--radius); border: 1px solid var(--line); max-height: calc(100% - 30px); width: min(720px, calc(100% - 26px)); max-width: none; padding: clamp(18px, 3vw, 30px); color: var(--ink); }
dialog::backdrop { background: rgb(20 32 69 / .55); }
.dialog-section { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 20px; }
.order-details { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; margin: 15px 0; }
.detail-list { display: grid; gap: 5px 12px; grid-template-columns: auto minmax(0, 1fr); margin: 0; align-content: start; }
.detail-list dt { color: var(--muted); font-size: .875rem; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.order-lines { display: grid; gap: 8px; margin-top: 12px; }
.order-line { display: flex; justify-content: space-between; gap: 12px; }
.order-line span:last-child { white-space: nowrap; }
.order-line.total { border-top: 1px solid var(--line); padding-top: 9px; font-weight: 700; }
@media (max-width: 900px) {
  .layout.signed-in { grid-template-columns: 170px minmax(0, 1fr); }
  nav { padding-left: 10px; padding-right: 10px; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .layout.signed-in { grid-template-columns: minmax(0, 1fr); }
  nav { border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; display: flex; overflow: auto; gap: 4px; }
  nav a { margin: 0; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .top-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .brand { gap: 7px; font-size: 1rem; }
  .brand-mark { width: 20px; height: 20px; }
  main { padding-left: 14px; padding-right: 14px; }
  .mode, .page-heading { align-items: flex-start; flex-direction: column; }
  .stats { gap: 7px; }
  .stat { padding: 10px; }
  .stat p { font-size: .875rem; }
  .fields, .order-details { grid-template-columns: 1fr; }
}
