/* معمل الجينز — one stylesheet for the workshop app and the boutique.

   Direction: workmanlike, exact, a little warm. The world is the cutting table:
   pattern paper, tailor's chalk, raw denim and topstitch thread.
   - Surfaces and text come from one neutral ramp; nothing in the chrome is coloured.
   - One accent, the thread: the selected menu row, the figure that matters, the seam.
   - Signature: the double row of topstitching, on the logo mark and the production seam only.
   - Everything sits on a 4px grid. The pages read right to left, so spacing and
     alignment use start/end. One type family covers Arabic and Latin (IBM Plex). */

:root {
  color-scheme: light;
  --page: #fafafa;
  --card: #ffffff;
  --raised: #f4f4f5;
  --text: #171717;
  --text-2: #525252;
  --text-3: #737373;
  --line: rgb(23 23 23 / 8%);
  --line-2: rgb(23 23 23 / 16%);
  --thread: #a8590a;
  --thread-soft: #f6ead9;
  --ok: #15803d;
  --warn: #a16207;
  --bad: #b91c1c;
  --bad-soft: #fdecec;
  --r-control: 8px;
  --r-card: 14px;
  --shadow-float: 0 8px 24px rgb(0 0 0 / 6%);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --side-w: 256px;
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font: 400 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--text); font-weight: 500; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
h1 { margin: 0; font-size: 28px; font-weight: 500; line-height: 1.35; text-wrap: balance; }
h2 { margin: 0; font-size: 17px; font-weight: 500; line-height: 1.4; }
h3 { margin: 0; font-size: 17px; font-weight: 500; line-height: 1.4; }
p { margin: 0; }
small { font-size: 13px; font-weight: 400; color: var(--text-3); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.icon { flex: none; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- brand: the name, and a mark with two rows of stitching ---------- */

.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; flex: none; background: var(--text); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 8px 4px; border-block: 1.5px dashed var(--thread-soft); }

/* ---------- app shell: menu at the side, content beside it ---------- */

body.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; align-items: start; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 24px; padding: 20px 12px 16px;
  background: var(--raised); border-inline-end: 1px solid var(--line);
}
.side > .brand { padding: 0 8px; min-height: 32px; }
.side-nav { margin: 0; padding: 0; border: 0; inset: auto; width: auto; height: auto; background: none; color: inherit; overflow: visible; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group p { padding: 0 8px 8px; font-size: 13px; color: var(--text-3); }
.nav-group a { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 8px; border-radius: var(--r-control); color: var(--text-2); font-weight: 400; transition: background-color 140ms var(--ease), color 140ms var(--ease); }
.nav-group a .icon { color: var(--text-3); }
.nav-group a:hover { background: rgb(23 23 23 / 5%); color: var(--text); text-decoration: none; }
.nav-group a[aria-current="page"] { background: var(--card); color: var(--text); font-weight: 500; box-shadow: 0 0 0 1px var(--line); }
.nav-group a[aria-current="page"] .icon { color: var(--thread); }
.side-user { display: flex; align-items: center; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.side-user a { color: var(--text-2); font-weight: 400; }

main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 32px 32px 64px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
/* wide content scrolls inside its own box instead of stretching the page */
main > *, .card > *, .panel > *, .container > * { min-width: 0; }
body.plain main { max-width: 1040px; }

@media (min-width: 861px) {
  .menu-btn { display: none; }
  .side-nav { position: static; display: flex; flex-direction: column; gap: 24px; flex: 1; }
  .side-user { margin-top: auto; }
}
@media (max-width: 860px) {
  body.app { display: block; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .side > .brand { padding: 0; }
  .menu-btn { min-height: 40px; }
  .side-nav { position: fixed; inset-block-start: 68px; inset-inline: 8px; max-block-size: calc(100dvh - 84px); overflow: hidden auto; overscroll-behavior: contain; padding: 16px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-float); }
  /* two columns of groups, scrolling up and down only when the screen is short (newspaper
     columns were tried: with a capped height they grow sideways, off the screen) */
  .side-nav:is(:popover-open, .\:popover-open) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 8px; align-content: start; }
  .side-nav::backdrop { background: rgb(0 0 0 / 0.2); }
  .nav-group:first-child, .side-user { grid-column: 1 / -1; }
  .nav-group a { min-height: 44px; }
  /* the page behind stays still while the menu is open */
  html:has(.side-nav:is(:popover-open, .\:popover-open)) { overflow: hidden; }
  main { padding: 20px 16px 48px; gap: 20px; }
  h1 { font-size: 24px; }
}

/* ---------- page head ---------- */

.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 16px; }
.crumb { font-size: 13px; }
.crumb a { color: var(--text-3); font-weight: 400; }
.crumb a::before { content: "› "; }
.meta, .hint, .foot, .empty { color: var(--text-3); font-size: 13px; }
.empty { padding: 32px 16px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--r-card); }
.summary { color: var(--text-2); }
.summary strong { color: var(--text); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- buttons ---------- */

/* hidden means hidden, whatever display a component sets */
[hidden] { display: none !important; }
button, .btn {
  font: 500 14px/1 var(--font); cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: var(--r-control); border: 1px solid var(--text); background: var(--text); color: #fff;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease), transform 140ms var(--ease);
}
button:hover, .btn:hover { background: #2e2e2e; border-color: #2e2e2e; text-decoration: none; }
button:active, .btn:active { transform: scale(0.98); }
button.ghost, .btn.ghost { background: var(--card); color: var(--text); border-color: var(--line-2); }
button.ghost:hover, .btn.ghost:hover { background: var(--raised); border-color: var(--line-2); }
button.ghost.danger, button.danger { color: var(--bad); }
button.danger { background: var(--card); border-color: var(--line-2); }
button.ghost.danger:hover, button.danger:hover { background: var(--bad-soft); }
button.link { min-height: 0; padding: 4px; border: 0; background: none; color: var(--text); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line-2); }
button.link:hover { background: none; text-decoration-color: currentColor; }
button.link.danger { color: var(--bad); }
/* the X that closes a panel */
button.close { width: 36px; min-height: 36px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-2); }
button.close:hover { background: var(--raised); color: var(--text); }
button.close svg { width: 18px; height: 18px; }
.menu-btn { background: var(--card); color: var(--text); border-color: var(--line-2); }
/* a light button: it must not pick up the dark hover of the main buttons, or its text disappears */
.menu-btn:hover, .menu-btn:active { background: var(--raised); border-color: var(--line-2); color: var(--text); }

/* ---------- cards and forms ---------- */

