:root {
    --bur: #6B2D2D;
    --wood: #2C1810;
    --gold: #C4A35A;
    --gold-light: #e6d3a3;
    --bg: #F5F0E6;
    --card: #FBF7EE;
    --ink: #2C1810;
    --mut: #6b5d52;
    --line: #dfd1b4;
    --acc: #6B2D2D;
    --warn: #9b2c2c;
    --success: #2e7d32;
    --info: #1976d2;
    --pending: #ed6c02;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media(prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #1d110b;
        --card: #2C1810;
        --ink: #F5F0E6;
        --mut: #bba993;
        --line: #4a3426;
        --acc: #C4A35A;
        --warn: #ff9c8a;
    }
}

:root[data-theme="dark"] {
    --bg: #1d110b;
    --card: #2C1810;
    --ink: #F5F0E6;
    --mut: #bba993;
    --line: #4a3426;
    --acc: #C4A35A;
    --warn: #ff9c8a;
}

* {
    box-sizing: border-box;
    margin: 0;
}

html {
    font-size: clamp(.9375rem, .86rem + .35vw, 1.0625rem);
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
    font: 1rem/1.55 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg) radial-gradient(rgba(107, 45, 45, .07) 1px, transparent 1px) 0 0/0.875rem 0.875rem;
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

h1, h2, h3, h4, .logo {
    font-family: 'Playfair Display', Georgia, serif;
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.625rem, 4vw, 2.25rem);
    margin-bottom: 0.5rem;
}

h3 {
    font-size: 1.25rem;
}

a {
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 0.1875rem;
}

.ic {
    width: 1.25em;
    height: 1.25em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -0.22em;
}

/* Header & Navigation */
header {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 100;
    background: var(--wood);
    color: #F5F0E6;
    border-bottom: 2px solid var(--gold);
}

.wrap {
    width: 100%;
    max-width: 72rem;
    margin-inline: auto;
    padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
}

header .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    min-height: 4rem;
    gap: 0.75rem;
    padding-block: 0.5rem;
}

.logo {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--gold);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
}

nav a {
    text-decoration: none;
    color: #e8dcc4;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--gold);
}

.portal-bar {
    background: #1d110b;
    border-top: 1px solid rgba(196, 163, 90, .25);
    padding: 0.35rem 0;
}

.portal-bar .wrap {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    overflow-x: auto;
    white-space: nowrap;
}

.portal-bar small {
    color: #bba993;
    font-size: 0.8rem;
    margin-right: 0.4rem;
}

.portal-pill {
    font: 600 0.8125rem 'Inter', sans-serif;
    padding: 0.3rem 0.85rem;
    border-radius: 6rem;
    border: 1px solid var(--gold);
    background: none;
    color: var(--gold);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: 0.2s;
}

.portal-pill:hover, .portal-pill.active {
    background: var(--gold);
    color: var(--wood);
}

/* Sections & Layout */
.sec {
    padding-top: 2.5rem;
    padding-bottom: 3rem;
}

.mut {
    color: var(--mut);
}

.sm {
    font-size: 0.85rem;
}

.warn {
    color: var(--warn);
}

.success {
    color: var(--success);
}

.center {
    text-align: center;
}

.narrow {
    max-width: 32rem;
    margin: auto;
}

