:root {
    --navy: #0b1f4a;
    --navy-deep: #071533;
    --navy-soft: #142a5c;
    --orange: #e85d04;
    --orange-bright: #f48c06;
    --cream: #f7f2ea;
    --line: #e6e0d6;
    --muted: #5c6478;
    --font: "Outfit", system-ui, sans-serif;
    --display: "Cormorant Garamond", Georgia, serif;
    --sidebar: 260px;
    --glow: 0 20px 50px rgba(232, 93, 4, 0.22);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body, .admin-body {
    font-family: var(--font);
    background: linear-gradient(135deg, #f3ece2 0%, #ebe4d9 40%, #f7f2ea 100%);
    color: #141414;
    min-height: 100vh;
}
a { color: var(--navy); text-decoration: none; }
img { max-width: 100%; display: block; }

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    background: linear-gradient(180deg, var(--navy-deep) 0%, var(--navy) 55%, #0d2858 100%);
    color: #fff;
    padding: 1.35rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 8px 0 40px rgba(7, 21, 51, 0.18);
    z-index: 100;
}
.admin-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: #fff;
    font-family: var(--display);
    font-size: 1.3rem;
}
.admin-brand img {
    height: 42px;
    background: transparent;
}
.login-logo {
    background: transparent;
}
.admin-sidebar nav { display: grid; gap: .25rem; flex: 1; }
.admin-sidebar nav a {
    color: rgba(255,255,255,.82);
    padding: .68rem .8rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: .88rem;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}
.nav-icon {
    opacity: .7;
    font-size: .85rem;
    width: 1.1rem;
    text-align: center;
}
.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
    background: rgba(255,255,255,.12);
    color: #fff;
    transform: translateX(3px);
}
.admin-sidebar nav a.active {
    background: linear-gradient(90deg, rgba(232,93,4,.35), rgba(255,255,255,.08));
    border: 1px solid rgba(232,93,4,.25);
}
.nav-external { opacity: .75; margin-top: .5rem; }
.admin-main { padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 3rem; }
.admin-main.with-sidebar { margin-left: var(--sidebar); }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-head h1 {
    font-family: var(--display);
    font-size: 2.4rem;
    color: var(--navy);
}
.eyebrow {
    color: var(--orange);
    letter-spacing: .18em;
    text-transform: uppercase;
    font-size: .75rem;
    margin-bottom: .35rem;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--orange);
    color: #fff;
    border: 0;
    padding: .75rem 1.15rem;
    cursor: pointer;
    font: inherit;
    border-radius: 10px;
    font-weight: 600;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-glow {
    background: linear-gradient(135deg, var(--orange), var(--orange-bright));
    box-shadow: var(--glow);
}
.btn-glow:hover { box-shadow: 0 16px 36px rgba(232, 93, 4, 0.32); }
.btn-ghost-light {
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.28);
    color: #fff;
}
.btn-block { width: 100%; }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.logout-form { margin-top: auto; }
.logout-form button {
    width: 100%;
    border: 1px solid rgba(255,255,255,.25);
    background: rgba(255,255,255,.06);
    color: #fff;
    padding: .68rem;
    cursor: pointer;
    border-radius: 10px;
    font: inherit;
    transition: background .2s ease;
}
.logout-form button:hover { background: rgba(255,255,255,.14); }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat, .panel {
    background: #fff;
    border-top: 3px solid var(--orange);
    padding: 1.25rem;
    box-shadow: 0 10px 30px rgba(11,31,74,.06);
}
.stat strong {
    display: block;
    font-family: var(--display);
    font-size: 2rem;
    color: var(--navy);
}
.stat span { color: var(--muted); font-size: .85rem; }
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.panel h2 {
    font-family: var(--display);
    color: var(--navy);
    margin-bottom: 1rem;
}
table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: .75rem .4rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    font-size: .92rem;
}
.thumb { width: 48px; height: 60px; object-fit: cover; }
.actions { display: flex; gap: .75rem; align-items: center; }
.actions form { display: inline; }
.actions button {
    border: 0;
    background: transparent;
    color: #b42318;
    cursor: pointer;
    font: inherit;
}
.badge {
    display: inline-block;
    padding: .2rem .5rem;
    border-radius: 999px;
    font-size: .75rem;
    text-transform: uppercase;
    background: #eee;
}
.badge.paid { background: #dcfce7; color: #166534; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.failed { background: #fee2e2; color: #991b1b; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.form-grid label, .login-card label, .checkout-form label {
    display: grid;
    gap: .35rem;
    font-size: .88rem;
    color: var(--navy);
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea,
.login-card input, .checkout-form input, .checkout-form textarea {
    border: 1px solid var(--line);
    padding: .7rem .8rem;
    font: inherit;
    background: #fff;
}
.check {
    display: flex !important;
    align-items: center;
    gap: .5rem;
    margin-top: 1.4rem;
}
.flash {
    padding: .85rem 1rem;
    margin-bottom: 1rem;
}
.flash.success { background: #dcfce7; color: #166534; }
.flash.error { background: #fee2e2; color: #991b1b; }
.field-error { display: block; color: #b91c1c; font-size: .82rem; margin-top: .35rem; }
.input-error { border-color: #dc2626 !important; box-shadow: 0 0 0 2px rgba(220,38,38,.12); }
.muted { color: var(--muted); margin-bottom: 1rem; }
.order-meta { display: grid; gap: .4rem; margin-bottom: 1.25rem; }

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
}
.login-card {
    width: min(420px, 100%);
    background: #fff;
    padding: 2rem;
    border-top: 3px solid var(--orange);
    box-shadow: 0 18px 50px rgba(11,31,74,.1);
}
.login-logo { height: 64px; width: auto; max-width: 220px; object-fit: contain; margin-bottom: 1rem; display: block; }
.login-card h1 {
    font-family: var(--display);
    color: var(--navy);
    margin-bottom: .35rem;
}
.login-card p { color: var(--muted); margin-bottom: 1.25rem; }
.login-card form { display: grid; gap: .9rem; }

@media (max-width: 900px) {
    .admin-sidebar { position: static; width: 100%; }
    .admin-main.with-sidebar { margin-left: 0; }
    .stat-grid, .two-col, .form-grid { grid-template-columns: 1fr; }
}

.admin-user-chip {
    font-size: .75rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.65);
    padding: 0 .75rem;
}
.stat-accent { border-top-color: var(--navy); }
.animate-rise { animation: adminRise .6s ease both; }
@keyframes adminRise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}
.role-badge {
    display: inline-block;
    padding: .25rem .55rem;
    border-radius: 999px;
    background: rgba(11,31,74,.08);
    font-size: .75rem;
}
.chart-row {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: .75rem;
    align-items: center;
    margin-bottom: .65rem;
}
.chart-bar-wrap {
    height: 10px;
    background: #eee;
    border-radius: 999px;
    overflow: hidden;
}
.chart-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--orange), #ffb347);
    border-radius: 999px;
}
.stock-inline-form {
    display: flex;
    gap: .5rem;
    align-items: center;
}
.stock-inline-form input {
    width: 80px;
    border: 1px solid var(--line);
    padding: .4rem .5rem;
}
.btn-sm { padding: .45rem .75rem; font-size: .85rem; }
.row-warn { background: #fff7ed; }
.account-list-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem 0;
    border-bottom: 1px solid var(--line);
}

