/* ===== RESET ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f1f5f9; color: #1e293b; }
a { text-decoration: none; color: inherit; }

#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ===== HEADER ===== */
.header {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #475569;
    padding: 4px 8px;
}
.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e3a8a;
}
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
}
.header-nav a {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    color: #475569;
    transition: 0.2s;
}
.header-nav a:hover { background: #f1f5f9; }
.header-nav a.active {
    background: #1e3a8a;
    color: #ffffff;
}
.header-nav .logout {
    color: #dc2626;
}
.header-nav .logout:hover { background: #fee2e2; }

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.username {
    font-size: 0.875rem;
    color: #475569;
}
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1e3a8a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

/* ===== SIDEBAR (Mobile only) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.show { opacity: 1; }

.sidebar-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: #0f172a;
    color: #fff;
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 61;
    overflow-y: auto;
    box-shadow: 2px 0 12px rgba(0,0,0,0.3);
}
.sidebar-panel.open { transform: translateX(0); }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #334155;
}
.sidebar-header span {
    font-size: 1.25rem;
    font-weight: 700;
}
.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}
.sidebar-nav {
    padding: 0.75rem;
}
.sidebar-nav a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    color: #cbd5e1;
    transition: 0.2s;
    margin-bottom: 0.25rem;
}
.sidebar-nav a:hover { background: #1e293b; color: #fff; }
.sidebar-nav a.active { background: #1e3a8a; color: #fff; }
.sidebar-nav .logout { color: #f87171; }

/* ===== BOTTOM NAV (Mobile only) ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    height: 64px;
    align-items: center;
    justify-content: space-around;
    padding: 0 0.5rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #94a3b8;
    font-size: 0.65rem;
    transition: color 0.2s;
}
.bottom-nav a svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}
.bottom-nav a span { margin-top: 2px; }
.bottom-nav a.active { color: #1e3a8a; }

.bottom-nav .invoice-btn {
    position: relative;
    top: -10px;
}
.bottom-nav .invoice-btn .icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: #1e3a8a;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(30,58,138,0.3);
}
.bottom-nav .invoice-btn .icon-wrap svg {
    stroke: #fff;
    width: 28px;
    height: 28px;
}
.bottom-nav .invoice-btn span:last-child {
    color: #1e3a8a;
    font-weight: 600;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
}
.main-content .container {
    padding: 0 1rem;
}

/* ===== CARDS ===== */
.card {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: #fff;
    padding: 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid #3b82f6;
}
.stat-card .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.05em;
}
.stat-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}
.stat-card:nth-child(2) { border-color: #22c55e; }
.stat-card:nth-child(3) { border-color: #6366f1; }
.stat-card:nth-child(4) { border-color: #eab308; }
.stat-card:nth-child(5) { border-color: #a855f7; }
.stat-card:nth-child(6) { border-color: #ef4444; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { text-align: left; padding: 0.75rem; border-bottom: 2px solid #e2e8f0; color: #475569; font-weight: 600; }
td { padding: 0.75rem; border-bottom: 1px solid #e2e8f0; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}
.btn-primary { background: #1e3a8a; color: #fff; }
.btn-primary:hover { background: #152b5e; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-warning { background: #ca8a04; color: #fff; }
.btn-warning:hover { background: #a16207; }

/* ===== TOAST ===== */
#toastContainer {
    position: fixed;
    bottom: 80px;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 20rem;
    width: 100%;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    padding: 0.75rem 1rem;
    background: #1e293b;
    color: #fff;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    animation: slideUp 0.3s ease;
    font-size: 0.875rem;
}
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.warning { background: #ca8a04; }
.toast button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
    .hamburger { display: block; }
    .header-nav { display: none; }
    .username { display: none; }
    .bottom-nav { display: flex; }
    .main-content { padding: 1rem 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
    .hamburger { display: none; }
    .header-nav { display: flex; }
    .bottom-nav { display: none; }
    .sidebar-overlay, .sidebar-panel { display: none !important; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}