:root {
    /* Filtron Multipack Brand */
    --primary: #F58220;
    --primary-dark: #D96E10;
    --primary-light: #FF9500;
    --accent: #FFD200;
    --brand-black: #000000;
    --brand-dark: #111111;
    --success: #10b981;
    --warning: #FFD200;
    --danger: #ef4444;
    --info: #06b6d4;

    --sidebar-width: 270px;
    --sidebar-bg: #ffffff;
    --sidebar-brand-bg: #000000;
    --sidebar-border: #ebe6e0;
    --sidebar-text: #4b5563;
    --sidebar-text-muted: #9ca3af;
    --body-bg: #f5f5f5;
    --surface: #ffffff;
    --text: #111111;
    --text-muted: #6b7280;
    --border: #ebe6e0;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.12);
    --gradient: linear-gradient(135deg, #F58220 0%, #FF9500 45%, #FFD200 100%);
    --gradient-dark: linear-gradient(180deg, #111111 0%, #000000 100%);
    --gradient-soft: linear-gradient(135deg, rgba(245, 130, 32, 0.1) 0%, rgba(255, 210, 0, 0.08) 100%);
    --glow-orange: 0 8px 24px rgba(245, 130, 32, 0.35);
}

* { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--body-bg);
    background-image:
        radial-gradient(ellipse at 0% 0%, rgba(245, 130, 32, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(255, 210, 0, 0.05) 0%, transparent 50%);
    color: var(--text);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─── */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show { display: block; opacity: 1; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 12px;
    border-bottom: 1px solid var(--sidebar-border);
    background: var(--sidebar-bg);
}

.brand-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    width: 100%;
}

.brand-fm {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: var(--gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
    box-shadow: var(--glow-orange);
}

.brand-fm-text {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.brand-logo-wrap:hover .brand-fm {
    transform: scale(1.04);
    transition: transform 0.2s ease;
}

.brand-logo-wrap:hover .brand-logo-img {
    transform: scale(1.02);
}

.brand-icon {
    width: 46px;
    height: 46px;
    background: var(--gradient);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    box-shadow: var(--glow-orange);
}

.sidebar-brand h1 {
    margin: 0;
    font-size: 1.15rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-brand span {
    font-size: 0.72rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.sidebar-nav {
    padding: 8px 14px;
    flex: 1;
}

.nav-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    opacity: 0.75;
    padding: 16px 14px 8px;
    margin: 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.sidebar-nav .nav-link i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    opacity: 0.85;
    color: var(--primary);
}

.sidebar-nav .nav-link:hover {
    background: rgba(245, 130, 32, 0.08);
    color: var(--primary-dark);
    transform: translateX(2px);
}

.sidebar-nav .nav-link.active {
    background: var(--gradient);
    color: #fff;
    box-shadow: var(--glow-orange);
}

.sidebar-nav .nav-link.active i {
    opacity: 1;
    color: #fff;
}

.sidebar-footer {
    padding: 20px 22px;
    border-top: 1px solid var(--sidebar-border);
    font-size: 0.75rem;
    color: var(--sidebar-text-muted);
    background: #fafafa;
}

.sidebar-footer strong {
    color: var(--text);
    display: block;
    margin-bottom: 2px;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Topbar ─── */
.topbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 14px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    color: var(--text) !important;
    text-decoration: none !important;
    padding: 8px !important;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.sidebar-toggle:hover { background: var(--gradient-soft); }

.topbar-title h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.topbar-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--gradient-soft);
    border-radius: 999px;
    font-weight: 500;
}

.topbar-fy {
    font-size: 0.8rem;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(245, 130, 32, 0.12);
    border: 1px solid rgba(245, 130, 32, 0.25);
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border) !important;
    border-radius: 999px !important;
    padding: 6px 16px 6px 6px !important;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--surface) !important;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.user-menu:hover {
    border-color: var(--primary-light) !important;
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 8px;
}

.dropdown-item {
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.875rem;
}

.app-content {
    padding: 28px 32px 40px;
    flex: 1;
}

/* ─── Cards ─── */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
    overflow: hidden;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border);
    padding: 18px 24px;
    font-weight: 600;
}

.card-header h5 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card-body { padding: 24px; }

.filter-card {
    background: var(--surface);
    border: 1px solid var(--border);
}

.filter-card .card-body { padding: 20px 24px; }

/* ─── Tables ─── */
.table-responsive {
    border-radius: var(--radius);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 700;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    white-space: nowrap;
}

.table tbody td {
    font-size: 0.875rem;
    vertical-align: middle;
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text);
}

.table tbody tr {
    transition: background 0.15s ease;
}