.variant-editor { margin-top: 1.5rem; }
.variant-row {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .75rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
}
.section-head-inline h2 { font-family: var(--display); color: var(--navy); }
.section-head-inline .muted { margin-top: .35rem; }

@media (max-width: 900px) {
    .variant-row { grid-template-columns: 1fr 1fr; }
}

/* ── Dashboard hero & stats ── */
.dash-hero {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1.5rem;
    padding: clamp(1.5rem, 4vw, 2.25rem);
    margin-bottom: 1.5rem;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 45%, #12306a 100%);
    color: #fff;
    box-shadow: 0 24px 60px rgba(7, 21, 51, 0.28);
    position: relative;
    overflow: hidden;
}
.dash-hero::before {
    content: "";
    position: absolute;
    top: -40%;
    right: -10%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(232,93,4,.35) 0%, transparent 70%);
    pointer-events: none;
}
.dash-hero-copy { position: relative; z-index: 1; }
.dash-hero .eyebrow { color: var(--orange-bright); }
.dash-hero h1 {
    font-family: var(--display);
    font-size: clamp(1.85rem, 4vw, 2.75rem);
    line-height: 1.1;
    margin-bottom: .35rem;
}
.dash-sub { opacity: .78; font-size: .95rem; }
.dash-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    position: relative;
    z-index: 1;
}

