/* =====================================================================
   Bakery design system (shared by the public site and the dashboard)
   Mobile-first. Colours: cream, chocolate, caramel, soft pink, gold.
   ===================================================================== */
:root {
  --cream: #fbf4ea;
  --cream-2: #f5eadb;
  --cream-3: #efe0cb;
  --chocolate: #4a2c21;
  --chocolate-2: #6b4334;
  --chocolate-3: #8a5d48;
  --caramel: #c68b59;
  --caramel-2: #b2733f;
  --pink: #e7aebb;
  --pink-soft: #f9e6ea;
  --gold: #b8923a;
  --gold-soft: #f3e7c8;
  --ink: #2e2420;
  --muted: #7a6a60;
  --line: #eadfce;
  --white: #fff;
  --success: #3f8f5a;
  --danger: #c0392b;
  --warning: #d9902f;
  --info: #4f86a8;
  /* Readable-text tokens (overridden per brand theme from Site settings) */
  --primary-text: #4a2c21;
  --on-primary: #ffffff;
  --on-primary-muted: #d7d1ce;
  --on-accent: #1c1917;
  --on-accent-2: #1c1917;
  --on-pink: #1c1917;
  --on-gold: #1c1917;
  --on-gold-soft: #725c2a;
  --surface-alt: #f6efe5;
  --primary-rgb: 74, 44, 33;
  --cream-rgb: 251, 244, 234;
  --hero-image: url("../img/hero/classic.jpg");
  --accent-rgb: 198, 139, 89;
  --on-primary-rgb: 255, 255, 255;
  --primary-text-rgb: 74, 44, 33;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(var(--primary-rgb), .06), 0 2px 8px rgba(var(--primary-rgb), .05);
  --shadow: 0 6px 24px rgba(var(--primary-rgb), .09);
  --shadow-lg: 0 18px 50px rgba(var(--primary-rgb), .14);
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;

  --bs-body-font-family: var(--font-body);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--cream);
  --bs-primary: var(--chocolate);
  --bs-primary-rgb: var(--primary-rgb);
  --bs-secondary-color: var(--muted);
  --bs-border-color: var(--line);
  --bs-link-color: var(--primary-text);
  --bs-link-color-rgb: var(--primary-text-rgb);
  --bs-link-hover-color: var(--caramel-2);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-focus-ring-color: rgba(var(--accent-rgb), .3);
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
h1, h2, h3, .display-font { font-family: var(--font-display); color: var(--primary-text); letter-spacing: -.01em; }
h4, h5, h6 { color: var(--primary-text); font-weight: 700; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3.1rem); line-height: 1.15; }
h2 { font-size: clamp(1.55rem, 3.4vw, 2.3rem); line-height: 1.2; }
h3 { font-size: clamp(1.2rem, 2.4vw, 1.5rem); }
.text-muted, .text-body-secondary { color: var(--muted) !important; }
.text-caramel { color: var(--caramel-2) !important; }
.text-gold { color: var(--gold) !important; }
.text-chocolate { color: var(--primary-text) !important; }
.bg-cream { background: var(--cream) !important; }
.bg-cream-2 { background: var(--cream-2) !important; }
.bg-pink-soft { background: var(--pink-soft) !important; }
.bg-chocolate { background: var(--chocolate) !important; color: var(--on-primary); }
.small-caps { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 700; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; font-weight: 700; color: var(--caramel-2); }
.min-w-0 { min-width: 0; }
.text-break-word { overflow-wrap: anywhere; }