.card, .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.card.key { border-color: var(--line-2); }
.card.narrow { max-width: 400px; width: 100%; margin: 8vh auto 0; padding: 32px; gap: 20px; }
.card.narrow.below { margin-top: 0; }
/* login / new account / invite code: one card, three tabs */
.door { gap: 24px; }
.door form { display: flex; flex-direction: column; gap: 20px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-control); background: var(--raised); }
.tabs a { flex: 1; display: grid; place-items: center; min-height: 36px; padding: 0 8px; border-radius: 6px; color: var(--text-2); font-size: 13px; font-weight: 400; text-align: center; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { background: var(--card); color: var(--text); font-weight: 500; box-shadow: 0 0 0 1px var(--line-2); }
.card.narrow h1 { font-size: 20px; }
.card > button { align-self: flex-start; }
.card.narrow > button { align-self: stretch; }
.panel > header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.panel > header a { font-size: 13px; color: var(--text-2); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; align-items: start; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field span { font-size: 13px; color: var(--text-2); }
.field:has(:required) > span::after { content: " *"; color: var(--thread); }
input, select {
  font: 400 15px/1.4 var(--font); color: var(--text); background: var(--card); width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-control); transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
input::placeholder { color: var(--text-3); }
/* iPhones give a date field a width of its own and centre its text: it stuck out of the
   form. Without the native look it takes the width it is given, like any other field. */
input[type="date"], input[type="month"], input[type="time"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; box-sizing: border-box; }
input::-webkit-date-and-time-value { text-align: start; min-height: 1.4em; }
/* the list's own arrow sits against the edge with no room: ours is drawn with space around it */
select:not([multiple]) {
  appearance: none; -webkit-appearance: none; padding-inline-end: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 16px; background-position: left 14px center;
}
[dir="ltr"] select:not([multiple]) { background-position: right 14px center; }
input:hover, select:hover { border-color: rgb(23 23 23 / 32%); }
input:focus, select:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px rgb(23 23 23 / 8%); }
input:user-invalid, select:user-invalid { border-color: var(--bad); }
input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--text); }
/* several choices as tick-able chips */
.field.choices { min-width: 0; margin: 0; padding: 0; border: 0; }
.field.choices legend { padding: 0; margin-bottom: 8px; font-size: 13px; color: var(--text-2); }
.field.choices > div { display: flex; flex-wrap: wrap; gap: 8px; }
.field.choices.wide { grid-column: 1 / -1; }
.field.choices label { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-control); background: var(--card); cursor: pointer; }
.field.choices label:has(input:checked) { border-color: var(--text); background: var(--raised); font-weight: 500; }
.field.choices input { width: 16px; height: 16px; margin: 0; accent-color: var(--text); }
.field.check { flex-direction: row; align-items: center; gap: 8px; padding-top: 24px; }
.field.check span { font-size: 15px; color: var(--text); }
input.small { width: 88px; min-height: 36px; padding: 4px 8px; text-align: center; }
form.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.filter { display: flex; gap: 8px; align-items: center; }
.filter input { width: auto; }
/* numbers, codes, dates and passwords are typed left to right, but sit on the start edge */
input[type="tel"], input[type="number"], input[type="date"], input[type="month"], input[type="password"], input[inputmode] { direction: ltr; text-align: end; }
input.small, .stepper input { text-align: center; }

.error { color: var(--bad); }
p.error { padding: 8px 12px; background: var(--bad-soft); border-radius: var(--r-control); }

