:root {
    --brand-red: #C8102E;
    --brand-red-hover: #A50D26;
    --brand-red-soft: #FFF5F6;
    --ink: #1A1A1A;
    --text-muted: #555555;
    --text-faint: #888888;
    --text-disabled: #B0B0B0;
    --surface: #FFFFFF;
    --surface-alt: #FAFAFA;
    --surface-muted: #F7F7F7;
    --divider: #F0F0F0;
    --divider-strong: #EAEAEA;
    --success: #1D9E75;
    --warning: #EF9F27;
}

[data-theme="dark"] {
    --ink: #F0F0F0;
    --text-muted: #B0B0B0;
    --text-faint: #888888;
    --text-disabled: #555555;
    --surface: #0F0F10;
    --surface-alt: #18181A;
    --surface-muted: #1F1F22;
    --divider: #2A2A2C;
    --divider-strong: #353538;
    --brand-red-soft: #2A1518;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--surface-alt);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

input, button, select, textarea {
    font-family: inherit;
}

.adm-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.adm-side {
    background: var(--surface);
    border-right: 1px solid var(--divider);
    padding: 18px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.adm-brand {
    padding: 0 18px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--divider);
    margin-bottom: 14px;
}

.brand-logo {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: var(--brand-red);
    color: #FFF;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.brand-name { font-size: 14px; font-weight: 600; }
.brand-sub { font-size: 11px; color: var(--text-faint); margin-top: 1px; }

.nav-group { padding: 6px 12px; }

.nav-label {
    font-size: 10px;
    color: var(--text-disabled);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover { background: var(--surface-alt); color: var(--ink); }

.nav-item.active {
    background: var(--brand-red-soft);
    color: var(--brand-red);
    font-weight: 500;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 3px;
    background: var(--brand-red);
    border-radius: 2px;
}

.nav-item i { font-size: 17px; width: 18px; text-align: center; }

.nav-badge {
    margin-left: auto;
    background: var(--brand-red);
    color: #FFF;
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 9px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

.adm-main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--divider);
    padding: 12px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.search { flex: 1; max-width: 380px; position: relative; }

.search input {
    width: 100%;
    height: 38px;
    padding: 0 14px 0 36px;
    border: 1px solid var(--divider-strong);
    border-radius: 10px;
    font-size: 13px;
    background: var(--surface-alt);
    color: var(--ink);
}

.search input:focus { outline: none; border-color: var(--brand-red); background: var(--surface); }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 15px; color: var(--text-faint); }

.tb-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    border: 1px solid var(--divider-strong);
    background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    color: var(--ink);
    position: relative;
    cursor: pointer;
}

.tb-icon:hover { border-color: var(--brand-red); color: var(--brand-red); }

.tb-icon .pulse {
    position: absolute; top: 8px; right: 8px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--brand-red);
    border: 1.5px solid var(--surface);
}

.tb-user {
    display: flex; align-items: center; gap: 9px;
    padding: 4px 4px 4px 4px;
    border-radius: 10px;
    border: 1px solid var(--divider-strong);
}

.tb-user-link {
    display: flex; align-items: center; gap: 9px;
    text-decoration: none;
    color: inherit;
    padding: 2px 6px 2px 2px;
    border-radius: 8px;
    transition: background 0.15s;
}
.tb-user-link:hover {
    background: var(--surface-alt);
}

.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--surface);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

.user-name { font-size: 12px; font-weight: 600; }
.user-role { font-size: 10px; color: var(--brand-red); font-weight: 600; }

.content { padding: 22px; display: flex; flex-direction: column; gap: 18px; }

.page-head {
    display: flex; align-items: center; justify-content: space-between;
}

.page-title { font-size: 22px; font-weight: 600; margin: 0; }