.wide-card {
    max-width: 60rem;
    margin: auto;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

.between {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.pad {
    padding: 1.5rem;
}

.stack {
    display: grid;
    gap: 1rem;
}

.grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    margin-top: 1.25rem;
}

.grid-3 {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
    margin-top: 1.25rem;
}

.grid-4 {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    margin-top: 1rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 0.875rem;
    box-shadow: 0 2px 0.75rem rgba(44, 24, 16, .08);
}

/* Buttons & Chips */
.btn {
    font: 600 0.9375rem 'Inter', sans-serif;
    padding: 0.6875rem 1.375rem;
    border-radius: 6rem;
    border: 1.5px solid var(--bur);
    background: var(--bur);
    color: #F5F0E6;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.125rem rgba(107, 45, 45, .3);
    color: #fff;
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn.g {
    background: transparent;
    border-color: var(--gold);
    color: var(--ink);
}

.btn.g:hover {
    background: var(--gold);
    color: var(--wood);
}

.btn.gold {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--wood);
}

.btn.gold:hover {
    background: #b09149;
    border-color: #b09149;
    color: #fff;
}

.btn.danger {
    background: var(--warn);
    border-color: var(--warn);
    color: #fff;
}

.btn.sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

.btn.wide {
    width: 100%;
    margin-top: 0.75rem;
}

.chip {
    padding: 0.45rem 1.1rem;
    border-radius: 6rem;
    border: 1.5px solid var(--gold);
    background: none;
    color: var(--ink);
    font: 600 0.875rem 'Inter', sans-serif;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: 0.2s;
}

.chip.on, .chip:hover {
    background: var(--gold);
    color: var(--wood);
}

/* Hero Section */
.hero {
    background: linear-gradient(rgba(44, 24, 16, .78), rgba(44, 24, 16, .94)), repeating-linear-gradient(92deg, #3d2417 0 0.1875rem, #2C1810 0.1875rem 0.625rem, #35200f 0.625rem 0.75rem);
    color: #F5F0E6;
    text-align: center;
    padding: 4.5rem 1.25rem 5rem;
    border-bottom: 0.3125rem double var(--gold);
}

.hero h1 {
    font-size: clamp(2.25rem, 7vw, 4.25rem);
    font-weight: 900;
    margin: 0.875rem auto;
}

.hero .lead {
    max-width: 36rem;
    margin: 0 auto 1.5rem;
    font-size: 1.15rem;
    color: #e8dcc4;
}

.hero .row {
    justify-content: center;
}

.orn {
    color: var(--gold);
    font-size: 2.25rem;
}

.trust {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem 2rem;
    margin-top: 2.25rem;
    color: var(--gold);
    font-size: 0.9rem;
}

/* Role Cards & Steps */
.role {
    padding: 1.75rem;
    text-align: left;
    text-decoration: none;
    color: inherit;
    border-top: 0.3125rem solid var(--gold);
    transition: 0.25s;
    display: block;
}

.role:hover, .pc:hover {
    transform: translateY(-0.25rem);
    box-shadow: 0 0.875rem 1.75rem rgba(44, 24, 16, .18);
}

.role .ic {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--acc);
}

.role h3 {
    margin: 0.75rem 0 0.25rem;
    font-size: 1.35rem;
}

.role p {
    margin-bottom: 0.85rem;
    color: var(--mut);
}

.role b {
    color: var(--acc);
}

.step {
    padding: 1.5rem;
}

.step .ic {
    width: 2rem;
    height: 2rem;
    color: var(--acc);
}

.step h3 {
    margin: 0.5rem 0 0.25rem;
}

.step small {
    color: var(--gold);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.note {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.125rem 1.25rem;
    border: 1px solid var(--gold);
    border-left: 0.375rem solid var(--bur);
    border-radius: 0.625rem;
    background: var(--card);
}

.note .ic {
    flex: none;
    width: 1.75rem;
    height: 1.75rem;
    color: var(--acc);
}

/* Products */
.pc {
    transition: 0.25s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pic {
    height: clamp(7.5rem, 20vw, 10rem);
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, var(--t, #6B2D2D), #2C1810);
    color: #F5F0E6;
}

.pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pic .ic {
    width: 3.5rem;
    height: 3.5rem;
    stroke-width: 1.2;
}

.pc h3 {
    margin: 0.25rem 0 0.5rem;
    font-size: 1.15rem;
}

.pc .card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
}

/* Form inputs */
label {
    font-size: 0.875rem;
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

input, textarea, select {
    width: 100%;
    padding: 0.6875rem 0.8125rem;
    border: 1px solid var(--line);
    border-radius: 0.625rem;
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    margin-bottom: 0.875rem;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(196, 163, 90, .3);
}

input[type=checkbox], input[type=radio] {
    width: auto;
    margin: 0 0.625rem 0 0;
    cursor: pointer;
}

.ck {
    display: flex;
    align-items: center;
    padding: 0.75rem 0.25rem;
    border-bottom: 1px solid var(--line);
    font-weight: 400;
}

/* Tables & Badges */
.table-wrap {
    overflow-x: auto;
    margin-top: 1rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

th {
    background: rgba(44, 24, 16, .05);
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--line);
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.95rem;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(196, 163, 90, .05);
}

.tag {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 6rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: capitalize;
}

.tag.placed { background: #e0e0e0; color: #333; }
.tag.accepted { background: #d0ebff; color: #1971c2; }
.tag.preparing { background: #fff3bf; color: #f08c00; }
.tag.ready_for_pickup { background: #e6fcf5; color: #0ca678; }
.tag.picked_up, .tag.out_for_delivery { background: #e3fafc; color: #0c8599; }
.tag.delivered { background: #d3f9d8; color: #2b8a3e; }
.tag.cancelled, .tag.rejected, .tag.failed { background: #ffe3e3; color: #e03131; }
.tag.gold { background: var(--gold); color: var(--wood); }

/* Quantity & Order Details */
.line {
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--line);
}

.tot {
    font: 700 1.25rem 'Playfair Display', serif;
    padding-top: 0.75rem;
}

.qty {
    display: inline-flex;
    gap: 0.625rem;
    align-items: center;
    font-weight: 600;
}

.qty button, .qty .qty-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1.5px solid var(--gold);
    background: none;
    color: var(--ink);
    font-size: 1.1rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: 0.15s;
    text-decoration: none;
}

.qty button:hover, .qty .qty-btn:hover {
    background: var(--gold);
    color: var(--wood);
}

/* Stepper / Timeline */
.st {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.6rem 0;
    opacity: .45;
}

.st.d {
    opacity: 1;
}

.dot {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    border: 2px solid var(--gold);
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    font-weight: bold;
}

.st.d .dot {
    background: var(--gold);
    color: var(--wood);
}

.empty {
    text-align: center;
    color: var(--mut);
    padding: 2.5rem 1rem;
}

.empty .ic {
    width: 3rem;
    height: 3rem;
    color: var(--acc);
    margin-bottom: 0.5rem;
}

/* Flash alerts */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: 0.625rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Footer */
footer {
    background: var(--wood);
    color: #d9cdb5;
    text-align: center;
    padding: 2rem 1.25rem;
    font-size: 0.85rem;
    border-top: 2px solid var(--gold);
    margin-top: auto;
}

footer a {
    color: var(--gold);
}

/* Stats / Dashboard metric blocks */
.stat-box {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: left;
}

.stat-box small {
    color: var(--mut);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.stat-box .val {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--ink);
    margin-top: 0.25rem;
}

/* Responsiveness */
@media(max-width: 48rem) {
    header .wrap {
        flex-direction: column;
        align-items: flex-start;
    }
    nav {
        width: 100%;
        justify-content: space-between;
    }
}
