/* ==========================================================================
   OM MOBILE - PREMIUM MANAGEMENT SYSTEM DESIGN SYSTEM
   Modern, Dark-Slate, Glassmorphism, Responsive POS & Retail Dashboard
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-main: #0B0F19;
    --bg-surface: #111827;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --bg-input: #1F2937;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #3B82F6;

    /* Brand Accents */
    --accent-blue: #38BDF8;
    --accent-primary: #2563EB;
    --accent-indigo: #6366F1;
    --accent-emerald: #10B981;
    --accent-amber: #F59E0B;
    --accent-rose: #F43F5E;
    --accent-purple: #A855F7;

    /* Typography */
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-inverse: #0F172A;

    /* Spacing & Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --sidebar-width: 250px;
    --header-height: 64px;

    /* Shadows & Glass */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 14px 0 rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
    --glass-blur: blur(16px);

    --topbar-bg: rgba(17, 24, 39, 0.8);
    --modal-bg: #131B2E;
    --toast-bg: #1E293B;
    --focus-ring: 0 0 0 2px rgba(59, 130, 246, 0.45);
}

[data-theme="light"] {
    --bg-main: #F1F5F9;
    --bg-surface: #FFFFFF;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-card-hover: rgba(241, 245, 249, 0.95);
    --bg-input: #F8FAFC;
    --border-color: rgba(15, 23, 42, 0.10);
    --border-focus: #2563EB;

    --text-primary: #0F172A;
    --text-secondary: #334155;
    --text-muted: #64748B;
    --text-inverse: #F8FAFC;

    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 14px 0 rgba(15, 23, 42, 0.10);
    --shadow-lg: 0 10px 30px -5px rgba(15, 23, 42, 0.14);

    --topbar-bg: rgba(255, 255, 255, 0.92);
    --modal-bg: #FFFFFF;
    --toast-bg: #FFFFFF;
    --focus-ring: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

html {
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Base Resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.5;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Layout Container */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 50;
    transition: all 0.25s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #2563EB, #38BDF8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
}

.sidebar-brand-name {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.sidebar-brand-sub {
    font-size: 10px;
    color: var(--accent-blue);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 12px 10px 6px 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    border: 1px solid transparent;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
    color: var(--text-primary);
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.25), rgba(56, 189, 248, 0.1));
    border-color: rgba(56, 189, 248, 0.3);
    font-weight: 600;
}

[data-theme="light"] .nav-item.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.12), rgba(56, 189, 248, 0.06));
}

.nav-item-icon {
    font-size: 16px;
    width: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item-label {
    flex: 1;
    min-width: 0;
    line-height: 1.35;
}

.nav-item .badge {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 12px;
    background: var(--accent-rose);
    color: #fff;
    font-weight: 700;
}

.nav-item .badge.badge-nav-primary { background: var(--accent-primary); }
.nav-item .badge.badge-nav-slate { background: #475569; }
.nav-item .badge.badge-nav-amber { background: var(--accent-amber); }
.nav-item .badge.badge-nav-indigo { background: var(--accent-indigo); }

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: radial-gradient(circle at 80% 20%, rgba(37, 99, 235, 0.05), transparent 40%),
                radial-gradient(circle at 10% 90%, rgba(16, 185, 129, 0.04), transparent 40%),
                var(--bg-main);
}

/* Top Navbar */
.topbar {
    height: var(--header-height);
    background: var(--topbar-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 24px;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.topbar-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #2563EB, #38BDF8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.35);
    letter-spacing: -0.5px;
}

.topbar-heading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.topbar-store-name {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.45px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 0;
    margin: 0;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-shortcuts {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shortcut-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s;
}

.shortcut-chip:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

[data-theme="light"] .shortcut-chip:hover {
    background: rgba(15, 23, 42, 0.06);
}

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

.quick-action-btn {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
    transition: all 0.15s;
}

.quick-action-btn:hover {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.quick-action-btn__icon {
    font-size: 18px;
    line-height: 1;
}

/* View Content Container */
.view-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    max-width: 100%;
}

/* Modern Card System */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.14);
}

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

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Metric Stats Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-primary);
}

.metric-card.green::after { background: var(--accent-emerald); }
.metric-card.amber::after { background: var(--accent-amber); }
.metric-card.rose::after { background: var(--accent-rose); }
.metric-card.purple::after { background: var(--accent-purple); }