/* rows of inputs: the models of a matelas, the lines of a sale */
.lines { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
.lines.sale { grid-template-columns: 3fr 1fr 1fr; }
.lines.ret { grid-template-columns: 3fr 1fr 1fr 1fr; align-items: center; }
.lines.ret input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--text); }
/* the bundles of a new matelas: model, size, pieces per trace, the pieces that gives, remove */
.lines.cut { grid-template-columns: 2fr 1fr 1fr 96px 36px; align-items: center; }
.lines.cut .line-row { display: contents; }
.lines.cut output { font-weight: 500; text-align: end; }
/* the new-matelas form has two faces: cut now (metres and trace) or cut before (pieces and where they are) */
.contents { display: contents; }
.cut-form .only-old { display: none; }
.cut-form:has(#f-existing:checked) .only-old { display: revert; }
.cut-form:has(#f-existing:checked) fieldset.only-old { display: flex; }
.cut-form:has(#f-existing:checked) .only-old.contents { display: contents; }
.cut-form:has(#f-existing:checked) .lines.cut { grid-template-columns: 2fr 1fr 1fr 72px 1.6fr 36px; }
.cut-preview { margin: 0; color: var(--text-2); }
.cut-preview strong { font-size: 18px; font-weight: 500; color: var(--text); margin-inline-start: 4px; }
.lines > * { min-width: 0; }
.lines .lh { font-size: 13px; color: var(--text-2); }

/* ---------- figures ---------- */

.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 0; }
.totals > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 20px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.totals dt { font-size: 13px; color: var(--text-2); }
.totals dt a { color: inherit; font-weight: 400; }
.totals dd { margin: 0; font-size: 28px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.totals dd small { margin-inline-start: 4px; }
.totals dd.hint { font-size: 13px; font-weight: 400; line-height: 1.6; }
.totals > div.key dd:not(.hint) { color: var(--thread); }
.panel > .totals > div { border: 0; padding: 0; }

.notice { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 16px; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-card); color: var(--text); font-weight: 400; }
.notice strong { margin-inline-start: 8px; color: var(--thread); font-weight: 600; }
.notice:hover { background: var(--raised); text-decoration: none; }
p.notice { padding-block: 12px; flex-wrap: wrap; }
.notice > .icon { color: var(--text-3); transform: scaleX(-1); } /* "onward" points left here */

/* ---------- the seam: where the pieces are, station by station ---------- */

.seam { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: relative; }
/* the thread: two dashed lines painted as the background of each station, from its dot
   to the next. (Drawn as a stretched box it came out a dot long in Safari, three times.) */
.seam li {
  background-image: repeating-linear-gradient(90deg, var(--thread) 0 4px, transparent 4px 7px), repeating-linear-gradient(90deg, var(--thread) 0 4px, transparent 4px 7px);
  background-repeat: no-repeat; background-size: calc(100% - 28px) 1.5px; background-position: right 22px top 6px, right 22px top 8.5px;
}
.seam li { position: relative; padding-top: 28px; }
.seam li::before { content: ""; position: absolute; top: 0; inset-inline-start: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 4px var(--card); }
.seam li.idle::before { background: var(--card); border: 1.5px solid var(--line-2); }
.seam li.last::before { background: var(--thread); }
.seam a { display: flex; flex-direction: column; gap: 4px; padding-inline-end: 16px; color: var(--text); font-weight: 400; }
.seam a:hover { text-decoration: none; }
.seam a:hover span { color: var(--text); }
.seam strong { font-size: 28px; font-weight: 500; line-height: 1.3; }
.seam li.idle strong { color: var(--text-3); }
.seam li.last strong { color: var(--thread); }
.seam span { font-size: 13px; color: var(--text-2); }
.panel:has(.seam) { container-type: inline-size; }
@container (width < 640px) {
  .seam { grid-auto-flow: row; gap: 0; }
  .seam li {
    background-image: repeating-linear-gradient(180deg, var(--thread) 0 4px, transparent 4px 7px), repeating-linear-gradient(180deg, var(--thread) 0 4px, transparent 4px 7px);
    background-size: 1.5px calc(100% - 28px); background-position: right 6px top 28px, right 8.5px top 28px; padding-bottom: 16px;
  }
  .seam li:last-child { background-image: none; padding-bottom: 0; }
  .seam li { padding-top: 0; padding-inline-start: 32px; }
  .seam li:not(:last-child) { padding-bottom: 16px; }
  .seam li::before { top: 8px; }
  .seam a { flex-direction: row; align-items: baseline; gap: 12px; }
}

/* ---------- the month's money: in, out, and what is left ---------- */
.money { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.money h3 { margin: 0; font-size: 15px; font-weight: 500; }
.money > .hint { margin: 0; }
.money dl { margin: 8px 0 0; display: flex; flex-direction: column; }
.money dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.money dt { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.money dt a { color: var(--text); font-weight: 400; }
.money .sign { width: 12px; color: var(--text-3); flex: none; }
.money dd { margin: 0; font-weight: 500; white-space: nowrap; }
.money .part { border-top: 0; padding: 0 0 8px; padding-inline-start: 20px; font-size: 13px; color: var(--text-2); }
.money .part dd { font-weight: 400; }
.money .note { margin: -6px 0 8px; padding-inline-start: 20px; }
.panel > .hint { margin: 0; }
.money .sum { border-top: 1.5px solid var(--text); }
.money .sum dt { font-weight: 500; }
.money .sum dd { font-size: 20px; color: var(--thread); }
.money .sum.bad dd { color: var(--bad); }
.panel > header .month-pick summary { min-width: 144px; }

/* home page widgets: the whole tile opens its page */
.widgets .totals > div { position: relative; transition: border-color 140ms var(--ease); }
.widgets .totals > div:hover, .widgets .totals > div:focus-within { border-color: var(--line-2); }
.widgets dt a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-card); }
.widgets dt a:hover { text-decoration: none; }

/* "where to" on the take-out form: the workshop of the next stage is asked only when they go in */
form:has(#f-to option[value="wait"]:checked) .next-only { display: none; }

/* the rights of a role: one row per page, one tick per action */
.rights-grid th, .rights-grid td { padding: 8px 12px 8px 0; white-space: nowrap; }
.rights-grid thead th, .rights-grid tbody th { font-size: 14px; color: var(--text); }
.rights-grid td, .rights-grid thead th:not(:first-child) { text-align: center; width: 88px; }
.rights-grid td:last-child, .rights-grid thead th:last-child { border-inline-start: 1px solid var(--line); }
form.owner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; color: var(--text-2); }
form.owner select { width: auto; min-height: 36px; }
.rights-grid label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.rights-grid input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--text); }
.rights-grid tr.group th { padding-top: 20px; font-size: 13px; font-weight: 400; color: var(--text-3); border-top: 0; }
.rights-grid tbody tr:not(.group) th { font-weight: 400; border-top: 1px solid var(--line); }
/* a set of rights that will not work as hoped */
.warnings { list-style: none; margin: 8px 0 0; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); background: #fbf3e6; border: 1px solid #ecd9b8; border-radius: var(--r-control); white-space: normal; }
.warnings li::before { content: "⚠ "; color: var(--thread); }
/* a form the user may read but not send (see filterHtml in lib/acl.ts) */
form[inert] { opacity: 0.75; }

/* the rights of a user: one small list per area, side by side when there is room */
.step.rights { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 16px; }
.step.rights legend { grid-column: 1 / -1; }
form:has(#f-super:checked) .rights { opacity: 0.45; }

/* short lists on the home page: a name, a word about it, an amount */
.short { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.short li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.short li:first-child { border-top: 0; padding-top: 0; }
.short a { color: var(--text); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.short .hint { grid-column: 1; grid-row: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.short strong { grid-row: 1; grid-column: 2; font-weight: 500; white-space: nowrap; }
.cols.three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cols + .hint { margin: -12px 0 0; }
.bars.wide { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 32px; }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: baseline; }
.bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--raised); position: relative; overflow: hidden; }
.bar::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--w, 0%); border-radius: 2px; background: var(--text-2); }