.dash-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.dash-stat {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.35rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 36px rgba(11,31,74,.07);
    border: 1px solid rgba(230,224,214,.8);
    transition: transform .25s ease, box-shadow .25s ease;
}
.dash-stat:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 44px rgba(11,31,74,.12);
}
.dash-stat-revenue {
    background: linear-gradient(145deg, #fff 0%, #fff9f4 100%);
    border-color: rgba(232,93,4,.2);
}
.dash-stat-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--navy), var(--navy-soft));
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}
.dash-stat-revenue .dash-stat-icon {
    background: linear-gradient(135deg, var(--orange), var(--orange-bright));
}
.dash-stat strong {
    display: block;
    font-family: var(--display);
    font-size: 1.85rem;
    color: var(--navy);
    line-height: 1.1;
}
.dash-stat span { color: var(--muted); font-size: .82rem; }

/* ── Live online strip ── */
.dash-online-strip {
    background: #fff;
    border-radius: 18px;
    padding: 1.35rem 1.5rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 14px 40px rgba(11,31,74,.08);
    border: 1px solid var(--line);
}
.dash-online-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.15rem;
    flex-wrap: wrap;
}
.dash-online-head h2 {
    font-family: var(--display);
    font-size: 1.5rem;
    color: var(--navy);
}
.dash-online-head p { color: var(--muted); font-size: .88rem; margin-top: .2rem; }
.link-arrow {
    color: var(--orange);
    font-weight: 600;
    font-size: .88rem;
    transition: transform .2s ease;
}
.link-arrow:hover { transform: translateX(4px); }

.dash-online-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.dash-online-grid-page { margin-top: 1rem; }
.dash-online-card {
    background: linear-gradient(180deg, #faf8f5 0%, #fff 100%);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.1rem 1.15rem;
}
.dash-online-card h3 {
    font-size: .78rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: .85rem;
}
.online-row {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .55rem 0;
    border-bottom: 1px solid rgba(230,224,214,.6);
}
.online-row:last-child { border-bottom: 0; }
.online-row-lg { padding: .75rem 0; }
.online-row strong { display: block; font-size: .92rem; color: var(--navy); }
.online-row small {
    display: block;
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.45;
}
.online-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    margin-top: .35rem;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(34,197,94,.25);
    animation: pulseDot 2s ease infinite;
}
.online-dot-customer {
    background: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}
@keyframes pulseDot {
    0%, 100% { opacity: 1; }
    50% { opacity: .55; }
}
.muted-inline { color: var(--muted); font-size: .88rem; }

.role-pill {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: .7rem;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--navy);
    color: #fff;
}
.role-pill-admin { background: var(--orange); }
.role-pill-uploader { background: #6366f1; }
.role-pill-stock_manager { background: #0d9488; }

/* ── Dashboard panels ── */
.dash-panels {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
.dash-panel {
    background: #fff;
    border-radius: 16px;
    padding: 1.25rem 1.35rem;
    box-shadow: 0 12px 36px rgba(11,31,74,.07);
    border: 1px solid var(--line);
}
.dash-panel-wide { grid-column: 1 / -1; margin-top: 1rem; }
.dash-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.dash-panel-head h2 {
    font-family: var(--display);
    font-size: 1.35rem;
    color: var(--navy);
}
.dash-panel-head a {
    font-size: .85rem;
    color: var(--orange);
    font-weight: 600;
}
.dash-table-wrap { overflow-x: auto; }
.dash-table th {
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}
.dash-table td { font-size: .88rem; }
.dash-alert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .75rem;
}
.dash-alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    font-size: .88rem;
}
.dash-alert-item span {
    color: #c2410c;
    font-weight: 700;
    white-space: nowrap;
}

/* ── Tabs (team page) ── */
.tab-bar {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.tab-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .65rem 1.1rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--navy);
    font-size: .88rem;
    font-weight: 500;
    transition: all .2s ease;
}
.tab-link:hover {
    border-color: var(--navy);
    transform: translateY(-1px);
}
.tab-link.active {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
    box-shadow: 0 8px 24px rgba(11,31,74,.2);
}
.tab-badge {
    display: inline-grid;
    place-items: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: var(--orange);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
}
.tab-link.active .tab-badge {
    background: var(--orange-bright);
}

