/* =============================================================
   Carlota Segalà · Gestió — estils
   Pensat per a pantalles tàctils (iPad i mòbils): botons grans,
   contrast alt, poques distraccions.
   ============================================================= */
:root {
  --bg: #F6F1E9;
  --bg-2: #EFE7DB;
  --surface: #FFFFFF;
  --surface-2: #FBF8F3;
  --ink: #2A1D15;
  --ink-2: #5B4839;
  --ink-3: #8B7869;
  --line: #E6DCCE;
  --line-2: #D6C8B6;
  --brand: #5A3A28;
  --brand-2: #8A5A3B;
  --brand-soft: #F1E4D4;
  --accent: #9E2A35;
  --accent-soft: #F8E3E3;
  --ok: #2E7D4F;
  --ok-soft: #E3F2E8;
  --warn: #A86311;
  --warn-soft: #FCEFD9;
  --danger: #B42318;
  --danger-soft: #FDE8E6;
  --info: #2F6A8A;
  --info-soft: #E2EFF6;
  --violet: #6E4A8E;
  --violet-soft: #EEE6F6;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --shadow: 0 1px 2px rgba(42, 29, 21, .06), 0 4px 14px rgba(42, 29, 21, .06);
  --shadow-lg: 0 24px 60px -20px rgba(42, 29, 21, .35);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --side-w: 236px;
  --top-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; scrollbar-gutter: stable; }
body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font: 400 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 28px; height: 28px; }
.tabular, .money { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid rgba(138, 90, 59, .45); outline-offset: 2px; }

/* ---------- Arrencada ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot__logo { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; background: var(--brand); color: #F3E6D3; font: italic 30px var(--font-display); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .8; } }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 4px; padding: calc(16px + var(--safe-t)) 12px 14px; background: var(--brand); color: #F3E6D3; overflow-y: auto; }
.side__brand { display: grid; gap: 6px; padding: 4px 10px 18px; color: #F3E6D3; text-decoration: none; }
.side__brand svg { width: 168px; height: auto; }
.side__brand small { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: #D9B38C; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: rgba(243, 230, 211, .82); text-decoration: none; font-weight: 500; border: 0; background: none; text-align: left; width: 100%; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.is-active { background: #F6F1E9; color: var(--brand); }
.nav-item .badge { margin-left: auto; }
.side__foot { margin-top: auto; display: grid; gap: 4px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .12); }
.side__user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 13px; color: rgba(243, 230, 211, .8); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 20px 0; background: rgba(246, 241, 233, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top__title { margin: 0; font: 600 20px/1.2 var(--font); letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top__back { display: inline-grid; }
.top__actions { display: flex; align-items: center; gap: 8px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.live.is-off::before { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.view { flex: 1; padding: 20px; padding-bottom: calc(28px + var(--safe-b)); min-width: 0; }
.view--flush { padding: 0; }
.tabs { display: none; }
.offline { position: fixed; left: 50%; top: calc(10px + var(--safe-t)); transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); }

/* Mòbil: barra inferior en lloc del menú lateral */
@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .top { padding-left: 12px; padding-right: 12px; }
  .top__title { font-size: 18px; }
  .top__back { display: inline-grid; }
  .view { padding: 14px 12px calc(96px + var(--safe-b)); }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px 4px calc(6px + var(--safe-b)); background: rgba(255, 255, 255, .96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .tab { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border: 0; background: none; color: var(--ink-3); font-size: 11px; font-weight: 500; text-decoration: none; }
  .tab .icon { width: 24px; height: 24px; }
  .tab.is-active { color: var(--brand); }
  .tab .badge { position: absolute; top: 0; left: 55%; }
}