.crumbs { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.crumbs span { color: var(--ink); }

.range {
    display: flex; gap: 4px; padding: 4px;
    background: var(--surface);
    border: 1px solid var(--divider-strong);
    border-radius: 10px;
}

.range button,
.range a {
    font-size: 12px; padding: 6px 12px;
    border: 0;
    background: transparent;
    border-radius: 7px;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
}

.range button.on,
.range a.on { background: var(--brand-red); color: #FFF; }

.range a:hover { background: var(--surface); color: var(--text); }

/* Sidebar Royex footer */
.adm-side {
    display: flex;
    flex-direction: column;
}

.adm-side-footer {
    margin-top: auto;
    padding: 18px 16px;
    border-top: 1px solid var(--divider);
    text-align: center;
}

.adm-side-footer .royex-credit {
    font-size: 10.5px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.adm-side-footer img {
    max-width: 90px;
    height: auto;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.adm-side-footer a:hover img { opacity: 1; }

.kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.kpi {
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: 12px;
    padding: 16px;
    min-width: 0;
}

.kpi.featured {
    background: var(--ink);
    color: var(--surface);
    border-color: var(--ink);
}

.kpi.featured .kpi-label { color: var(--text-disabled); }
.kpi.featured .kpi-value { color: var(--surface); }

/* In dark mode --ink is light and --surface is dark, which makes the
   featured KPI flip to a stark white card. Override with the brand red
   so the highlight reads as an accent against the dark page. */
[data-theme="dark"] .kpi.featured {
    background: var(--brand-red);
    color: #FFFFFF;
    border-color: var(--brand-red);
}
[data-theme="dark"] .kpi.featured .kpi-label,
[data-theme="dark"] .kpi.featured .kpi-value { color: #FFFFFF; }
[data-theme="dark"] .kpi.featured .kpi-icon { background: rgba(255,255,255,0.18); color: #FFFFFF; }
[data-theme="dark"] .kpi.featured .delta-up { background: rgba(255,255,255,0.18); color: #FFFFFF; }

.kpi-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi-label { font-size: 12px; color: var(--text-faint); }

.kpi-icon {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: var(--brand-red-soft);
    color: var(--brand-red);
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
}

.kpi.featured .kpi-icon { background: var(--brand-red); color: #FFF; }

.kpi-value { font-size: 22px; font-weight: 600; line-height: 1.2; }

.kpi-delta {
    font-size: 11px; margin-top: 8px;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px;
    border-radius: 7px;
    font-weight: 600;
}

.delta-up { background: var(--brand-red-soft); color: var(--brand-red); }
.delta-down { background: var(--surface-muted); color: var(--text-muted); }
.kpi.featured .delta-up { background: rgba(200,16,46,0.25); color: #FFF; }

.row-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.card {
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: 12px;
    padding: 18px;
    min-width: 0;
}

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: 14px; font-weight: 600; margin: 0; }
.card-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.card-link { font-size: 11px; color: var(--brand-red); cursor: pointer; font-weight: 600; }

.legend { display: flex; gap: 12px; font-size: 11px; }
.legend-item { display: flex; align-items: center; gap: 5px; color: var(--text-muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }

.pay-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 0;
    border-bottom: 1px solid var(--divider);
    font-size: 12px;
}
.pay-row:last-child { border-bottom: 0; }

.pay-name { display: flex; align-items: center; gap: 8px; min-width: 80px; }
.pay-dot { width: 8px; height: 8px; border-radius: 2px; }
.pay-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-muted); margin: 0 12px; overflow: hidden; }
.pay-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.pay-val { min-width: 40px; text-align: right; font-weight: 600; }

.tbl {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
}

.tbl th {
    text-align: left;
    font-weight: 600;
    color: var(--text-faint);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 6px;
    border-bottom: 1px solid var(--divider);
}

.tbl td {
    padding: 11px 6px;
    border-bottom: 1px solid var(--divider);
}

.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--surface-alt); }

.pill { display: inline-block; padding: 3px 9px; border-radius: 11px; font-size: 11px; font-weight: 600; }
.pill-paid { background: var(--brand-red-soft); color: var(--brand-red); }
.pill-pending { background: var(--surface-muted); color: var(--text-muted); }
.pill-shipped { background: var(--ink); color: var(--surface); }
.pill-delivered { background: var(--surface); color: var(--brand-red); border: 1px solid var(--brand-red); }
.pill-cancel { background: var(--surface-alt); color: var(--text-faint); border: 1px solid var(--divider-strong); }

.zone-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.zone-row:last-child { margin-bottom: 0; }
.zone-name { font-size: 12px; width: 100px; flex-shrink: 0; font-weight: 600; }
.zone-bar { flex: 1; height: 24px; background: var(--surface-muted); border-radius: 7px; overflow: hidden; }
.zone-fill {
    height: 100%; border-radius: 7px;
    display: flex; align-items: center;
    padding: 0 9px;
    font-size: 11px; font-weight: 600; color: #FFF;
    transition: width 0.6s ease;
}

.alert-row {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 10px 0;
    border-bottom: 1px solid var(--divider);
    font-size: 12px;
}
.alert-row:last-child { border-bottom: 0; }

.alert-icon {
    width: 32px; height: 32px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.al-red { background: var(--brand-red-soft); color: var(--brand-red); }
.al-dark { background: var(--ink); color: var(--surface); }
.al-light { background: var(--surface-muted); color: var(--ink); }

.alert-title { font-size: 12px; font-weight: 600; }
.alert-meta { font-size: 11px; color: var(--text-faint); margin-top: 3px; }

.product-row {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 0;
    border-bottom: 1px solid var(--divider);
    font-size: 12px;
}
.product-row:last-child { border-bottom: 0; }

.product-thumb {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--surface-alt);
    border: 1px solid var(--divider);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.product-info { flex: 1; min-width: 0; }
.product-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-cat { font-size: 10px; color: var(--text-faint); margin-top: 2px; }
.product-sales { color: var(--brand-red); font-weight: 600; font-size: 12px; }
.product-units { font-size: 10px; color: var(--text-faint); margin-top: 2px; text-align: right; }

.btn-primary {
    background: var(--brand-red);
    color: #FFF;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: var(--brand-red-hover); }

.btn-outline {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--divider-strong);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

/* Login page */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-alt);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: 16px;
    padding: 36px 32px;
}

.login-brand {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 28px;
}

.login-brand .brand-logo { width: 44px; height: 44px; font-size: 16px; }

.login-title { font-size: 22px; font-weight: 600; margin: 0 0 6px; }
.login-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 26px; }

.field-group { margin-bottom: 16px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; display: block; }

.field-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--divider-strong);
    border-radius: 10px;
    font-size: 14px;
    background: var(--surface);
    color: var(--ink);
}

.field-input:focus { outline: none; border-color: var(--brand-red); }

.alert-error {
    background: var(--brand-red-soft);
    color: var(--brand-red);
    border: 1px solid var(--brand-red);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 16px;
}

.demo-hint {
    margin-top: 20px;
    padding: 12px 14px;
    background: var(--surface-alt);
    border-radius: 8px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

.demo-hint strong { color: var(--ink); }

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-faint);
    font-size: 13px;
}