/* one bar split into shares: where the cost of a piece goes */
.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.stack span { width: var(--w); min-width: 2px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.legend li { display: flex; align-items: center; gap: 12px; min-height: 36px; border-top: 1px solid var(--line); }
.legend .hint { width: 48px; text-align: end; }
.sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.s0 { background: #171717; }
.s1 { background: #525252; }
.s2 { background: #8a8a8a; }
.s3 { background: #b5b5b5; }
.s4 { background: #d9d9d9; }
.s5 { background: #ececec; box-shadow: inset 0 0 0 1px var(--line-2); }

/* ---------- tables ---------- */

.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 4px 20px; container-type: inline-size; }
.panel > .tablewrap, .card > .tablewrap { border: 0; border-radius: 0; padding: 0; }
table { border-collapse: collapse; width: 100%; }
/* lists that sit one under the other with the same columns line up */
.same-cols { display: flex; flex-direction: column; gap: 16px; }
.same-cols table { table-layout: fixed; }
.same-cols th:first-child { width: 36%; }
.same-cols th:last-child { width: 64px; }
.same-cols td { overflow: hidden; text-overflow: ellipsis; }
th, td { text-align: start; padding: 12px 0; padding-inline-end: 16px; white-space: nowrap; vertical-align: middle; }
th:last-child, td:last-child { padding-inline-end: 0; }
th { font-size: 13px; font-weight: 400; color: var(--text-3); }
td { border-top: 1px solid var(--line); }
tbody tr:hover td { background: rgb(23 23 23 / 2%); }
/* A row that opens something: the whole row is the target (see /app.js) and its name reads as a link. */
main tbody tr:has(td:first-child > a[href]) { cursor: pointer; }
main tbody td:first-child > a[href] { font-weight: 500; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line-2); }
main tbody tr:hover td:first-child > a[href] { text-decoration-color: currentColor; }
th.num, td.num { text-align: end; }
td strong, .strong { font-weight: 500; }
td form { margin: 0; }
td button.ghost, td .actions button { min-height: 32px; padding: 0 12px; }
td .actions { flex-wrap: nowrap; }
input.small.pay { width: 96px; }
/* the buttons of a row sit at the end of it, so the same button is under itself on every row */
td:last-child:has(.actions, .edit, form.inline) { text-align: end; }
td:last-child .actions { display: inline-flex; justify-content: flex-end; gap: 16px; }
td .actions button.link { min-height: 0; padding: 4px 0; }
td .actions .edit { padding: 4px 0; }
.wrap { white-space: normal; display: inline-block; min-width: 224px; max-width: 448px; font-size: 13px; color: var(--text-2); }
/* on a narrow screen each row becomes a small card with the column names in front */
@container (width < 440px) {
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { padding: 12px 0; border-top: 1px solid var(--line); }
  tr:first-child { border-top: 0; }
  td { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0; border: 0; white-space: normal; text-align: end; }
  td:empty { display: none; }
  td[data-label]::before { content: attr(data-label); flex: none; font-size: 13px; color: var(--text-3); }
  tbody tr:hover td { background: none; }
}

/* the "edit" link beside anything that can be corrected */
.edit { font-size: 13px; font-weight: 400; color: var(--text-2); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line-2); }
.edit:hover { color: var(--text); text-decoration-color: currentColor; }
.lines > span { align-self: center; }
input[readonly] { background: var(--raised); color: var(--text-3); }

/* a status: a small dot and the word */
.tag { display: inline-flex; align-items: center; gap: 8px; margin-inline-start: 8px; font-size: 13px; font-weight: 400; color: var(--text-2); white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
td > .tag:first-child { margin-inline-start: 0; }
.tag.ok::before { background: var(--ok); }
.tag.warn::before { background: var(--warn); }
.tag.bad::before { background: var(--bad); }
.tag.bad { color: var(--bad); }
.code { direction: ltr; display: inline-block; padding: 2px 8px; font: 500 14px/1.6 var(--mono); background: var(--raised); border: 1px solid var(--line); border-radius: 6px; user-select: all; }

#toast { position: fixed; z-index: 40; inset-block-end: 24px; inset-inline: 0; width: fit-content; max-width: min(92vw, 520px); margin-inline: auto; padding: 12px 16px; background: var(--card); border: 1px solid var(--bad); border-radius: var(--r-card); box-shadow: var(--shadow-float); }
.form-error { margin: 0; }

.rows { display: flex; flex-direction: column; gap: 16px; }
.row-set { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-control); }
.row-set legend { padding: 0 8px; font-size: 13px; color: var(--text-2); }
.row-set > button { margin-block-start: 12px; }
.recipe-slots { margin-top: 12px; }
.recipe-slots summary { cursor: pointer; color: var(--text-2); min-height: 32px; }
.recipe-slots .lines { margin-top: 8px; }
.head .actions .btn svg, button svg { flex: none; }

/* "Add a new one" in a list: its fields join the same row as the list, only when that choice is picked. */
.create-new { display: none; }
.field:has(option[value="new"]:checked) + .create-new { display: contents; }
/* A form asked as a few plain questions, one under the other. */
.steps { gap: 28px; }
.step { min-width: 0; margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 12px; }
/* floated so the title sits inside the block, under the dividing line, not on it */
.step legend { float: inline-start; width: 100%; padding: 0; font-size: 15px; font-weight: 500; color: var(--text); }
.step legend + * { clear: both; }
.step + .step { padding-top: 24px; border-top: 1px solid var(--line); }
.step .hint { margin: 0; }
/* paying only makes sense with a supplier: hidden while "no supplier" is chosen */
.steps:has(#f-partyId option[value=""]:checked) .pay-step { display: none; }
/* the kimbiel date only with a kimbiel */
.pay-step .grid:has(#f-method option[value="cash"]:checked) label:has(#f-kimbielDate) { display: none; }
.pay-step .field.check { padding-top: 0; }
.step-total { margin: 4px 0 0; font-size: 15px; color: var(--text-2); }
.step-total strong { font-size: 20px; font-weight: 500; color: var(--text); margin-inline: 4px; }

/* ---------- the month of a page: before, after, and the twelve months to jump to ---------- */
.month-pick { display: flex; align-items: center; gap: 8px; }
.month-pick > a { width: 40px; min-height: 40px; padding: 0; justify-content: center; }
.month-pick .next svg { transform: scaleX(-1); }
.month-pick details { position: relative; }
.month-pick summary { min-width: 168px; min-height: 40px; justify-content: center; list-style: none; cursor: pointer; font-weight: 500; }
.month-pick summary::-webkit-details-marker { display: none; }
.month-grid { position: absolute; z-index: 5; inset-block-start: calc(100% + 8px); inset-inline-start: 0; width: 288px; padding: 12px; display: grid; gap: 12px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.1); }
.month-grid header { display: flex; align-items: center; justify-content: space-between; }
.month-grid header a { width: 36px; min-height: 36px; padding: 0; justify-content: center; }
.month-grid ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.month-grid li a { display: grid; place-items: center; min-height: 40px; border-radius: 8px; color: var(--text); font-weight: 400; }
.month-grid li a:hover { background: var(--raised); text-decoration: none; }
.month-grid li a[aria-current] { background: var(--text); color: var(--page); font-weight: 500; }

/* ---------- every list: search, period, sort, pages (see /lists.js) ---------- */
.list-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.list-bar input[type="search"] { flex: 1 1 200px; max-width: 320px; min-height: 40px; }
.list-bar input[type="date"], .list-bar select { width: auto; min-height: 40px; }
.list-period { display: inline-flex; align-items: center; gap: 6px; }
.list-period small { color: var(--text-3); }
.list-bar select { margin-inline-start: auto; color: var(--text-2); }
.list-body { display: grid; gap: inherit; transition: opacity 0.15s; }
.list-body[aria-busy="true"] { opacity: 0.55; }
.row-filter { max-width: 320px; min-height: 40px; }
tbody tr[hidden] { display: none; }
.list-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.list-foot .hint { margin: 0; margin-inline-end: auto; }
.list-foot button { min-height: 36px; padding: 0 12px; }
th a { color: inherit; font-weight: inherit; }
th a:hover { color: var(--text); text-decoration: none; }
th a[aria-sort]::after { content: " ↑"; color: var(--text); }
th a[aria-sort="descending"]::after { content: " ↓"; }
.list-foot .btn { min-height: 36px; padding: 0 12px; }
@media (max-width: 560px) {
  .list-bar input[type="search"] { flex: 1 1 100%; max-width: none; }
  .list-bar select { margin-inline-start: 0; flex: 1 1 100%; }
  .list-period { flex: 1 1 100%; min-width: 0; }
  .list-bar .list-period input[type="date"] { flex: 1 1 0; width: 0; min-width: 0; padding-inline: 8px; }
}

/* ---------- home: what needs doing today ---------- */
.todo { gap: 8px; }
.todo h2 { font-size: 16px; }
.todo ul { list-style: none; margin: 0; padding: 0; }
.todo li + li { border-top: 1px solid var(--line); }
.todo a { display: flex; align-items: center; gap: 12px; min-height: 44px; color: var(--text); font-weight: 400; }
.todo a:hover { text-decoration: none; background: var(--raised); }
.todo a strong { min-width: 28px; font-size: 16px; font-weight: 500; color: var(--accent, #a8590a); }
.todo a.bad strong { color: var(--bad); }
.todo a .icon { color: var(--text-3); transform: scaleX(-1); }

/* ---------- month calendar (attendance) ---------- */
.cal header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.cal header h2 { font-size: 18px; }
.cal header .btn { width: 40px; padding: 0; }
/* back in time is to the right here, forward to the left */
.cal header .btn.next svg { transform: scaleX(-1); }
.cal-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { padding: 4px 8px; font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-day { display: flex; flex-direction: column; gap: 4px; min-height: 76px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--card); color: var(--text); font-weight: 400; }
.cal-day:hover { border-color: var(--line-2); background: var(--raised); text-decoration: none; }
.cal-day .num { font-size: 15px; font-weight: 500; }
.cal-day small { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.cal-day small.bad { color: var(--bad); font-weight: 500; }
.cal-day.miss { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.cal-day.off { background: var(--raised); }
.field.check.tight { padding-top: 0; }
.cal-day.later { color: var(--text-3); background: none; }
.cal-day.today .num { display: inline-grid; place-items: center; width: 28px; height: 28px; margin: -4px; border-radius: 50%; background: var(--text); color: #fff; }
.cal-day.on { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
@media (max-width: 640px) {
  .cal-grid { gap: 4px; }
  .cal-head { padding: 4px 2px; font-size: 11px; text-align: center; }
  .cal-day { min-height: 56px; padding: 6px 4px; align-items: center; }
  .cal-day small { font-size: 10px; text-align: center; }
}

.card.holiday { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.card.holiday p { margin: 0; }

/* attendance: the row of "fill many at once" buttons above the day's sheet */
.bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--raised); }
.bulk[hidden] { display: none; }
.bulk button { min-height: 36px; padding: 0 12px; }
.bulk-set { display: inline-flex; align-items: center; gap: 8px; }
.bulk-set input { width: 72px; min-height: 36px; }
.bulk .hint { margin: 0; margin-inline-start: auto; }
tbody tr.touched td { background: color-mix(in srgb, var(--accent, #a8590a) 6%, transparent); }
td > input[type="checkbox"], .bulk input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--text); }

/* the matelas page: what its bundles can do next */
.next-steps { display: flex; flex-direction: column; gap: 12px; }
.next-step { gap: 12px; border-inline-start: 3px solid var(--accent, #a8590a); }
.next-what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 0; }
.next-what strong { font-size: 16px; font-weight: 500; }
.next-what .hint { margin: 0; }
.next-step > button { align-self: flex-start; }

/* ---------- confirm box ---------- */

dialog { max-width: min(92vw, 400px); padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text); box-shadow: var(--shadow-float); }
dialog[open] { display: flex; flex-direction: column; gap: 20px; }
dialog .actions { justify-content: flex-end; }
dialog:modal { overscroll-behavior: contain; }
/* the page behind an open dialog (a form, the size picker, the cart, a question) stays still;
   the gutter keeps the page from jumping sideways when its scrollbar goes */
html { scrollbar-gutter: stable; }
html:has(dialog[open]) { overflow: hidden; }
dialog::backdrop { background: rgb(23 23 23 / 32%); overflow: hidden; overscroll-behavior: contain; }

/* ---------- forms in place: the sheet, and the quick-add menu ---------- */

#sheet { width: min(94vw, 760px); max-width: none; max-height: 92dvh; overflow: auto; padding: 0; }
#sheet.wide { width: min(96vw, 1080px); height: 92dvh; background: var(--page); }
#sheet[open] { gap: 0; }
.sheet-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 48px; padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--line); font-size: 13px; }
.sheet-bar a { color: var(--text-2); font-weight: 400; }
.sheet-bar button { margin-inline-start: auto; }
#sheet-body > .card { border: 0; border-radius: 0; padding: 24px; }
#sheet-body > .card h1 { font-size: 20px; }
#sheet.wide #sheet-body { display: flex; flex-direction: column; gap: 24px; padding: 24px; }
#sheet.wide #sheet-body > * { min-width: 0; }
#sheet.wide #sheet-body > .card { border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; }
#sheet.wide h1 { font-size: 24px; }
#sheet-error { margin: 16px 24px 0; }
/* a form opened inside a detail view: part of the page, marked by a thread-coloured edge */
#sheet .inline-form { border-color: var(--line-2); border-inline-start: 3px solid var(--accent, #a8590a); }
#sheet .inline-form h1 { font-size: 18px; }
#sheet .inline-form { position: relative; }
#sheet .inline-form [data-inline-close] { position: absolute; inset-block-start: 12px; inset-inline-end: 12px; }
/* In a panel the X closes; the "back" link of the full page is not needed. */
#sheet form.card .actions > a { display: none; }
@media (max-width: 560px) {
  #sheet.wide { width: 100vw; height: 100dvh; max-height: none; border: 0; border-radius: 0; }
  #sheet.wide #sheet-body { padding: 16px; gap: 20px; }
}


/* ---------- scanner, labels ---------- */

.cam { width: 100%; max-width: 520px; aspect-ratio: 4 / 3; background: var(--text); border-radius: var(--r-card); object-fit: cover; }
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(62mm, 1fr)); gap: 4mm; }
.label { direction: ltr; background: #fff; color: #000; border: 1px solid var(--line-2); border-radius: 6px; padding: 3mm; display: flex; flex-direction: column; gap: 1.5mm; break-inside: avoid; page-break-inside: avoid; }
.label-top { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; }
.label-main { font-size: 16px; font-weight: 600; }
.label svg { width: 100%; height: auto; }
.photo { max-width: 320px; width: 100%; border-radius: var(--r-card); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- boutique: the same system on pattern paper ---------- */

body.bleed { --page: #f7f4ee; --card: #fdfbf7; --raised: #efe9df; --text: #1f1b16; --text-2: #5e554a; --text-3: #6b6257; --line: rgb(31 27 22 / 8%); --line-2: rgb(31 27 22 / 16%); }
body.bleed main { max-width: none; min-height: 100vh; padding: 0; gap: 0; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding-inline: 24px; }
.container.stack { display: flex; flex-direction: column; gap: 24px; padding-block: 24px 64px; flex: 1; }

.shop-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; min-height: 64px; }
.shop-head nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.shop-head nav a:not(.btn) { color: var(--text-2); font-weight: 400; }
.shop-head nav a[aria-current="page"] { color: var(--text); font-weight: 500; }
.shop-head .who { color: var(--text-3); font-size: 13px; }
.shop-head .btn { min-height: 36px; }
/* the signed-in client: a person icon and the name of their shop */
.shop-head .who { display: inline-flex; align-items: center; gap: 6px; }
.shop-head .who svg { width: 16px; height: 16px; }

/* the hero is one scene: the subject sits on the left of the picture, the words on its calm wall */
.hero { position: relative; display: flex; align-items: center; height: clamp(320px, 48vh, 440px); margin-top: 8px; border-radius: 16px; overflow: hidden; background: #ebe4da; }
.hero-scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left bottom; }
.hero-text { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 20px; max-width: 560px; padding: 32px 56px; }
.hero h1 { font-size: clamp(32px, 3.6vw, 44px); line-height: 1.3; max-width: 12ch; }
.hero p { max-width: 32ch; font-size: 18px; color: var(--text-2); }
.hero .actions { gap: 20px; }
.hero .btn { min-height: 48px; padding: 0 20px; font-size: 15px; }
/* the short facts sit in the hero, under the buttons, separated by dots */
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 13px; color: var(--text-2); }
.facts li + li::before { content: "·"; margin-inline: 10px; color: var(--text-3); }
@media (max-width: 760px) {
  .hero { flex-direction: column; align-items: stretch; height: auto; background: none; border-radius: 0; overflow: visible; gap: 24px; }
  .hero-text { order: -1; max-width: none; padding: 24px 0 0; }
  .hero-scene { position: static; height: auto; aspect-ratio: 4 / 3; border-radius: 16px; object-position: left bottom; }
}
.price { font-weight: 500; white-space: nowrap; }

.section { padding-block: 32px 64px; display: flex; flex-direction: column; gap: 24px; }
.section > h2, .promo h2 { font-size: 28px; line-height: 1.35; }
/* Three models across on a wide screen, so the row fills the page; fewer as it narrows. */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(240px, (100% - 48px) / 3), 1fr)); gap: 40px 24px; }
.product { display: flex; flex-direction: column; gap: 8px; }
.product-photo { aspect-ratio: 4 / 5; margin-bottom: 4px; border-radius: var(--r-card); overflow: hidden; background: var(--raised); display: grid; place-items: center; color: var(--text-3); }
.product-photo img { width: 100%; height: 100%; object-fit: cover; }
.product-photo svg { width: 40%; height: auto; }

/* Several photos: a track that scrolls sideways and always rests on one photo. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.carousel { position: relative; display: block; }
.carousel-track { display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; touch-action: manipulation; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track > * { flex: 0 0 100%; scroll-snap-align: center; }
.carousel-track:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
@media (prefers-reduced-motion: no-preference) { .carousel-track { scroll-behavior: smooth; } }
.carousel-controls { position: absolute; z-index: 1; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; pointer-events: none; }
/* The arrows stay out of the photo until the pointer is over it (or the keyboard is on them). Phones swipe. */
.carousel-controls button { pointer-events: auto; touch-action: manipulation; width: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 50%; background: rgb(255 255 255 / 0.92); color: var(--text); box-shadow: 0 1px 4px rgb(0 0 0 / 0.14); opacity: 0; transition: opacity 160ms var(--ease); }
.carousel:hover .carousel-controls button, .carousel-controls button:focus-visible { opacity: 1; }
.carousel-controls button:hover { background: #fff; }
.carousel .carousel-controls button:disabled { opacity: 0; pointer-events: none; }
.carousel-controls button svg { width: 16px; height: 16px; }
.carousel-controls [data-direction="next"] svg { transform: scaleX(-1); } /* the next photo is to the left here */
@media (hover: none) { .carousel-controls { display: none; } }
.carousel-markers { position: absolute; z-index: 1; inset-block-end: 4px; inset-inline: 0; width: fit-content; margin-inline: auto; display: flex; }
/* Small dots inside 24px targets. The current one is longer as well as solid, and each
   has a thin light edge so it reads on a light or a dark photo. */
.carousel-markers button { box-sizing: border-box; width: 28px; height: 28px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.carousel-markers button::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: rgb(23 23 23 / 0.3); box-shadow: 0 0 0 1px rgb(255 255 255 / 0.7); transition: width 160ms var(--ease); }
.carousel-markers button[aria-current="true"]::before { width: 16px; background: var(--text); }
.carousel-markers button:focus-visible { outline: 2px solid var(--text); outline-offset: -4px; border-radius: 6px; }

/* the photos of a model, on its dashboard page */
.photo-list { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; list-style: none; }
.photo-list li { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.photo-list img { width: 120px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-control); border: 1px solid var(--line); }
.product-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pick-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; margin-top: 4px; padding: 0; border: 0; border-top: 1px solid var(--line-2); border-radius: 0; background: none; color: var(--text-2); font-weight: 400; }
.pick-btn:hover { background: none; border-color: var(--line-2); color: var(--text); }
.pick-btn:active { transform: none; }
.pick-btn .icon { color: var(--text-3); }
.pick-btn.chosen { color: var(--accent-ink, var(--text)); font-weight: 500; }
/* The sizes of one model, in a box over the page; on a phone it comes up from the bottom. */
.pick-dialog { width: min(92vw, 420px); max-width: none; padding: 0; }
.pick-dialog[open] { gap: 0; }
.pick-dialog header, .pick-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; }
.pick-dialog header > div { display: flex; flex-direction: column; gap: 2px; }
.pick-dialog header h3 { font-size: 18px; }
.pick-dialog .sizes { padding: 0 20px; max-height: min(52dvh, 420px); overflow-y: auto; }
.pick-dialog footer { border-top: 1px solid var(--line); }
.pick-dialog footer strong { font-size: 18px; font-weight: 500; }
.pick-dialog footer button { min-height: 44px; padding: 0 20px; }
@media (max-width: 560px) {
  .pick-dialog { width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; border-inline: 0; border-bottom: 0; }
}
.size { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; border-top: 1px solid var(--line); }
.size label { display: flex; align-items: baseline; gap: 12px; }
.size label strong { min-width: 24px; font-weight: 500; }
.size label span { font-size: 13px; color: var(--text-3); }
.size label span.in { color: var(--ok); }
.stepper { direction: ltr; display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r-control); background: var(--card); overflow: hidden; }
.stepper button { width: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 0; background: none; color: var(--text); font-size: 18px; }
.stepper button:hover { background: var(--raised); }
.stepper input { width: 56px; min-height: 40px; padding: 0; border: 0; border-radius: 0; border-inline: 1px solid var(--line); box-shadow: none; }
.chips { list-style: none; margin: 4px 0 0; padding: 12px 0 0; display: flex; flex-wrap: wrap; gap: 4px 16px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.promo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px 48px; margin-block: 0 64px; padding: 40px; background: var(--raised); border-radius: 16px; }
.promo > div:first-child { flex: 1 1 320px; display: flex; flex-direction: column; gap: 8px; }
.promo p { max-width: 44ch; color: var(--text-2); }
.promo .actions { gap: 20px; }
.promo .btn { min-height: 48px; padding: 0 20px; font-size: 15px; }

.order-bar[hidden] { display: none; }
.order-bar { position: sticky; bottom: 0; z-index: 5; padding-block: 16px; }
.order-bar .container > div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 12px; padding-inline-start: 20px; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-card); box-shadow: var(--shadow-float); }
/* The order: a panel on the side of the screen, as tall as the window. */
.cart { width: min(100vw, 440px); max-width: none; height: 100dvh; max-height: none; margin: 0; margin-inline-start: auto; padding: 0; border: 0; border-inline-start: 1px solid var(--line); border-radius: 0; }
.cart[open] { gap: 0; }
.cart header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.cart header h2 { font-size: 18px; }
.cart ul { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 0 24px; }
.cart li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name amount" "count edit"; align-items: baseline; gap: 2px 16px; padding-block: 14px; }
.cart li .grow { grid-area: name; }
.cart li .hint { grid-area: count; }
.cart li strong { grid-area: amount; }
.cart li button { grid-area: edit; }
.cart li + li { border-top: 1px solid var(--line); }
.cart li .grow { font-weight: 500; }
.cart li strong { text-align: end; font-weight: 500; }
.cart li .hint { margin: 0; }
.cart li button { justify-self: end; }
.cart footer { display: flex; flex-direction: column; gap: 12px; padding: 20px 24px; border-top: 1px solid var(--line); }
.cart footer .order-sum { justify-content: space-between; }
.cart footer button { min-height: 48px; }
.order-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 24px; }
.order-sum > span { font-size: 13px; color: var(--text-3); }
.order-sum strong { font-size: 20px; font-weight: 500; }
.order-bar button { min-height: 44px; padding: 0 20px; }

