/* ===========================
   SELFPRINTZ FRANCHISER DASHBOARD
   Navy / Purple Design System
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --purple: #6B4FFF;
    --purple-lt: rgba(107, 79, 255, 0.12);
    --purple-mid: rgba(107, 79, 255, 0.25);
    --navy: #1A1D2E;
    --navy-dark: #13161F;
    --navy-hover: #22263A;
    --navy-active: #2A2F47;
    --bg: #F5F6FA;
    --card: #FFFFFF;
    --border: rgba(0, 0, 0, 0.07);
    --text: #1E2130;
    --muted: #6B7280;
    --green: #22C55E;
    --green-lt: rgba(34, 197, 94, 0.1);
    --red: #EF4444;
    --red-lt: rgba(239, 68, 68, 0.1);
    --orange: #F97316;
    --orange-lt: rgba(249, 115, 22, 0.1);
    --blue: #3B82F6;
    --blue-lt: rgba(59, 130, 246, 0.1);
    --yellow: #EAB308;
    --yellow-lt: rgba(234, 179, 8, 0.1);
    --sidebar-w: 240px;
    --topbar-h: 60px;
    --radius: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.10);
    --transition: 0.2s ease;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
}

/* ===========================  SIDEBAR  =========================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--navy);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow: hidden;
    transition: width var(--transition);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    min-height: var(--topbar-h);
    text-decoration: none;
}

.sidebar-logo-icon {
    width: 34px;
    height: 34px;
    background: var(--purple);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-logo-text {
    display: flex;
    flex-direction: column;
}

.sidebar-logo-text .brand {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.3px;
}

.sidebar-logo-text .sub {
    font-size: 9px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.nav-group-label {
    font-size: 9.5px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 14px 20px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 20px;
    margin: 1px 8px;
    border-radius: var(--radius);
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    user-select: none;
    position: relative;
}

.nav-item:hover {
    background: var(--navy-hover);
    color: #fff;
}

.nav-item.active {
    background: var(--purple);
    color: #fff;
    font-weight: 600;
}

.nav-item .nav-icon {
    font-size: 16px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    line-height: 1.4;
}

.nav-badge.new {
    background: var(--green);
}

.sidebar-footer {
    padding: 14px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.store-card {
    background: var(--navy-active);
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.store-avatar {
    width: 34px;
    height: 34px;
    background: var(--purple);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.store-info .store-name {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.store-info .store-id {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
}

.help-btn {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: rgba(107, 79, 255, 0.15);
    border: 1px solid rgba(107, 79, 255, 0.3);
    border-radius: var(--radius);
    color: #a78bfa;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all var(--transition);
}

.help-btn:hover {
    background: rgba(107, 79, 255, 0.25);
}

/* ===========================  MAIN LAYOUT  =========================== */
.main-wrap {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===========================  TOPBAR  =========================== */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.topbar-page {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    min-width: 80px;
}

.topbar-sep {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

.topbar-apm-select {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    position: relative;
    transition: all var(--transition);
}

.topbar-apm-select:hover {
    background: var(--card);
    border-color: var(--purple);
    box-shadow: 0 2px 6px rgba(107, 79, 255, 0.12);
}

.apm-count-badge {
    background: var(--purple);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
}

.select-native {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    font-size: 13px;
    z-index: 2;
}

.topbar-date {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all var(--transition);
    position: relative;
}

.icon-btn:hover {
    background: var(--bg);
    border-color: var(--purple);
}

.notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    background: var(--red);
    border-radius: 50%;
    border: 1.5px solid #fff;
}

/* ===========================  CONTENT AREA  =========================== */
.content-area {
    padding: 20px 24px;
    flex: 1;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

/* ===========================  PAGE HEADER  =========================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.4px;
}

.page-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

/* ===========================  KPI CARDS  =========================== */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.kpi-card {
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
}

.kpi-body {
    flex: 1;
    min-width: 0;
}

.kpi-label {
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 3px;
}

.kpi-value {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text);
}

.kpi-trend {
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 2px;
}

.kpi-trend.up {
    color: var(--green);
}

.kpi-trend.down {
    color: var(--red);
}

/* Icon colour variants */
.kpi-icon.purple {
    background: var(--purple-lt);
}

.kpi-icon.green {
    background: var(--green-lt);
}

.kpi-icon.orange {
    background: var(--orange-lt);
}

.kpi-icon.red {
    background: var(--red-lt);
}

.kpi-icon.blue {
    background: var(--blue-lt);
}

/* ===========================  GRID LAYOUTS  =========================== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.grid-12 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 14px;
}

.grid-21 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
}

.grid-13 {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 14px;
}

.span-2 {
    grid-column: span 2;
}

/* ===========================  CARDS  =========================== */
.card {
    background: var(--card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 0;
    margin-bottom: 14px;
}

.card-title {
    font-size: 13px;
    font-weight: 700;
}

.card-action {
    font-size: 11.5px;
    color: var(--purple);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.card-action:hover {
    text-decoration: underline;
}

.card-body {
    padding: 0 16px 14px;
}

.card-pad {
    padding: 16px;
}

.no-pad {
    padding: 0 !important;
}

/* ===========================  PRINT SUMMARY  =========================== */
.print-summary-row {
    display: flex;
    gap: 0;
    background: #F9F9FB;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 14px;
}

.ps-item {
    flex: 1;
    padding: 12px 16px;
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ps-item:last-child {
    border-right: none;
}

.ps-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ps-dot.bw {
    background: #374151;
}

.ps-dot.color {
    background: var(--orange);
}

.ps-dot.custom {
    background: var(--purple);
}

.ps-dot.total {
    background: var(--blue);
}

.ps-info {}

.ps-val {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

.ps-label {
    font-size: 10px;
    color: var(--muted);
    font-weight: 500;
}

.ps-pct {
    font-size: 10px;
    color: var(--muted);
    margin-top: 1px;
}

/* ===========================  CHART AREAS  =========================== */
.chart-wrap {
    position: relative;
    padding: 0 16px 14px;
}

.chart-wrap canvas {
    display: block;
    width: 100% !important;
}

/* ===========================  TABLES  =========================== */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

thead th {
    padding: 8px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: #F9F9FB;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    color: var(--text);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: #FAFBFF;
}

.td-id {
    font-weight: 600;
    color: var(--purple);
    font-size: 11px;
    font-family: monospace;
}

.td-name {
    font-weight: 600;
}

.td-muted {
    color: var(--muted);
    font-size: 11.5px;
}

.td-amount {
    font-weight: 700;
}

.td-pages {
    font-weight: 600;
}

/* ===========================  BADGES / STATUS  =========================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 600;
}

.badge-green {
    background: var(--green-lt);
    color: #16a34a;
}

.badge-blue {
    background: var(--blue-lt);
    color: #2563eb;
}

.badge-orange {
    background: var(--orange-lt);
    color: #c2410c;
}

.badge-red {
    background: var(--red-lt);
    color: #dc2626;
}

.badge-gray {
    background: #F3F4F6;
    color: var(--muted);
}

.badge-yellow {
    background: var(--yellow-lt);
    color: #854d0e;
}

.badge-purple {
    background: var(--purple-lt);
    color: var(--purple);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.dot-green {
    background: var(--green);
}

.dot-orange {
    background: var(--orange);
}

.dot-red {
    background: var(--red);
}

.dot-blue {
    background: var(--blue);
}

/* ===========================  APM CARDS  =========================== */
.apm-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.apm-card {
    background: var(--card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 14px 16px;
}

.apm-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.apm-name {
    font-size: 14px;
    font-weight: 800;
}

.apm-loc {
    font-size: 11px;
    color: var(--muted);
}

.apm-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
}

.apm-stat-item {
    text-align: center;
}

.apm-stat-val {
    font-size: 15px;
    font-weight: 800;
}

.apm-stat-lbl {
    font-size: 9px;
    color: var(--muted);
    font-weight: 500;
}

.apm-consumables {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.consumable-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.apm-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

/* ===========================  ALERT ITEMS  =========================== */
.alert-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: #FAFAFA;
    border: 1px solid var(--border);
    font-size: 12px;
}

.alert-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.alert-text {
    flex: 1;
}

.alert-text strong {
    font-weight: 700;
    display: block;
}

.alert-text span {
    color: var(--muted);
    font-size: 11px;
}

/* ===========================  STAT SUMMARY CARDS  =========================== */
.summary-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.summary-stat:last-child {
    border-bottom: none;
}

.ss-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.ss-label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
}

.ss-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

/* ===========================  REFERRAL CARD  =========================== */
.referral-code-box {
    background: linear-gradient(135deg, #6B4FFF 0%, #9B59B6 100%);
    border-radius: var(--radius-md);
    padding: 16px;
    color: #fff;
    margin-bottom: 14px;
}

.ref-code-label {
    font-size: 10px;
    opacity: 0.75;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.ref-code-value {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 2px;
    margin: 4px 0;
}

.ref-share-icons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.share-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: background var(--transition);
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.ref-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.ref-stat {
    background: #F9F9FB;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.ref-stat-val {
    font-size: 18px;
    font-weight: 800;
}

.ref-stat-label {
    font-size: 10px;
    color: var(--muted);
    font-weight: 500;
}

/* ===========================  SHOP PRODUCT CARDS  =========================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.product-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
}

.product-card:hover {
    border-color: var(--purple);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.product-img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin: 0 auto 10px;
}

.product-name {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.product-brand {
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 6px;
}

.product-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--purple);
    margin-bottom: 8px;
}

/* ===========================  BUTTONS  =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 12.5px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    font-family: 'Inter', system-ui, sans-serif;
    text-decoration: none;
}

.btn-primary {
    background: var(--purple);
    color: #fff;
    box-shadow: 0 3px 12px rgba(107, 79, 255, 0.3);
}

.btn-primary:hover {
    background: #5A3FE8;
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-ghost:hover {
    border-color: var(--purple);
    color: var(--purple);
    background: var(--purple-lt);
}

.btn-danger {
    background: var(--red-lt);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-success {
    background: var(--green-lt);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 7px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 14px;
}

/* ===========================  TABS  =========================== */
.tab-bar {
    display: flex;
    gap: 2px;
    background: #F3F4F6;
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    padding: 7px 14px;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius) - 4px);
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.tab-btn.active,
.tab-btn:hover {
    background: var(--card);
    color: var(--text);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.tab-btn.active {
    color: var(--purple);
}

/* ===========================  FILTERS  =========================== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: 12px;
    flex: 1;
    max-width: 260px;
}

.search-box input {
    border: none;
    outline: none;
    font-size: 12px;
    font-family: inherit;
    width: 100%;
    background: transparent;
}

/* ===========================  TOGGLE SWITCH  =========================== */
.toggle-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #D1D5DB;
    border-radius: 22px;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform var(--transition);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.toggle input:checked+.toggle-slider {
    background: var(--green);
}

.toggle input:checked+.toggle-slider::before {
    transform: translateX(18px);
}

.toggle-label {
    font-size: 12.5px;
    font-weight: 600;
}

/* ===========================  MODAL  =========================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        transform: translateY(-16px) scale(0.97);
        opacity: 0;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 16px;
    font-weight: 800;
}

.modal-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: var(--bg);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-group {
    margin-bottom: 14px;
}

.form-label {
    font-size: 11.5px;
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    color: var(--muted);
}

.form-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
}

.form-input:focus {
    border-color: var(--purple);
}

/* ===========================  CATEGORY TABS  =========================== */
.cat-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.cat-tab {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--muted);
}

.cat-tab.active {
    background: var(--purple);
    color: #fff;
    border-color: var(--purple);
}

.cat-tab:hover:not(.active) {
    border-color: var(--purple);
    color: var(--purple);
}

/* ===========================  EARNINGS TABLE  =========================== */
.earnings-table-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
    align-items: center;
}

.earnings-table-row:last-child {
    border-bottom: none;
}

.earnings-table-row.header {
    background: #F9F9FB;
    font-weight: 700;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ===========================  PAGINATION  =========================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
}

.page-nums {
    display: flex;
    gap: 4px;
}

.page-num-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-num-btn.active {
    background: var(--purple);
    color: #fff;
    border-color: var(--purple);
}

.page-num-btn:hover:not(.active) {
    border-color: var(--purple);
}

/* ===========================  SUPPORT  =========================== */
.support-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.support-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.support-card:hover {
    border-color: var(--purple);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.support-card-icon {
    font-size: 28px;
    margin-bottom: 10px;
}

.support-card-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.support-card-desc {
    font-size: 11.5px;
    color: var(--muted);
}

/* ===========================  SETTINGS SECTIONS  =========================== */
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #F3F4F6;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item-label {
    font-size: 13px;
    font-weight: 600;
}

.settings-item-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

/* ===========================  PROFILE  =========================== */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.profile-field label {
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 600;
    display: block;
    margin-bottom: 3px;
}

.profile-field p {
    font-size: 13.5px;
    font-weight: 600;
}

/* ===========================  MINI CHART AREA  =========================== */
.mini-chart {
    height: 60px;
    position: relative;
    overflow: hidden;
}

/* ===========================  CART BADGE  =========================== */
.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===========================  SCROLLBAR  =========================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* ===========================  RESPONSIVE  =========================== */
@media (max-width: 1280px) {
    .kpi-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-w: 60px;
    }

    .sidebar-logo-text,
    .nav-item span.nav-label,
    .nav-group-label,
    .store-info,
    .help-btn span {
        display: none;
    }

    .sidebar-logo {
        justify-content: center;
        padding: 18px 0;
    }

    .sidebar-logo-icon {
        margin: 0;
    }

    .nav-item {
        justify-content: center;
        padding: 12px 0;
        margin: 2px 8px;
    }

    .nav-item .nav-icon {
        margin: 0;
        width: auto;
    }

    .store-card {
        justify-content: center;
    }

    .help-btn {
        justify-content: center;
        padding: 9px;
    }

    .apm-cards {
        grid-template-columns: 1fr 1fr;
    }

    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {

    .grid-2,
    .grid-3,
    .grid-4,
    .grid-12,
    .grid-21,
    .grid-13 {
        grid-template-columns: 1fr;
    }

    .apm-cards {
        grid-template-columns: 1fr;
    }

    .support-cards {
        grid-template-columns: 1fr;
    }

    .kpi-row {
        grid-template-columns: 1fr 1fr;
    }

    .content-area {
        padding: 14px 12px;
    }

    .span-2 {
        grid-column: span 1;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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