:root {
    --primary: #0071e3;
    --primary-dark: #0062c4;
    --primary-light: #e8f1fd;
    --gold: #d4af37;
    --gold-light: #fdf6e3;
    --gold-dark: #b8960c;
    --silver: #86868b;
    --sidebar-bg: #1c1c1e;
    --sidebar-bg-2: #2c2c2e;
    --white: #ffffff;
    --bg: #f5f5f7;
    --bg-subtle: #ebebed;
    --text: #1d1d1f;
    --text-light: #6e6e73;
    --text-muted: #aeaeb2;
    --border: #d2d2d7;
    --border-light: #e8e8ed;
    --danger: #ff3b30;
    --danger-light: #fff2f1;
    --success: #34c759;
    --success-light: #f0fdf4;
    --warning: #ff9500;
    --warning-light: #fff8ee;
    --info: #0071e3;
    --info-light: #e8f1fd;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: white;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.layout.sidebar-collapsed .sidebar { transform: translateX(-100%); }

.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    text-align: center;
}

.sidebar-header h1 {
    font-size: 1.35rem;
    color: var(--gold);
    letter-spacing: 1.5px;
    font-weight: 700;
}

.sidebar-header .subtitle {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 3px;
}

.sidebar-nav {
    padding: 10px 10px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: rgba(255,255,255,0.5);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-radius: 8px;
    margin-bottom: 2px;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.85);
}

.sidebar-nav a.active {
    background: rgba(0, 113, 227, 0.22);
    color: #5eaaff;
}

.sidebar-nav .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-section {
    padding: 14px 12px 4px;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.2);
    font-weight: 600;
}

.sidebar-user {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    background: var(--sidebar-bg);
    flex-shrink: 0;
}

.sidebar-user .user-name {
    font-size: 0.85rem;
    color: white;
    font-weight: 600;
}

.sidebar-user .user-role {
    font-size: 0.68rem;
    color: #5eaaff;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 1px;
}

.sidebar-user .store-name {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.3);
    margin-top: 2px;
}

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 0;
    min-height: 100vh;
    background: var(--bg);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.layout.sidebar-collapsed .main-content { margin-left: 0; }

.top-bar {
    background: rgba(245, 245, 247, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h2 {
    font-size: 1.15rem;
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.page-content { padding: 24px 28px; }

.card {
    background: white;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
    margin-bottom: 18px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
    font-size: 1rem;
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.01em;
}

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

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.04);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-icon.gold { background: var(--gold-light); color: var(--gold-dark); }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: #1a8f3a; }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }

.stat-value {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    margin-top: 2px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); color: white; }

.btn-secondary {
    background: white;
    color: var(--text);
    box-shadow: 0 0 0 1px var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #e0352b; color: white; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #2aab4a; }

.btn-sm { padding: 6px 13px; font-size: 0.8rem; border-radius: 7px; }

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 0.84rem;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    background: white;
    color: var(--text);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 11px 14px;
    font-size: 0.71rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    background: var(--bg);
}

td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

tr:hover { background: #fafafa; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge-gold { background: var(--gold-light); color: var(--gold-dark); }
.badge-silver { background: var(--bg-subtle); color: var(--text-light); }
.badge-bronze { background: #fef3c7; color: #92400e; }
.badge-platinum { background: var(--bg-subtle); color: #48484a; }
.badge-success { background: var(--success-light); color: #1a8f3a; }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: #b45309; }
.badge-info { background: var(--info-light); color: var(--primary); }

.tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.alert {
    padding: 11px 18px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success { background: var(--success-light); color: #166534; border-left: 3px solid var(--success); }
.alert-error { background: var(--danger-light); color: #9b1c1c; border-left: 3px solid var(--danger); }
.alert-info { background: var(--info-light); color: #1e3a5f; border-left: 3px solid var(--primary); }

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.search-bar input,
.search-bar select {
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    background: white;
    color: var(--text);
}

.search-bar input:focus,
.search-bar select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.search-bar input { flex: 1; min-width: 200px; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-light);
}

.empty-state .icon { font-size: 2.8rem; margin-bottom: 12px; opacity: 0.35; }
.empty-state p { font-size: 0.95rem; }

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

.text-gold { color: var(--gold); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-light); }
.text-right { text-align: right; }
.text-center { text-align: center; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 16px; }
.gap-1 { gap: 8px; }

.low-stock-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--danger);
    font-weight: 600;
    font-size: 0.8rem;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.15s;
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg-subtle); }

.mobile-toggle {
    display: none;
    background: transparent;
    color: var(--text);
    border: none;
    padding: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 8px;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 18px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.05);
}

.auth-card h1 {
    color: var(--text);
    font-size: 1.55rem;
    text-align: center;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
    font-weight: 700;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 28px;
}

.auth-card .btn-primary { width: 100%; justify-content: center; padding: 12px; font-size: 0.95rem; }

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.receipt {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border-radius: 14px;
    padding: 30px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
}

.receipt-header {
    text-align: center;
    border-bottom: 2px dashed var(--border);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.875rem;
}

.receipt-total {
    border-top: 2px solid var(--primary);
    padding-top: 8px;
    margin-top: 8px;
    font-weight: 700;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: block; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
    .top-bar { padding: 12px 16px; }
    .search-bar { flex-direction: column; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 24px; }
}