/* Pagination */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-top: 1px solid var(--divider);
    flex-wrap: wrap;
    gap: 12px;
}

.pager-info {
    font-size: 12px;
    color: var(--text-muted);
}

.pager-info strong { color: var(--ink); font-weight: 600; }
.pager-sep { color: var(--text-disabled); margin: 0 8px; }

.pager-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pager-size {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.pager-size select {
    padding: 5px 10px;
    border: 1px solid var(--divider-strong);
    border-radius: 7px;
    font-size: 12px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
}

.pg-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--divider-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.pg-btn:hover:not(.disabled):not(.current) {
    border-color: var(--brand-red);
    color: var(--brand-red);
}

.pg-btn.current {
    background: var(--brand-red);
    border-color: var(--brand-red);
    color: #FFF;
    cursor: default;
}

.pg-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

.pg-btn i { font-size: 14px; }

.pg-ellipsis {
    padding: 0 4px;
    color: var(--text-faint);
    font-size: 12px;
}

/* Coming-soon module placeholder */
.coming-soon {
    padding: 60px 20px;
    text-align: center;
}

.coming-soon-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: var(--brand-red-soft);
    color: var(--brand-red);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
}

.coming-soon h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--ink);
}

.coming-soon p {
    color: var(--text-muted);
    font-size: 13px;
    max-width: 420px;
    margin: 0 auto 20px;
    line-height: 1.6;
}

