:root {
    --cream: #f7f5f0;
    --panel: #ffffff;
    --ink: #171512;
    --muted: #6f6a61;
    --line: #e6e0d4;
    --black: #0d0d0d;
    --gold: #bf9b30;
    --gold-soft: #e6cd8b;
    --gold-dark: #8a6a18;
    --green: #2e7d32;
    --red: #b8322a;
    --shadow: 0 18px 45px rgba(28, 22, 9, .08);
}

* { box-sizing: border-box; }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--cream);
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.05; letter-spacing: 0; }
h1, h2 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 700; }

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: 278px;
    padding: 24px 18px;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(191,155,48,.2), rgba(13,13,13,0) 28%),
        var(--black);
    border-right: 1px solid rgba(230, 205, 139, .25);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    font-weight: 800;
    color: var(--gold-soft);
}
.brand-lockup img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(230,205,139,.6);
}
.app-sidebar nav { display: grid; gap: 8px; }
.app-sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.74);
    font-weight: 700;
}
.app-sidebar nav a:hover, .app-sidebar nav a.active {
    color: #111;
    background: linear-gradient(135deg, var(--gold-soft), var(--gold));
}
.app-sidebar nav i { font-size: 1.1rem; }
.sidebar-note {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 24px;
    padding: 16px;
    border: 1px solid rgba(230,205,139,.28);
    border-radius: 8px;
    background: rgba(255,255,255,.04);
}
.sidebar-note span { display: block; color: rgba(255,255,255,.58); font-size: .78rem; }
.sidebar-note strong { color: var(--gold-soft); }

.app-main {
    min-height: 100vh;
    margin-left: 278px;
    padding: 28px;
    padding-bottom: 96px;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}
.topbar h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.3rem); }
.eyebrow {
    color: var(--gold-dark);
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .11em;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn, .profile-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,.05);
}
.icon-btn { color: var(--ink); }
.icon-btn.small {
    min-width: 34px;
    min-height: 34px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    box-shadow: none;
}
.profile-pill { gap: 8px; padding: 0 14px; font-weight: 700; }

.hero-panel, .panel, .metric-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}
.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, .7fr);
    gap: 22px;
    align-items: stretch;
    margin-bottom: 20px;
    padding: clamp(22px, 4vw, 36px);
    overflow: hidden;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(13,13,13,.96), rgba(31,27,18,.94)),
        url("../assets/brand/logo-rofs-cookies.webp") right -120px center / 420px no-repeat;
}
.hero-panel h2 { max-width: 780px; margin: 0 0 12px; font-size: clamp(2rem, 5vw, 4.1rem); }
.hero-panel p:not(.eyebrow) { max-width: 680px; margin: 0; color: rgba(255,255,255,.72); font-size: 1.02rem; }
.hero-panel.compact { grid-template-columns: minmax(0, 1fr) auto; }
.hero-stats { display: grid; gap: 12px; }
.hero-stats div, .big-money {
    display: grid;
    align-content: center;
    min-height: 112px;
    padding: 18px;
    border: 1px solid rgba(230,205,139,.35);
    border-radius: 8px;
    background: rgba(255,255,255,.06);
}
.hero-stats span, .big-money {
    color: var(--gold-soft);
    font-size: clamp(1.9rem, 5vw, 3.2rem);
    font-weight: 800;
}
.hero-stats small { color: rgba(255,255,255,.68); }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.metric-card {
    min-height: 132px;
    padding: 18px;
    display: grid;
    align-content: space-between;
}
.metric-card i { color: var(--gold-dark); font-size: 1.35rem; }
.metric-card span { color: var(--muted); font-weight: 700; }
.metric-card strong { font-size: clamp(1.35rem, 2.2vw, 2rem); }

.content-grid { display: grid; gap: 18px; }
.content-grid.two { grid-template-columns: minmax(0, 1fr) minmax(340px, .72fr); }
.panel { padding: 20px; }
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}
.panel-head h2 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.25rem); }
.text-link { color: var(--gold-dark); font-weight: 800; }
.btn-gold {
    min-height: 44px;
    color: #15110b;
    border: 0;
    background: linear-gradient(135deg, var(--gold-soft), var(--gold));
    font-weight: 800;
}
.btn-gold:hover { color: #000; filter: brightness(.98); }

.chart-wrap { min-height: 310px; position: relative; }
.rank-list, .production-list, .packing-list, .timeline-list, .fee-list { display: grid; gap: 10px; }
.rank-item, .production-item, .packing-item, .timeline-item, .fee-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.rank-item img, .production-item img, .packing-item img {
    width: 54px;
    height: 54px;
    border-radius: 8px;
    object-fit: cover;
}
.item-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.item-main h3 { margin: 0 0 3px; font-family: "Plus Jakarta Sans"; font-size: .96rem; font-weight: 800; }
.item-main p { margin: 0; color: var(--muted); font-size: .82rem; }
.pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 9px;
    border-radius: 999px;
    background: #f4efe2;
    color: var(--gold-dark);
    font-weight: 800;
    white-space: nowrap;
}