.table tbody tr:hover { background: #fafbff; }

.table tbody tr:last-child td { border-bottom: none; }

.card-footer {
    background: #fafbfc !important;
    border-top: 1px solid var(--border);
    padding: 14px 20px;
}

/* ─── Stat cards ─── */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.stat-primary::before { background: var(--gradient); }
.stat-success::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-info::before { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
.stat-warning::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-primary .stat-icon { background: rgba(245, 130, 32, 0.12); color: var(--primary); }
.stat-success .stat-icon { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.stat-info .stat-icon { background: rgba(6, 182, 212, 0.12); color: var(--info); }
.stat-warning .stat-icon { background: rgba(245, 158, 11, 0.12); color: var(--warning); }

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.stat-info h3 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1;
}

/* ─── Dashboard ─── */
.welcome-banner {
    background: var(--gradient);
    border-radius: var(--radius);
    padding: 28px 32px;
    color: #fff;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--glow-orange);
}

.welcome-banner::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.welcome-banner h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}

.welcome-banner p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.metric-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    background: var(--surface);
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s ease;
    background: var(--surface);
}

.quick-action-btn i {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: transform 0.2s;
}

.quick-action-btn:hover {
    border-color: var(--primary-light);
    background: var(--gradient-soft);
    color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.quick-action-btn:hover i { transform: scale(1.08); }

.qa-invoice i { background: rgba(245, 130, 32, 0.12); color: var(--primary); }
.qa-payment i { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.qa-customer i { background: rgba(6, 182, 212, 0.12); color: var(--info); }
.qa-product i { background: rgba(255, 210, 0, 0.15); color: #c99200; }
.qa-ledger i { background: rgba(15, 23, 42, 0.08); color: var(--text); }

/* ─── Buttons ─── */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 9px 18px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--gradient);
    border: none;
    box-shadow: var(--glow-orange);
}

.btn-primary:hover {
    background: var(--gradient);
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 8px 28px rgba(245, 130, 32, 0.45);
}

.btn-outline-primary {
    border-color: var(--primary-light);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--gradient-soft);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.btn-light {
    background: #f8fafc;
    border-color: var(--border);
    color: var(--text-muted);
}

.btn-light:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--text);
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 8px; }

/* ─── Forms ─── */
.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 10px 14px;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(245, 130, 32, 0.15);
}

.input-group-text {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    border-color: var(--border);
    background: #f8fafc;
    color: var(--text-muted);
}

.input-group .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ─── Badges ─── */
.badge {
    font-weight: 600;
    font-size: 0.72rem;
    padding: 5px 10px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

/* ─── Alerts ─── */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

/* ─── Page header ─── */
.page-header .btn-primary {
    box-shadow: var(--glow-orange);
}

/* ─── Invoice totals ─── */
.invoice-totals {
    background: var(--gradient-soft);
    border: 1px solid rgba(245, 130, 32, 0.2);
    border-radius: var(--radius-sm);
    padding: 20px;
}

/* ─── Pagination ─── */
.pagination .page-link {
    border-radius: 8px !important;
    margin: 0 2px;
    border-color: var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
}

.pagination .page-item.active .page-link {
    background: var(--gradient);
    border-color: transparent;
}

/* ─── Login ─── */
.auth-body {
    min-height: 100vh;
    display: flex;
    margin: 0;
    background: #f0f0f0;
}

.login-page {
    display: flex;
    width: 100%;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
}

.login-form-panel {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: #f0f0f0;
}

.login-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8e8e8;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo-wrap {
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-fm {
    width: 72px;
    height: 72px;
    background: var(--gradient);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 1.9rem;
    letter-spacing: 0.02em;
    box-shadow: var(--glow-orange);
}

.login-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0;
    color: #000000;
    letter-spacing: -0.02em;
}

.login-header p {
    color: #888888;
    margin: 6px 0 0;
    font-size: 0.9rem;
}

.input-group-brand {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group-brand .input-group-text {
    background: #fafafa;
    border: none;
    color: #F58220;
    padding-left: 14px;
}

.input-group-brand .form-control {
    border: none;
    background: #fafafa;
    padding: 12px 14px;
    font-size: 0.9rem;
}

.input-group-brand .form-control:focus {
    background: #fff;
    box-shadow: none;
}

.input-group-brand:focus-within {
    border-color: #F58220;
    box-shadow: 0 0 0 3px rgba(245, 130, 32, 0.12);
}

.input-group-brand:focus-within .input-group-text,
.input-group-brand:focus-within .form-control {
    background: #fff;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #f0f0f0;
}

.login-form .btn-primary {
    padding: 13px;
    font-size: 0.95rem;
    border-radius: 10px;
    font-weight: 700;
}

/* ─── Code ─── */
code {
    background: var(--gradient-soft);
    color: var(--primary-dark);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
}

/* ─── Responsive ─── */
@media (min-width: 992px) {
    .topbar-date { display: flex; }
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .app-main { margin-left: 0; }
    .app-content { padding: 20px 16px 32px; }
    .topbar { padding: 12px 16px; }
}

@media (max-width: 575.98px) {
    .stat-card { padding: 18px; }
    .stat-info h3 { font-size: 1.4rem; }
    .welcome-banner { padding: 22px 20px; }
    .user-menu span { display: none; }
}
