:root {
    --green: #0f8a6a;
    --green-dark: #09634f;
    --blue: #58b9d6;
    --orange: #f68b22;
    --ink: #172033;
    --muted: #667085;
    --line: #e5eaf0;
    --paper: #ffffff;
    --soft: #f5f8fb;
    --shadow: 0 14px 36px rgba(21, 43, 65, .10);
    --shadow-pop: 0 18px 44px rgba(15, 138, 106, .16);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(246,139,34,.16), transparent 28rem),
        radial-gradient(circle at top right, rgba(88,185,214,.18), transparent 26rem),
        linear-gradient(180deg, #fffdf8 0%, #f4fbff 48%, #f7fff9 100%);
}
.app-body {
    background:
        radial-gradient(circle at 12% 8%, rgba(246,139,34,.14), transparent 25rem),
        radial-gradient(circle at 88% 12%, rgba(88,185,214,.18), transparent 28rem),
        linear-gradient(180deg, #f8fcff 0%, #f5fff9 100%);
}
.public-body {
    display: flex;
    flex-direction: column;
}
.public-body > main { flex: 1 0 auto; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font: inherit; }

.public-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}
.nav-inner, .market-section, .footer-inner {
    width: min(1120px, calc(100% - 24px));
    margin: 0 auto;
}
.nav-inner {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
}
.brand-public, .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: var(--green-dark);
}
.brand-public span, .brand span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--green), var(--blue));
    overflow: hidden;
    flex: 0 0 auto;
}
.brand-public img, .brand img { width: 100%; height: 100%; object-fit: cover; }
.nav-links { display: none; align-items: center; gap: 24px; font-weight: 700; font-size: 14px; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 9px 15px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--green), #13aa83);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(15,138,106,.18);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 14px 28px rgba(15,138,106,.22); }
.btn-outline { color: var(--green-dark); background: #fff; border: 1px solid rgba(15,138,106,.35); }
.btn-outline:hover { color: #fff; }
.btn-orange { background: linear-gradient(135deg, var(--orange), #ffb13b); }
.btn-sm { min-height: 32px; padding: 7px 10px; font-size: 13px; }
.btn-danger { background: #dc2626; }
.hero {
    width: min(1120px, calc(100% - 24px));
    margin: 16px auto 22px;
    min-height: 420px;
    border-radius: 12px;
    padding: 32px 18px;
    color: #0d2b3f;
    text-align: left;
    background:
        linear-gradient(90deg, rgba(255,255,255,.98) 0%, rgba(255,255,255,.9) 46%, rgba(255,255,255,.28) 100%),
        url('../img/hero-marketplace.webp') center/cover;
    box-shadow: var(--shadow-pop);
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.hero::after {
    content: "";
    position: absolute;
    right: -50px;
    bottom: -44px;
    width: 210px;
    height: 210px;
    border-radius: 50%;
    background: rgba(246,139,34,.18);
}
.hero h1 { max-width: 650px; margin: 0 0 14px; font-size: clamp(31px, 10vw, 58px); line-height: 1.02; letter-spacing: 0; }
.hero p { max-width: 600px; margin: 0 0 24px; color: #3b5568; font-weight: 700; }
.searchbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 700px;
    margin: 0;
    padding: 8px;
    border-radius: 10px;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(15,138,106,.14);
    box-shadow: 0 12px 26px rgba(23,32,51,.10);
}
.searchbar input { flex: 1; border: 0; padding: 0 10px; outline: none; color: var(--ink); }
.searchbar select { border: 0; min-height: 42px; color: var(--ink); outline: none; background: #fff; }
.section-title { display: flex; align-items: end; justify-content: space-between; margin: 28px 0 14px; }
.section-title h2 { margin: 0; font-size: 26px; }
.grid { display: grid; gap: 18px; }
.grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.category-card, .item-card, .business-card, .panel, .auth-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.category-card {
    padding: 18px;
    text-align: left;
    font-weight: 900;
    min-height: 112px;
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #ffffff, #f2fffb);
    transition: transform .18s ease, box-shadow .18s ease;
}
.category-card:nth-child(2n) { background: linear-gradient(135deg, #ffffff, #fff7ec); }
.category-card:nth-child(3n) { background: linear-gradient(135deg, #ffffff, #eef9ff); }
.category-card:hover, .item-card:hover, .business-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.category-card i { font-size: 30px; color: var(--green); display: block; margin-bottom: 12px; }
.category-card i { margin-bottom: 0; }
.card-image { height: 190px; object-fit: cover; width: 100%; border-radius: 8px 8px 0 0; background: #dbe4ec; }
.card-body { padding: 14px; }
.tag { color: var(--orange); font-size: 11px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.price { font-size: 18px; color: var(--green-dark); font-weight: 900; margin: 10px 0; }
.muted { color: var(--muted); }
.meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.public-footer {
    margin-top: auto;
    background: linear-gradient(135deg, #0d5f52, #102235);
    color: #e8f7f4;
    padding: 24px 0;
    flex-shrink: 0;
}

.shell { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 14px 12px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.96), rgba(245,255,251,.94)),
        radial-gradient(circle at top left, rgba(246,139,34,.18), transparent 16rem);
    border-right: 1px solid rgba(15, 138, 106, .12);
    box-shadow: 18px 0 44px rgba(16, 34, 53, .06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar .brand {
    margin-bottom: 12px;
    padding: 9px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 28px rgba(15, 138, 106, .10);
}
.sidebar .brand span { width: 34px; height: 34px; border-radius: 10px; }
.sidebar .brand strong { font-size: 14px; line-height: 1.15; }
.sidebar nav {
    display: grid;
    gap: 5px;
    padding: 8px 0;
    overflow-y: auto;
    min-height: 0;
    flex: 1 1 auto;
}
.sidebar nav a, .logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 9px;
    color: #334155;
    font-weight: 700;
    border: 1px solid transparent;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}
.sidebar nav a i, .logout i {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #eef8f5;
    color: var(--green-dark);
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: linear-gradient(135deg, #ffffff, #ecfff9);
    color: var(--green-dark);
    border-color: rgba(15, 138, 106, .16);
    box-shadow: 0 12px 26px rgba(15,138,106,.12);
    transform: translateX(2px);
}
.sidebar nav a.active i {
    background: linear-gradient(135deg, var(--green), var(--blue));
    color: #fff;
}
.logout {
    position: sticky;
    bottom: 0;
    flex: 0 0 auto;
    margin-top: 10px;
    color: #dc2626;
    background: #fff6f5;
    box-shadow: 0 -10px 24px rgba(255,255,255,.80);
}
.logout:hover { background: #fee4e2; color: #b42318; }
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 9;
    min-height: 72px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: rgba(255,255,255,.82);
    border-bottom: 1px solid rgba(15, 138, 106, .10);
    backdrop-filter: blur(10px);
}
.topbar h1 { margin: 1px 0 0; font-size: 20px; }
.topbar-subtitle { margin: 4px 0 0; color: var(--muted); font-weight: 700; font-size: 12px; }
.eyebrow { margin: 0; color: var(--green); font-size: 10px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--green-dark);
    background: #ecfff9;
    border: 1px solid rgba(15, 138, 106, .18);
    font-weight: 900;
}
.topbar-user {
    min-width: 150px;
    text-align: right;
    font-weight: 800;
    padding: 8px 10px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(16, 34, 53, .08);
}
.topbar-user small { display: block; color: var(--muted); font-weight: 700; }
.content { padding: 16px 20px; flex: 1 0 auto; }
.admin-hero {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 18px;
    align-items: stretch;
    margin-bottom: 14px;
    padding: 18px;
    border-radius: 12px;
    color: #102235;
    background:
        linear-gradient(105deg, rgba(255,255,255,.98), rgba(255,255,255,.75)),
        url('../img/marketplace-mix.webp') right center/cover;
    border: 1px solid rgba(15,138,106,.13);
    box-shadow: var(--shadow-pop);
    overflow: hidden;
}
.admin-hero h2 {
    max-width: 760px;
    margin: 5px 0 8px;
    font-size: clamp(22px, 3vw, 32px);
    line-height: 1.08;
    letter-spacing: 0;
}
.admin-hero p { max-width: 680px; margin: 0; color: #40566a; font-weight: 700; }
.admin-hero-score {
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(246,139,34,.24);
    box-shadow: 0 16px 34px rgba(246,139,34,.12);
}
.admin-hero-score span { color: var(--orange); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.admin-hero-score strong { font-size: 24px; color: var(--green-dark); }
.admin-hero-score small { color: var(--muted); font-weight: 700; line-height: 1.45; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi {
    position: relative;
    min-height: 104px;
    padding: 12px;
    border-left: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff, #f2fffb);
}
.kpi::after {
    content: "";
    position: absolute;
    width: 92px;
    height: 92px;
    right: -26px;
    bottom: -28px;
    border-radius: 50%;
    background: rgba(15, 138, 106, .10);
}
.kpi-2 { background: linear-gradient(135deg, #ffffff, #eff9ff); }
.kpi-3 { background: linear-gradient(135deg, #ffffff, #fff7eb); }
.kpi-4 { background: linear-gradient(135deg, #ffffff, #fff2f7); }
.kpi-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--green), var(--blue));
    margin-bottom: 8px;
    box-shadow: 0 12px 24px rgba(15,138,106,.18);
}
.kpi-2 .kpi-icon { background: linear-gradient(135deg, #2888d8, #58b9d6); }
.kpi-3 .kpi-icon { background: linear-gradient(135deg, #f68b22, #ffc247); }
.kpi-4 .kpi-icon { background: linear-gradient(135deg, #e84c88, #f68b22); }
.kpi span { color: var(--muted); font-weight: 800; }
.kpi strong { display: block; font-size: clamp(20px, 2.4vw, 26px); margin-top: 5px; position: relative; z-index: 1; }
.insight-grid, .chart-grid {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}
.insight-grid { grid-template-columns: repeat(3, 1fr); }
.chart-grid { grid-template-columns: repeat(4, 1fr); }
.insight-card {
    margin-bottom: 0;
    display: grid;
    gap: 7px;
    background: linear-gradient(135deg, #ffffff, #f6fffd);
}
.insight-card span { color: var(--orange); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.insight-card strong { display: block; margin-top: 3px; font-size: 18px; color: var(--green-dark); }
.insight-card p { margin: 0; color: var(--muted); font-weight: 700; line-height: 1.35; }
.chart-card { margin-bottom: 0; }
.chart-card canvas { width: 100%; display: block; }
.settings-summary {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 14px;
    align-items: center;
}
.settings-logo {
    width: 86px;
    height: 86px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 16px 34px rgba(15,138,106,.16);
    background: #eef8f5;
}
.settings-logo img { width: 100%; height: 100%; object-fit: cover; }
.settings-summary h2 { margin: 3px 0 5px; font-size: 22px; }
.settings-summary p { margin: 0; color: var(--muted); font-weight: 700; }
.summary-lines { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.summary-lines span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #f2fffb;
    color: #31505f;
    font-weight: 800;
    font-size: 12px;
}
.panel {
    padding: 14px;
    margin-bottom: 12px;
    background: rgba(255,255,255,.93);
    border-color: rgba(15, 138, 106, .10);
    box-shadow: 0 18px 42px rgba(16, 34, 53, .08);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-note { color: var(--muted); font-weight: 800; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.field label { display: block; margin-bottom: 5px; color: #344054; font-weight: 900; font-size: 12px; }
.field input, .field select, .field textarea, .search-input {
    width: 100%;
    min-height: 34px;
    border: 1px solid #d9e5ea;
    border-radius: 8px;
    padding: 7px 10px;
    background: linear-gradient(180deg, #ffffff, #fbfeff);
    outline-color: rgba(15,138,106,.35);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.field input:focus, .field select:focus, .field textarea:focus, .search-input:focus {
    border-color: rgba(15,138,106,.55);
    box-shadow: 0 0 0 4px rgba(15,138,106,.10);
    background: #fff;
}
.field textarea { min-height: 74px; resize: vertical; }
.full { grid-column: 1 / -1; }
.table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(15,138,106,.10);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 9px 10px; border-bottom: 1px solid #eef3f6; text-align: left; vertical-align: top; }
th {
    color: #406070;
    font-size: 11px;
    letter-spacing: .05em;
    text-transform: uppercase;
    background: linear-gradient(180deg, #f7fcfb, #f1f8fb);
}
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: #fbfffd; }
.actions { display: flex; gap: 7px; flex-wrap: wrap; }
.status { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 900; }
.status-success { color: #067647; background: #dcfae6; }
.status-warning { color: #b54708; background: #fef0c7; }
.status-danger { color: #b42318; background: #fee4e2; }
.status-secondary { color: #475467; background: #eef2f6; }
.status-primary { color: #175cd3; background: #dbeafe; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(430px, 100%); padding: 28px; }
.auth-card h1 { margin-top: 0; }
.invoice-head { display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 16px; }
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 16px;
    background: rgba(15, 31, 50, .42);
    backdrop-filter: blur(8px);
    overflow-y: auto;
}
.modal-backdrop.is-open { display: flex; }
.modal-backdrop:target { display: flex; }
.modal-card {
    width: min(900px, 100%);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 26px 80px rgba(15, 31, 50, .28);
    border: 1px solid rgba(15,138,106,.12);
    animation: modalIn .18s ease-out;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #edf3f6;
    background: linear-gradient(135deg, #f8fffd, #fff8ef);
    border-radius: 12px 12px 0 0;
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 14px; }
.icon-btn {
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: #eef8f5;
    color: var(--green-dark);
    cursor: pointer;
}
.admin-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px 16px;
    color: #5b7081;
    font-size: 12px;
    margin-top: auto;
    border-top: 1px solid rgba(15,138,106,.10);
    background: rgba(255,255,255,.72);
}
.admin-footer div { display: flex; gap: 10px; flex-wrap: wrap; }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media print {
    .sidebar, .topbar, .no-print, .public-nav, .public-footer { display: none !important; }
    .shell { display: block; }
    .content { padding: 0; }
    .panel { box-shadow: none; border: 0; }
}

@media (min-width: 640px) {
    .nav-inner, .market-section, .footer-inner, .hero { width: min(1120px, calc(100% - 32px)); }
    .searchbar { flex-direction: row; }
    .grid-5 { grid-template-columns: repeat(2, 1fr); }
    .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 901px) {
    .nav-links { display: flex; }
    .hero { margin-top: 24px; padding: 60px 42px; text-align: left; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
    .grid-5 { grid-template-columns: repeat(5, 1fr); }
    .detail-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        padding: 14px 12px;
        border-right: 0;
        border-bottom: 1px solid rgba(15,138,106,.12);
    }
    .sidebar .brand { margin-bottom: 10px; }
    .sidebar nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-bottom: 10px;
    }
    .sidebar nav a {
        min-height: 54px;
        padding: 10px;
        font-size: 13px;
    }
    .sidebar nav a i, .logout i { width: 30px; height: 30px; }
    .logout { position: static; margin-top: 12px; box-shadow: none; }
    .kpi-grid, .form-grid, .insight-grid, .chart-grid { grid-template-columns: 1fr; }
    .topbar {
        position: static;
        min-height: auto;
        padding: 18px 16px;
        align-items: flex-start;
        flex-direction: column;
    }
    .topbar-actions {
        width: 100%;
        justify-content: space-between;
        align-items: stretch;
    }
    .topbar-user {
        min-width: 0;
        flex: 1;
    }
    .topbar-chip { white-space: nowrap; }
    .content { padding: 16px 12px 22px; }
    .admin-hero {
        grid-template-columns: 1fr;
        padding: 18px;
        background:
            linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.86)),
            url('../img/marketplace-mix.webp') center/cover;
    }
    .admin-hero-score { padding: 14px; }
    .panel { padding: 16px; }
    .panel-head { align-items: flex-start; flex-direction: column; }
    .table-wrap { border-radius: 8px; }
    th, td { padding: 11px 10px; }
    .hero { background-position: 62% center; }
    .nav-actions .btn { padding-left: 10px; padding-right: 10px; }
    .brand-public strong { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 520px) {
    .sidebar nav { grid-template-columns: 1fr; }
    .topbar-actions { flex-direction: column; }
    .topbar-user { text-align: left; }
    .admin-hero h2 { font-size: 25px; }
    .actions .btn, .actions button.btn { width: 100%; }
}