.metric-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 6px 0;
    letter-spacing: -0.5px;
}

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

/* Tables — no horizontal scroll; wrap + card layout on small screens */
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
    table-layout: fixed;
}

table.data-table th,
table.data-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

table.data-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] table.data-table th {
    background: rgba(15, 23, 42, 0.04);
}

table.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

table.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

[data-theme="light"] table.data-table tr:hover td {
    background: rgba(15, 23, 42, 0.03);
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

@media (max-width: 1024px) {
    table.data-table--responsive .col-hide-md {
        display: none;
    }
}

@media (max-width: 768px) {
    table.data-table--responsive {
        display: block;
        border-collapse: separate;
    }

    table.data-table--responsive thead {
        display: none;
    }

    table.data-table--responsive tbody {
        display: block;
    }

    table.data-table--responsive tr {
        display: block;
        margin-bottom: 12px;
        padding: 12px;
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
    }

    table.data-table--responsive tr.row-empty {
        padding: 20px;
        text-align: center;
    }

    table.data-table--responsive tr.row-empty td {
        display: block;
        border: none;
        padding: 0;
    }

    table.data-table--responsive tr.row-empty td::before {
        display: none;
    }

    table.data-table--responsive tr:hover td {
        background: transparent;
    }

    table.data-table--responsive td {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 12px 0;
        border-bottom: 1px solid var(--border-color);
        text-align: left;
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    table.data-table--responsive td:last-child {
        border-bottom: none;
    }

    table.data-table--responsive td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        color: var(--text-muted);
        text-align: left;
        flex: none;
        width: 100%;
        max-width: none;
    }

    table.data-table--responsive td.col-hide-md {
        display: flex;
    }

    table.data-table--responsive td > .btn,
    table.data-table--responsive td > a.btn {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        justify-content: center;
    }

    table.data-table--responsive .table-actions {
        justify-content: stretch;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    table.data-table--responsive .table-actions .btn,
    table.data-table--responsive .table-actions a.btn {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        justify-content: center;
    }

    table.data-table--responsive .text-imei {
        font-family: ui-monospace, 'Space Mono', monospace;
        font-size: 13px;
        word-break: break-all;
        overflow-wrap: anywhere;
        line-height: 1.4;
    }
}

/* Layout utilities */
.layout-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.layout-split {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.layout-split-wide {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.layout-split-expenses {
    display: grid;
    grid-template-columns: 1fr 1.8fr;
    gap: 20px;
}

.layout-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.layout-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.layout-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.layout-grid-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.layout-grid-reports {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

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

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.toolbar-wrap > .form-control {
    flex: 1 1 160px;
    min-width: 0;
}

.card-header.toolbar,
.card-header.toolbar-wrap {
    flex-wrap: wrap;
}

.text-subtle {
    color: var(--text-secondary);
    font-size: 12px;
}

.text-strong {
    color: var(--text-primary);
    font-weight: 700;
}

.text-accent {
    color: var(--accent-blue);
}

.panel-emphasis {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.panel-emphasis-blue {
    background: linear-gradient(145deg, rgba(30, 58, 138, 0.2), var(--bg-surface));
    border-color: rgba(59, 130, 246, 0.35);
}

[data-theme="light"] .panel-emphasis-blue {
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.08), var(--bg-surface));
}

.sim-output-grid {
    background: var(--bg-input);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.pos-customer-panel {
    background: var(--bg-surface);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 14px;
}

.section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-blue);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.imei-search-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.imei-search-row .form-control {
    flex: 1 1 200px;
    min-width: 0;
}

.status-online {
    color: var(--accent-emerald);
}

.kpi-tile {
    background: var(--bg-surface);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.metric-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.metric-stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 4px;
}

.sim-kpi-label {
    font-size: 10px;
    color: var(--text-muted);
    display: block;
}

.sim-kpi-value {
    color: var(--text-primary);
    font-weight: 700;
}

.detail-field-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.section-heading {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.sales-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.emi-calculator-card {
    margin-bottom: 20px;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.2), var(--bg-card));
    border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="light"] .emi-calculator-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), var(--bg-card));
}

.sim-metric-highlight {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.sim-metric-highlight.blue {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.35);
}

.sim-metric-highlight.green {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
}

.layout-grid-metrics .sim-span-2 {
    grid-column: span 2;
}

.pos-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    margin-bottom: 10px;
}

