:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1e293b;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #2563eb;
    --body-bg: #f1f5f9;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --card-shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
    --border-radius: 12px;
    --transition: all 0.2s ease;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--body-bg);
    color: var(--dark);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand h4 {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0;
}

.sidebar-brand small {
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-section {
    padding: 0.5rem 1.25rem;
    color: rgba(255,255,255,0.4);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.25rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.875rem;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: rgba(37, 99, 235, 0.15);
    color: #fff;
    border-left-color: var(--primary);
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 0.75rem;
    font-size: 0.9rem;
}

.sidebar-nav .nav-submenu .nav-link {
    padding-left: 2.5rem;
    font-size: 0.825rem;
}

/* Main Content */
.main-wrapper {
    margin-left: 260px;
    min-height: 100vh;
    transition: var(--transition);
}

.topbar {
    background: #fff;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--secondary);
    cursor: pointer;
    padding: 0.25rem;
}

.breadcrumb-nav {
    font-size: 0.85rem;
    color: var(--secondary);
}

.breadcrumb-nav a {
    color: var(--primary);
    text-decoration: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.content-area {
    padding: 1.5rem;
}

/* Cards */
.stat-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    border: 1px solid #e2e8f0;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--card-shadow-lg);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--secondary);
    font-weight: 500;
}

.stat-card.primary .stat-icon { background: rgba(37,99,235,0.1); color: var(--primary); }
.stat-card.success .stat-icon { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-card.danger .stat-icon { background: rgba(239,68,68,0.1); color: var(--danger); }
.stat-card.info .stat-icon { background: rgba(6,182,212,0.1); color: var(--info); }
.stat-card.danger .stat-icon { background: rgba(239,68,68,0.1); color: var(--danger); }

.sales-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 180px;
    padding: 10px 0;
    overflow-x: auto;
}

.sales-chart-bar {
    flex: 1;
    min-width: 36px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.sales-chart-bar .bar {
    width: 100%;
    max-width: 40px;
    background: linear-gradient(180deg, var(--primary-light), var(--primary));
    border-radius: 6px 6px 2px 2px;
    min-height: 4px;
    transition: height 0.3s ease;
}

.sales-chart-bar small {
    font-size: 0.65rem;
    color: var(--secondary);
    margin-top: 6px;
    white-space: nowrap;
}

.report-chart-wrap {
    position: relative;
    height: 300px;
}

.report-chart-wrap.sm {
    height: 240px;
}

.card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid #e2e8f0;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h5 {
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

/* Tables */
.table-responsive {
    border-radius: var(--border-radius);
}

.table {
    margin: 0;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--secondary);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Records table */
.records-card {
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.records-count-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
}

.records-table-wrap {
    overflow-x: auto;
}

.records-table thead th {
    font-size: 0.72rem;
    padding: 0.65rem 0.85rem;
}

.records-table tbody td {
    padding: 0.7rem 0.85rem;
}

.records-table .col-deal-gift {
    max-width: 160px;
}

.record-cell-title {
    font-weight: 600;
    color: var(--dark);
    line-height: 1.35;
}

.record-cell-sub {
    font-size: 0.75rem;
    color: var(--secondary);
    line-height: 1.35;
}

.record-sale-value {
    font-weight: 700;
    color: var(--success);
    font-size: 0.95rem;
}

.record-action-group {
    display: flex;
    gap: 0.3rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.record-action-group .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    line-height: 1;
}

.record-action-group .btn-icon:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

@media (max-width: 991.98px) {
    .records-table .col-deal-gift {
        max-width: 120px;
    }
}

/* Badges */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

.badge-active, .badge-verified { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-suspended, .badge-inactive { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge-pending { background: rgba(245,158,11,0.1); color: var(--warning); }

/* Buttons */
.btn {
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--dark);
    margin-bottom: 0.35rem;
}

/* Filters */
.filter-bar {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--card-shadow);
    border: 1px solid #e2e8f0;
}

/* Login */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #2563eb 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

.login-card h2 {
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.login-card .subtitle {
    color: var(--secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-logo {
    width: auto;
    max-width: 280px;
    height: auto;
    max-height: 100px;
    object-fit: contain;
}

.password-input-wrap {
    position: relative;
}

.password-input-wrap .form-control {
    padding-right: 2.75rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #64748b;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    cursor: pointer;
}

.password-toggle-btn:hover {
    color: var(--primary);
}

.password-toggle-btn:focus {
    outline: none;
    color: var(--primary);
}

.backup-card .backup-feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.backup-card .backup-feature-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    color: var(--secondary);
}

.backup-card .backup-feature-list i {
    color: var(--primary);
}

.image-preview-grid,
.record-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 0.5rem;
}

.image-preview-thumb,
.record-gallery-item img {
    width: 100%;
    height: 88px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.record-gallery-item {
    display: block;
    transition: transform 0.15s ease;
}

.record-gallery-item:hover {
    transform: scale(1.02);
}

.image-picker {
    position: relative;
    display: flex;
    flex-direction: column;
    margin-bottom: 0.25rem;
}

.image-picker-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.image-picker-zone {
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 12px;
    padding: 1rem;
    min-height: 110px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.image-picker-zone:hover,
.image-picker-zone:focus-visible {
    border-color: #0d6efd;
    background: #f0f7ff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12);
    outline: none;
}

.image-picker-zone.has-files {
    border-style: solid;
    border-color: #bfdbfe;
    background: #fff;
    cursor: default;
}

.image-picker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.image-picker-actions .btn {
    flex: 1 1 auto;
    min-width: 110px;
    cursor: pointer;
}

.image-picker-actions .image-picker-more {
    flex: 0 0 auto;
}

.image-picker-hint {
    display: block;
    margin-top: 0.5rem;
}

.record-form-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.record-form-nav {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: sticky;
    top: 1rem;
}

.record-form-nav-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    padding: 0.25rem 0.75rem 0.5rem;
}

.record-form-nav-item {
    border: 1px solid transparent;
    background: transparent;
    text-align: left;
    padding: 0.8rem 0.85rem;
    border-radius: 10px;
    color: var(--secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.record-form-nav-item i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
}

.record-form-nav-item:hover {
    background: #f8fafc;
    color: var(--dark);
}

.record-form-nav-item.active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: var(--primary);
    font-weight: 600;
}

.record-form-panels {
    min-width: 0;
}

.record-form-panel {
    display: none;
}

.record-form-panel.active {
    display: block;
}

@media (max-width: 991.98px) {
    .record-form-layout {
        grid-template-columns: 1fr;
    }

    .record-form-nav {
        position: static;
    }
}

.image-preview-thumb-wrap {
    position: relative;
}

.image-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-remove:hover {
    background: var(--danger);
}

.record-image-carousel {
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.record-image-carousel .carousel-inner {
    border-radius: 12px;
}

.record-carousel-link {
    display: block;
    background: #f1f5f9;
}

.record-carousel-img {
    max-height: 280px;
    object-fit: contain;
    margin: auto;
    background: #f8fafc;
}

.record-image-carousel .carousel-control-prev,
.record-image-carousel .carousel-control-next {
    width: 12%;
}

.record-image-carousel .carousel-indicators {
    margin-bottom: 0.5rem;
}

.record-image-carousel .carousel-indicators [data-bs-target] {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background-color: rgba(15, 23, 42, 0.35);
}

.record-image-carousel .carousel-indicators .active {
    background-color: var(--primary);
}

.record-carousel-meta {
    font-size: 0.75rem;
}

/* Image Preview */
.img-preview {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    object-fit: cover;
}

.record-location-map {
    height: 320px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    z-index: 1;
}

.img-thumbnail-view {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
}

/* Map */
#map {
    height: 450px;
    border-radius: var(--border-radius);
    border: 1px solid #e2e8f0;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

/* Pagination */
.pagination .page-link {
    border-radius: 8px;
    margin: 0 2px;
    border: 1px solid #e2e8f0;
    color: var(--dark);
    font-size: 0.85rem;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* Report Cards */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.report-metric {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.report-metric .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.report-metric .label {
    font-size: 0.8rem;
    color: var(--secondary);
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
}

@media (max-width: 575.98px) {
    .content-area {
        padding: 1rem;
    }
    .stat-card .stat-value {
        font-size: 1.35rem;
    }
    .filter-bar .row > div {
        margin-bottom: 0.5rem;
    }
}

/* Print */
@media print {
    .sidebar, .topbar, .filter-bar, .btn, .pagination { display: none !important; }
    .main-wrapper { margin-left: 0; }
    .content-area { padding: 0; }
}

/* Action buttons group */
.action-buttons {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Location link */
.location-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8rem;
}

.location-link:hover {
    text-decoration: underline;
}

/* Page title */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.page-header p {
    color: var(--secondary);
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Verified button special */
.btn-verified {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
    font-weight: 600;
    padding: 0.65rem 2rem;
}

.btn-verified:hover {
    background: #059669;
    border-color: #059669;
    color: #fff;
}

/* Detail grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.detail-item label {
    font-size: 0.75rem;
    color: var(--secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 0.15rem;
}

.detail-item .value {
    font-size: 0.9rem;
    color: var(--dark);
    font-weight: 500;
}

.sale-metric-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    text-align: center;
}

.sale-metric-card .metric-label {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.15rem;
}

.sale-metric-card .metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dark);
}

.sale-metric-card.highlight {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.sale-metric-card.highlight .metric-value {
    color: var(--primary);
}