.tag-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.tag-pill {
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--surface-alt);
    border: 1px solid var(--divider);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

/* 404 page */
.error-shell {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.error-card {
    text-align: center;
    max-width: 460px;
}

.error-code {
    font-size: 96px;
    font-weight: 800;
    color: var(--brand-red);
    line-height: 1;
    margin-bottom: 8px;
}

.error-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 8px;
}

.error-text {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 1100px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .row-2, .row-3 { grid-template-columns: 1fr; }
    .adm-shell { grid-template-columns: 64px 1fr; }
    .adm-side .nav-item span, .nav-label, .brand-name, .brand-sub { display: none; }
    .nav-item { justify-content: center; }
}

/* ========================================================
   ADDITIONS — Tree views, forms, image gallery, alerts
   ======================================================== */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #E6F8F0; color: #147748; border: 1px solid #B6E5CB; }
.alert-danger  { background: #FCEBED; color: #9B1B25; border: 1px solid #F2BCC1; }
[data-theme="dark"] .alert-success { background: #14352B; color: #5BC59C; border-color: #1F4E3D; }
[data-theme="dark"] .alert-danger  { background: #3D1A1F; color: #FF8B95; border-color: #5A2228; }

/* Card head */
.card-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--divider);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head small { color: var(--text-faint); font-size: 12px; }
.card-body { padding: 20px; }

/* Form layout */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
    align-items: start;
}
@media (max-width: 1024px) {
    .form-grid-2 { grid-template-columns: 1fr; }
}
.form-grid-2 > div { display: flex; flex-direction: column; gap: 16px; }

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--divider-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    transition: border-color 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px var(--brand-red-soft);
}
textarea.form-control { resize: vertical; min-height: 70px; font-family: inherit; }
.mb-3 { margin-bottom: 16px; }

.form-checks { display: flex; flex-direction: column; gap: 10px; }
.check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--ink);
}
.check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand-red); cursor: pointer; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 0;
}
.text-danger { color: #C8102E; }
.text-warning { color: #B07300; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-right { text-align: right; }
.small { font-size: 12px; }

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--brand-red);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-primary:hover { background: var(--brand-red-hover); color: #fff; }
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--divider-strong);
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 13.5px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.btn-ghost:hover { background: var(--surface-muted); }
.btn-ghost-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.btn-ghost-sm:hover { background: var(--surface-muted); color: var(--ink); }
.btn-ghost-sm.danger:hover { background: var(--brand-red-soft); color: var(--brand-red); }

/* Tree (Categories / Brands) */
.tree-toolbar {
    padding: 12px 20px;
    border-bottom: 1px solid var(--divider);
    background: var(--surface-muted);
    border-radius: 8px 8px 0 0;
}
.cat-tree {
    padding: 8px;
}
.tree-node { padding-bottom: 2px; }
.tree-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.15s;
}
.tree-row:hover { background: var(--surface-muted); }
.caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    cursor: pointer;
    transition: transform 0.15s;
    color: var(--text-faint);
    flex-shrink: 0;
}
.caret.no-kids { cursor: default; }
.caret.rotated { transform: rotate(90deg); }
.tree-icon { color: var(--brand-red); font-size: 18px; }
.tree-icon-img { width: 24px; height: 24px; border-radius: 4px; object-fit: cover; }
.tree-name { font-weight: 500; flex-shrink: 0; }
.tree-slug { font-family: ui-monospace, monospace; color: var(--text-faint); font-size: 12px; }
.tree-order { color: var(--text-faint); font-size: 11.5px; margin-left: auto; padding-right: 12px; }
.tree-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}
.tree-row:hover .tree-actions { opacity: 1; }