/* ----- Buttons ----- */
.btn { border-radius: 999px; font-weight: 600; padding: .62rem 1.3rem; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn-sm { min-height: 36px; padding: .38rem .9rem; font-size: .86rem; }
.btn-lg { min-height: 52px; padding: .8rem 1.8rem; }
.btn-primary { --bs-btn-color: var(--on-primary); --bs-btn-hover-color: var(--on-primary); --bs-btn-active-color: var(--on-primary); --bs-btn-disabled-color: var(--on-primary); --bs-btn-bg: var(--chocolate); --bs-btn-border-color: var(--chocolate); --bs-btn-hover-bg: var(--chocolate-2); --bs-btn-hover-border-color: var(--chocolate-2); --bs-btn-active-bg: var(--chocolate-2); --bs-btn-disabled-bg: var(--chocolate-3); --bs-btn-disabled-border-color: var(--chocolate-3); }
.btn-caramel { background: var(--caramel); color: var(--on-accent); border: 1px solid var(--caramel); }
.btn-caramel:hover, .btn-caramel:focus { background: var(--caramel-2); border-color: var(--caramel-2); color: var(--on-accent-2); }
.btn-outline-primary { --bs-btn-hover-color: var(--on-primary); --bs-btn-active-color: var(--on-primary); --bs-btn-color: var(--primary-text); --bs-btn-border-color: var(--chocolate); --bs-btn-hover-bg: var(--chocolate); --bs-btn-hover-border-color: var(--chocolate); --bs-btn-active-bg: var(--chocolate); }
.btn-light { background: #fff; border-color: var(--line); color: var(--primary-text); }
.btn-light:hover { background: var(--cream-2); border-color: var(--cream-3); }
.btn-ghost { background: transparent; border: 0; color: var(--chocolate-2); }
.btn-ghost:hover { background: var(--cream-2); }
.btn-icon { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; }
.btn-whatsapp { background: #25d366; color: #fff; border: 0; }
.btn-whatsapp:hover { background: #1fb457; color: #fff; }
.btn.htmx-request, button[disabled].is-submitting { opacity: .7; pointer-events: none; }

/* ----- Forms ----- */
.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--line); padding: .62rem .85rem; min-height: 46px; background-color: #fff; font-size: 1rem; }
textarea.form-control { min-height: 90px; }
.form-control:focus, .form-select:focus { border-color: var(--caramel); box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .2); }
.form-label { font-weight: 600; color: var(--primary-text); font-size: .92rem; margin-bottom: .35rem; }
.form-text { color: var(--muted); }
.form-check-input { width: 1.2em; height: 1.2em; }
.form-check-input:checked { background-color: var(--chocolate); border-color: var(--chocolate); }
.invalid-feedback, .errorlist { color: var(--danger); font-size: .86rem; }
.errorlist { list-style: none; padding: 0; margin: .25rem 0 0; }
.is-invalid { border-color: var(--danger) !important; }
.form-section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1rem; }
.form-section-title { font-family: var(--font-body); font-size: 1rem; font-weight: 700; color: var(--primary-text); display: flex; align-items: center; gap: .5rem; margin-bottom: .9rem; }
.form-section-title i { color: var(--caramel); }
.input-group-text { background: var(--cream-2); border-color: var(--line); }
input[type="checkbox"].form-check-input + label { cursor: pointer; }
.option-pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.option-pills input { position: absolute; opacity: 0; pointer-events: none; }
.option-pills label { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: .45rem .95rem; cursor: pointer; font-weight: 500; font-size: .92rem; min-height: 40px; display: inline-flex; align-items: center; gap: .35rem; }
.option-pills input:checked + label { border-color: var(--chocolate); background: var(--chocolate); color: var(--on-primary); }
.option-pills input:focus-visible + label { outline: 3px solid rgba(var(--accent-rgb), .45); }

/* ----- Cards ----- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: #fff; }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--primary-text); padding: .9rem 1.1rem; }
.card-body { padding: 1.1rem; }
.soft-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm); }

/* ----- Badges ----- */
.status-badge { font-weight: 600; font-size: .74rem; padding: .38em .75em; letter-spacing: .01em; white-space: nowrap; }
.text-bg-primary { background-color: var(--chocolate) !important; color: var(--on-primary) !important; }
.text-bg-warning { background-color: #f6e2bd !important; color: #7a4d06 !important; }
.text-bg-info { background-color: #dcebf3 !important; color: #23526e !important; }
.text-bg-success { background-color: #dcefe2 !important; color: #23613a !important; }
.text-bg-danger { background-color: #f6dcd8 !important; color: #8f2a1f !important; }
.text-bg-secondary { background-color: #ece6df !important; color: #5c4f47 !important; }
.text-bg-dark { background-color: #3d3430 !important; color: #fff !important; }
.badge-sale { background: var(--pink); color: var(--on-pink); }
.badge-gold { background: var(--gold-soft); color: var(--on-gold-soft); }

/* ----- Tables (desktop) and card lists (mobile) ----- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
.table-scroll.has-overflow { box-shadow: inset -14px 0 10px -10px rgba(var(--primary-rgb), .18); }
.table { --bs-table-bg: transparent; margin: 0; font-size: .93rem; vertical-align: middle; }
.table > thead th { background: var(--cream-2); color: var(--primary-text); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; padding: .75rem .9rem; }
.table > thead th a { color: inherit; text-decoration: none; }
.table > tbody td { padding: .72rem .9rem; border-color: var(--line); }
.table > tbody tr:hover { background: #fffaf3; }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; background: var(--cream-2); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.row-actions { white-space: nowrap; text-align: right; }
.card-list { display: grid; gap: .75rem; }
.list-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow-sm); }
.list-card-title { font-weight: 700; color: var(--primary-text); overflow-wrap: anywhere; }
.list-card dl { display: grid; grid-template-columns: minmax(90px, 40%) 1fr; gap: .3rem .75rem; margin: .6rem 0 0; font-size: .9rem; }
.list-card dt { color: var(--muted); font-weight: 500; }
.list-card dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.list-card .card-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; padding-top: .75rem; border-top: 1px dashed var(--line); }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.2rem; color: var(--caramel); margin-bottom: .75rem; display: block; }

/* ----- Pagination ----- */
.pagination { gap: .25rem; flex-wrap: wrap; }
.page-link { border-radius: 10px !important; border-color: var(--line); color: var(--primary-text); min-width: 40px; min-height: 40px; display: flex; align-items: center; justify-content: center; }
.page-item.active .page-link { background: var(--chocolate); border-color: var(--chocolate); color: var(--on-primary); }

/* ----- Modal / toast ----- */
.modal-content { border-radius: var(--radius-lg); border: 0; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--line); padding: 1rem 1.25rem; }
.modal-title { font-family: var(--font-body); font-weight: 700; color: var(--primary-text); font-size: 1.1rem; }
.modal-body { padding: 1.25rem; }
.modal-header, .modal-footer { flex-shrink: 0; }
.modal-footer { border-top: 1px solid var(--line); background: #fff; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
/* Our modal forms wrap header/body/footer in a <form>. Make that form part of the flex layout so the
   body (not the whole dialog) scrolls and every field stays reachable, with header and buttons always visible. */
.modal-content > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-height: 100%; overflow: hidden; }
.modal-dialog-scrollable .modal-content { max-height: calc(100dvh - var(--bs-modal-margin) * 2); }
.modal-content .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
@media (max-width: 575.98px) {
  .modal-dialog-scrollable .modal-content { max-height: 100dvh; }
}
.toast-container { z-index: 2000; }
.toast { border-radius: var(--radius); border: 0; box-shadow: var(--shadow); }

/* ----- HTMX loading ----- */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
#page-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: linear-gradient(90deg, var(--caramel), var(--gold)); z-index: 3000; transition: width .3s ease, opacity .3s; opacity: 0; }
body.htmx-busy #page-progress { width: 75%; opacity: 1; }
.htmx-swapping { opacity: .6; transition: opacity .15s; }
[hx-target].htmx-request, .is-loading { cursor: progress; }

/* ----- Misc ----- */
.divider-dot::before { content: "•"; margin: 0 .5rem; color: var(--line); }
.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: .4rem 1rem; font-size: .93rem; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.4rem; border-left: 2px solid var(--line); margin-left: .4rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .35rem; width: 12px; height: 12px; border-radius: 50%; background: var(--caramel); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.progress { background: var(--cream-2); border-radius: 999px; }
.progress-bar { background: linear-gradient(90deg, var(--caramel), var(--gold)); }
.nav-pills .nav-link { border-radius: 999px; color: var(--primary-text); font-weight: 600; }
.nav-pills .nav-link.active { background: var(--chocolate); color: var(--on-primary); }
.nav-tabs { border-color: var(--line); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.nav-tabs .nav-link { color: var(--muted); font-weight: 600; border: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav-tabs .nav-link.active { color: var(--primary-text); border-bottom-color: var(--caramel); background: transparent; }
.alert { border-radius: var(--radius); border: 0; }
.alert-warning { background: #fbf0d9; color: #6d4a09; }
.alert-info { background: #e3eef4; color: #23526e; }
.alert-success { background: #e1f1e6; color: #23613a; }
.alert-danger { background: #f8e1dd; color: #8f2a1f; }
.lock-banner { background: var(--gold-soft); border: 1px solid var(--gold); color: var(--on-gold-soft); border-radius: var(--radius); padding: .8rem 1rem; }
:focus-visible { outline: 3px solid rgba(var(--accent-rgb), .55); outline-offset: 2px; }
.visually-hidden-focusable:focus { position: fixed; top: .5rem; left: .5rem; z-index: 5000; background: #fff; padding: .5rem 1rem; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Shortened money amounts (1.2M) – full value shown on hover */
.money-short { cursor: help; text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 3px; white-space: nowrap; }
