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

:root {
    --sidebar: #0f172a;
    --sidebar-accent: #1e293b;
    --sidebar-hover: rgba(255,255,255,.09);
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --soft: #f1f5f9;
    --white: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.06);
    --shadow: 0 4px 16px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.05);
    --shadow-lg: 0 12px 32px rgba(15,23,42,.10);
    --transition: all .18s cubic-bezier(.4,0,.2,1);
}

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

body {
    margin: 0;
    background: var(--soft);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: .925rem;
    -webkit-font-smoothing: antialiased;
}

/* ── App Shell ── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: 258px;
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-accent) 100%);
    color: #fff;
    padding: 20px 12px 20px;
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    font-weight: 800;
    font-size: 1rem;
    padding: 10px 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    margin-bottom: 8px;
    line-height: 1.3;
    color: #fff;
}

.brand i { font-size: 1.7rem; color: #fbbf24; flex-shrink: 0; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,.94); padding: 4px; flex-shrink: 0; }

.sidebar .nav-link {
    color: rgba(255,255,255,.78);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .88rem;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
    letter-spacing: .01em;
}

.sidebar .nav-link i { font-size: 1.05rem; width: 20px; flex-shrink: 0; opacity: .85; }
.sidebar .nav-link:hover { background: var(--sidebar-hover); color: #fff; transform: translateX(2px); }
.sidebar .nav-link.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.sidebar .nav-link.active i { opacity: 1; }

/* ── Main content ── */
.content { margin-left: 258px; padding: 26px 30px; width: calc(100% - 258px); min-height: 100vh; }

/* ── Topbar ── */
.topbar {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 26px;
    margin-bottom: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.topbar h1 {
    font-size: 1.45rem;
    margin: 0 0 3px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--text);
}

.topbar p.text-muted { font-size: .83rem; margin: 0; }

/* ── Cards ── */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--white);
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow); }
.card-header { font-weight: 700; background: #f8fafc; border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0 !important; padding: 14px 20px; font-size: .9rem; color: #374151; letter-spacing: .01em; }
.card-body { padding: 20px; }

/* ── Stat Cards ── */
.stat-card {
    padding: 22px 22px;
    border-radius: var(--radius);
    color: #fff;
    min-height: 110px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(255,255,255,.07);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .label { opacity: .88; font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.stat-card .value { font-size: 1.8rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.stat-card i { font-size: 2.2rem; opacity: .55; flex-shrink: 0; }

.bg-blue  { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); }
.bg-green { background: linear-gradient(135deg, #16a34a 0%, #15803d 100%); }
.bg-orange{ background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.bg-red   { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }
.bg-purple{ background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%); }

/* ── Table ── */
.table { font-size: .88rem; }
.table thead th {
    background: #f8fafc;
    font-weight: 700;
    color: #475569;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 2px solid var(--border);
    padding: 11px 14px;
    white-space: nowrap;
}

.table tbody td { padding: 12px 14px; vertical-align: middle; border-bottom: 1px solid #f1f5f9; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: #f8fafc; }

.actions { white-space: nowrap; }

/* ── Buttons ── */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .85rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.btn-success:hover { box-shadow: 0 4px 12px rgba(22,163,74,.3); }
.btn-danger:hover  { box-shadow: 0 4px 12px rgba(220,38,38,.3); }

.btn-sm { font-size: .8rem; padding: .3rem .65rem; border-radius: 6px; }

.btn-group-sm > .btn { border-radius: 0; }
.btn-group-sm > .btn:first-child { border-radius: 6px 0 0 6px; }
.btn-group-sm > .btn:last-child { border-radius: 0 6px 6px 0; }
.btn-group-sm > .btn:only-child { border-radius: 6px; }

/* ── Badges ── */
.badge {
    font-weight: 600;
    padding: .38em .75em;
    border-radius: 6px;
    font-size: .76rem;
    letter-spacing: .01em;
}

/* ── Form controls ── */
.form-label { font-weight: 600; color: #374151; font-size: .85rem; margin-bottom: .35rem; }
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    font-size: .88rem;
    padding: .5rem .85rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.input-group-text { border-color: var(--border); background: #f8fafc; }
.input-group > .form-control:not(:first-child) { border-left-color: transparent; }
.input-group > .form-control:not(:first-child):focus { border-left-color: var(--primary); }

/* ── Alerts ── */
.alert { border-radius: var(--radius-sm); font-size: .88rem; border: none; }
.alert-success { background: #f0fdf4; color: #15803d; border-left: 4px solid #22c55e; }
.alert-danger  { background: #fef2f2; color: #b91c1c; border-left: 4px solid #ef4444; }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid #f59e0b; }
.alert-info    { background: #eff6ff; color: #1e40af; border-left: 4px solid #60a5fa; }

/* ── Summary grid ── */
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.summary-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    transition: var(--transition);
}

.summary-item:hover { background: #f1f5f9; border-color: #cbd5e1; }
.summary-item span { display: block; color: #64748b; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.summary-item strong { font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; }

/* ── Receipt ── */
.receipt-box { max-width: 780px; margin: 0 auto; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); }
.receipt-title { font-size: 1.75rem; font-weight: 900; letter-spacing: .04em; }

/* ── Login ── */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%); padding: 20px; }
.login-card { width: 100%; max-width: 430px; border-radius: 22px; box-shadow: var(--shadow-lg); }
.login-logo { max-height: 90px; max-width: 180px; object-fit: contain; margin-bottom: 14px; }

/* ── Scroll-to-top ── */
#scrollTopBtn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 999;
    transition: var(--transition);
    font-size: 1rem;
}

#scrollTopBtn.visible { display: flex; }
#scrollTopBtn:hover { background: var(--primary-dark); transform: translateY(-2px); }

/* ── Misc ── */
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

.fw-semibold { font-weight: 600; }
.text-muted { color: var(--text-muted) !important; }

.page-section-label { font-size: .75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .sidebar { position: static; width: 100%; padding: 14px 10px; }
    .app-shell { display: block; }
    .content { margin-left: 0; width: 100%; padding: 14px; }
    .topbar { flex-direction: column; align-items: flex-start; padding: 16px; }
    .summary-grid { grid-template-columns: 1fr; }
    #scrollTopBtn { bottom: 16px; right: 16px; }
}

/* ── Print ── */
@media print {
    .sidebar, .topbar, .no-print, .btn, nav, #scrollTopBtn { display: none !important; }
    .content { margin: 0; width: 100%; padding: 0; }
    body { background: #fff; }
    .card, .receipt-box { box-shadow: none; border: 1px solid #ccc; }
    a[href]:after { content: none !important; }
}