.role-badge-admin { background: rgba(232,93,4,.15); color: #c2410c; }
.role-badge-uploader { background: rgba(99,102,241,.15); color: #4338ca; }
.role-badge-stock_manager { background: rgba(13,148,136,.15); color: #0f766e; }
.role-badge-customer { background: rgba(11,31,74,.08); color: var(--navy); }

/* ── Permissions form ── */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .75rem;
    margin: 1rem 0;
}
.perm-box {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .85rem 1rem;
    background: #faf8f5;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}
.perm-box:has(input:checked) {
    border-color: var(--orange);
    background: #fff9f4;
}
.perm-box input { margin-top: .15rem; accent-color: var(--orange); }
.perm-box strong { display: block; font-size: .88rem; color: var(--navy); }
.perm-box small { color: var(--muted); font-size: .75rem; line-height: 1.35; }
.perm-box fieldset,
fieldset.perm-box {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.15rem 1.25rem;
    background: #fff;
}
fieldset.perm-box legend {
    font-family: var(--display);
    font-size: 1.1rem;
    color: var(--navy);
    padding: 0 .35rem;
}
.perm-check {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .75rem 1rem;
    background: #faf8f5;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    font-size: .88rem;
    transition: border-color .2s ease, background .2s ease;
}
.perm-check:has(input:checked) {
    border-color: var(--orange);
    background: #fff9f4;
}
.perm-check input { accent-color: var(--orange); }
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
}
.role-hint {
    padding: .85rem 1rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    font-size: .85rem;
    color: #1e40af;
    margin-bottom: 1rem;
}

/* ── Staff login ── */
.admin-login-page .admin-main { padding: 0; min-height: 100vh; }
.login-wrap-staff {
    background: linear-gradient(135deg, var(--navy-deep) 0%, #0d2858 50%, var(--navy) 100%);
}
.login-card-staff {
    border-radius: 20px;
    border-top: none;
    padding: 2.25rem;
    box-shadow: 0 28px 70px rgba(0,0,0,.35);
    position: relative;
    overflow: hidden;
}
.login-card-staff::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--orange), var(--orange-bright));
}
.login-domains {
    font-size: .82rem;
    padding: .65rem .85rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 1rem !important;
}
.login-domains code {
    background: rgba(11,31,74,.08);
    padding: .1rem .35rem;
    border-radius: 4px;
    font-size: .78rem;
}

@media (max-width: 1100px) {
    .dash-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-online-grid { grid-template-columns: 1fr; }
    .dash-panels { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .dash-hero-actions { width: 100%; }
    .dash-hero-actions .btn { flex: 1; min-width: 140px; }
    .dash-stat-grid { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: flex-start; }
}

.alert-style-pill {
    display: inline-block;
    padding: .25rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
}
.alert-style-sale { background: rgba(255,107,0,.15); color: #c2410c; }
.alert-style-new { background: rgba(37,99,235,.15); color: #1d4ed8; }
.alert-style-urgent { background: rgba(220,38,38,.15); color: #b91c1c; }
.alert-style-info { background: rgba(16,185,129,.15); color: #047857; }
.alert-status {
    display: inline-block;
    padding: .22rem .5rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.alert-status-live { background: #dcfce7; color: #166534; }
.alert-status-scheduled { background: #dbeafe; color: #1e40af; }
.alert-status-expired { background: #f3f4f6; color: #6b7280; }
.alert-status-off { background: #fee2e2; color: #991b1b; }