/* Pills */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}
.pill-paid { background: #DEF5E8; color: #147748; }
.pill-cancel { background: #ECECED; color: #595959; }
.pill-warn { background: #FFF1D9; color: #8C5A0F; }
.pill-info { background: #DDEFFF; color: #1B5C9C; }
.pill-danger { background: #FCDFE2; color: #9B1B25; }
[data-theme="dark"] .pill-paid { background: #143E2C; color: #5BC59C; }
[data-theme="dark"] .pill-cancel { background: #2A2A2C; color: #B0B0B0; }
[data-theme="dark"] .pill-warn { background: #3F2C0E; color: #FFD08A; }
[data-theme="dark"] .pill-info { background: #112F4D; color: #80B6F4; }
[data-theme="dark"] .pill-danger { background: #3F1A1F; color: #FF8B95; }

/* Image gallery */
.thumb-preview { display: inline-block; margin-bottom: 8px; }
.thumb-preview img { width: 80px; height: 80px; border-radius: 6px; object-fit: cover; border: 1px solid var(--divider); }
.thumb-sm {
    width: 36px; height: 36px; border-radius: 5px; object-fit: cover;
    border: 1px solid var(--divider); display: inline-block;
}
.thumb-sm.placeholder {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-muted); color: var(--text-disabled);
}
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.image-item {
    position: relative;
    border: 1px solid var(--divider);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-alt);
}
.image-item.primary { border-color: var(--brand-red); border-width: 2px; }
.image-item img { width: 100%; height: 120px; object-fit: cover; display: block; }
.image-item .badge-primary {
    position: absolute; top: 6px; left: 6px;
    background: var(--brand-red); color: #fff;
    padding: 2px 6px; border-radius: 4px;
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.image-item .image-actions {
    position: absolute; bottom: 6px; right: 6px;
    display: flex; gap: 2px;
    background: rgba(255,255,255,0.95);
    border-radius: 5px;
    padding: 2px;
}
[data-theme="dark"] .image-item .image-actions { background: rgba(20,20,22,0.95); }

/* Page head spacing */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 16px;
}
.page-title { font-size: 22px; font-weight: 600; margin: 0 0 4px; color: var(--ink); }
.crumbs { font-size: 12.5px; color: var(--text-faint); display: flex; align-items: center; gap: 6px; }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--brand-red); }

/* Filter row */
.filter-row {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--divider);
    flex-wrap: wrap;
    align-items: center;
}

/* Tabs (multilingual) */
.nav-tabs {
    display: flex;
    border-bottom: 1px solid var(--divider);
    margin: 0;
    padding: 0;
    list-style: none;
    gap: 2px;
}
.nav-tabs .nav-link {
    background: transparent;
    border: none;
    padding: 10px 16px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px 6px 0 0;
}
.nav-tabs .nav-link:hover { background: var(--surface-muted); }
.nav-tabs .nav-link.active {
    color: var(--brand-red);
    border-bottom-color: var(--brand-red);
    background: var(--surface);
    font-weight: 600;
}
.nav-tabs .lang-code {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    background: var(--surface-muted);
    padding: 1px 5px;
    border-radius: 3px;
}
.nav-tabs .lang-name { font-size: 12.5px; }
.nav-tabs .badge { font-size: 9px; padding: 1px 4px; border-radius: 3px; background: var(--text-disabled); color: #fff; }
.tab-pane { display: none; }
.tab-pane.active.show { display: block; }

/* Strikethrough for sale prices */
.strike { text-decoration: line-through; color: var(--text-faint); font-size: 12.5px; margin-right: 4px; }

/* Empty state polish */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

/* DateTime input theme */
input[type="datetime-local"], input[type="date"], input[type="time"] {
    color-scheme: light;
}
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"] { color-scheme: dark; }