/* ---------- Components bàsics ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--r); border: 1px solid transparent; background: var(--brand); color: #fff; font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; transition: transform .08s, background .15s, opacity .15s; user-select: none; -webkit-user-select: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--soft { background: var(--brand-soft); color: var(--brand); }
.btn--ok { background: var(--ok); }
.btn--danger { background: var(--danger); }
.btn--danger-ghost { background: var(--surface); color: var(--danger); border-color: #EBC6C2; }
.btn--accent { background: var(--accent); }
.btn--lg { min-height: 56px; font-size: 17px; padding: 0 22px; border-radius: 14px; }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn--block { width: 100%; }
.btn--icon { width: 44px; padding: 0; }
.btn--icon.btn--sm { width: 36px; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn--ghost.is-loading::after { border-color: rgba(0, 0, 0, .2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.link { border: 0; background: none; padding: 0; color: var(--brand-2); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.badge { display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--violet { background: var(--violet-soft); color: var(--violet); }
.badge--brand { background: var(--brand-soft); color: var(--brand); }
.badge--accent { background: var(--accent); color: #fff; }
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }

.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none; background: var(--c, var(--brand-2)); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.avatar--lg { width: 64px; height: 64px; font-size: 22px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.card__head h2, .card__head h3 { margin: 0; font-size: 16px; font-weight: 650; flex: 1; }
.card__body { padding: 14px 16px 16px; }
.card--pad { padding: 16px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.section-title:first-child { margin-top: 0; }
.section-title .grow { flex: 1; }
.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.row { display: flex; align-items: center; gap: 10px; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }
.stack--sm { gap: 6px; }
.spacer { flex: 1; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* KPI */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.kpi { display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.kpi__label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.kpi__value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi__sub { font-size: 13px; color: var(--ink-3); }
.kpi--alert { border-color: #EBC6C2; background: var(--danger-soft); }
.kpi--alert .kpi__value { color: var(--danger); }
.kpi--warn { border-color: #F1D7A8; background: var(--warn-soft); }
.kpi--warn .kpi__value { color: var(--warn); }
.trend { font-size: 12px; font-weight: 700; }
.trend--up { color: var(--ok); }
.trend--down { color: var(--danger); }

/* Llistes */
.list { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left; color: inherit; text-decoration: none; min-height: 56px; }
.li:last-child { border-bottom: 0; }
button.li:active, a.li:active { background: var(--surface-2); }
.li__main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.li__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li__sub { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li__sub--wrap { white-space: normal; }
.li__side { display: grid; justify-items: end; gap: 4px; text-align: right; }
.li__time { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; min-width: 52px; }
.li--muted { opacity: .55; }
.li .chev { color: var(--ink-3); }
.group-head { position: sticky; top: calc(var(--top-h) + var(--safe-t)); z-index: 5; display: flex; align-items: center; gap: 8px; padding: 10px 2px 8px; background: var(--bg); font-weight: 700; font-size: 14px; }
.group-head .muted { font-weight: 500; }

/* Formularis */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 12px; }
.input, .select, .textarea { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); font-size: 16px; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none; }
.textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B7869' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 34px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(138, 90, 59, .14); }
.input--money { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.search { position: relative; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 40px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; min-height: 40px; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span.track { width: 46px; height: 28px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch span.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + span.track { background: var(--ok); }
.switch input:checked + span.track::after { transform: translateX(18px); }
.switch input:focus-visible + span.track { outline: 3px solid rgba(138, 90, 59, .45); outline-offset: 2px; }

/* Segmentats i xips */
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--bg-2); gap: 2px; flex-wrap: wrap; }
.seg button { min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: none; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.seg button.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(42, 29, 21, .15); }
.seg--block { display: flex; width: 100%; }
.seg--block button { flex: 1; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.chip.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .count { background: var(--accent); }
.chip.is-on .count { background: #fff; color: var(--brand); }
.chip--dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--brand-2)); }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 220px; }

/* Estat buit */
.empty { display: grid; justify-items: center; gap: 8px; padding: 36px 16px; text-align: center; color: var(--ink-3); }
.empty .icon { width: 40px; height: 40px; color: var(--line-2); }
.empty h3 { margin: 4px 0 0; color: var(--ink-2); font-size: 16px; }
.skel { border-radius: var(--r); background: linear-gradient(90deg, var(--bg-2), #F7F1E8, var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Avisos */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--info-soft); color: #234E67; font-size: 14px; }
.notice .icon { margin-top: 1px; }
.notice--warn { background: var(--warn-soft); color: #6B420B; }
.notice--danger { background: var(--danger-soft); color: #7A1A12; }
.notice--ok { background: var(--ok-soft); color: #1C5434; }
.notice .grow { flex: 1; }

/* ---------- Capes: full lliscant, diàleg, avís ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; align-items: end; justify-items: center; background: rgba(28, 19, 13, .42); animation: fadeIn .18s ease-out; }
.overlay.is-closing { animation: fadeOut .16s ease-in forwards; }
.sheet { width: 100%; max-height: calc(100dvh - 40px - var(--safe-t)); display: flex; flex-direction: column; background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); animation: slideUp .26s cubic-bezier(.2, .8, .2, 1); }
.overlay.is-closing .sheet { animation: slideDown .16s ease-in forwards; }
.sheet__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.sheet__head h2 { margin: 0; flex: 1; font-size: 18px; font-weight: 650; }
.sheet__body { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet__foot { display: flex; gap: 10px; padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface-2); }
.sheet__foot .btn { flex: 1; }
@media (min-width: 900px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { width: min(640px, 100%); border-radius: 22px; max-height: calc(100dvh - 48px); animation: popIn .2s cubic-bezier(.2, .8, .2, 1); }
  .sheet--wide { width: min(920px, 100%); }
  .sheet--narrow { width: min(440px, 100%); }
  .overlay.is-closing .sheet { animation: fadeOut .14s ease-in forwards; }
  .sheet__foot { border-radius: 0 0 22px 22px; }
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: .6; } }
@keyframes slideDown { to { transform: translateY(40px); opacity: 0; } }
@keyframes popIn { from { transform: scale(.97); opacity: 0; } }
.toasts { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (max-width: 899px) { .toasts { top: calc(10px + var(--safe-t)); bottom: auto; } }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 500; box-shadow: var(--shadow-lg); animation: slideUp .22s ease-out; pointer-events: auto; }
.toast--ok .icon { color: #8EE0AE; }
.toast--danger { background: var(--danger); }
.toast--web { background: var(--violet); }
.toast.is-out { animation: fadeOut .2s forwards; }

/* ---------- Teclat numèric ---------- */
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numpad button { min-height: 58px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; box-shadow: 0 1px 0 var(--line); }
.numpad button:active { background: var(--bg-2); transform: scale(.97); }
.numpad .np-muted { font-size: 16px; color: var(--ink-3); }
.amount-display { text-align: right; font-size: 40px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; padding: 6px 4px 12px; }

/* ---------- Pantalla de bloqueig (iPad) i inici de sessió ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; padding-top: calc(24px + var(--safe-t)); background: radial-gradient(120% 80% at 50% 0%, #FBF6EE 0%, var(--bg) 55%, var(--bg-2) 100%); }
.auth__box { width: min(420px, 100%); display: grid; gap: 18px; }
.auth__logo { display: grid; justify-items: center; gap: 8px; color: var(--brand); text-align: center; }
.auth__logo svg.word { width: 230px; height: auto; }
.auth__logo small { letter-spacing: .2em; text-transform: uppercase; font-size: 11px; color: var(--ink-3); }
.auth .card { padding: 22px; }
.auth h1 { margin: 0 0 6px; font-size: 20px; }
.lock { position: fixed; inset: 0; z-index: 60; display: grid; align-content: center; justify-items: center; gap: 22px; padding: 24px; padding-top: calc(24px + var(--safe-t)); background: radial-gradient(120% 80% at 50% 0%, #FBF6EE 0%, var(--bg) 55%, var(--bg-2) 100%); overflow-y: auto; }
.lock__clock { font: 300 64px/1 var(--font); letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--brand); }
.lock__date { color: var(--ink-3); font-weight: 500; margin-top: -12px; }
.lock__people { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; max-width: 760px; }
.person { display: grid; justify-items: center; gap: 8px; width: 110px; padding: 14px 6px; border-radius: 18px; border: 1px solid transparent; background: none; font-weight: 600; }
.person:active, .person.is-on { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
.pin-dots { display: flex; gap: 14px; justify-content: center; height: 20px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand-2); transition: background .1s; }
.pin-dots span.is-on { background: var(--brand-2); }
.pin-box { width: min(330px, 100%); display: grid; gap: 16px; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.lock__alert { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; background: var(--violet); color: #fff; font-weight: 600; }

/* ---------- TPV ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: calc(100dvh - var(--top-h) - var(--safe-t)); }
.pos__catalog { display: flex; flex-direction: column; min-width: 0; padding: 14px 16px 0; gap: 12px; overflow: hidden; }
.pos__grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; align-content: start; padding-bottom: 20px; -webkit-overflow-scrolling: touch; }
.pcard { position: relative; display: grid; grid-template-rows: auto 1fr; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; text-align: left; padding: 0; box-shadow: var(--shadow); transition: transform .08s; }
.pcard:active { transform: scale(.97); }
.pcard__img { aspect-ratio: 4 / 3; background: var(--bg-2) center / cover no-repeat; }
.pcard__img--none { display: grid; place-items: center; color: var(--c, var(--brand-2)); background: color-mix(in srgb, var(--c, var(--brand-2)) 12%, white); }
.pcard__img--none .icon { width: 30px; height: 30px; }
.pcard__body { display: grid; gap: 2px; padding: 8px 10px 10px; }
.pcard__name { font-weight: 600; font-size: 13.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard__price { font-weight: 700; font-size: 14px; color: var(--brand-2); font-variant-numeric: tabular-nums; }
.pcard__stock { position: absolute; top: 6px; right: 6px; }
.pos__ticket { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--surface); min-height: 0; }
.ticket__head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ticket__lines { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tline__name { font-weight: 600; font-size: 14px; }
.tline__meta { font-size: 12px; color: var(--ink-3); }
.tline__total { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.tline__ctrl { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.qty button { width: 38px; height: 34px; border: 0; background: var(--surface-2); display: grid; place-items: center; }
.qty span { min-width: 34px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.ticket__foot { display: grid; gap: 10px; padding: 12px 14px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface-2); }
.totals { display: grid; gap: 4px; }
.totals__row { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.totals__row--big { font-size: 24px; font-weight: 800; color: var(--ink); }
.pos__bar { display: none; }
@media (max-width: 899px) {
  .pos { grid-template-columns: minmax(0, 1fr); height: auto; }
  .pos__catalog { padding: 0; overflow: visible; }
  .pos__grid { overflow: visible; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); padding-bottom: 90px; }
  .pos__ticket { display: none; }
  .pos__bar { position: fixed; left: 12px; right: 12px; bottom: calc(76px + var(--safe-b)); z-index: 35; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 16px; background: var(--brand); color: #fff; box-shadow: var(--shadow-lg); }
  .pos__bar .btn { background: #fff; color: var(--brand); }
}
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.pay-method { display: grid; justify-items: center; gap: 6px; min-height: 84px; padding: 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; }
.pay-method .icon { width: 28px; height: 28px; color: var(--brand-2); }
.pay-method.is-on { border-color: var(--brand); background: var(--brand-soft); }
.quick-amounts { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-amounts button { flex: 1 0 70px; min-height: 48px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; font-variant-numeric: tabular-nums; }
.change { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--ok-soft); color: var(--ok); font-size: 20px; font-weight: 800; }
.change--bad { background: var(--danger-soft); color: var(--danger); }
.done-sale { display: grid; justify-items: center; gap: 10px; padding: 20px 0 6px; text-align: center; }
.done-sale__check { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; }
.done-sale__check .icon { width: 38px; height: 38px; stroke-width: 2.6; }

/* ---------- Encàrrecs ---------- */
.ostatus { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.ostatus::-webkit-scrollbar { display: none; }
.ostep { flex: 1 0 auto; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: 13px; color: var(--ink-3); }
.ostep.is-done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.ostep.is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.card-msg { padding: 14px 16px; border-radius: 14px; background: #FFFDF8; border: 1px dashed var(--line-2); font: italic 17px/1.5 var(--font-display); white-space: pre-wrap; }
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding-bottom: 12px; position: relative; }
.tl::before { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl__dot { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-2); margin-top: 2px; }
.tl__text { font-size: 14px; }
.tl__meta { font-size: 12px; color: var(--ink-3); }
.photo { position: relative; border-radius: 14px; overflow: hidden; background: var(--bg-2); }
.photo img { width: 100%; max-height: 360px; object-fit: cover; }
.items-editor { display: grid; gap: 8px; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 110px 40px; gap: 8px; align-items: start; }
@media (max-width: 599px) { .item-row { grid-template-columns: 1fr 70px 96px 40px; } .item-row .input { font-size: 15px; padding: 8px; } }
.ac { position: relative; }
.ac__list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow-lg); }
.ac__item { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; }
.ac__item:hover, .ac__item.is-on { background: var(--surface-2); }

/* ---------- Calendari ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-head h2 { margin: 0; font-size: 20px; min-width: 180px; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--line); gap: 1px; }
.month__dow { padding: 8px; background: var(--surface-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); text-align: center; }
.mday { display: flex; flex-direction: column; gap: 3px; min-height: 112px; padding: 6px; background: var(--surface); border: 0; text-align: left; overflow: hidden; }
.mday--out { background: var(--surface-2); color: var(--ink-3); }
.mday--today .mday__n { background: var(--brand); color: #fff; }
.mday--closed { background: repeating-linear-gradient(-45deg, #FBF8F3, #FBF8F3 6px, #F4EEE5 6px, #F4EEE5 12px); }
.mday__top { display: flex; align-items: center; gap: 4px; }
.mday__n { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.mday__count { margin-left: auto; display: flex; gap: 4px; }
.mini { display: block; font-size: 11.5px; font-weight: 600; line-height: 1.25; padding: 2px 6px; border-radius: 6px; background: var(--c-soft, var(--bg-2)); color: var(--c, var(--ink-2)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camp-stripe { height: 4px; border-radius: 2px; background: var(--c); opacity: .75; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.wday { display: flex; flex-direction: column; gap: 6px; min-height: 300px; padding: 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.wday--today { border-color: var(--brand-2); box-shadow: 0 0 0 2px rgba(138, 90, 59, .2); }
.wday--closed { background: repeating-linear-gradient(-45deg, #FBF8F3, #FBF8F3 6px, #F4EEE5 6px, #F4EEE5 12px); }
.wday__head { display: flex; align-items: baseline; gap: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.wday__head b { font-size: 20px; }
.wday__head span { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; }
.wslot { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }
.ev { display: grid; gap: 1px; padding: 6px 8px; border-radius: 10px; border: 0; border-left: 4px solid var(--c, var(--brand-2)); background: var(--c-soft, var(--bg-2)); text-align: left; font-size: 12.5px; width: 100%; }
.ev b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev span { color: var(--ink-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev--done { opacity: .5; text-decoration: line-through; }
.dayview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 899px) {
  .month { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .mday { min-height: 64px; padding: 3px; }
  .mday .mini { display: none; }
  .mday__count { margin: 0; flex-wrap: wrap; }
  .week { grid-template-columns: 1fr; }
  .wday { min-height: 0; }
  .dayview { grid-template-columns: 1fr; }
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--brand-2)); display: inline-block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-3); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Caixa ---------- */
.denoms { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.denom { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.denom b { font-variant-numeric: tabular-nums; }
.denom input { width: 64px; min-height: 40px; text-align: center; border-radius: 10px; border: 1px solid var(--line-2); font-size: 17px; font-weight: 700; }
.cash-diff { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 14px; font-size: 18px; font-weight: 800; background: var(--ok-soft); color: var(--ok); }
.cash-diff--bad { background: var(--danger-soft); color: var(--danger); }
.cash-diff--warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Gràfics ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 11px var(--font); fill: var(--ink-3); }
.chart .bar { fill: var(--brand-2); }
.chart .bar--prev { fill: var(--line-2); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; align-items: center; gap: 10px; font-size: 13.5px; }
.hbar__track { height: 12px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.hbar__fill { display: block; height: 100%; border-radius: 6px; background: var(--c, var(--brand-2)); }
.hbar b { font-variant-numeric: tabular-nums; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ---------- Factures (vista i impressió) ---------- */
.doc { background: #fff; color: #111; border-radius: 14px; border: 1px solid var(--line); padding: 28px; font-size: 13.5px; }
.doc h1 { font: 600 22px var(--font-display); margin: 0 0 4px; }
.doc table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.doc th, .doc td { padding: 6px 4px; border-bottom: 1px solid #e5e5e5; text-align: left; }
.doc td.num, .doc th.num { text-align: right; font-variant-numeric: tabular-nums; }
.doc__head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.doc__foot { margin-top: 18px; font-size: 12px; color: #555; }
.doc__hash { font: 10px ui-monospace, Menlo, Consolas, monospace; color: #888; word-break: break-all; }
.ticket-doc { width: 300px; max-width: 100%; margin: 0 auto; font: 13px/1.35 ui-monospace, Menlo, Consolas, monospace; color: #000; background: #fff; padding: 16px; border-radius: 10px; border: 1px solid var(--line); }
.ticket-doc .c { text-align: center; }
.ticket-doc .r { display: flex; justify-content: space-between; gap: 8px; }
.ticket-doc hr { border: 0; border-top: 1px dashed #999; margin: 8px 0; }
#print-area { display: none; }
@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  #app, .overlay, .toasts, .lock, .offline { display: none !important; }
  #print-area { display: block !important; }
  .doc, .ticket-doc { border: 0; padding: 0; }
  .ticket-doc { width: 72mm; }
}

/* ---------- Ajustos per a iPad en vertical ---------- */
@media (min-width: 900px) and (max-width: 1100px) {
  :root { --side-w: 200px; }
  .pos { grid-template-columns: minmax(0, 1fr) 330px; }
  .side__brand svg { width: 150px; }
}

/* ---------- Disposicions afegides ---------- */
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1099px) { .split { grid-template-columns: minmax(0, 1fr); } }
.savebar { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 10px; margin: 18px -20px -28px; padding: 12px 20px calc(12px + var(--safe-b)); background: rgba(246, 241, 233, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
@media (max-width: 899px) { .savebar { bottom: calc(64px + var(--safe-b)); margin: 16px -12px 0; padding: 10px 12px; } }
.pcard__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chip:disabled { opacity: .5; }
.kpi { font: inherit; text-align: left; }
button.kpi { cursor: pointer; }
.li > a.li__main { color: inherit; }

/* ---------- Barra de preu (ram de pressupost) ---------- */
.range { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 44px; background: transparent; --p: 50%; touch-action: pan-y; }
.range::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--brand-2) var(--p), var(--line-2) var(--p)); }
.range::-moz-range-track { height: 10px; border-radius: 999px; background: var(--line-2); }
.range::-moz-range-progress { height: 10px; border-radius: 999px; background: var(--brand-2); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; margin-top: -12px; border-radius: 50%; background: #fff; border: 3px solid var(--brand); box-shadow: 0 2px 8px rgba(42, 29, 21, .25); }
.range::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 3px solid var(--brand); box-shadow: 0 2px 8px rgba(42, 29, 21, .25); }
.budget .amount-display { font-size: 52px; color: var(--brand); }

/* ---------- Pagament part i part ---------- */
.pay-method small { font-size: 11px; font-weight: 500; color: var(--ink-3); margin-top: -4px; }
.pay-method--mix { border-style: dashed; }
.mix { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.mix__part { padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
@media (max-width: 699px) { .mix { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Mapa petit ---------- */
.minimap { position: relative; overflow: hidden; border-radius: 14px; border: 1px solid var(--line); background: #e9e5dc; }
.minimap__tiles { position: absolute; width: 1280px; height: 768px; }
.minimap__tiles img { position: absolute; width: 256px; height: 256px; max-width: none; user-select: none; -webkit-user-drag: none; }
.minimap__pin { position: absolute; left: 50%; top: 50%; width: 30px; height: 40px; transform: translate(-50%, -100%); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.minimap__pin path { fill: var(--accent); stroke: #fff; stroke-width: 1.5; }
.minimap__pin circle { fill: #fff; }
.minimap__attr { position: absolute; right: 6px; bottom: 4px; font-size: 10px; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, .85); color: #444; }
.geo-status { display: grid; gap: 8px; }
.ac__item small { display: block; color: var(--ink-3); font-size: 12px; }

/* ---------- Crea el teu ram (TPV i encàrrecs) ---------- */
.sheet--wide:has(.bq) { width: min(1100px, 100%); }
.bq { display: grid; gap: 16px; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); align-items: start; }
.bq__preview { position: sticky; top: 0; display: grid; gap: 10px; padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.bq__art { aspect-ratio: 4 / 5; display: grid; place-items: center; border-radius: 14px; background: radial-gradient(circle at 50% 40%, #fffdf8, var(--surface-2)); overflow: hidden; }
.bq__art svg { width: 100%; height: 100%; }
.bq__empty { display: grid; justify-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; text-align: center; padding: 20px; }
.bq__empty .icon { width: 44px; height: 44px; color: var(--line-2); }
.bq__total { display: grid; gap: 2px; text-align: center; }
.bq__total b { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.bq__sizes { display: grid; grid-auto-flow: column; gap: 4px; }
.bq__step { display: grid; gap: 4px; text-align: center; font-size: 11px; color: var(--ink-3); }
.bq__step i { display: block; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--brand-2) var(--p), var(--bg-2) var(--p)); }
.bq__step.is-on { color: var(--brand); font-weight: 700; }
.bq__tip { display: flex; gap: 6px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: var(--info-soft); color: #234E67; }
.bq__tip.is-ok { background: var(--ok-soft); color: #1C5434; }
.bq__box { padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.bq__pal { display: inline-flex; margin-right: 4px; }
.bq__pal i { width: 10px; height: 10px; border-radius: 50%; margin-left: -3px; border: 1px solid rgba(0, 0, 0, .08); }
.bq__pal i:first-child { margin-left: 0; }
.bq__flowers { display: grid; gap: 6px; max-height: 420px; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.bqf { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.bqf.is-in { border-color: var(--brand-2); background: var(--brand-soft); }
.bqf.is-off { opacity: .6; }
.bqf__thumb { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 10px; background: #fff; }
.bqf__thumb svg { width: 44px; height: 44px; }
.bqf__main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.bqf__name { font-weight: 650; font-size: 14px; }
.bqf__colors { display: flex; flex-wrap: wrap; gap: 6px; }
.bqf__dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px var(--line-2); padding: 0; flex: none; display: inline-block; }
.bqf__dot.is-on { box-shadow: 0 0 0 2px var(--brand); }
.pcard--builder { border: 2px dashed var(--brand-2); }
.pcard--builder .pcard__img { color: var(--brand); background: linear-gradient(135deg, #f8e3e3, #f1e4d4); }
.pcard--builder .pcard__img .icon { width: 40px; height: 40px; }
@media (max-width: 899px) {
  .bq { grid-template-columns: minmax(0, 1fr); }
  .bq__preview { position: static; grid-template-columns: 120px minmax(0, 1fr); align-items: center; }
  .bq__art { grid-row: span 3; }
  .bq__preview > [data-warn], .bq__preview > .bq__tip { grid-column: 1 / -1; }
  .bq__total { text-align: left; }
  .bq__flowers { max-height: none; overflow: visible; }
}

/* ---------- Encàrrecs: targetes per estat ---------- */
.ocards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.ocards--one { grid-template-columns: minmax(0, 1fr); }
.ocard { --sc: #7C4DBA; --ss: #F1E9FB; position: relative; display: grid; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--sc); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.ocard.is-late { border-color: #EBC6C2; border-left-color: var(--danger); box-shadow: 0 0 0 2px rgba(180, 35, 24, .12), var(--shadow); }
.ocard.is-done { opacity: .62; }
.ocard__link { display: grid; gap: 5px; padding: 11px 13px 9px; color: inherit; text-decoration: none; }
.ocard__link:active { background: var(--surface-2); }
.ocard__top { display: flex; align-items: center; gap: 8px; }
.ocard__time { font-size: 17px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.ocard__day { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.ocard__day.is-late { color: var(--danger); }
.ocard__status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--ss); color: var(--sc); font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.ocard__status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ocard__who { font-size: 16px; font-weight: 700; line-height: 1.25; }
.ocard__code { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.ocard__what { font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ocard__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.tag { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0 8px; border-radius: 8px; font-size: 12px; font-weight: 700; background: var(--bg-2); color: var(--ink-2); }
.tag--del { background: #E6EEF8; color: #2F5F96; }
.tag--pick { background: #F1E4D4; color: var(--brand); }
.tag--web { background: #7C4DBA; color: #fff; }
.tag--due { background: #FCEFD9; color: #9A5B07; }
.tag--paid { background: var(--ok-soft); color: var(--ok); }
.ocard__foot { display: flex; align-items: center; gap: 8px; padding: 7px 10px 9px 13px; border-top: 1px dashed var(--line); }
.ocard__next { --nc: var(--brand); display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 12px 0 14px; border: 0; border-radius: 11px; background: var(--nc); color: #fff; font-weight: 700; font-size: 14px; }
.ocard__next:active { transform: scale(.97); }
.ocard__next.is-loading { color: transparent; }
.ocard--compact .ocard__link { padding: 9px 11px 7px; }
.ocard--compact .ocard__who { font-size: 15px; }
.ocard--compact .ocard__status { display: none; }
.group-head.is-today { color: var(--accent); }
.group-head.is-late { color: var(--danger); }

/* Comptadors per estat (també filtren) */
.ostates { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; }
.ostates::-webkit-scrollbar { display: none; }
.ostate { --sc: #5A3A28; --ss: #F1E4D4; flex: 0 0 auto; display: grid; justify-items: start; gap: 0; min-width: 96px; padding: 8px 12px; border-radius: 14px; border: 2px solid transparent; background: var(--ss); color: var(--sc); text-align: left; }
.ostate__n { font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ostate__name { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.ostate.is-on { border-color: var(--sc); box-shadow: 0 2px 10px rgba(0, 0, 0, .08); background: #fff; }
.ostate.is-zero { opacity: .55; }

/* Tauler per estats */
.oboard { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.oboard__col { --sc: #7C4DBA; --ss: #F1E9FB; display: grid; gap: 8px; padding: 8px; border-radius: 16px; background: var(--ss); min-height: 120px; }
.oboard__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; color: var(--sc); font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; }
.oboard__head b { min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 999px; background: var(--sc); color: #fff; font-size: 13px; }
.oboard__body { display: grid; gap: 8px; }
.oboard__empty { margin: 4px 6px 10px; color: var(--sc); opacity: .5; }
@media (max-width: 899px) { .oboard { grid-auto-columns: minmax(78vw, 1fr); scroll-snap-type: x mandatory; } .oboard__col { scroll-snap-align: start; } }

/* Fitxa: passos amb el color de cada estat */
.ostep { --sc: var(--brand); --ss: var(--brand-soft); }
.ostep.is-done { background: var(--ss); color: var(--sc); border-color: transparent; }
.ostep.is-current { background: var(--sc); border-color: var(--sc); color: #fff; }

/* ---------- Calendari estil Apple ---------- */
.acal { --red: #E5484D; --hair: #E8E3DC; display: grid; gap: 12px; }
.acal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.acal-title { margin: 0; font-size: 28px; font-weight: 400; letter-spacing: -.02em; line-height: 1.1; }
.acal-title b { font-weight: 800; }
.acal-ctrl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.aseg { display: inline-flex; padding: 2px; border-radius: 9px; background: #EDE7DF; }
.aseg button { min-height: 32px; padding: 0 14px; border: 0; border-radius: 7px; background: none; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.aseg button.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.acal-nav { display: inline-flex; align-items: center; gap: 2px; }
.acal-nav button { min-height: 34px; min-width: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--red); font-weight: 600; font-size: 15px; display: inline-grid; place-items: center; }
.acal-nav button:hover { background: #F3EEE8; }
.acal-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.afilter { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--hair); background: #fff; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.afilter::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--c); }
.afilter.is-on { color: var(--ink); }
.afilter.is-on::before { background: var(--c); }

/* Mes */
.amonth-wrap { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.amonth { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: #fff; border-radius: 16px; border: 1px solid var(--hair); overflow: hidden; }
.amonth__dow { padding: 8px 8px 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-align: right; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--hair); }
.amday { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-height: 108px; padding: 4px 4px 6px; border: 0; border-top: 1px solid var(--hair); border-left: 1px solid var(--hair); background: #fff; text-align: left; overflow: hidden; }
.amday:nth-child(7n + 8) { border-left: 0; }
.amday__n { align-self: flex-end; display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 999px; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.amday.is-out .amday__n { color: #B8AEA3; }
.amday.is-closed { background: #FAF8F5; }
.amday.is-closed .amday__n { color: var(--ink-3); }
.amday.is-today .amday__n { background: var(--red); color: #fff; font-weight: 700; }
.amday.is-sel { background: #FBF6EF; }
.amday.is-sel:not(.is-today) .amday__n { background: var(--ink); color: #fff; font-weight: 700; }
.amday__camp { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--c); opacity: .8; }
.amday__items { display: grid; gap: 2px; min-width: 0; }
.amday__ev { display: block; font-size: 11.5px; line-height: 1.3; padding: 1px 4px 1px 10px; position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.amday__ev::before { content: ""; position: absolute; left: 3px; top: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.amday__ev.is-all { padding-left: 5px; border-radius: 4px; background: color-mix(in srgb, var(--c) 16%, white); color: color-mix(in srgb, var(--c) 75%, black); font-weight: 600; }
.amday__ev.is-all::before { display: none; }
.amday__ord { display: block; font-size: 11.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: #F1E4D4; color: var(--brand); }
.amday__more { font-size: 11px; color: var(--ink-3); padding-left: 5px; }
.amday__dots { display: none; justify-content: center; gap: 3px; }
.amday__dots i { width: 5px; height: 5px; border-radius: 50%; }

/* Panell del dia i llistes */
.apanel { display: grid; gap: 10px; align-content: start; padding: 14px; border-radius: 16px; background: #fff; border: 1px solid var(--hair); position: sticky; top: calc(var(--top-h) + 12px); max-height: calc(100dvh - var(--top-h) - 40px); overflow-y: auto; }
.apanel--flat { position: static; max-height: none; }
.apanel__head { display: flex; align-items: center; gap: 10px; }
.apanel__head > div { flex: 1; display: grid; }
.apanel__head b { font-size: 18px; font-weight: 800; }
.apanel__head span { font-size: 13px; color: var(--ink-3); }
.acircle { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--red); color: #fff; display: inline-grid; place-items: center; text-decoration: none; flex: none; }
.abanner { --c: #A86311; display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; font-size: 13px; font-weight: 600; background: color-mix(in srgb, var(--c) 14%, white); color: color-mix(in srgb, var(--c) 80%, black); }
.abanner.is-closed { --c: #8A8077; }
.asummary { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.alist { display: grid; }
.arow { display: grid; grid-template-columns: 58px 4px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 2px; border: 0; border-bottom: 1px solid var(--hair); background: none; text-align: left; color: inherit; text-decoration: none; width: 100%; }
.arow:last-child { border-bottom: 0; }
.arow:active { background: #FAF7F3; }
.arow.is-done { opacity: .5; }
.arow__time { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; display: grid; line-height: 1.2; }
.arow__time small { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.arow__bar { align-self: stretch; border-radius: 2px; background: var(--c); }
.arow__main { display: grid; min-width: 0; }
.arow__main b { font-size: 14.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow__main span { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow__chip { font-size: 11.5px; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.aempty { margin: 6px 2px; color: var(--ink-3); font-size: 14px; }
.alistview { display: grid; gap: 14px; max-width: 760px; }
.alistview section { background: #fff; border: 1px solid var(--hair); border-radius: 16px; padding: 4px 14px 6px; display: grid; gap: 6px; }
.alistview__head { display: flex; align-items: baseline; gap: 8px; padding: 10px 0 6px; border-bottom: 1px solid var(--hair); }
.alistview__head b { font-size: 16px; font-weight: 800; }
.alistview__head span { font-size: 13px; color: var(--ink-3); }
.alistview__head.is-today b { color: var(--red); }

/* Franja horària */
.atl { --cols: 7; background: #fff; border: 1px solid var(--hair); border-radius: 16px; overflow: hidden; }
.atl__head, .atl__all { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); border-bottom: 1px solid var(--hair); }
.atl__day { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 8px 4px; border: 0; background: none; font-size: 13px; color: var(--ink-3); }
.atl__day b { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 999px; font-size: 17px; font-weight: 600; color: var(--ink); }
.atl__day.is-today { color: var(--red); }
.atl__day.is-today b { background: var(--red); color: #fff; }
.atl__alllabel { font-size: 10.5px; color: var(--ink-3); padding: 6px; text-align: right; }
.atl__allcell { display: flex; flex-direction: column; gap: 2px; padding: 4px 3px; border-left: 1px solid var(--hair); min-height: 30px; min-width: 0; }
.apill { --c: var(--brand); display: block; font-size: 11.5px; font-weight: 600; line-height: 1.3; padding: 2px 6px; border-radius: 5px; border: 0; text-align: left; background: color-mix(in srgb, var(--c) 16%, white); color: color-mix(in srgb, var(--c) 75%, black); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; width: 100%; }
.apill.is-closed { --c: #8A8077; }
.atl__scroll { max-height: max(380px, calc(100dvh - var(--top-h) - 300px)); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.atl__grid { position: relative; display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); background: repeating-linear-gradient(to bottom, var(--hair) 0, var(--hair) 1px, transparent 1px, transparent 52px); }
.atl__hours { position: relative; }
.atl__hours span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.atl__hours span:first-child { transform: none; }
.atl__col { position: relative; border-left: 1px solid var(--hair); }
.atl__col.is-today { background: rgba(229, 72, 77, .03); }
.aband { position: absolute; left: 2px; right: 2px; display: grid; align-content: start; padding: 4px 6px; border: 1px dashed #D9C3AE; border-radius: 8px; background: rgba(241, 228, 212, .55); color: var(--brand); text-align: left; font-size: 12px; }
.aband b { font-size: 12.5px; }
.ablock { --c: #2F6A8A; position: absolute; display: grid; align-content: start; gap: 1px; padding: 3px 6px 3px 8px; border: 0; border-radius: 6px; background: color-mix(in srgb, var(--c) 18%, white); border-left: 3px solid var(--c); color: color-mix(in srgb, var(--c) 70%, black); text-align: left; text-decoration: none; overflow: hidden; font-size: 12px; z-index: 2; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.ablock b { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ablock span { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ablock.is-done { opacity: .5; text-decoration: line-through; }
.anow { position: absolute; left: -4px; right: 0; height: 2px; background: var(--red); z-index: 3; }
.anow::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }

/* Tira de la setmana (dia i mòbil) */
.astrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding: 6px; background: #fff; border: 1px solid var(--hair); border-radius: 16px; }
.astrip__d { display: grid; justify-items: center; gap: 2px; padding: 4px 0; border: 0; background: none; font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; }
.astrip__d b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: 17px; font-weight: 600; color: var(--ink); }
.astrip__d i { width: 5px; height: 5px; border-radius: 50%; background: #B8AEA3; }
.astrip__d i.is-empty { visibility: hidden; }
.astrip__d.is-today, .astrip__d.is-today b { color: var(--red); }
.astrip__d.is-sel b { background: var(--ink); color: #fff; }
.astrip__d.is-sel.is-today b { background: var(--red); color: #fff; }
.aday { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.aslot { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }
.aslot span { color: var(--brand); }

@media (max-width: 1099px) {
  .amonth-wrap, .aday { grid-template-columns: minmax(0, 1fr); }
  .apanel { position: static; max-height: none; }
}
@media (max-width: 899px) {
  .acal-title { font-size: 24px; }
  .acal-head { align-items: center; }
  .amday { min-height: 56px; align-items: center; padding: 4px 2px; }
  .amday__n { align-self: center; }
  .amday__items { display: none; }
  .amday__dots { display: flex; }
  .amonth__dow { text-align: center; }
  .atl__scroll { max-height: 60vh; }
}

/* ---------- Crea el teu ram: quadres de flors ---------- */
.bqtiles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.bqt { position: relative; display: grid; border-radius: 16px; border: 2px solid var(--line); background: #fff; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.bqt.is-in { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(138, 90, 59, .14); }
.bqt.is-off { opacity: .55; }
.bqt__add { display: grid; justify-items: center; gap: 2px; padding: 10px 6px 8px; border: 0; background: none; text-align: center; }
.bqt__add:active { background: var(--brand-soft); }
.bqt__art { width: 100%; aspect-ratio: 1; max-height: 92px; display: grid; place-items: center; border-radius: 12px; background: radial-gradient(circle at 50% 45%, #fffdf8, #f6efe6); }
.bqt__art svg { width: 82%; height: 82%; }
.bqt__name { font-size: 13px; font-weight: 700; line-height: 1.2; min-height: 2.4em; display: grid; place-items: center; }
.bqt__price { font-size: 12.5px; font-weight: 700; color: var(--brand-2); font-variant-numeric: tabular-nums; }
.bqt__q { position: absolute; top: 6px; right: 6px; min-width: 28px; height: 28px; padding: 0 7px; display: grid; place-items: center; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 800; font-size: 14px; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); pointer-events: none; }
.bqt__minus { position: absolute; top: 6px; left: 6px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; border: 0; background: #fff; color: var(--danger); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.bqt__stock { position: absolute; top: 40px; right: 6px; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.bqt__stock.is-out { background: var(--danger-soft); color: var(--danger); }
.bqt__colors { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 0 6px 10px; }
.bqt__colors .bqf__dot { width: 26px; height: 26px; }
@media (max-width: 899px) { .bqtiles { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); } }

/* ---------- Pressupostos de l'Ajuntament ---------- */
.qwrap { flex-wrap: wrap; overflow: visible; }
.chip--sm { min-height: 32px; padding: 0 11px; font-size: 13px; }
.chip--auto:not(.is-on) { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.qpill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--qs, var(--bg-2)); color: var(--qc, var(--ink-2)); font-size: 12.5px; font-weight: 700; }
.qpill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--qc, var(--ink-3)); }
.qflag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 700; }
.qflag--soft { background: var(--bg-2); color: var(--ink-2); }
.qpend { color: var(--danger); font-weight: 700; letter-spacing: .02em; }
.is-late { color: var(--danger); font-weight: 700; }

/* Entrada ràpida: enganxar el correu */
.qintake { display: grid; gap: 12px; padding: 18px; border-radius: var(--r-lg); background: linear-gradient(135deg, #FFFFFF, var(--surface-2)); border: 1px solid var(--line); box-shadow: var(--shadow); }
.qintake__head { display: flex; gap: 14px; align-items: flex-start; }
.qintake__head h2 { margin: 0 0 2px; font: 600 20px/1.25 var(--font-display); }
.qintake__head p { margin: 0; color: var(--ink-2); font-size: 14px; max-width: 70ch; }
.qintake__icon { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.qintake__text { min-height: 120px; font-size: 15px; }

/* Llista */
.qgroup + .qgroup { margin-top: 6px; }
.qrows { display: grid; gap: 8px; }
.qrow { position: relative; display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 14px 12px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: inherit; text-decoration: none; overflow: hidden; }
.qrow::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--qc); }
.qrow:active { background: var(--surface-2); }
.qrow.is-done { opacity: .72; }
.qrow__num { display: grid; justify-items: center; line-height: 1.1; padding: 6px 0; border-radius: 12px; background: var(--qs); color: var(--qc); }
.qrow__num small { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.qrow__num b { font-size: 22px; font-variant-numeric: tabular-nums; }
.qrow__main { display: grid; gap: 4px; min-width: 0; }
.qrow__top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.qrow__title { font-size: 15.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow__sub { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); }
.qrow__sub > span { display: inline-flex; align-items: center; gap: 4px; }
.qrow__side { display: grid; justify-items: end; gap: 6px; font-size: 16px; }
@media (max-width: 599px) { .qrow { grid-template-columns: 58px minmax(0, 1fr); } .qrow__side { grid-column: 2; justify-items: start; } .qrow__title { white-space: normal; } }

/* Fitxa */
.qhead { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px 18px 16px 24px; margin-bottom: 12px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.qhead::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: var(--qc); }
.qhead__num { display: grid; justify-items: center; min-width: 92px; padding: 8px 10px; border-radius: 14px; background: var(--qs); color: var(--qc); line-height: 1.1; }
.qhead__num small { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.qhead__num b { font: 700 32px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.qhead__main { display: grid; gap: 6px; min-width: 0; }
.qhead__title { font-size: 18px; font-weight: 650; }
.qhead__meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--ink-2); font-size: 14px; }
.qhead__meta > span { display: inline-flex; align-items: center; gap: 5px; }
.qhead__total { display: grid; justify-items: end; line-height: 1.15; }
.qhead__total small { font-size: 12px; color: var(--ink-3); }
.qhead__total b { font-size: 26px; font-variant-numeric: tabular-nums; }
@media (max-width: 699px) { .qhead { grid-template-columns: auto minmax(0, 1fr); } .qhead__total { grid-column: 1 / -1; justify-items: start; grid-auto-flow: column; gap: 8px; align-items: baseline; } }
.qsteps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.qstep { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 650; color: var(--ink-3); background: var(--bg-2); }
.qstep.is-done { color: var(--qc); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.qstep.is-on { color: #fff; background: var(--qc); }
.qnext { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.qnext:empty { display: none; }

/* Avisos */
.qalerts { display: grid; gap: 6px; }
.qalert { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--r); font-size: 14px; background: var(--info-soft); color: #234E67; }
.qalert .grow { flex: 1; }
.qalert--warn { background: var(--warn-soft); color: #6B420B; }
.qalert--error { background: var(--danger-soft); color: #7A1A12; font-weight: 600; }
.qok { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: var(--r); background: var(--ok-soft); color: #1C5434; font-size: 14px; font-weight: 600; }
.qack { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; }
.qack input { width: 22px; height: 22px; accent-color: var(--ok); flex: none; margin-top: 1px; }

/* Editor */
.qmail summary { cursor: pointer; list-style: none; padding-bottom: 14px; }
.qmail summary::-webkit-details-marker { display: none; }
.qmail__text { margin: 0; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); white-space: pre-wrap; font: 13.5px/1.5 var(--font); max-height: 420px; overflow: auto; }
.qfound { display: grid; gap: 6px; }
.qfound__i { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 2px 10px; font-size: 14px; }
.qfound__k { color: var(--ink-3); font-size: 13px; }
.qfound__s { grid-column: 2; font-size: 12.5px; color: var(--ink-3); font-style: italic; }
@media (max-width: 599px) { .qfound__i { grid-template-columns: 1fr; } .qfound__s { grid-column: 1; } }
.qclient { align-items: flex-start; }
.qtiles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.qtile { display: grid; gap: 2px; padding: 12px; min-height: 64px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); text-align: left; color: var(--ink); }
.qtile span { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.qtile:active { background: var(--brand-soft); border-color: var(--brand-2); }
.qtile--ghost { border-style: dashed; background: var(--surface-2); }
.qline { display: grid; gap: 8px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); }
.qline__head { display: flex; gap: 8px; align-items: center; }
.qline__prod { flex: 1; font-weight: 650; }
.qline__opts { display: grid; gap: 6px; }
.qline__nums { display: grid; gap: 8px; grid-template-columns: 90px 1fr 1fr 96px 1fr; align-items: end; }
.qline__nums .field { gap: 3px; }
.qline__total { display: grid; gap: 3px; justify-items: end; padding-bottom: 8px; font-variant-numeric: tabular-nums; }
.qline__total b { font-size: 17px; }
@media (max-width: 699px) { .qline__nums { grid-template-columns: 1fr 1fr; } .qline__total { justify-items: start; } }
.qtrans { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.qsum { position: sticky; top: calc(var(--top-h) + var(--safe-t) + 12px); }
.qsum__card { gap: 12px; }
.qsum__num { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: var(--ink-2); }
.qdirty { padding: 2px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 700; }
@media (max-width: 1099px) { .qsum { position: static; } }

/* Revisió abans de generar */
.qreview { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.qreview th, .qreview td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.qreview th { width: 210px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.qreview th .icon { color: var(--ok); }
.qreview tr.is-pending th .icon { color: var(--danger); }
.qreview tr.is-pending { background: #FFF8F6; }
@media (max-width: 599px) { .qreview th { width: auto; white-space: normal; } }

/* Correu */
.qmailer__body { font: 14.5px/1.55 var(--font); min-height: 360px; }

/* Document */
.qdoc-wrap { overflow-x: auto; }
.qdoc { position: relative; min-width: 620px; }
.qdoc__draft { position: absolute; top: 10px; right: 50%; transform: translateX(50%); padding: 3px 12px; border-radius: 999px; background: #FFF1E6; color: #A8550F; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.qdoc__kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: #666; }
.qdoc__num { font: 700 24px var(--font-display); }
.qdoc__boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.qdoc__box { padding: 12px 14px; border: 1px solid #e3e3e3; border-radius: 8px; line-height: 1.5; }
.qdoc__label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: #777; margin-right: 4px; }
.qdoc__mt { margin-top: 6px; }
.qdoc__sub { font-size: 12px; color: #666; }
.qdoc__pend { color: #B42318; }
.qdoc__totals { width: auto !important; min-width: 300px; margin-left: auto !important; }
.qdoc__totals td { padding: 5px 10px; border-bottom: 1px solid #eee; }
.qdoc__total td { font-size: 17px; font-weight: 700; border-top: 2px solid #222; border-bottom: 0; }
.qdoc__obs { margin-top: 10px; padding: 10px 14px; border-left: 3px solid #999; background: #fafafa; }

/* Configuració */
.qcfg-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; align-items: center; }
.qcfg-row--5 { grid-template-columns: minmax(0, 1.3fr) minmax(0, .8fr) minmax(0, 1.3fr) minmax(0, 1.2fr) auto; }
@media (max-width: 799px) { .qcfg-row, .qcfg-row--5 { grid-template-columns: 1fr; padding-bottom: 10px; border-bottom: 1px solid var(--line); } }
.qcfg-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.qcfg-card { display: grid; gap: 4px; align-content: start; padding: 14px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); text-align: left; color: inherit; }
.qcfg-card.is-off { opacity: .6; }
.qcfg-card__price { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.qcfg-card__tpl { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qvars { display: flex; flex-wrap: wrap; gap: 6px; }
.qvar { display: inline-grid; gap: 1px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); font: 600 12.5px ui-monospace, Menlo, Consolas, monospace; color: var(--brand); text-align: left; }
.qvar span { font: 400 11.5px var(--font); color: var(--ink-3); }

@media print {
  .qdoc { min-width: 0; }
  .qdoc__draft { position: static; transform: none; display: inline-block; margin-bottom: 8px; }
}

/* ---------- Preferències del dispositiu ---------- */
html.text-big body { zoom: 1.12; }
.kpis--mini .kpi { box-shadow: none; background: var(--bg); }
.kpis--mini .kpi__value { font-size: 22px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok, #2E7D4F); box-shadow: 0 0 0 0 rgba(46,125,79,.5); animation: livepulse 2s infinite; margin-right: auto; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(46,125,79,.45); } 70% { box-shadow: 0 0 0 8px rgba(46,125,79,0); } 100% { box-shadow: 0 0 0 0 rgba(46,125,79,0); } }

/* ---------- TPV: «Crea el teu ram» com a primera pantalla ---------- */
.pos__modes { flex: none; }
.pos__modes button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; font-size: 15px; }
.pos__products { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.pos__products[hidden] { display: none; }
.pos__builder { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 20px; -webkit-overflow-scrolling: touch; }
.bq--inline { grid-template-columns: minmax(0, 1fr); gap: 12px; }
/* Franja de dalt: dibuix, preu en gran (el client el veu en directe) i botons */
.bq--inline .bq__preview { position: sticky; top: 0; z-index: 6; box-shadow: var(--shadow); grid-template-columns: 128px minmax(0, 1fr) minmax(190px, 250px);
  grid-template-areas: "art total actions" "art sizes actions" "tip tip tip" "warn warn warn"; align-items: center; column-gap: 14px; }
.bq--inline .bq__art { grid-area: art; aspect-ratio: 1; }
.bq--inline .bq__total { grid-area: total; text-align: left; }
.bq--inline .bq__sizes { grid-area: sizes; }
.bq--inline .bq__tip { grid-area: tip; }
.bq--inline [data-warn] { grid-area: warn; }
.bq--inline [data-warn]:empty { display: none; }
.bq--inline .bq__actions { grid-area: actions; }
.bq__label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.bq--inline .bq__total b { font-size: 40px; line-height: 1.05; }
@media (min-width: 1500px) {
  .bq--inline { grid-template-columns: minmax(0, 1fr) 300px; }
  .bq--inline .bq__preview { order: 2; grid-template-columns: 1fr; grid-template-areas: "art" "total" "sizes" "tip" "warn" "actions"; }
  .bq--inline .bq__art { aspect-ratio: 4 / 5; }
  .bq--inline .bq__total { text-align: center; }
  .bq--inline .bq__controls { order: 1; }
}
@media (max-width: 899px) {
  .pos__builder { overflow: visible; padding-bottom: 96px; }
  .bq--inline .bq__preview { top: calc(var(--top-h) + var(--safe-t)); grid-template-columns: 84px minmax(0, 1fr); grid-template-areas: "art total" "actions actions" "warn warn"; padding: 10px; }
  .bq--inline .bq__sizes, .bq--inline .bq__tip { display: none; }
  .bq--inline .bq__actions { grid-template-columns: 1fr 1fr; }
  .bq--inline .bq__total b { font-size: 30px; }
}

.table--inputs td { padding: 6px 6px; }
.table--inputs .input { min-width: 84px; }
.bqcfg { gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.bqcfg[hidden] { display: none; }
.bqcfg__name { flex: 1; min-width: 140px; }
.bq__actions { display: grid; gap: 8px; }
.bq__actions .btn { width: 100%; }
.bq__box > summary { cursor: pointer; list-style: none; }
.bq__box > summary::-webkit-details-marker { display: none; }
.chips--price { align-items: center; }
.chips__label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin-right: 2px; white-space: nowrap; }
.bqt__price--inc { color: var(--ok, #2E7D4F); font-size: 11.5px; }
.seg--full { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
@media (max-width: 899px) {
  .bq--inline .bq__actions { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .bq--inline .bq__actions .btn { min-height: 46px; padding: 0 10px; font-size: 14px; }
  .bq--inline [data-warn] .notice { padding: 6px 10px; font-size: 12.5px; }
}

/* ---------- Estoc: receptes i previsió de compra ---------- */
.rrow { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto auto; gap: 8px 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.rrow__main { display: grid; gap: 6px; min-width: 0; }
.rrow__qty { display: flex; align-items: center; gap: 6px; }
.rrow__qty .input { width: 70px; text-align: right; }
.rrow__cost { display: grid; justify-items: end; gap: 2px; min-width: 90px; }
.rrow__cost .input { width: 90px; }
.rrow__alts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.select--sm { min-height: 32px; font-size: 13px; padding: 0 8px; width: auto; }
.table tr.is-muted td { color: var(--ink-3); }
.text-danger { color: var(--danger); }
@media (max-width: 640px) { .rrow { grid-template-columns: minmax(0, 1fr) auto; } .rrow__cost { grid-column: 1 / 2; justify-items: start; } }

/* ---------- Caixa i registre de vendes ---------- */
.cash-break .totals__row { padding: 3px 0; }
.totals__row--sum { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px !important; }
.reg-table td { vertical-align: top; }
.reg-table .reg-prod { max-width: 340px; }
.reg-table tr.is-void td { color: var(--ink-3); text-decoration: line-through; }
.reg-table tr.is-void td:last-child { text-decoration: none; }

/* ---------- Encàrrecs: client pel telèfon i qui l'ha registrat ---------- */
.input--lg { min-height: 50px; font-size: 19px; font-weight: 600; letter-spacing: .02em; }
.ok-text { color: var(--ok, #2E7D4F); font-weight: 600; }
.notice--ok { background: var(--ok-soft); color: #1C5434; }
.who-dot { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--c, #8A5A3B); color: #fff; font-size: 12.5px; font-weight: 800; box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0,0,0,.18); }
.who-dot .icon { width: 14px; height: 14px; }
@media (max-width: 599px) { .hide-sm { display: none; } }

/* ---------- Clients: fitxa i comunicacions ---------- */
.kv--wide { grid-template-columns: minmax(150px, 190px) 1fr; }
.chip--static { pointer-events: none; }
.cdate { align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cdate:last-child { border-bottom: 0; }
.mailbody { margin: 0; white-space: pre-wrap; font: inherit; font-size: 14px; line-height: 1.5; background: var(--bg); border-radius: 12px; padding: 12px 14px; max-height: 360px; overflow: auto; }
.tpl { padding-bottom: 12px; border-bottom: 1px solid var(--line); }

/* ---------- Formularis QR ---------- */
.qr-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.qr-tile { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.qr-tile img { width: 150px; height: 150px; image-rendering: pixelated; }
.qcamp { background: var(--bg); }
.qr-poster { text-align: center; padding: 30mm 15mm; display: grid; gap: 8mm; justify-items: center; font-family: Georgia, serif; }
.qr-poster__brand { font-size: 13pt; letter-spacing: .2em; text-transform: uppercase; color: #5A3A28; }
.qr-poster h1 { font-size: 34pt; line-height: 1.15; margin: 0; color: #2A1D15; }
.qr-poster p { font-size: 16pt; margin: 0; max-width: 150mm; }
.qr-poster img { width: 110mm; height: 110mm; image-rendering: pixelated; }
.qr-poster__steps { font-family: system-ui, sans-serif; font-size: 12pt !important; color: #5B4A3F; }

/* ---------- Repartiments ---------- */
.rot90 { transform: rotate(90deg); }
.split--route { grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); }
@media (max-width: 1099px) { .split--route { grid-template-columns: minmax(0, 1fr); } .split--route > aside { order: -1; } }
.dsel { padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: 12px; }
.dlist { display: grid; gap: 8px; margin-bottom: 14px; }
.drow { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--sc); border-radius: 14px; }
.drow.is-done { opacity: .6; }
.drow__sel { width: 22px; height: 22px; accent-color: var(--brand); }
.drow__n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--sc); color: #fff; font-weight: 800; }
.drow__main { display: grid; gap: 2px; min-width: 0; text-decoration: none; color: inherit; }
.drow__top { display: flex; align-items: center; gap: 6px; }
.drow__st { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--ss); color: var(--sc); white-space: nowrap; }
.drow__who { font-weight: 700; font-size: 15.5px; }
.drow__side { display: grid; justify-items: end; gap: 6px; }
.drow__btns { display: flex; gap: 2px; }
.drow__btns .is-on { color: var(--warn); }
@media (max-width: 599px) { .drow { grid-template-columns: auto minmax(0, 1fr) auto; } .drow__sel { display: none; } }
.rmap { position: relative; width: 100%; overflow: hidden; border-radius: 14px; background: #e9e4dc; }
.rmap__in { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(var(--k, 1)); transform-origin: center; }
.rmap__in img { position: absolute; width: 256px; height: 256px; max-width: none; }
.rmap__line { position: absolute; left: 0; top: 0; overflow: visible; }
.rmap__line polyline { fill: none; stroke: #5A3A28; stroke-width: 3; stroke-dasharray: 6 5; stroke-linejoin: round; opacity: .75; }
.rmap__pin { position: absolute; transform: translate(-50%, -50%); min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; background: var(--c); color: #fff; font: 800 13px var(--font); box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,.3); }
.rmap__pin.is-shop .icon { width: 15px; height: 15px; }
/* ---------- Albarà de producció ---------- */
.ws__kicker { font-size: 12px; color: #666; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.ws__mode { display: inline-block; margin-top: 4px; padding: 3px 8px; border: 2px solid #222; border-radius: 6px; font-size: 13px; }
.ws__sec { margin: 14px 0 6px; padding-bottom: 3px; border-bottom: 1.5px solid #222; font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.ws__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; font-size: 14px; }
.ws__grid--2 { grid-template-columns: 1fr 1fr; }
.ws__item { padding: 6px 0 10px; border-bottom: 1px dashed #bbb; }
.ws__prod { font-size: 17px; }
.ws__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; color: #333; }
.ws__details { white-space: pre-wrap; font-size: 14px; color: #333; margin-top: 4px; }
.ws__table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 14px; }
.ws__table th, .ws__table td { padding: 4px 6px; border-bottom: 1px solid #ddd; text-align: left; }
.ws__table .num { text-align: right; }
.ws__card { padding: 14px 18px; border: 1px dashed #999; border-radius: 10px; font: italic 19px/1.5 Georgia, serif; white-space: pre-wrap; }
@media print { .ws-page { page-break-after: always; break-after: page; } .ws-page:last-child { page-break-after: auto; break-after: auto; } }
/* ---------- Repartidor ---------- */
.dcard { display: grid; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--sc); border-radius: 16px; box-shadow: var(--shadow); }
.dcard.is-done { opacity: .65; }
.dcard__head { display: flex; align-items: center; gap: 10px; }
.dcard__who { font-weight: 800; font-size: 17px; }
.dcard__addr { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--bg); color: inherit; text-decoration: none; font-weight: 600; font-size: 15.5px; }
.dcard__addr > span { flex: 1; }
.dcard__tel { display: flex; align-items: center; gap: 8px; color: var(--brand); font-weight: 700; text-decoration: none; }
.dcard__acts { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.dcard__acts .btn { min-height: 50px; padding: 0 8px; }
@media (max-width: 420px) { .dcard__acts { grid-auto-flow: row; } }
.view--driver .kpis { grid-template-columns: 1fr 1fr; }

/* ---------- Targeta de conservació ---------- */
.care-card { width: 100mm; min-height: 70mm; margin: 0 auto 8mm; padding: 6mm 7mm; border: 1px solid #cdbfae; border-radius: 3mm; font-family: Georgia, serif; color: #2A1D15; page-break-inside: avoid; break-inside: avoid; }
.care-card__brand { font: 700 7.5pt/1 system-ui, sans-serif; letter-spacing: .18em; text-transform: uppercase; color: #8A5A3B; }
.care-card__title { font-size: 15pt; margin: 2mm 0 2.5mm; }
.care-card ul { margin: 0; padding-left: 4.5mm; font-size: 9.5pt; line-height: 1.45; display: grid; gap: 1mm; }
.care-card__foot { display: flex; gap: 3mm; align-items: center; margin-top: 3.5mm; font: 7.5pt/1.35 system-ui, sans-serif; color: #5B4A3F; }
.care-card__foot img { width: 17mm; height: 17mm; image-rendering: pixelated; }

/* ---------- Fase 1: tarifes d'elaboració, arrodoniment i extres del «Crea el teu ram» ---------- */
.tiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.tier { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ic name" "ic price"; align-items: center; column-gap: 10px; row-gap: 0;
  min-height: 60px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); text-align: left; color: var(--ink); }
.tier__icon { grid-area: ic; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.tier__name { grid-area: name; font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.tier__price { grid-area: price; font-size: 15px; font-variant-numeric: tabular-nums; }
.tier.is-on { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: 0 6px 18px -8px rgba(90, 58, 40, .6); }
.tier.is-on .tier__icon { background: rgba(255, 255, 255, .18); color: #fff; }
.tier--custom .tier__price { color: var(--ink-3); }
.tier--custom.is-on .tier__price { color: #fff; }
.bq__totalrow { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.bq--inline .bq__totalrow { justify-content: flex-start; }
.bq__round { display: inline-flex; align-items: center; gap: 1px; height: 28px; padding: 0 8px; border-radius: 999px; border: 1px dashed var(--line-2);
  background: transparent; color: var(--ink-3); font-weight: 700; font-size: 12px; opacity: .8; }
.bq__round:hover { opacity: 1; color: var(--ink-2); }
.bq__round.is-on { border-style: solid; border-color: var(--ok); color: var(--ok); background: var(--ok-soft); opacity: 1; }
.xbtn { min-height: 28px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ok); font-size: 12px; font-weight: 700; }
.xbtn.is-on { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.qty--sm button { width: 26px; height: 26px; }
.switch-mark { position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--line-2); flex: none; transition: background .15s; }
.switch-mark i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch-mark.is-on { background: var(--ok); }
.switch-mark.is-on i { transform: translateX(16px); }
.perm-group + .perm-group { margin-top: 6px; }
.perm-row .badge { margin-right: 6px; }
.warn-text { color: var(--warn); font-weight: 600; }
.danger-text { color: var(--danger); font-weight: 600; }
small.warn-text, small.danger-text { display: flex; gap: 6px; align-items: flex-start; font-weight: 500; }
.savebar__state { align-self: center; display: inline-flex; gap: 6px; align-items: center; max-width: 42%; line-height: 1.25; }
@media (max-width: 599px) { .savebar__state { display: none; } .savebar__state.warn-text, .savebar__state.danger-text { display: inline-flex; max-width: 50%; } }
/* El preu gran del ram s'encongeix abans de passar per sota dels botons */
.bq--inline .bq__total { min-width: 0; }
.bq--inline .bq__totalrow { flex-wrap: wrap; min-width: 0; row-gap: 2px; }
.bq--inline .bq__total b { font-size: clamp(26px, 2.6vw, 40px); }
@media (min-width: 900px) and (max-width: 1499px) {
  .bq--inline .bq__preview { grid-template-columns: 100px minmax(150px, 1fr) minmax(180px, 240px); }
}

/* ---------- Centre de correus (Configuració › Comunicacions) ---------- */
.mailtpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.mailtpl { display: grid; gap: 10px; padding: 14px 16px; }
.mailtpl__head { display: flex; gap: 12px; align-items: flex-start; }
.mailtpl__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); flex: none; }
.mailtpl__summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailpreview { width: 100%; height: min(70vh, 640px); border: 1px solid var(--line); border-radius: var(--r); background: #F6F1E9; }

/* ---------- Adjunts dels encàrrecs ---------- */
.attach { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.attach__item { margin: 0; display: grid; gap: 6px; align-content: start; }
.attach__thumb { position: relative; display: block; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); }
.attach__thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach__doc { display: grid; place-items: center; align-content: center; gap: 4px; height: 100%; color: var(--ink-2); }
.attach__tag { position: absolute; left: 6px; bottom: 6px; display: inline-flex; gap: 4px; align-items: center; padding: 3px 8px; border-radius: 999px; background: rgba(42, 29, 21, .72); color: #fff; font-size: 11.5px; font-weight: 600; }
.attach__item figcaption { display: grid; gap: 4px; }
.attach__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl__from { color: var(--ink-3); }
.dcard.is-new { box-shadow: 0 0 0 2px var(--brand-2), var(--shadow); }
.dcard__acts label.btn { cursor: pointer; }

/* =============================================================
   Idea 18 · Aparença clara, fosca o automàtica i capes de vidre
   · L'estructura no canvia: només l'acabat visual.
   · El vidre (translucidesa + desenfocament) només a les capes que floten:
     barra de dalt, barra del mòbil, fulls, avisos i barra de desar.
     Taules, preus, llistes i formularis sempre sobre fons opac.
   · Sense efectes si el dispositiu demana menys transparència o moviment.
   ============================================================= */
:root {
  --font-title: var(--font);
  --on-brand: #FFFFFF;
  --side-bg: var(--brand);
  --nav-active-bg: #F6F1E9;
  --nav-active-ink: var(--brand);
  --tile: #FFFFFF;
  --glass: rgba(251, 248, 243, .74);
  --glass-strong: rgba(248, 244, 238, .88);
  --glass-line: rgba(255, 255, 255, .75);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .8);
  --glass-shadow: 0 12px 32px -14px rgba(42, 29, 21, .32);
  --ink-on-info: #234E67;
  --ink-on-warn: #6B420B;
  --ink-on-danger: #7A1A12;
  --ink-on-ok: #1C5434;
  --soft-line-danger: #EBC6C2;
}
/* Fosca: tons de terra i cafè, no gris pla */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14100D; --bg-2: #1C1713; --surface: #221C17; --surface-2: #2A231D;
  --ink: #F4EBE1; --ink-2: #D3C5B7; --ink-3: #A39383;
  --line: #372D26; --line-2: #4A3E35;
  --brand: #D6A57C; --brand-2: #C38D63; --brand-soft: #3A2A1E; --on-brand: #1E140D;
  --accent: #E77C85; --accent-soft: #3E2024;
  --ok: #67C28D; --ok-soft: #16301F; --warn: #E3A653; --warn-soft: #37280F;
  --danger: #F2837A; --danger-soft: #3E1B17; --info: #79B7DA; --info-soft: #13283A;
  --violet: #BDA0E0; --violet-soft: #2B2239;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 6px 18px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .75);
  --side-bg: #1A1410; --nav-active-bg: rgba(214, 165, 124, .16); --nav-active-ink: #F3D9C2;
  --tile: var(--surface);
  --glass: rgba(30, 24, 20, .68); --glass-strong: rgba(24, 19, 16, .86);
  --glass-line: rgba(255, 255, 255, .08); --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .06);
  --glass-shadow: 0 14px 34px -14px rgba(0, 0, 0, .8);
  --ink-on-info: #AED6EE; --ink-on-warn: #F3CF97; --ink-on-danger: #F7B9B0; --ink-on-ok: #A9DEBE;
  --soft-line-danger: #5A2A24;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #14100D; --bg-2: #1C1713; --surface: #221C17; --surface-2: #2A231D;
    --ink: #F4EBE1; --ink-2: #D3C5B7; --ink-3: #A39383;
    --line: #372D26; --line-2: #4A3E35;
    --brand: #D6A57C; --brand-2: #C38D63; --brand-soft: #3A2A1E; --on-brand: #1E140D;
    --accent: #E77C85; --accent-soft: #3E2024;
    --ok: #67C28D; --ok-soft: #16301F; --warn: #E3A653; --warn-soft: #37280F;
    --danger: #F2837A; --danger-soft: #3E1B17; --info: #79B7DA; --info-soft: #13283A;
    --violet: #BDA0E0; --violet-soft: #2B2239;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 6px 18px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .75);
    --side-bg: #1A1410; --nav-active-bg: rgba(214, 165, 124, .16); --nav-active-ink: #F3D9C2;
    --tile: var(--surface);
    --glass: rgba(30, 24, 20, .68); --glass-strong: rgba(24, 19, 16, .86);
    --glass-line: rgba(255, 255, 255, .08); --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .06);
    --glass-shadow: 0 14px 34px -14px rgba(0, 0, 0, .8);
    --ink-on-info: #AED6EE; --ink-on-warn: #F3CF97; --ink-on-danger: #F7B9B0; --ink-on-ok: #A9DEBE;
    --soft-line-danger: #5A2A24;
  }
}

/* Colors que abans eren fixos i ara segueixen l'aparença */
.side { background-color: var(--side-bg); }
.nav-item.is-active { background: var(--nav-active-bg); color: var(--nav-active-ink); }
.btn, .chip.is-on, .tier.is-on, .ostep.is-current, .mday--today .mday__n { color: var(--on-brand); }
.btn--ghost { color: var(--ink); }
.btn--soft { color: var(--brand); }
.btn--danger-ghost { color: var(--danger); border-color: var(--soft-line-danger); }
.btn--ok, .btn--danger { color: #FFFFFF; }
:root[data-theme="dark"] .btn--ok { background-color: #2B7F4E; }
:root[data-theme="dark"] .btn--danger { background-color: #B4372C; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .btn--ok { background-color: #2B7F4E; }
  :root[data-theme="auto"] .btn--danger { background-color: #B4372C; }
}
.tier.is-on .tier__icon { color: var(--on-brand); }
.chip.is-on .count { background: var(--on-brand); color: var(--brand); }
.notice, .bq__tip, .qalert { color: var(--ink-on-info); }
.notice--warn, .qalert--warn { color: var(--ink-on-warn); }
.notice--danger, .qalert--error { color: var(--ink-on-danger); }
.notice--ok, .bq__tip.is-ok { color: var(--ink-on-ok); }
.kpi--alert, .ocard.is-late { border-color: var(--soft-line-danger); }
.card-msg { background: var(--surface-2); }
.bqt, .bqf__thumb, .bqt__minus, .ostate.is-on, .aseg button.is-on, .amonth, .apanel, .alistview section, .atl, .astrip { background-color: var(--tile); }
.aseg { background: var(--bg-2); }
.amday.is-closed { background: var(--surface-2); }
.amday.is-sel, .arow:active, .acal-nav button:hover { background: var(--brand-soft); }
.amday__ord, .tag--pick { background: var(--brand-soft); color: var(--brand); }
.tag--del { background: var(--info-soft); color: var(--info); }
.tag--due { background: var(--warn-soft); color: var(--warn); }
.acal { --hair: var(--line); }
.auth { background: radial-gradient(120% 80% at 50% 0%, var(--surface-2) 0%, var(--bg) 55%, var(--bg-2) 100%); }
.input, .select, .textarea { background-color: var(--surface); color: var(--ink); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }

/* Títols de la interfície: lletra del sistema (com a l'iPhone), més ajustada.
   La lletra de la marca queda per al logotip, la targeta del ram i els documents impresos. */
.top__title, .sheet__head h2, .card__head h2 { letter-spacing: -.015em; }

/* ---------- Vidre a les capes flotants ---------- */
.top { background: var(--glass); border-bottom-color: var(--glass-line); box-shadow: var(--glass-hi);
  backdrop-filter: blur(22px) saturate(1.7); -webkit-backdrop-filter: blur(22px) saturate(1.7); }
.savebar { background: var(--glass); border-top-color: var(--glass-line);
  backdrop-filter: blur(22px) saturate(1.7); -webkit-backdrop-filter: blur(22px) saturate(1.7); }
.bq--inline .bq__preview { background: var(--glass-strong); border-color: var(--glass-line);
  backdrop-filter: blur(24px) saturate(1.6); -webkit-backdrop-filter: blur(24px) saturate(1.6); box-shadow: var(--glass-hi), var(--glass-shadow); }
.overlay { background: rgba(20, 14, 10, .38); }
.sheet { background: var(--glass-strong); border: 1px solid var(--glass-line); border-bottom: 0;
  backdrop-filter: blur(30px) saturate(1.5); -webkit-backdrop-filter: blur(30px) saturate(1.5); box-shadow: var(--glass-hi), var(--shadow-lg); }
.sheet__head { border-bottom-color: var(--glass-line); }
.sheet__foot { background: transparent; border-top-color: var(--glass-line); }
.toast { background-color: rgba(30, 22, 17, .84); border: 1px solid rgba(255, 255, 255, .1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), var(--shadow-lg);
  backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6); }
.toast--danger { background-color: rgba(160, 30, 22, .9); }
.toast--web { background-color: rgba(98, 62, 148, .9); }
/* Reflex de llum suau als botons principals i a la barra lateral */
.btn:not(.btn--ghost):not(.btn--soft):not(.btn--danger-ghost) { background-image: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 55%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 2px rgba(0, 0, 0, .08); }
.side { background-image: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0) 40%); }
.card, .list, .kpi { box-shadow: var(--glass-hi), var(--shadow); }
/* Transicions suaus (curtes: no han d'alentir res) */
.btn, .chip, .tier, .nav-item, .tab, .li, .ocard, .bqt { transition: background-color .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .08s ease; }
.btn:active, .chip:active, .tier:active { transform: scale(.98); }

@media (max-width: 899px) {
  /* Barra del mòbil: una peça de vidre que sura sobre el contingut */
  .tabs { left: 10px; right: 10px; bottom: calc(8px + var(--safe-b)); padding: 6px 4px; border-radius: 24px; border: 1px solid var(--glass-line);
    background: var(--glass); box-shadow: var(--glass-hi), var(--glass-shadow);
    backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8); }
  .tab { border-radius: 16px; }
  .tab.is-active { background: var(--brand-soft); }
  .view { padding-bottom: calc(110px + var(--safe-b)); }
  .savebar { bottom: calc(82px + var(--safe-b)); border-radius: 18px; margin-left: 0; margin-right: 0; border: 1px solid var(--glass-line); box-shadow: var(--glass-hi), var(--glass-shadow); }
  .sheet { border-radius: 24px 24px 0 0; }
}
@media (min-width: 900px) {
  .sheet { border-radius: 22px; border-bottom: 1px solid var(--glass-line); }
}

/* Selector d'aparença */
.themeopts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.themeopt { display: grid; justify-items: center; gap: 6px; padding: 12px 8px; border-radius: var(--r-lg); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); text-align: center; }
.themeopt.is-on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.themeopt__sw { display: grid; place-items: center; width: 54px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2); }
.themeopt__sw--clar { background: #F6F1E9; color: #5A3A28; }
.themeopt__sw--fosc { background: #1C1713; color: #F3D9C2; }
.themeopt__sw--auto { background: linear-gradient(135deg, #F6F1E9 50%, #1C1713 50%); color: #8A5A3B; }

/* Menys transparència o moviment si el dispositiu ho demana (i si no admet el desenfocament) */
@media (prefers-reduced-transparency: reduce) {
  .top, .savebar, .sheet, .tabs, .bq--inline .bq__preview { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; background: var(--surface) !important; }
  .toast { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; background-color: #2A1D15 !important; }
}
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .top, .savebar, .tabs, .bq--inline .bq__preview { background: var(--surface-2); }
  .sheet { background: var(--bg); }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .chip, .tier, .nav-item, .tab, .li, .ocard, .bqt { transition: none; }
  .btn:active, .chip:active, .tier:active { transform: none; }
}
/* Botons amb el color d’un estat posat a la mateixa etiqueta: sempre text blanc */
.btn[style*="background"] { color: #FFFFFF; }
.pos__bar .btn { background: var(--surface); color: var(--ink); }
.pos__bar { color: var(--on-brand); }
/* Fosca: els colors suaus dels estats (columnes, etiquetes) passen a un to fosc del mateix color */
:root[data-theme="dark"] :is(.ocard, .oboard__col, .ostate, .ostep, .dcard, .drow__st, .qrow, .qpill, [style*="--ss"]) { --ss: color-mix(in srgb, var(--sc, #A39383) 22%, #1C1713) !important; }
:root[data-theme="dark"] .badge--dot { background-color: color-mix(in srgb, currentColor 20%, transparent) !important; }
:root[data-theme="dark"] .oboard__head b { color: #FFFFFF; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] :is(.ocard, .oboard__col, .ostate, .ostep, .dcard, .drow__st, .qrow, .qpill, [style*="--ss"]) { --ss: color-mix(in srgb, var(--sc, #A39383) 22%, #1C1713) !important; }
  :root[data-theme="auto"] .badge--dot { background-color: color-mix(in srgb, currentColor 20%, transparent) !important; }
}
@media (max-width: 899px) { .tab .count { position: absolute; top: 2px; left: calc(50% + 6px); } }
/* Correus pendents d'atenció a l'Inici (es poden lliscar per marcar-los com a gestionats) */
.mrow { touch-action: pan-y; user-select: none; -webkit-user-select: none; background: var(--surface); }
.mrow.is-swiping { background: var(--ok-soft); }
.mrow__subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
/* Fitxa d'una flor: tria de la il·lustració */
.shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; max-height: 300px; overflow-y: auto; padding: 2px; }
.shape { display: grid; justify-items: center; gap: 2px; padding: 6px 4px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 11.5px; }
.shape.is-on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); color: var(--ink); }
.shape__art { width: 52px; height: 52px; display: grid; place-items: center; }
.shape__art svg { width: 100%; height: 100%; }
.shape__name { text-align: center; line-height: 1.15; }

/* =============================================================
   Liquid Glass · transformació visual de tot el panell (idea 18)
   · La mateixa estructura, mòduls i funcions: només canvia l'aparença.
   · Fons càlid amb llums suaus (els colors de la web) i, a sobre, plafons de vidre:
     translúcids, amb vora brillant, reflex i ombra que els fa surar.
   · Les capes que floten (menú, barra de dalt, barra del mòbil, fulls, avisos) a més desenfoquen el que passa per sota.
   · Les dades (preus, llistes, taules, estats) sempre sobre un vidre prou opac per llegir-se bé.
   · Rendiment: el desenfocament només a les capes flotants; els plafons de contingut no en porten
     (el fons ja és suau), així es manté fluid als mòbils Android senzills.
   ============================================================= */
:root {
  --lg-base: #F2ECE3;
  --lg-glow-1: rgba(214, 165, 124, .42);
  --lg-glow-2: rgba(196, 104, 138, .20);
  --lg-glow-3: rgba(104, 140, 92, .20);
  --lg-glow-4: rgba(255, 252, 247, .85);
  --lg-panel: rgba(255, 255, 255, .58);
  --lg-panel-2: rgba(255, 255, 255, .74);
  --lg-panel-solid: rgba(255, 255, 255, .86);
  --lg-bar: rgba(255, 255, 255, .52);
  --lg-edge: rgba(255, 255, 255, .9);
  --lg-line: rgba(90, 58, 40, .10);
  --lg-line-2: rgba(90, 58, 40, .16);
  --lg-hover: rgba(255, 255, 255, .55);
  --lg-sheen: linear-gradient(140deg, rgba(255, 255, 255, .62) 0%, rgba(255, 255, 255, .12) 34%, rgba(255, 255, 255, 0) 60%);
  --lg-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 2px rgba(60, 38, 22, .06), 0 10px 28px -14px rgba(60, 38, 22, .30);
  --lg-shadow-hi: inset 0 1px 0 rgba(255, 255, 255, .95), 0 2px 6px rgba(60, 38, 22, .08), 0 18px 40px -18px rgba(60, 38, 22, .38);
  --lg-float: inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 -1px 0 rgba(255, 255, 255, .25), 0 16px 40px -18px rgba(60, 38, 22, .42), 0 2px 8px rgba(60, 38, 22, .08);
  --lg-blur: blur(26px) saturate(1.9);
  --lg-accent: linear-gradient(180deg, #9C6A47 0%, #6E4630 100%);
  --lg-accent-glow: 0 6px 18px -8px rgba(110, 70, 48, .65);
  --lg-radius: 22px;
}
:root[data-theme="dark"] {
  --lg-base: #110D0A;
  --lg-glow-1: rgba(214, 165, 124, .17);
  --lg-glow-2: rgba(231, 124, 133, .11);
  --lg-glow-3: rgba(103, 194, 141, .08);
  --lg-glow-4: rgba(255, 220, 190, .05);
  --lg-panel: rgba(46, 36, 29, .56);
  --lg-panel-2: rgba(40, 32, 26, .74);
  --lg-panel-solid: rgba(34, 27, 22, .88);
  --lg-bar: rgba(34, 27, 22, .55);
  --lg-edge: rgba(255, 255, 255, .11);
  --lg-line: rgba(255, 255, 255, .07);
  --lg-line-2: rgba(255, 255, 255, .12);
  --lg-hover: rgba(255, 255, 255, .06);
  --lg-sheen: linear-gradient(140deg, rgba(255, 255, 255, .08) 0%, rgba(255, 255, 255, .02) 34%, rgba(255, 255, 255, 0) 60%);
  --lg-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -14px rgba(0, 0, 0, .7);
  --lg-shadow-hi: inset 0 1px 0 rgba(255, 255, 255, .09), 0 2px 6px rgba(0, 0, 0, .35), 0 20px 44px -18px rgba(0, 0, 0, .8);
  --lg-float: inset 0 1px 0 rgba(255, 255, 255, .09), 0 18px 44px -18px rgba(0, 0, 0, .85), 0 2px 8px rgba(0, 0, 0, .35);
  --lg-accent: linear-gradient(180deg, #E3B790 0%, #C8936A 100%);
  --lg-accent-glow: 0 6px 18px -8px rgba(214, 165, 124, .55);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --lg-base: #110D0A;
    --lg-glow-1: rgba(214, 165, 124, .17);
    --lg-glow-2: rgba(231, 124, 133, .11);
    --lg-glow-3: rgba(103, 194, 141, .08);
    --lg-glow-4: rgba(255, 220, 190, .05);
    --lg-panel: rgba(46, 36, 29, .56);
    --lg-panel-2: rgba(40, 32, 26, .74);
    --lg-panel-solid: rgba(34, 27, 22, .88);
    --lg-bar: rgba(34, 27, 22, .55);
    --lg-edge: rgba(255, 255, 255, .11);
    --lg-line: rgba(255, 255, 255, .07);
    --lg-line-2: rgba(255, 255, 255, .12);
    --lg-hover: rgba(255, 255, 255, .06);
    --lg-sheen: linear-gradient(140deg, rgba(255, 255, 255, .08) 0%, rgba(255, 255, 255, .02) 34%, rgba(255, 255, 255, 0) 60%);
    --lg-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -14px rgba(0, 0, 0, .7);
    --lg-shadow-hi: inset 0 1px 0 rgba(255, 255, 255, .09), 0 2px 6px rgba(0, 0, 0, .35), 0 20px 44px -18px rgba(0, 0, 0, .8);
    --lg-float: inset 0 1px 0 rgba(255, 255, 255, .09), 0 18px 44px -18px rgba(0, 0, 0, .85), 0 2px 8px rgba(0, 0, 0, .35);
    --lg-accent: linear-gradient(180deg, #E3B790 0%, #C8936A 100%);
    --lg-accent-glow: 0 6px 18px -8px rgba(214, 165, 124, .55);
  }
}

/* ---------- Fons: llum càlida i suau (es veu a través del vidre) ---------- */
html, body { background-color: var(--lg-base); }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vmax 50vmax at 8% 4%, var(--lg-glow-1), transparent 62%),
    radial-gradient(52vmax 44vmax at 94% 10%, var(--lg-glow-2), transparent 64%),
    radial-gradient(60vmax 52vmax at 78% 98%, var(--lg-glow-3), transparent 62%),
    radial-gradient(46vmax 40vmax at 34% 58%, var(--lg-glow-4), transparent 70%);
}
.auth, .lock { background: transparent; }
.lock { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }

/* ---------- Menú lateral: un plafó de vidre que sura ---------- */
.side {
  top: 12px; height: calc(100vh - 24px); height: calc(100dvh - 24px); margin: 12px 0 12px 12px; border-radius: 26px;
  background-color: var(--lg-bar); background-image: var(--lg-sheen); color: var(--ink-2);
  border: 1px solid var(--lg-edge); box-shadow: var(--lg-float);
  backdrop-filter: var(--lg-blur); -webkit-backdrop-filter: var(--lg-blur);
  overflow-x: hidden; scrollbar-width: none;
}
.side::-webkit-scrollbar { display: none; }
.side__brand, .side__brand svg { color: var(--brand); }
.side__brand small { color: var(--brand-2); }
.nav-item { color: var(--ink-2); border-radius: 14px; font-weight: 550; }
.nav-item .icon { color: var(--ink-3); transition: color .18s ease; }
.nav-item:hover { background: var(--lg-hover); color: var(--ink); }
.nav-item:hover .icon { color: var(--brand); }
.nav-item.is-active { background: var(--lg-accent); color: var(--on-brand); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), var(--lg-accent-glow); }
.nav-item.is-active .icon { color: var(--on-brand); }
.side__foot { border-top: 1px solid var(--lg-line-2); }
.side__user { color: var(--ink-3); }
.side__user div[style*="color:#fff"] { color: var(--ink) !important; }

/* ---------- Barra de dalt: una càpsula de vidre flotant (ocupa la mateixa alçada que abans) ---------- */
.top {
  top: calc(8px + var(--safe-t)); margin: calc(8px + var(--safe-t)) 14px 0; padding: 0 12px 0 16px;
  min-height: calc(var(--top-h) - 8px); border-radius: 20px; border: 1px solid var(--lg-edge); border-bottom: 1px solid var(--lg-edge);
  background-color: var(--lg-bar); background-image: var(--lg-sheen); box-shadow: var(--lg-float);
  backdrop-filter: var(--lg-blur); -webkit-backdrop-filter: var(--lg-blur);
}
.top__title { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
@media (max-width: 899px) {
  .top { margin: calc(8px + var(--safe-t)) 10px 0; padding: 0 8px 0 12px; border-radius: 18px; }
}

/* ---------- Plafons de contingut: vidre amb vora brillant, reflex i ombra ---------- */
.card, .list, .kpi, .bq__box, .bq__preview, .apanel, .amonth, .atl, .astrip, .alistview section, .mailtpl, .pay-method, .ostate, .dcard, .themeopt {
  background-color: var(--lg-panel); background-image: var(--lg-sheen);
  border: 1px solid var(--lg-edge); box-shadow: var(--lg-shadow);
}
.card, .list, .kpi { border-radius: var(--lg-radius); }
.kpis--mini .kpi { background-color: var(--lg-panel-2); box-shadow: inset 0 1px 0 var(--lg-edge); }
.kpi__value { font-weight: 760; letter-spacing: -.02em; }
.kpi__label { letter-spacing: .07em; }
a.kpi, button.kpi { transition: transform .18s ease, box-shadow .18s ease; }
a.kpi:hover, button.kpi:hover { transform: translateY(-2px); box-shadow: var(--lg-shadow-hi); }
.kpi--warn { background-color: color-mix(in srgb, var(--warn-soft) 72%, transparent); }
.kpi--alert { background-color: color-mix(in srgb, var(--danger-soft) 72%, transparent); }
.card__head { border-bottom: 0; }
.li { border-bottom-color: var(--lg-line); background: transparent; }
a.li:hover, button.li:hover, label.li:hover { background: var(--lg-hover); }
.table th, .table td { border-bottom-color: var(--lg-line); }
.sep, hr.sep { border-color: var(--lg-line-2); }
/* Encàrrecs: targetes més opaques (dades), columnes del tauler com a vidre tenyit del color de l'estat */
.ocard { background-color: var(--lg-panel-solid); background-image: var(--lg-sheen); border-color: var(--lg-edge); border-left-color: var(--sc); box-shadow: var(--lg-shadow); border-radius: 18px; }
.ocard:hover { box-shadow: var(--lg-shadow-hi); }
.oboard__col { background: color-mix(in srgb, var(--ss) 62%, transparent); border: 1px solid var(--lg-edge); box-shadow: inset 0 1px 0 var(--lg-edge); border-radius: 22px; }
.ostate { border-radius: 18px; }
.ostate.is-on { background-color: var(--lg-panel-solid); }
.dcard { border-left: 6px solid var(--sc); border-radius: 20px; background-color: var(--lg-panel-solid); }
/* TPV: el tiquet és un plafó de vidre a la dreta */
.pos__ticket { background-color: var(--lg-panel); background-image: var(--lg-sheen); border-left: 1px solid var(--lg-edge); backdrop-filter: var(--lg-blur); -webkit-backdrop-filter: var(--lg-blur); }
.ticket__foot { background: transparent; border-top-color: var(--lg-line-2); }
.tline { border-bottom-color: var(--lg-line); }
.bqt { background-color: var(--lg-panel-solid); border-color: var(--lg-edge); box-shadow: var(--lg-shadow); border-radius: 18px; }
.bqt.is-in { border-color: var(--brand-2); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-2) 55%, transparent), var(--lg-shadow); }
.bq__art { background: radial-gradient(circle at 50% 38%, var(--lg-panel-solid), transparent 72%); }
.tier { background-color: var(--lg-panel-2); border-color: var(--lg-edge); box-shadow: var(--lg-shadow); border-radius: 18px; }
.tier.is-on { background: var(--lg-accent); border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), var(--lg-accent-glow); }
.tier__icon { background: var(--lg-hover); }
/* Capçaleres que es queden enganxades en desplaçar: vidre */
.group-head { background: transparent; }
/* (sense desenfocament: n'hi pot haver moltes en una llista llarga i als mòbils senzills alentiria el desplaçament) */
.group-head::before { content: ""; position: absolute; inset: 4px -8px 2px; z-index: -1; border-radius: 14px; background: var(--lg-panel-solid); border: 1px solid var(--lg-edge); box-shadow: 0 4px 12px -8px rgba(60, 38, 22, .3); }
.group-head { isolation: isolate; }

/* ---------- Controls ---------- */
.btn { border-radius: 14px; font-weight: 620; letter-spacing: -.005em; }
.btn:not(.btn--ghost):not(.btn--soft):not(.btn--danger-ghost):not(.btn--ok):not(.btn--danger):not([style*="background"]) {
  background-color: transparent; background-image: var(--lg-accent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .26), var(--lg-accent-glow);
}
.btn--ok { background-image: linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0) 55%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 16px -8px rgba(46, 125, 79, .7); }
.btn--danger { background-image: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 55%); }
.btn--ghost, .btn--danger-ghost { background-color: var(--lg-panel-2); background-image: var(--lg-sheen); border: 1px solid var(--lg-edge); box-shadow: var(--lg-shadow); }
.btn--ghost:hover, .btn--danger-ghost:hover { background-color: var(--lg-panel-solid); }
.btn--soft { background: color-mix(in srgb, var(--brand-soft) 78%, transparent); border: 1px solid var(--lg-edge); }
.btn--icon { border-radius: 12px; }
.chip { background-color: var(--lg-panel-2); background-image: var(--lg-sheen); border: 1px solid var(--lg-edge); box-shadow: inset 0 1px 0 var(--lg-edge), 0 1px 2px rgba(60, 38, 22, .06); color: var(--ink-2); }
.chip.is-on { background: var(--lg-accent); border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .26), var(--lg-accent-glow); }
.seg { background: color-mix(in srgb, var(--lg-panel) 70%, transparent); border: 1px solid var(--lg-edge); box-shadow: inset 0 1px 2px rgba(60, 38, 22, .08); border-radius: 15px; padding: 3px; }
.seg button { border-radius: 12px; transition: background-color .2s ease, color .2s ease, box-shadow .2s ease; }
.seg button.is-on { background-color: var(--lg-panel-solid); background-image: var(--lg-sheen); box-shadow: inset 0 1px 0 var(--lg-edge), 0 2px 8px -2px rgba(60, 38, 22, .25); }
.input, .select, .textarea { background-color: var(--lg-panel-solid); border: 1px solid var(--lg-line-2); border-radius: 14px; box-shadow: inset 0 1px 2px rgba(60, 38, 22, .05); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 22%, transparent); }
.input.is-invalid { border-color: var(--warn); }
.qty { border-color: var(--lg-line-2); border-radius: 12px; background: var(--lg-panel-2); }
.qty button { background: transparent; }
.switch span.track { box-shadow: inset 0 1px 2px rgba(0, 0, 0, .12); }
.notice { border: 1px solid var(--lg-edge); border-radius: 16px; box-shadow: inset 0 1px 0 var(--lg-edge); }
.badge { border-radius: 999px; }
.avatar { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 1px 3px rgba(0, 0, 0, .15); }
.bq__round { background: var(--lg-panel-2); border: 1px solid var(--lg-line-2); gap: 4px; padding: 0 9px; font-size: 12.5px; color: var(--ink-2); opacity: .9; }
.bq__round.is-on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }

/* ---------- Fulls i finestres: vidre que sura, cantonades més rodones ---------- */
.overlay { background: rgba(28, 18, 12, .30); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet { background-color: var(--lg-panel-2); background-image: var(--lg-sheen); border: 1px solid var(--lg-edge); box-shadow: var(--lg-float);
  backdrop-filter: blur(34px) saturate(1.8); -webkit-backdrop-filter: blur(34px) saturate(1.8); }
.sheet__head h2 { font-weight: 700; letter-spacing: -.02em; }
@media (min-width: 900px) { .sheet { border-radius: 28px; } }
@media (max-width: 899px) { .sheet { border-radius: 28px 28px 0 0; } }
.sheet::before { content: ""; display: block; width: 38px; height: 5px; margin: 8px auto -4px; border-radius: 999px; background: var(--lg-line-2); }
@media (min-width: 900px) { .sheet::before { display: none; } }

/* ---------- Barra del mòbil: més vidre i icona activa amb llum ---------- */
@media (max-width: 899px) {
  .tabs { background-color: var(--lg-bar); background-image: var(--lg-sheen); border: 1px solid var(--lg-edge); box-shadow: var(--lg-float); border-radius: 26px;
    backdrop-filter: var(--lg-blur); -webkit-backdrop-filter: var(--lg-blur); }
  .tab { color: var(--ink-3); }
  .tab.is-active { background: var(--lg-accent); color: var(--on-brand); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .26), var(--lg-accent-glow); }
  .savebar { background-color: var(--lg-bar); background-image: var(--lg-sheen); border: 1px solid var(--lg-edge); box-shadow: var(--lg-float); border-radius: 22px; }
  .pos__bar { border-radius: 22px; box-shadow: var(--lg-float); background-image: var(--lg-accent); }
}
.savebar { background-color: var(--lg-bar); background-image: var(--lg-sheen); border-top: 1px solid var(--lg-edge); }

/* ---------- Avisos: càpsula de vidre fosc ---------- */
.toast { border-radius: 18px; }

/* ---------- Transicions suaus ---------- */
@keyframes lgViewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view { animation: lgViewIn .24s cubic-bezier(.2, .8, .2, 1); }
@keyframes lgSheetIn { from { opacity: 0; transform: translateY(24px) scale(.985); } to { opacity: 1; transform: none; } }
.sheet { animation: lgSheetIn .3s cubic-bezier(.2, .9, .25, 1); }

/* ---------- Pantalla d'inici de sessió i iPad bloquejat ---------- */
.auth .card { border-radius: 28px; padding: 26px; }
.lock__person, .lock .person { background-color: var(--lg-panel); }

/* ---------- Accessibilitat i dispositius sense desenfocament ---------- */
@media (prefers-reduced-transparency: reduce) {
  :root { --lg-panel: var(--surface); --lg-panel-2: var(--surface); --lg-panel-solid: var(--surface); --lg-bar: var(--surface); }
  .side, .top, .tabs, .sheet, .pos__ticket, .overlay { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  body::before { display: none; }
}
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  :root { --lg-bar: var(--lg-panel-solid); }
}
@media (prefers-reduced-motion: reduce) {
  .view, .sheet { animation: none; }
  a.kpi:hover, button.kpi:hover { transform: none; }
}
.bq__round { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 999px; }