.catalog-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 18px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}
.catalog-toolbar h2 {
    margin: 0 0 6px;
    font-size: clamp(1.8rem, 4vw, 3rem);
}
.catalog-toolbar p:not(.eyebrow) { margin: 0; color: var(--muted); }
.catalog-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 280px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.search-box i { color: var(--gold-dark); }
.search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
}
.catalog-metrics .metric-card { min-height: 112px; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.product-card {
    display: grid;
    grid-template-columns: 104px minmax(0,1fr);
    gap: 14px;
    min-height: 160px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.product-card:hover {
    transform: translateY(-2px);
    border-color: rgba(191,155,48,.55);
    box-shadow: 0 14px 34px rgba(28,22,9,.08);
}
.product-card.inactive {
    opacity: .58;
    background: #f8f6f0;
}
.product-card img { width: 104px; height: 104px; border-radius: 8px; object-fit: cover; }
.product-card-body { min-width: 0; }
.product-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}
.product-card h3 { margin: 4px 0; font-family: "Plus Jakarta Sans"; font-size: 1.02rem; font-weight: 900; }
.product-card p { margin: 0 0 8px; color: var(--muted); }
.sku { color: var(--gold-dark); font-size: .74rem; font-weight: 900; }
.product-prices { display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; }
.product-prices span { color: var(--muted); }
.product-prices.improved {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}
.product-prices.improved span {
    display: grid;
    gap: 2px;
    padding: 8px;
    border-radius: 8px;
    background: #f8f5ee;
}
.product-prices.improved small {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 800;
    text-transform: uppercase;
}
.product-prices.improved strong { color: var(--ink); font-size: .9rem; }
.product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.drop-zone {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 260px;
    padding: 26px;
    text-align: center;
    border: 1.5px dashed var(--gold);
    border-radius: 8px;
    background: #fbf8ef;
    cursor: pointer;
}
.drop-zone i { color: var(--gold-dark); font-size: 2.4rem; }
.drop-zone span { color: var(--muted); }
.drop-zone input { display: none; }
.mapping-box {
    margin-top: 14px;
    display: grid;
    gap: 6px;
    padding: 12px;
    border-radius: 8px;
    background: #f5f1e7;
}
.mapping-box code { white-space: normal; color: var(--ink); }
.data-table th { color: var(--muted); font-size: .78rem; text-transform: uppercase; }
.data-table td { white-space: nowrap; }

.segmented {
    display: inline-flex;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8f5ee;
}
.segmented button {
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-weight: 800;
}
.segmented button.active { color: #15110b; background: var(--gold-soft); }
.packing-item.done { opacity: .72; }
.packing-item.done h3 { text-decoration: line-through; }
.stack-form { display: grid; gap: 12px; }
.fee-item input { max-width: 96px; text-align: right; }

.mobile-nav {
    display: none;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 30;
    grid-template-columns: repeat(5, 1fr);
    min-height: 64px;
    padding: 6px;
    border: 1px solid rgba(230,205,139,.3);
    border-radius: 10px;
    background: rgba(13,13,13,.96);
    box-shadow: 0 18px 40px rgba(0,0,0,.22);
}
.mobile-nav a {
    display: grid;
    place-items: center;
    gap: 2px;
    color: rgba(255,255,255,.72);
    font-size: .68rem;
    font-weight: 800;
}
.mobile-nav i { color: var(--gold-soft); font-size: 1.08rem; }

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 22px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(13,13,13,.96), rgba(30,23,8,.92)),
        url("../assets/brand/logo-rofs-cookies.webp") center / 720px no-repeat;
}
.login-card {
    width: min(100%, 430px);
    padding: 30px;
    border: 1px solid rgba(230,205,139,.35);
    border-radius: 8px;
    background: rgba(13,13,13,.82);
    box-shadow: 0 22px 70px rgba(0,0,0,.35);
}
.login-card img { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; margin-bottom: 18px; }
.login-card h1 { margin-bottom: 18px; font-size: 2.45rem; }
.login-card form { display: grid; gap: 12px; margin-bottom: 14px; }
.login-card small { color: rgba(255,255,255,.62); }

@media (max-width: 1100px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .app-sidebar { display: none; }
    .app-main { margin-left: 0; padding: 18px 14px 92px; }
    .topbar { align-items: flex-start; }
    .profile-pill span { display: none; }
    .hero-panel, .hero-panel.compact { grid-template-columns: 1fr; background-size: 300px; }
    .metric-grid { grid-template-columns: 1fr; }
    .panel { padding: 16px; }
    .panel-head { align-items: flex-start; flex-direction: column; }
    .mobile-nav { display: grid; }
    .catalog-toolbar { align-items: stretch; flex-direction: column; }
    .catalog-actions { align-items: stretch; flex-direction: column; }
    .search-box { min-width: 0; width: 100%; }
    .product-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .hero-panel h2 { font-size: 2.15rem; }
    .rank-item, .production-item, .packing-item, .timeline-item, .fee-item { align-items: flex-start; flex-direction: column; }
    .product-card { grid-template-columns: 86px minmax(0,1fr); }
    .product-card img { width: 86px; height: 86px; }
    .product-prices.improved { grid-template-columns: 1fr; }
    .topbar h1 { font-size: 2.05rem; }
}
