/* PANILO — design system (shared by the app, the site and the public order page).
   Rules: flat surfaces, no gradients, no glow, no decorative shadows.
   Borders only where they help find a control. Status = word + shape, never colour alone. */

@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/dmsans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/dmsans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url(/static/fonts/archivo-latin-wdth.woff2) format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/static/fonts/fraunces-latin.woff2) format("woff2"); }

:root {
  color-scheme: light;
  /* Brand */
  --blue: #163e78;
  --blue-dark: #0f2d59;
  --blue-soft: #e6ecf5;
  --yellow: #e8b744;
  --yellow-soft: #fbf1d6;
  --cream: #f4efe5;
  --charcoal: #252423;
  --crust: #a75b36;
  /* Surfaces */
  --paper: #fffdf9;
  --paper-2: #faf6ee;
  --line: #e2dbcd;
  --line-strong: #c9c0b0;
  --muted: #625e57;
  --faint: #8a857c;
  /* Functional (pale tint + dark text) */
  --ok: #2f6a48;      --ok-soft: #e4f0e7;
  --warn: #8a5a00;    --warn-soft: #fbefd2;
  --danger: #9d3b32;  --danger-soft: #f7e3e0;
  --info: #163e78;    --info-soft: #e6ecf5;
  --focus: #e8b744;
  /* Type */
  --font: "DM Sans", "Avenir Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sign: "Archivo", "DM Sans", system-ui, sans-serif; /* shop-sign display face: titles, prices, big numbers */
  /* Shape */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --tap: 48px;
  --sidebar: 232px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--cream); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--charcoal);
  background: var(--cream);
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
img, svg { display: block; }
a { color: var(--blue); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Icons (sprite: <svg class="ic"><use href="/static/icons/sprite.svg#i-plus"/></svg>) ---------- */
.ic { width: 20px; height: 20px; flex: 0 0 auto; }
.ic-lg { width: 24px; height: 24px; }
.ic-sm { width: 16px; height: 16px; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.t-section { font-size: 1.125rem; }
.t-muted { color: var(--muted); }
.t-small { font-size: 0.875rem; }
.t-label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.t-num { font-variant-numeric: tabular-nums; }
p { margin: 0 0 0.75em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 1.5px solid transparent; border-radius: var(--r);
  font-weight: 600; font-size: 1rem; line-height: 1; text-decoration: none; white-space: nowrap;
  background: var(--paper); color: var(--blue); border-color: var(--line-strong);
}
.btn:hover { border-color: var(--blue); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-accent { background: var(--yellow); color: var(--charcoal); border-color: var(--yellow); }
.btn-accent:hover { background: #dda935; border-color: #dda935; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--blue-soft); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: #dcb7b2; }
.btn-danger:hover { border-color: var(--danger); }
.btn-lg { min-height: 56px; padding: 0 24px; font-size: 1.0625rem; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 0.9375rem; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-icon { width: var(--tap); padding: 0; }
.btn-icon.btn-sm { width: 38px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-weight: 600; font-size: 0.9375rem; }
.field .hint { font-size: 0.9375rem; color: var(--muted); }
.field .hint-ok { color: var(--ok); font-weight: 600; }
.field .hint-warn { color: var(--warn); font-weight: 600; }
.field .error-text { font-size: 0.9375rem; color: var(--danger); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px;
  background: var(--paper); border: 1.5px solid var(--line-strong); border-radius: var(--r);
  font-size: 1rem; color: var(--charcoal);
}
.textarea { min-height: 88px; resize: vertical; line-height: 1.4; }
.select { appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23163e78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--yellow-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .ic { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.input-group .input { padding-left: 44px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9375rem; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--blue); flex: 0 0 auto; }

/* Segmented control / chips (one choice among a few) */
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button, .seg a { min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-weight: 600; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"], .seg a[aria-current="page"] { background: var(--paper); color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--paper); color: var(--charcoal); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { border-color: var(--blue); }
.chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 0.75rem; font-weight: 700; }

/* Stepper (- 4 +) */
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line-strong); border-radius: var(--r); background: var(--paper); }
.stepper button { width: 44px; height: 44px; border: 0; background: transparent; color: var(--blue); display: grid; place-items: center; border-radius: var(--r); }
.stepper button:hover { background: var(--blue-soft); }
.stepper input { width: 52px; height: 44px; border: 0; text-align: center; font-weight: 700; font-size: 1.0625rem; background: transparent; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; }

/* ---------- Status badges (always with a word; shape marker via ::before) ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; background: var(--paper-2); color: var(--muted); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge-pending  { background: var(--warn-soft); color: var(--warn); }               /* À préparer — filled dot */
.badge-ready    { background: var(--ok-soft); color: var(--ok); }
.badge-ready::before { width: 10px; height: 6px; border-radius: 0; background: none; border-left: 2px solid; border-bottom: 2px solid; transform: rotate(-45deg) translate(1px, -1px); } /* check mark */
.badge-picked   { background: #ecebe8; color: #55524c; }
.badge-picked::before { border-radius: 2px; }                                           /* square */
.badge-cancelled{ background: var(--danger-soft); color: var(--danger); }
.badge-cancelled::before { height: 2px; border-radius: 0; width: 10px; }                 /* dash */
.badge-request  { background: var(--info-soft); color: var(--info); }
.badge-request::before { background: transparent; border: 2px solid; width: 9px; height: 9px; } /* ring */
.badge-late     { background: var(--danger-soft); color: var(--danger); }
.badge-paid { background: var(--ok-soft); color: var(--ok); }
.badge-paid::before { display: none; }
.badge-pro { background: var(--yellow); color: var(--charcoal); letter-spacing: 0.04em; }
.badge-pro::before { display: none; }
.badge-soon { min-height: 22px; padding: 0 8px; font-size: 0.75rem; background: var(--yellow); color: var(--charcoal); vertical-align: 0.1em; }
.badge-soon::before { display: none; }

/* ---------- Surfaces ---------- */
.panel { background: var(--paper); border-radius: var(--r-lg); padding: 20px; }
.panel-flush { background: var(--paper); border-radius: var(--r-lg); overflow: hidden; }
.divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); background: var(--yellow-soft); color: var(--charcoal); font-size: 0.9375rem; }
.notice .ic { color: var(--warn); margin-top: 1px; }
.notice-info { background: var(--blue-soft); }
.notice-info .ic { color: var(--blue); }
.notice-danger { background: var(--danger-soft); }
.notice-danger .ic { color: var(--danger); }
.notice-ok { background: var(--ok-soft); }
.notice-ok .ic { color: var(--ok); }

/* Rows (lists of orders, customers, products) */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; min-height: 64px; border-bottom: 1px solid var(--line); background: var(--paper); text-decoration: none; color: inherit; }
.rows > li:last-child .row, .rows > .row:last-child { border-bottom: 0; }
a.row:hover, button.row:hover { background: var(--paper-2); }
button.row { width: 100%; border-left: 0; border-right: 0; border-top: 0; text-align: left; font: inherit; }
.row-time { font-weight: 700; font-size: 1.0625rem; min-width: 56px; color: var(--blue); }
.row-main { flex: 1 1 auto; min-width: 0; }
.row-title { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { display: block; color: var(--muted); font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Empty state */
.empty { text-align: center; padding: 48px 20px; max-width: 460px; margin: 0 auto; }
.empty img { width: 120px; height: auto; margin: 0 auto 16px; opacity: 0.9; }
.empty h2 { font-size: 1.25rem; margin-bottom: 8px; }
.empty p { color: var(--muted); margin-bottom: 20px; }

/* Toast */
.toast-zone { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--charcoal); color: #fff; font-weight: 500; }
.toast .ic { color: var(--yellow); }
.toast button { margin-left: auto; background: none; border: 0; color: var(--yellow); font-weight: 700; padding: 4px 6px; }
@media (min-width: 900px) { .toast-zone { bottom: 32px; } }

/* Dialog / sheet (native <dialog>) */
dialog.sheet { border: 0; padding: 0; background: var(--paper); color: var(--charcoal); width: min(640px, 100vw); max-width: 100vw; max-height: 92vh; border-radius: var(--r-lg); }
dialog.sheet::backdrop { background: rgba(37, 36, 35, 0.45); }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--paper); z-index: 1; }
.sheet-head h2 { font-size: 1.25rem; flex: 1; }
.sheet-body { padding: 20px; overflow: auto; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--paper); flex-wrap: wrap; }
@media (max-width: 640px) {
  dialog.sheet { margin: auto 0 0; width: 100vw; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 94vh; }
  .sheet-foot .btn { flex: 1; }
}

/* ---------- App shell ---------- */
.shell { min-height: 100vh; min-height: 100svh; }
.sidebar { display: none; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--cream); border-bottom: 1px solid var(--line); }
.topbar .logo { height: 22px; width: auto; }
.topbar .spacer { flex: 1; }
.main { padding: 20px 16px 120px; max-width: 1080px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(1.625rem, 3.2vw, 2rem); }
.page-head .sub { color: var(--muted); margin-top: 4px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; background: var(--paper); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 2px 10px; min-height: 60px; color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 600; }
.tabbar a[aria-current="page"] { color: var(--blue); }
.tabbar a[aria-current="page"] .ic { stroke-width: 2.4; }
.tabbar .tab-add { color: var(--charcoal); font-weight: 700; padding-top: 0; }
.tabbar .tab-add-dot { width: 56px; height: 56px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; margin-top: -22px; border: 4px solid var(--cream); }
.tabbar .tab-add .ic { width: 26px; height: 26px; stroke-width: 2.5; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--sidebar) 1fr; }
  .tabbar, .topbar { display: none; }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 24px 14px; overflow-y: auto; overscroll-behavior: contain; background: var(--blue); color: #fff; }
  .sidebar .logo { width: 128px; height: auto; margin: 4px 10px 28px; filter: brightness(0) invert(1); }
  .sidebar nav { display: grid; gap: 4px; }
  .sidebar a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: var(--r-sm); color: #dfe6f1; text-decoration: none; font-weight: 600; }
  .sidebar a:hover { background: rgba(255,255,255,0.08); color: #fff; }
  .sidebar a[aria-current="page"] { background: #fff; color: var(--blue); }
  .sidebar .side-new { margin: 0 0 20px; }
  .sidebar .side-bottom { margin-top: auto; flex: none; display: grid; gap: 2px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.15); }
  .sidebar .side-bottom a { min-height: 40px; font-weight: 500; font-size: 0.9375rem; }
  .sidebar .side-bakery { padding: 12px 12px 4px; font-size: 0.8125rem; color: #b9c6dc; }
  .main { padding: 32px 40px 64px; }
}

/* Demo / beta ribbon at the top of the app */
.ribbon { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: var(--yellow); color: var(--charcoal); font-size: 0.9375rem; font-weight: 500; text-align: center; }
.ribbon button, .ribbon a { background: none; border: 0; padding: 4px 2px; font-weight: 700; color: var(--charcoal); text-decoration: underline; text-underline-offset: 3px; }

/* Utility layout */
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; }
.stack-lg { display: grid; gap: 28px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Loading */
.skeleton { background: var(--paper-2); border-radius: var(--r-sm); min-height: 18px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Print (production sheet, bag tickets) ---------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  html, body { background: #fff !important; color: #000; font-size: 12pt; }
  .sidebar, .topbar, .tabbar, .ribbon, .toast-zone, .page-head .btn { display: none !important; }
  .print-only { display: block; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .panel, .panel-flush, .row { background: #fff !important; }
  .badge { border: 1px solid #000; background: #fff !important; color: #000 !important; }
  a { color: #000; text-decoration: none; }
}

@media (min-width: 900px) and (max-height: 860px) {
  .sidebar { padding: 14px 12px; }
  .sidebar .logo { margin-bottom: 14px; }
  .sidebar .side-new { margin-bottom: 10px; min-height: 46px; }
  .sidebar nav a { min-height: 42px !important; }
  .sidebar .side-bottom { padding-top: 8px; }
  .sidebar .side-bottom a, .sidebar .side-link { min-height: 36px; }
}