.shop-foot { margin-top: auto; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
.shop-foot .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block: 24px; }
.shop-foot nav { display: flex; gap: 24px; }
.shop-foot a { color: var(--text-2); font-weight: 400; }

/* ---------- phones ---------- */

@media (max-width: 560px) {
  .head { flex-direction: column; align-items: stretch; }
  .head > .actions > *, .head > .actions form.inline, .head > .actions form.inline button { flex: 1; }
  .card, .panel { padding: 16px; }
  .card > button { align-self: stretch; }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .totals > div { padding: 12px 16px; }
  .totals dd { font-size: 20px; }
  .tablewrap { padding: 0 16px; }
  .lines, .lines.sale { grid-template-columns: 1.6fr 1fr 1fr; }
  .lines.cut { grid-template-columns: 1.6fr 1fr 1fr 48px 32px; }
  .container { padding-inline: 16px; }
  .promo { padding: 24px; }
  .order-bar button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* the WhatsApp button: its own green so it is recognised, nothing else in the app uses it */
.btn.wa { border-color: #1a7f4b; color: #1a7f4b; }
.btn.wa:hover { background: #eef7f1; border-color: #1a7f4b; }
a.edit.wa { color: #1a7f4b; }

/* ---------- the store's own look, set from the dashboard ---------- */
.brand-logo { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; flex: none; }
.store-pic { max-width: 100%; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--raised); }
.store-pic.logo { width: 96px; height: 96px; object-fit: contain; }
.store-pic.hero { aspect-ratio: 16 / 7; object-fit: cover; }
.inline-form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline-form-row input[type="file"] { flex: 1; min-width: 0; }

/* ---------- papers: invoice and delivery note ---------- */
.paper { display: flex; flex-direction: column; gap: 24px; max-width: 820px; padding: 40px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
.paper header { display: flex; justify-content: space-between; gap: 24px; }
.paper header p { margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
.paper-name { font-size: 20px; font-weight: 500; }
.paper-ref { text-align: end; }
.paper-ref h2 { font-size: 20px; }
.paper-client { margin: 0; padding-block: 12px; border-block: 1px solid var(--line); }
.paper .tablewrap { border: 0; padding: 0; border-radius: 0; }
.paper-totals { display: flex; flex-direction: column; gap: 6px; margin: 0; margin-inline-start: auto; min-width: 280px; }
.paper-totals > div { display: flex; justify-content: space-between; gap: 24px; }
.paper-totals dt { color: var(--text-2); }
.paper-totals dd { margin: 0; }
.paper-totals .key { padding-top: 8px; border-top: 1px solid var(--text); font-weight: 500; font-size: 17px; }
.paper-totals .key dt { color: var(--text); }
.paper-totals-line { margin: 0; text-align: end; }
.paper footer { display: flex; justify-content: space-between; gap: 24px; min-height: 96px; padding-top: 12px; border-top: 1px dashed var(--line-2); font-size: 13px; color: var(--text-2); }

/* ---------- print: statements, pay sheets, labels ---------- */

@media print {
  .paper { border: 0; padding: 0; max-width: none; }
  .noprint, .side, form.card, .filter, button, dialog { display: none !important; }
  body, body.app { display: block; background: #fff; color: #000; }
  main { max-width: none; padding: 0; }
  .label { border: none; }
  main:has(.labels) .head { display: none; }
  /* printing from the panel (an account, the labels) prints the panel, not the page under it */
  html:has(#sheet[open]) main { display: none !important; }
  html:has(#sheet[open]) #sheet { display: block !important; position: absolute; inset: 0 0 auto 0; width: auto; max-width: none; height: auto; max-height: none; margin: 0; padding: 0; border: 0; box-shadow: none; overflow: visible; background: #fff; }
  html:has(#sheet[open]) { overflow: visible; }
  #sheet .sheet-bar, #sheet::backdrop { display: none !important; }
  #sheet:has(.labels) .head { display: none; }
}

/* ---------- boutique, editorial: edge to edge, square, ink on white ----------
   Comes after the rules above and replaces the look of the shop's public pages: a bar
   across the top, a two-panel opening, a grid of models separated by hairlines, a dark
   band, a large wordmark. The size boxes, the order panel and the sign-in pages keep
   their structure and take the square corners. */
body.bleed { --page: #fff; --card: #fff; --raised: #f3f1ed; --text: #141210; --text-2: #55504a; --text-3: #6b655d; --line: rgb(20 18 16 / 10%); --line-2: rgb(20 18 16 / 22%); --r-control: 0px; --r-card: 0px; }
body.bleed dialog { border-radius: 0; }

.shop-head { position: sticky; top: 0; z-index: 10; min-height: 60px; padding-inline: 24px; background: var(--page); border-bottom: 1px solid var(--text); }
.shop-head .brand { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.shop-head nav a:not(.btn) { color: var(--text); font-size: 14px; font-weight: 500; }
.shop-head .btn { min-height: 40px; padding: 0 20px; }

.hero { display: grid; align-items: stretch; grid-template-columns: 3fr 2fr; height: min(78vh, 760px); min-height: 460px; margin: 0; border-radius: 0; border-bottom: 1px solid var(--text); background: none; overflow: visible; }
.hero.alone { grid-template-columns: 1fr; }
.hero-main { position: relative; overflow: hidden; background: #ebe4da; }
.hero-scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left bottom; }
.hero-text { position: absolute; inset-block-start: 0; inset-inline-start: 0; max-width: min(560px, 100%); padding: 48px 40px; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.hero h1 { max-width: 11ch; font-size: clamp(40px, 5.2vw, 84px); font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; }
.hero p { max-width: 20ch; font-size: 17px; line-height: 1.6; color: var(--text); }
.hero .btn { min-height: 52px; padding: 0 28px; font-size: 16px; }
.hero-side { position: relative; display: block; min-height: 0; overflow: hidden; border-inline-start: 1px solid var(--text); background: var(--raised); color: var(--text); }
.hero-side img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease); }
.hero-side:hover { text-decoration: none; }
@media (prefers-reduced-motion: no-preference) { .hero-side:hover img { transform: scale(1.03); } }
.hero-tag { position: absolute; inset-block-start: 20px; inset-inline-start: 20px; padding: 6px 14px; background: var(--text); color: #fff; font-size: 14px; font-weight: 700; }
.hero-cap { position: absolute; inset-block-end: 0; inset-inline: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 20px; background: var(--page); border-top: 1px solid var(--text); font-size: 15px; }

.strip { list-style: none; margin: 0; padding: 12px 24px; display: flex; flex-wrap: wrap; justify-content: space-around; gap: 4px 32px; background: var(--text); color: #fff; font-size: 13px; font-weight: 500; }

.catalog { display: flex; flex-direction: column; }
.catalog-head { display: flex; align-items: flex-start; gap: 8px; padding: 48px 24px 20px; }
.catalog-head h2 { font-size: clamp(36px, 5vw, 72px); font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; }
.catalog-head span { font-size: 15px; font-weight: 500; color: var(--text-2); }
.catalog > .notice, .catalog > .empty { margin: 0 24px 24px; }
.products { --cols: 3; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 1px; padding-block: 1px; border-block: 1px solid var(--text); background: var(--page); }
/* a last row that is not full: its last model takes the room that is left, so the grid
   never ends on a hole */
.product { --span: 1; grid-column: span var(--span); }
.product-photo { aspect-ratio: calc(var(--span) * 3) / 4; }
.product:last-child:nth-child(3n + 1) { --span: 3; }
.product:last-child:nth-child(3n + 2) { --span: 2; }
@media (min-width: 1500px) {
  .products { --cols: 4; }
  .product:last-child:nth-child(n) { --span: 1; }
  .product:last-child:nth-child(4n + 1) { --span: 4; }
  .product:last-child:nth-child(4n + 2) { --span: 3; }
  .product:last-child:nth-child(4n + 3) { --span: 2; }
}
.product { gap: 6px; padding-bottom: 16px; outline: 1px solid var(--text); background: var(--page); }
.product-photo { margin-bottom: 8px; border-radius: 0; }
.product > :not(.product-photo):not(dialog) { margin-inline: 16px; }
.product-title h3 { font-size: 15px; font-weight: 700; }
.product .pick-btn { width: calc(100% - 32px); margin-top: 8px; padding-inline: 12px; border: 1px solid var(--text); font-weight: 500; }
.product .pick-btn:hover { background: var(--text); color: #fff; border-color: var(--text); }
.product .pick-btn:hover .icon { color: #fff; }
.product .pick-btn.chosen { background: var(--text); color: #fff; }
.product .pick-btn.chosen .icon { color: #fff; }

.promo-band { background: var(--text); }
.promo { max-width: none; margin: 0; padding: 72px 24px; border-radius: 0; background: none; color: #fff; }
.promo h2 { font-size: clamp(32px, 4.4vw, 64px); font-weight: 700; line-height: 1.12; color: #fff; }
.promo p { color: #cfc9c0; font-size: 17px; }
.promo .btn { min-height: 52px; padding: 0 28px; background: #fff; color: var(--text); border-color: #fff; font-size: 16px; }
.promo .btn:hover { background: #e9e5de; border-color: #e9e5de; }

.shop-foot { border-top: 1px solid var(--text); }
/* Arabic letters hang well below the line: the line is tall enough to hold them, and
   only what would spill sideways is cut */
.foot-mark { margin: 0; padding: 24px 24px 8px; font-size: clamp(56px, 13vw, 200px); font-weight: 700; line-height: 1.5; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; overflow-x: clip; overflow-y: visible; }
.shop-foot .container { max-width: none; }

@media (max-width: 760px) {
  .shop-head { padding-inline: 16px; }
  .hero { grid-template-columns: 1fr; height: auto; min-height: 0; flex-direction: initial; gap: 0; }
  /* on a phone the words go above the picture, on plain paper: there is no calm part of
     the scene wide enough to carry them */
  .hero-main { display: flex; flex-direction: column; background: var(--page); }
  /* the words come first, so the first screen says what this is and has the button;
     the picture follows, wide and short */
  .hero-text { position: static; order: -1; max-width: none; padding: 28px 16px 24px; }
  .hero h1 { max-width: none; font-size: clamp(34px, 9vw, 52px); }
  .hero p { max-width: 34ch; }
  .hero .btn { align-self: stretch; }
  .hero-scene { position: static; height: auto; aspect-ratio: 3 / 2; border-radius: 0; border-top: 1px solid var(--text); }
  .hero-side { height: 62vh; border-inline-start: 0; border-top: 1px solid var(--text); }
  .strip { justify-content: flex-start; padding-inline: 16px; }
  .catalog-head { padding: 32px 16px 16px; }
  .products { --cols: 2; }
  .product:last-child:nth-child(n) { --span: 1; }
  .product:last-child:nth-child(2n + 1) { --span: 2; }
  .product > :not(.product-photo):not(dialog) { margin-inline: 12px; }
  .product .pick-btn { width: calc(100% - 24px); }
  .product-title { flex-direction: column; gap: 2px; }
  .promo { padding: 48px 16px; }
  .foot-mark { padding-inline: 16px; }
}

body.bleed .tabs, body.bleed .tabs a { border-radius: 0; }
/* the large wordmark closes the catalogue; the small pages (sign in, my orders) end quietly */
body.bleed main:not(:has(.catalog)) .foot-mark { display: none; }