.pos-totals-row .form-control {
    width: 100%;
    max-width: 160px;
}

.imei-result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .imei-result-grid {
        grid-template-columns: 1fr;
    }

    .layout-grid-metrics .sim-span-2 {
        grid-column: span 1;
    }

    .card-header.toolbar-wrap .btn {
        width: auto;
    }
}

@media (max-width: 480px) {
    .pos-totals-row .form-control {
        max-width: none;
    }
}

.detail-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    background: var(--bg-surface);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 14px;
    font-size: 12px;
}

.detail-split-wide {
    grid-template-columns: 1.2fr 1fr;
}

.imei-add-row .imei-add-btn {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .detail-split,
    .detail-split-wide {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .layout-split,
    .layout-split-wide,
    .layout-split-expenses {
        grid-template-columns: 1fr;
    }

    .form-grid-2 {
        grid-template-columns: 1fr;
    }

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

    .card-header:not(.toolbar-wrap) {
        flex-direction: column;
        align-items: stretch;
    }

    .card-header:not(.toolbar-wrap) > .btn {
        width: 100%;
    }

    .toolbar > * {
        flex: 1 1 100%;
    }
}

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

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.badge-in-stock { background: rgba(16, 185, 129, 0.15); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-sold { background: rgba(148, 163, 184, 0.15); color: #CBD5E1; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-emi { background: rgba(59, 130, 246, 0.15); color: #60A5FA; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-overdue { background: rgba(244, 63, 94, 0.15); color: #FB7185; border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-paid { background: rgba(16, 185, 129, 0.15); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-pending { background: rgba(245, 158, 11, 0.15); color: #FBBF24; border: 1px solid rgba(245, 158, 11, 0.3); }

/* Buttons & Inputs */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
}
.btn-primary:hover {
    background: #1D4ED8;
}

.btn-success {
    background: var(--accent-emerald);
    color: #fff;
}
.btn-success:hover {
    background: #059669;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-whatsapp {
    background: #25D366;
    color: #fff;
    font-weight: 700;
}
.btn-whatsapp:hover {
    background: #1EBE5D;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

/* Form Controls */
.form-group {
    margin-bottom: 14px;
}

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

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    padding: 16px;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-box {
    background: var(--modal-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    padding: 24px;
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

.modal-backdrop.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
    margin-bottom: 18px;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* POS Layout Specifics */
.pos-container {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
    height: calc(100vh - var(--header-height) - 48px);
}

.pos-catalog {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-cart {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    overflow-y: auto;
}

.pos-search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.pos-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}

.pos-product-tile {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pos-product-tile:hover {
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

/* Circular EMI Live Table in POS */
.emi-circular-card {
    background: linear-gradient(145deg, rgba(30, 58, 138, 0.35), rgba(17, 24, 39, 0.7));
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 14px;
}

.emi-circular-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.emi-circular-row:last-child {
    border-bottom: none;
    font-size: 14px;
    font-weight: 800;
    color: var(--accent-blue);
    padding-top: 8px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: var(--toast-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-primary);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    color: var(--text-primary);
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlideIn 0.25s ease;
}

.toast.success { border-left-color: var(--accent-emerald); }
.toast.error { border-left-color: var(--accent-rose); }

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Theme toggle & mobile nav */
.hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.hamburger-btn:hover {
    background: var(--bg-card-hover);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
}

.theme-toggle:active {
    transform: scale(0.96);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Focus visible */
.btn:focus-visible,
.nav-item:focus-visible,
.form-control:focus-visible,
.modal-close:focus-visible,
.shortcut-chip:focus-visible,
.theme-toggle:focus-visible,
.hamburger-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.nav-item:focus-visible {
    border-color: var(--border-focus);
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-input) 0%,
        var(--bg-card-hover) 50%,
        var(--bg-input) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-pulse 1.2s ease-in-out infinite;
    border-radius: var(--radius-sm);
    min-height: 14px;
}

@keyframes skeleton-pulse {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

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

.empty-state-icon {
    font-size: 32px;
    margin-bottom: 8px;
    line-height: 1;
}

.empty-state-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-state-desc {
    font-size: 12px;
    margin-bottom: 12px;
}

.text-muted-inline {
    color: var(--text-muted);
}

/* Dashboard preview lists: ~3 rows visible, scroll if content is taller (e.g. mobile cards) */
.dashboard-panel-scroll {
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.dashboard-panel-scroll .table-responsive {
    overflow-x: visible;
}

.dashboard-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px 14px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

.dashboard-panel-footer[hidden] {
    display: none;
}

.dashboard-panel-footer .btn-link-dash {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-blue);
    cursor: pointer;
    text-decoration: none;
}

.dashboard-panel-footer .btn-link-dash:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .dashboard-panel-scroll {
        max-height: min(420px, 55vh);
    }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .topbar-shortcuts {
        display: none;
    }

    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .sidebar {
        width: 70px;
    }
    .sidebar-brand-name,
    .sidebar-brand-sub,
    .nav-section-label,
    .nav-item-label {
        display: none;
    }
    .sidebar-header {
        padding: 0 16px;
        justify-content: center;
    }
    .nav-item .nav-kbd-hint {
        display: none;
    }
}

@media (max-width: 768px) {
    .hamburger-btn {
        display: inline-flex;
    }

    .topbar-shortcuts {
        display: none;
    }

    .topbar {
        padding: 0 16px;
    }

    .view-content {
        padding: 16px;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: min(var(--sidebar-width), 88vw);
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.sidebar--open {
        transform: translateX(0);
    }

    .sidebar-brand-name,
    .sidebar-brand-sub,
    .nav-section-label {
        display: block;
    }

    .nav-item-label {
        display: block;
    }

    /* F2/F3/F4/F8 hints — desktop/tablet only; topbar shortcuts already hidden here */
    .nav-item .nav-kbd-hint {
        display: none;
    }

    .sidebar-header {
        padding: 0 20px;
        justify-content: flex-start;
    }

    .pos-container {
        height: auto;
        min-height: 0;
    }

    .sales-filter-grid {
        display: flex !important;
        flex-direction: column;
    }

    .btn,
    .btn-sm,
    .shortcut-chip,
    .theme-toggle,
    .hamburger-btn {
        min-height: 44px;
    }

    .btn-sm {
        padding: 8px 12px;
    }
}

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

/* ==========================================================================
   Mobile app-like UX — large touch targets, readable type (not shrunk UI)
   ========================================================================== */
@media (max-width: 768px) {
    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    body {
        font-size: 16px;
        line-height: 1.55;
    }

    .app-container {
        min-height: 100dvh;
    }

    .main-wrapper {
        min-height: 0;
    }

    .topbar {
        height: auto;
        min-height: 56px;
        padding: 10px 14px;
        padding-top: max(10px, env(safe-area-inset-top, 0px));
        gap: 12px;
    }

    .topbar-left {
        gap: 10px;
        min-width: 0;
        flex: 1 1 0;
        max-width: calc(100% - 118px);
    }

    .topbar-brand {
        gap: 10px;
        min-width: 0;
    }

    .topbar-heading {
        padding-right: 6px;
    }

    .topbar-logo {
        width: 44px;
        height: 44px;
        font-size: 14px;
    }

    .topbar-store-name {
        font-size: 9px;
    }

    .page-title {
        font-size: 16px;
        white-space: nowrap;
        line-height: 1.2;
    }

    .topbar-right {
        gap: 10px;
        flex-shrink: 0;
        padding-left: 4px;
    }

    .theme-toggle {
        margin-left: 2px;
    }

    .quick-action-btn {
        padding: 0 12px;
        min-width: 48px;
        margin-left: 0;
    }

    .quick-action-btn__label {
        display: none;
    }

    .quick-action-btn__icon {
        font-size: 22px;
    }

    .hamburger-btn,
    .theme-toggle {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        font-size: 22px;
        margin-right: 0;
    }

    .quick-action-btn {
        min-height: 48px;
        padding: 10px 14px;
        font-size: 14px;
    }

    .view-content {
        padding: 16px 14px max(24px, env(safe-area-inset-bottom, 0px));
    }

    .card {
        padding: 18px 16px;
    }

    .card-title {
        font-size: 16px;
        line-height: 1.35;
    }

    .card-header {
        gap: 14px;
        align-items: stretch;
    }

    .card-header.toolbar-wrap {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .card-header.toolbar-wrap > .toolbar-wrap {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .card-header.toolbar-wrap .form-control,
    .card-header.toolbar-wrap select.form-control {
        width: 100%;
        flex: 1 1 auto;
        min-width: 0;
    }

    .card-header.toolbar-wrap .btn {
        width: 100%;
    }

    .card-header.toolbar-wrap .btn,
    .card-header .toolbar .btn {
        min-height: 48px;
    }

    .card-header .toolbar {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

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

    .metric-card {
        padding: 20px 18px;
    }

    .metric-label {
        font-size: 13px;
    }

    .metric-value {
        font-size: 32px;
        margin: 8px 0;
    }

    .metric-sub {
        font-size: 14px;
    }

    .kpi-tile {
        padding: 18px;
    }

    .metric-stat-label {
        font-size: 12px;
    }

    .metric-stat-value {
        font-size: 26px;
    }

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

    .form-label {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .form-control,
    select.form-control,
    textarea.form-control {
        font-size: 16px;
        padding: 14px 14px;
        min-height: 48px;
        border-radius: 12px;
    }

    textarea.form-control {
        min-height: 100px;
        line-height: 1.5;
    }

    .btn {
        font-size: 15px;
        padding: 12px 18px;
        min-height: 48px;
        border-radius: 12px;
    }

    .btn-sm {
        font-size: 14px;
        padding: 10px 14px;
        min-height: 44px;
    }

    .badge {
        font-size: 12px;
        padding: 5px 11px;
    }

    .nav-item {
        padding: 14px 16px;
        font-size: 15px;
        min-height: 48px;
    }

    .nav-item-icon {
        font-size: 20px;
        width: 28px;
    }

    .sidebar-nav {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    table.data-table--responsive tr {
        padding: 16px 14px;
        margin-bottom: 14px;
        border-radius: 12px;
    }

    table.data-table--responsive td {
        font-size: 15px;
    }

    table.data-table--responsive td::before {
        font-size: 12px;
    }

    table.data-table--responsive td > .btn,
    table.data-table--responsive .table-actions .btn,
    table.data-table--responsive .table-actions a.btn {
        min-height: 48px;
    }

    .card .table-responsive {
        overflow: visible;
        margin: 0;
    }

    .imei-search-row {
        flex-direction: column;
    }

    .imei-search-row .form-control,
    .imei-search-row .btn {
        width: 100%;
        min-height: 48px;
    }

    .section-label,
    .detail-field-label {
        font-size: 12px;
    }

    .section-heading {
        font-size: 15px;
    }

    .sim-kpi-label {
        font-size: 12px;
    }

    .pos-search-bar {
        flex-direction: column;
        gap: 12px;
    }

    .pos-search-bar .btn {
        width: 100%;
        min-height: 48px;
    }

    .pos-items-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .pos-product-tile {
        padding: 16px;
        min-height: 0;
    }

    .pos-product-tile .btn {
        min-height: 44px;
    }

    .pos-cart {
        padding: 16px;
    }

    .pos-totals-row {
        gap: 12px;
    }

    .pos-totals-row .form-control {
        min-height: 48px;
        font-size: 16px;
    }

    .sales-filter-grid {
        gap: 12px;
    }

    .sales-filter-grid .form-control,
    .sales-filter-grid .btn {
        min-height: 48px;
        width: 100%;
    }

    .toolbar,
    .toolbar-wrap {
        gap: 10px;
    }

    .toolbar .form-control,
    .toolbar-wrap .form-control,
    .toolbar select,
    .toolbar-wrap select {
        min-height: 48px;
        font-size: 16px;
    }

    .modal-backdrop {
        padding: 0;
        align-items: flex-end;
    }

    .modal-box {
        width: 100%;
        max-width: 100%;
        max-height: min(92dvh, 92vh);
        border-radius: 20px 20px 0 0;
        padding: 20px 16px max(20px, env(safe-area-inset-bottom, 0px));
    }

    .modal-title {
        font-size: 18px;
    }

    .modal-close {
        min-width: 44px;
        min-height: 44px;
        font-size: 24px;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        bottom: max(16px, env(safe-area-inset-bottom, 0px));
    }

    .toast {
        font-size: 15px;
        padding: 14px 16px;
    }

    .dashboard-panel-footer {
        font-size: 14px;
        padding: 12px 16px 16px;
    }

    .dashboard-panel-footer .btn-link-dash {
        font-size: 14px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    button,
    .btn,
    a.nav-item,
    .hamburger-btn,
    .theme-toggle,
    input,
    select,
    textarea {
        touch-action: manipulation;
    }

    input[type="checkbox"],
    input[type="radio"] {
        width: 22px;
        height: 22px;
        min-height: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html,
    body,
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
