:root {
    --admin-bg: #fbf3e8;
    /* Logo-led: cream + navy wordmark · berry · sunset orange */
    --admin-sidebar: #fbf3e8;
    --admin-sidebar-ink: #102048;
    --admin-sidebar-muted: #3a4268;
    --admin-sidebar-line: rgba(16, 32, 72, 0.1);
    --admin-accent: #e58926;
    --admin-berry: #c03868;
    --admin-orchid: #672668;
    --admin-primary: #102048;
    --admin-text: #102048;
    --admin-logo-gradient: linear-gradient(135deg, #672668 0%, #c03868 48%, #e58926 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Outfit', system-ui, sans-serif; color: var(--admin-text); background: var(--admin-bg); }
a { color: var(--admin-primary); text-decoration: none; }
a:hover { color: var(--admin-accent); }

.admin-login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0c1433, #102048 50%, #672668);
    padding: 20px;
}
.admin-login-card {
    background: #fff; width: 100%; max-width: 420px; border-radius: 16px; padding: 36px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}
.admin-login-brand { text-align: center; margin-bottom: 24px; }
.admin-brand-logo {
    display: block;
    width: auto;
    max-width: 180px;
    height: auto;
    margin: 0 auto;
}
.admin-login-logo { max-width: 200px; margin-bottom: 8px; }
.admin-logo { display: none; }
.admin-login-brand p { color: #6b807c; margin-top: 4px; }
.admin-login-foot { text-align: center; margin-top: 20px; color: #6b807c; font-size: 0.9rem; line-height: 1.7; }
.btn-admin-primary {
    width: 100%; border: none; background: linear-gradient(135deg, #102048, #672668);
    color: #fff; font-weight: 700; padding: 12px 18px; border-radius: 10px; cursor: pointer; font-family: inherit;
}
.btn-admin-primary:hover { background: linear-gradient(135deg, #e58926, #d7633c); color: #0c1433; }

.admin-body { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    padding: 20px 0;
    color: var(--admin-sidebar-ink);
    background:
        radial-gradient(ellipse 90% 55% at 0% 0%, rgba(192, 56, 104, 0.12), transparent 55%),
        radial-gradient(ellipse 80% 50% at 100% 100%, rgba(229, 137, 38, 0.16), transparent 50%),
        var(--admin-sidebar);
    border-right: 1px solid var(--admin-sidebar-line);
    box-shadow: 4px 0 24px rgba(16, 32, 72, 0.04);
}
.admin-brand { padding: 8px 20px 24px; border-bottom: 1px solid var(--admin-sidebar-line); margin-bottom: 12px; }
.admin-brand-link {
    display: block;
    margin-bottom: 12px;
    background: #ffffff;
    border-radius: 14px;
    padding: 14px 12px;
    border: 1px solid rgba(16, 32, 72, 0.06);
    box-shadow: 0 8px 20px rgba(16, 32, 72, 0.06);
}
.admin-brand .admin-brand-logo {
    max-width: 148px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}
.admin-brand strong { display: none; }
.admin-brand span {
    color: var(--admin-accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: block;
}
.admin-nav a {
    display: flex; align-items: center; gap: 10px; padding: 12px 20px;
    color: var(--admin-sidebar-muted); font-size: 0.95rem; font-weight: 500;
}
.admin-nav a:hover {
    background: rgba(229, 137, 38, 0.1);
    color: var(--admin-sidebar-ink);
}
.admin-nav a.active {
    background: var(--admin-logo-gradient);
    color: #fff;
}
.admin-nav a.active i { color: #fff; }
.admin-nav a i { width: 20px; color: var(--admin-accent); }
.admin-nav a:hover i { color: var(--admin-berry); }
.admin-nav a.active:hover { color: #fff; }

.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
    background: #fff; padding: 16px 28px; display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.admin-topbar h1 { font-size: 1.35rem; }
.admin-content { padding: 24px 28px 40px; }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.admin-stat {
    background: #fff; border-radius: 14px; padding: 18px; display: flex; gap: 14px; align-items: center;
    box-shadow: 0 4px 14px rgba(16,32,72,0.06);
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; }
.admin-stat h3 { font-size: 1.4rem; }
.admin-stat p { font-size: 0.85rem; color: #6b807c; }

.admin-grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
@media (max-width: 900px) {
    .admin-body { flex-direction: column; }
    .admin-sidebar { width: 100%; }
    .admin-grid-2 { grid-template-columns: 1fr; }
}

.card { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 4px 14px rgba(16,32,72,0.06); }
.card-header { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; }
.card-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th, .admin-table td { padding: 10px 8px; border-bottom: 1px solid #eef3f2; text-align: left; }
.admin-table th { color: #6b807c; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }

.quick-actions { display: grid; gap: 10px; }
.quick-action-btn {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #fbf3e8;
    border-radius: 10px; color: var(--admin-text); font-weight: 600;
}
.quick-action-btn:hover { background: var(--admin-primary); color: #fff; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.form-control {
    width: 100%; padding: 11px 14px; border: 2px solid #e0d0ba; border-radius: 10px;
    font-family: inherit; font-size: 0.95rem;
}
.form-control:focus { outline: none; border-color: var(--admin-primary); }
.form-control[readonly] {
    background: #f5f0e8;
    color: #5c5348;
    cursor: default;
    border-style: dashed;
}

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }

.media-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 12px; }
.media-admin-item {
    background: #fbf3e8; border-radius: 10px; overflow: hidden; text-align: center; font-size: 0.8rem; padding-bottom: 8px;
}
.media-admin-item img, .media-admin-item video { width: 100%; height: 90px; object-fit: cover; display: block; }
.media-admin-item .badge { display: inline-block; background: var(--admin-accent); color: #0c1433; padding: 2px 8px; border-radius: 20px; margin: 6px 0; font-weight: 700; }

/* Orders */
.order-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter-chip {
    padding: 7px 12px; border-radius: 20px; background: #fff; font-size: 0.82rem; font-weight: 600;
    color: #3a4268; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.filter-chip.active, .filter-chip:hover { background: #102048; color: #fff; }
.order-search { display: flex; gap: 10px; margin-bottom: 16px; }
.order-search .form-control { max-width: 360px; }
.btn-admin-link { font-weight: 700; color: #102048; }
.table-responsive { overflow-x: auto; }

.status-badge {
    display: inline-block; padding: 4px 10px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 700; background: #eef3f2; color: #3a4268;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-confirmed, .status-processing { background: #dbeafe; color: #1e40af; }
.status-shipped, .status-out_for_delivery { background: #e0e7ff; color: #3730a3; }
.status-delivered, .status-paid { background: #d1fae5; color: #065f46; }
.status-cancelled, .status-failed, .status-refunded { background: #fee2e2; color: #991b1b; }
.status-cancel_pending { background: #ffedd5; color: #9a3412; }

.admin-order-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.live-pill { font-size: 0.82rem; font-weight: 700; padding: 6px 12px; border-radius: 20px; background: #eef3f2; color: #6b807c; }
.live-pill.saving { background: #fef3c7; color: #92400e; }
.live-pill.ok { background: #d1fae5; color: #065f46; }
.live-pill.error { background: #fee2e2; color: #991b1b; }

.admin-order-item {
    display: flex; gap: 12px; align-items: center; padding: 10px 0;
    border-bottom: 1px solid #eef3f2;
}
.admin-order-item img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; }
.admin-order-item > div { flex: 1; }
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.92rem; }
.summary-row.total { font-weight: 800; border-top: 2px solid #eef3f2; margin-top: 6px; padding-top: 10px; }

.status-update-card .hint { color: #6b807c; font-size: 0.85rem; margin: -8px 0 14px; }
.checkbox-inline { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; margin-top: 4px; }
.quick-status-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 18px; padding-top: 14px; border-top: 1px solid #eef3f2; }
.quick-status-row > span { font-size: 0.8rem; color: #6b807c; font-weight: 600; width: 100%; margin-bottom: 4px; }
.quick-status-btn {
    border: none; background: #fbf3e8; padding: 6px 10px; border-radius: 8px;
    font-size: 0.78rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.quick-status-btn:hover { background: #102048; color: #fff; }

.admin-h-timeline {
    position: relative;
    padding: 8px 4px 4px;
    overflow-x: auto;
}
.admin-h-timeline .empty-track { color: #6b807c; margin: 0; }
.admin-h-track {
    position: absolute;
    left: 28px;
    right: 28px;
    top: 30px;
    height: 3px;
    background: #e0d0ba;
    border-radius: 2px;
    z-index: 0;
}
.admin-h-timeline.is-cancelled .admin-h-track {
    background: #fecaca;
}
.admin-h-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-width: 640px;
    position: relative;
    z-index: 1;
}
.admin-h-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 140px;
    margin: 0 auto;
}
.admin-h-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #f3e6d4;
    color: #6b7390;
    border: 3px solid #d4c4b0;
    margin-bottom: 8px;
    font-size: 0.85rem;
}
.admin-h-step.is-done .admin-h-dot {
    background: #102048;
    border-color: #102048;
    color: #e58926;
}
.admin-h-step.is-current .admin-h-dot {
    background: #fff;
    border-color: #e58926;
    color: #102048;
    box-shadow: 0 0 0 4px rgba(229, 137, 38, 0.2);
}
.admin-h-step.is-todo .admin-h-dot {
    opacity: 0.55;
}
.admin-h-step strong {
    font-size: 0.82rem;
    color: #102048;
    line-height: 1.25;
}
.admin-h-step.is-todo strong { color: #6b7390; }
.admin-h-step time {
    display: block;
    margin-top: 4px;
    font-size: 0.7rem;
    color: #6b807c;
}
.admin-h-step p {
    margin: 6px 0 0;
    font-size: 0.72rem;
    color: #6b807c;
    line-height: 1.35;
    max-width: 120px;
}
.admin-h-timeline.is-cancelled .admin-h-step.is-done .admin-h-dot {
    background: #991b1b;
    border-color: #991b1b;
    color: #fff;
}

/* legacy vertical (unused) */
.admin-timeline { list-style: none; padding: 0; margin: 0; }
.admin-timeline li { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.admin-timeline .track-dot {
    width: 16px; height: 16px; border-radius: 50%; background: #e58926;
    border: 3px solid #102048; flex-shrink: 0; margin-top: 2px; z-index: 1;
}
.admin-timeline time { font-size: 0.75rem; color: #6b807c; }
.admin-timeline .empty-track { color: #6b807c; }

/* ===== CRM polish ===== */
.admin-sidebar { width: 260px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.nav-section {
    margin: 16px 20px 6px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--admin-berry);
}
.admin-nav a { position: relative; border-radius: 0 10px 10px 0; margin-right: 10px; }
.nav-badge {
    margin-left: auto; background: #e58926; color: #0c1433; font-size: 0.7rem;
    min-width: 18px; height: 18px; border-radius: 50%; display: inline-flex;
    align-items: center; justify-content: center; font-weight: 800;
}
.topbar-eyebrow { font-size: 0.72rem; font-weight: 700; color: #e58926; letter-spacing: 0.08em; text-transform: uppercase; }
.admin-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg,#102048,#e58926);
    color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.admin-user small { display: block; color: #6b807c; font-size: 0.75rem; text-transform: capitalize; }

.crm-hero {
    display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
    background: linear-gradient(125deg, #0c1433, #102048 55%, #672668);
    color: #fff; border-radius: 18px; padding: 22px 24px; margin-bottom: 22px;
    box-shadow: 0 16px 40px rgba(16,32,72,0.18);
}
.crm-hero h2 { font-size: 1.35rem; margin-bottom: 4px; }
.crm-hero p { color: rgba(255,255,255,0.75); font-size: 0.92rem; }
.crm-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-admin-primary.soft { background: rgba(255,255,255,0.12); color: #fff; width: auto; padding: 10px 16px; }
.btn-admin-primary.soft:hover { background: #e58926; color: #0c1433; }
.btn-admin-primary { width: auto; padding: 10px 16px; display: inline-flex; align-items: center; gap: 8px; }
.hint-pill { background: rgba(229,137,38,0.2); color: #e8d5a3; padding: 8px 12px; border-radius: 20px; font-size: 0.82rem; font-weight: 600; }

.admin-stat {
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    animation: riseIn 0.6s ease both;
}
.admin-stat:hover { transform: translateY(-4px); box-shadow: 0 16px 30px rgba(16,32,72,0.12); }
.admin-stat small { color: #6b807c; font-weight: 500; }

.charts-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px;
}
.chart-card { min-height: 320px; }
.chart-wrap { height: 240px; position: relative; }

.workflow-steps { list-style: none; display: grid; gap: 12px; }
.workflow-steps li {
    display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
    padding: 12px 14px; background: #fbf3e8; border-radius: 12px; align-items: center;
}
.workflow-steps li span { grid-column: 1; font-size: 0.82rem; color: #6b807c; }
.workflow-steps li a { grid-row: 1 / span 2; grid-column: 2; font-weight: 700; }

.animate-in { animation: riseIn 0.7s ease both; }
.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }
.delay-3 { animation-delay: 0.24s; }
.delay-4 { animation-delay: 0.32s; }
@keyframes riseIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

.product-cell { display: flex; gap: 10px; align-items: center; }
.product-cell img { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; }
.product-cell small { display: block; color: #6b807c; font-size: 0.75rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.85rem; }
.row-actions a.danger { color: #c44b4b; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.cat-tree-item { border-bottom: 1px solid #eef3f2; padding: 14px 0; }
.cat-tree-main { display: flex; gap: 12px; align-items: center; }
.cat-tree-main img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; }
.cat-tree-main > div { flex: 1; }
.cat-tree-main small { display: block; color: #6b807c; font-size: 0.78rem; }
.cat-tree-children { margin: 10px 0 0 60px; display: grid; gap: 8px; }
.cat-sub-row {
    display: flex; gap: 10px; align-items: center; background: #fbf3e8;
    padding: 8px 10px; border-radius: 10px;
}
.cat-sub-row img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.cat-sub-row span { flex: 1; font-size: 0.9rem; font-weight: 600; }

.role-pill {
    display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700;
}
.role-admin { background: #e0e7ff; color: #3730a3; }
.role-customer { background: #d1fae5; color: #065f46; }

.toggle-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.toggle-switch input { display: none; }
.toggle-ui {
    width: 44px; height: 24px; background: #cbd5d1; border-radius: 20px; position: relative; transition: 0.25s; flex-shrink: 0;
}
.toggle-ui::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
    background: #fff; border-radius: 50%; transition: 0.25s; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-ui { background: #672668; }
.toggle-switch input:checked + .toggle-ui::after { left: 23px; }
.toggle-switch input:disabled + .toggle-ui { opacity: 0.5; cursor: not-allowed; }
.toggle-label { font-size: 0.85rem; font-weight: 700; }
.toggle-row { display: flex; align-items: center; gap: 8px; font-weight: 600; }

/* Selectable option chips (Show strip / Show modal / Active) */
.option-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}
.option-chip {
    display: inline-flex;
    cursor: pointer;
    user-select: none;
    margin: 0;
}
.option-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}
.option-chip-ui {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid #e0d0ba;
    border-radius: 12px;
    background: #f5f9f8;
    color: #6b807c;
    font-weight: 700;
    font-size: 0.9rem;
    transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.option-chip-ui::before {
    content: '';
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #b7c7c3;
    background: #fff;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.option-chip:hover .option-chip-ui {
    border-color: #102048;
    color: #102048;
}
.option-chip input:checked + .option-chip-ui {
    background: linear-gradient(135deg, #102048, #672668);
    border-color: #102048;
    color: #fff;
    box-shadow: 0 6px 16px rgba(16, 32, 72, 0.22);
}
.option-chip input:checked + .option-chip-ui::before {
    border-color: #e58926;
    background: #e58926;
    box-shadow: inset 0 0 0 3px #102048;
}
.option-chip input:focus-visible + .option-chip-ui {
    outline: 2px solid #e58926;
    outline-offset: 2px;
}

.admin-mobile-toggle {
    display: none; position: fixed; top: 14px; left: 14px; z-index: 60;
    border: none; background: #102048; color: #fff; width: 42px; height: 42px; border-radius: 10px;
}

@media (max-width: 1100px) {
    .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .admin-mobile-toggle { display: flex; align-items: center; justify-content: center; }
    .admin-sidebar {
        position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-105%);
        transition: transform 0.3s ease; box-shadow: 0 0 40px rgba(0,0,0,0.3);
    }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { width: 100%; }
    .admin-content { padding: 20px 16px 40px; }
    .form-row-2, .admin-grid-2 { grid-template-columns: 1fr; }
    .cat-tree-children { margin-left: 12px; }
}

.chart-card { cursor: pointer; transition: transform 0.25s ease, box-shadow 0.25s ease; }
.chart-card:hover { transform: translateY(-3px); box-shadow: 0 16px 32px rgba(16,32,72,0.12); }
.chart-card.is-animating {
    box-shadow: 0 0 0 3px rgba(229,137,38,0.45), 0 16px 32px rgba(16,32,72,0.12);
}
.chart-hint {
    font-size: 0.75rem; color: #6b807c; margin: -4px 0 10px; font-weight: 500;
}
.chart-replay-btn {
    border: none; background: #fbf3e8; color: #102048; font-family: inherit;
    font-size: 0.78rem; font-weight: 700; padding: 6px 12px; border-radius: 20px;
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    transition: background 0.2s ease, transform 0.2s ease;
}
.chart-replay-btn:hover { background: #102048; color: #e58926; }
.chart-card.is-animating .chart-replay-btn i { animation: spinReplay 0.8s linear infinite; }
@keyframes spinReplay { to { transform: rotate(360deg); } }

/* Chart focus modal */
.chart-modal {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.chart-modal[hidden] { display: none !important; }
.chart-modal-backdrop {
    position: absolute; inset: 0; background: rgba(16, 32, 72, 0.72); backdrop-filter: blur(5px);
}
.chart-modal-panel {
    position: relative; z-index: 1; width: min(720px, 96vw);
    background: #fff; border-radius: 20px; padding: 24px 24px 20px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.35);
    animation: chartModalIn 0.35s ease;
}
@keyframes chartModalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: none; }
}
.chart-modal-close {
    position: absolute; top: 10px; right: 14px; border: none; background: none;
    font-size: 1.8rem; cursor: pointer; color: #6b807c; line-height: 1;
}
.chart-modal-eyebrow {
    font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em;
    text-transform: uppercase; color: #e58926; margin-bottom: 4px;
}
.chart-modal-head h2 { font-size: 1.5rem; color: #102048; margin-bottom: 4px; }
.chart-modal-meta { color: #6b807c; font-weight: 600; margin-bottom: 16px; }
.chart-modal-body {
    display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 18px; align-items: center;
}
.chart-modal-canvas-wrap { height: 280px; }
.chart-modal-legend { list-style: none; display: grid; gap: 8px; max-height: 280px; overflow-y: auto; }
.chart-modal-legend li {
    display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px; align-items: center;
    padding: 8px 10px; border-radius: 10px; background: #fbf3e8; font-size: 0.88rem;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.chart-modal-legend li.faded { opacity: 0.35; }
.chart-modal-legend li.active {
    opacity: 1; background: #102048; color: #fff; transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(16,32,72,0.2);
}
.chart-modal-legend .dot { width: 10px; height: 10px; border-radius: 50%; }
.chart-modal-legend .lbl { font-weight: 600; }
.chart-modal-legend .val { font-weight: 800; }
.chart-modal-legend .pct { font-size: 0.78rem; opacity: 0.8; }
@media (max-width: 700px) {
    .chart-modal-body { grid-template-columns: 1fr; }
    .chart-modal-canvas-wrap { height: 220px; }
}

/* Admin access modals / actions */
.link-btn {
    border: none; background: none; color: #102048; font-weight: 700;
    font-family: inherit; font-size: 0.85rem; cursor: pointer; padding: 0;
}
.link-btn.danger { color: #c44b4b; }
.link-btn:hover { text-decoration: underline; }
.muted { color: #6b807c; font-size: 0.9rem; margin-bottom: 14px; }

.admin-modal {
    position: fixed; inset: 0; z-index: 2100;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.admin-modal[hidden] { display: none !important; }
.admin-modal-backdrop {
    position: absolute; inset: 0; background: rgba(16,32,72,0.65); backdrop-filter: blur(4px);
}
.admin-modal-panel {
    position: relative; z-index: 1; width: min(480px, 96vw);
    background: #fff; border-radius: 16px; padding: 24px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.3);
    animation: chartModalIn 0.3s ease;
}
.admin-modal-panel h3 { margin-bottom: 6px; font-size: 1.25rem; }
.admin-modal-close {
    position: absolute; top: 10px; right: 14px; border: none; background: none;
    font-size: 1.7rem; cursor: pointer; color: #6b807c;
}
.crm-hero code {
    background: rgba(255,255,255,0.12); padding: 2px 8px; border-radius: 6px; font-size: 0.85rem;
}

/* Admin roles */
.role-guide {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px; margin-bottom: 20px;
}
.role-guide-card {
    background: #fff; border: 1px solid #e2ebe8; border-radius: 12px; padding: 14px 16px;
}
.role-guide-card p { margin: 8px 0 0; font-size: 0.8rem; color: #6b807c; line-height: 1.4; }
.you-badge {
    display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 10px;
    font-size: 0.7rem; font-weight: 700; background: #102048; color: #fff;
}
.role-super_admin { background: #fef3c7; color: #92400e; }
.role-manager { background: #e0e7ff; color: #3730a3; }
.role-catalog { background: #dbeafe; color: #1e40af; }
.role-sales { background: #fce7f3; color: #9d174d; }
.role-support { background: #d1fae5; color: #065f46; }

.quick-status-btn.is-locked,
.quick-status-btn:disabled {
    opacity: 0.4; cursor: not-allowed; text-decoration: line-through;
}
.status-lock-hint { margin: -4px 0 8px; font-size: 0.82rem; }
#orderStatus option:disabled { color: #9aa8a5; }

/* Discount CRM */
.nav-sub {
    margin: 0 10px 8px 20px;
    padding: 4px 0 8px 12px;
    border-left: 2px solid rgba(229,137,38,0.35);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-sub a {
    padding: 8px 12px !important;
    font-size: 0.82rem !important;
    margin-right: 0 !important;
    border-radius: 8px !important;
    color: var(--admin-sidebar-muted) !important;
}
.nav-sub a.active, .nav-sub a:hover {
    color: var(--admin-sidebar-ink) !important;
    background: rgba(229, 137, 38, 0.12) !important;
}
.nav-sub a.active {
    background: rgba(192, 56, 104, 0.12) !important;
    color: var(--admin-berry) !important;
}
.discount-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.discount-hub-card {
    background: #fff;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 4px 14px rgba(16,32,72,0.06);
    color: inherit;
    display: block;
    transition: transform .25s ease, box-shadow .25s ease;
    border: 1px solid transparent;
}
.discount-hub-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(16,32,72,0.12);
    border-color: rgba(229,137,38,0.4);
    color: inherit;
}
.discount-hub-card .dh-icon {
    width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg, #102048, #672668);
    color: #fff; display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px; font-size: 1.1rem;
}
.discount-hub-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.discount-hub-card p { color: #6b807c; font-size: 0.88rem; line-height: 1.45; margin-bottom: 14px; }
.discount-hub-card strong { color: #102048; font-size: 0.9rem; }
.discount-help-list { padding-left: 18px; color: #3a4268; line-height: 1.7; font-size: 0.92rem; }
.discount-panel {
    background: #f5f9f8;
    border: 1px solid #e2ebe8;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}
.discount-panel .panel-title {
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: #102048;
}
.form-hint { display: block; color: #6b807c; font-size: 0.8rem; margin-top: 4px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.radio-row label { font-weight: 600; font-size: 0.9rem; display: inline-flex; gap: 6px; align-items: center; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .form-row-2 { grid-template-columns: 1fr; } }

/* ===== Razorpay brand panel ===== */
.rz-panel {
    --rz-navy: #0b2452;
    --rz-blue: #3395ff;
    --rz-blue-soft: #e8f3ff;
    --rz-ink: #0b2452;
    background: #fff;
    border: 1px solid rgba(11, 36, 82, 0.12);
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(11, 36, 82, 0.1);
}
.rz-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 22px 24px;
    background: linear-gradient(120deg, #0b2452 0%, #123a7a 55%, #1a6fd4 100%);
}
.rz-panel-logo {
    height: 56px;
    width: auto;
    max-width: 260px;
    display: block;
    background: #fff;
    border-radius: 10px;
    padding: 10px 16px;
    box-sizing: content-box;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.rz-panel-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.rz-panel-badge.is-live {
    background: #3395ff;
    border-color: transparent;
}
.rz-panel-body {
    padding: 22px 24px 24px;
    background:
        radial-gradient(ellipse 70% 50% at 100% 0%, rgba(51, 149, 255, 0.12), transparent 55%),
        #f7fbff;
}
.rz-panel-body .form-hint,
.rz-panel-body p {
    color: #4a5d7a;
}
.rz-panel-body a {
    color: #1a6fd4;
    font-weight: 600;
}
.rz-panel-body .form-group > label:not(.toggle-switch) {
    color: var(--rz-navy);
    font-weight: 700;
}
.rz-panel-body .form-control {
    border: 1.5px solid rgba(11, 36, 82, 0.16);
    background: #fff;
    color: var(--rz-navy);
}
.rz-panel-body .form-control:focus {
    outline: none;
    border-color: #3395ff;
    box-shadow: 0 0 0 3px rgba(51, 149, 255, 0.2);
}
.rz-panel-body .toggle-switch span {
    color: var(--rz-navy);
    font-weight: 600;
}
.rz-panel .btn-rz {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #0b2452, #1a6fd4);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px 18px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
}
.rz-panel .btn-rz:hover {
    background: #3395ff;
    color: #fff;
}
.rz-panel .btn-rz-soft {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #0b2452;
    border: 1.5px solid rgba(11, 36, 82, 0.18);
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 700;
    text-decoration: none;
}
.rz-panel .btn-rz-soft:hover {
    border-color: #3395ff;
    color: #1a6fd4;
}
.rz-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.rz-meta { margin: 14px 0 0; padding-left: 18px; color: #4a5d7a; }
.rz-meta li { margin: 4px 0; }
.rz-meta code { background: #e8f3ff; color: #0b2452; padding: 1px 6px; border-radius: 4px; }

.rich-editor {
    border: 1px solid #ead9c4;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.rich-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 8px;
    background: #fbf3e8;
    border-bottom: 1px solid #ead9c4;
}
.rich-toolbar button,
.rich-toolbar label {
    border: 1px solid #ead9c4;
    background: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}
.rich-toolbar input[type="number"] { width: 64px; }
.rich-toolbar input[type="color"] { width: 36px; height: 28px; padding: 0; border: 0; background: none; }
.rich-surface {
    min-height: 160px;
    padding: 12px 14px;
    outline: none;
}
.rich-surface ul, .rich-surface ol { padding-left: 1.3em; }
.rich-surface b, .rich-surface strong { font-weight: 700; }
.rich-surface i, .rich-surface em { font-style: italic; }
.rich-surface u { text-decoration: underline; }

.print-invoice-highlight {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
    padding: 16px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, #102048 0%, #672668 55%, #c03868 100%);
    color: #fff !important;
    box-shadow: 0 12px 32px rgba(16, 32, 72, 0.3);
    animation: printInvPulse 2.6s ease-in-out infinite;
}
.print-invoice-highlight[hidden] { display: none !important; }
.print-invoice-highlight:hover {
    color: #0c1433 !important;
    background: linear-gradient(135deg, #e58926, #d7633c);
}
.print-invoice-highlight i {
    font-size: 1.45rem;
    margin-top: 3px;
}
.print-invoice-highlight strong {
    display: block;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}
.print-invoice-highlight em {
    display: block;
    font-style: normal;
    font-size: 0.8rem;
    opacity: 0.88;
    font-weight: 500;
    margin-top: 2px;
}
.print-invoice-wait {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fff8ee;
    border: 1px dashed #e58926;
    color: #6b807c;
    font-size: 0.85rem;
}
@keyframes printInvPulse {
    0%, 100% { box-shadow: 0 10px 28px rgba(16, 32, 72, 0.28); transform: translateY(0); }
    50% { box-shadow: 0 14px 40px rgba(229, 137, 38, 0.42); transform: translateY(-1px); }
}
@media (prefers-reduced-motion: reduce) {
    .print-invoice-highlight { animation: none; }
}
.btn-print-invoice {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #102048, #c03868);
    color: #fff !important;
    font-weight: 700;
    font-size: 0.78rem;
}
.btn-print-invoice:hover { background: #e58926; color: #0c1433 !important; }
