:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 74px;
    --topbar-height: 58px;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --dark: #0f172a;
    --dark-2: #111827;
    --light: #f3f4f6;
    --white: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, Helvetica, sans-serif;
    background: #f8fafc;
    color: var(--text);
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font: inherit;
}

.layout {
    min-height: 100vh;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #fff;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    overflow: hidden;
    transition: width 0.25s ease, transform 0.25s ease;
    box-shadow: 4px 0 18px rgba(15, 23, 42, 0.08);
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 700;
    white-space: nowrap;
}

.brand-badge {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 14px;
}

.brand-text {
    transition: opacity 0.2s ease, width 0.25s ease;
    white-space: nowrap;
}

.sidebar-menu {
    padding: 14px 12px 30px;
    overflow-y: auto;
    height: calc(100vh - var(--topbar-height));
}

.menu-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.45);
    margin: 18px 10px 8px;
    white-space: nowrap;
}

.menu-item,
.menu-link {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    margin-bottom: 4px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.82);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.menu-item:hover,
.menu-link:hover,
.menu-item.active,
.menu-group.open > .menu-link {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
}

.menu-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.menu-icon {
    width: 20px;
    text-align: center;
    flex: 0 0 auto;
}

.menu-label {
    flex: 1;
    text-align: left;
    transition: opacity 0.18s ease;
}

.menu-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.menu-group.open .menu-arrow {
    transform: rotate(90deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
    padding-left: 16px;
}

.menu-group.open .submenu {
    max-height: 500px;
}

.submenu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 4px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.72);
    transition: all 0.18s ease;
}

.submenu a:hover,
.submenu a.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* Main area */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.25s ease;
    min-width: 0;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 0 18px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.icon-btn:hover {
    background: #f3f4f6;
}

.topbar-search {
    position: relative;
    min-width: 280px;
}

.topbar-search input {
    width: 100%;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 14px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.topbar-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.topbar-select {
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 10px;
    background: #fff;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.18s ease;
    position: relative;
}

.user-chip:hover {
    background: #f9fafb;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1d4ed8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-meta {
    line-height: 1.1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.user-role {
    font-size: 12px;
    color: var(--muted);
    text-transform: capitalize;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 190px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.18s ease;
    z-index: 1200;
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text);
}

.dropdown-menu a:hover {
    background: #f3f4f6;
}

/* Content */
.content {
    padding: 22px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.page-title {
    margin: 0;
    font-size: 26px;
}

.page-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.18s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-light {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-light:hover {
    background: #f9fafb;
}

/* Cards */
.grid {
    display: grid;
    gap: 18px;
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: fadeUp 0.28s ease;
}

.card-body {
    padding: 18px;
}

.card-title {
    margin: 0 0 14px;
    font-size: 16px;
}

.stat-card {
    padding: 18px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -22px;
    top: -22px;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.08);
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
}

.stat-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.table tbody tr {
    transition: background 0.15s ease;
}

.table tbody tr:hover {
    background: #f9fafb;
}

/* Alerts */
.alert {
    padding: 13px 15px;
    border-radius: 12px;
    margin-bottom: 16px;
    animation: fadeUp 0.22s ease;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Auth */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 28%),
        radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.18), transparent 24%),
        #f8fafc;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 28px;
    animation: fadeUp 0.3s ease;
}

.auth-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 14px;
}

.form-control {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 12px;
    margin-bottom: 16px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea.form-control {
    height: auto;
    padding: 12px;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

/* Collapsed sidebar desktop */
.layout.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.layout.sidebar-collapsed .main {
    margin-left: var(--sidebar-collapsed-width);
}

.layout.sidebar-collapsed .brand-text,
.layout.sidebar-collapsed .menu-label,
.layout.sidebar-collapsed .menu-arrow,
.layout.sidebar-collapsed .menu-section-title,
.layout.sidebar-collapsed .submenu {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.layout.sidebar-collapsed .menu-item,
.layout.sidebar-collapsed .menu-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

/* Overlay */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 990;
}

.layout.sidebar-mobile-open .overlay {
    opacity: 1;
    visibility: visible;
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .layout.sidebar-mobile-open .sidebar {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
    }

    .layout.sidebar-collapsed .main {
        margin-left: 0;
    }

    .layout.sidebar-collapsed .sidebar {
        width: var(--sidebar-width);
    }

    .layout.sidebar-collapsed .brand-text,
    .layout.sidebar-collapsed .menu-label,
    .layout.sidebar-collapsed .menu-arrow,
    .layout.sidebar-collapsed .menu-section-title,
    .layout.sidebar-collapsed .submenu {
        opacity: 1;
        width: auto;
    }

    .topbar-search {
        display: none;
    }
}

@media (max-width: 768px) {
    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-meta {
        display: none;
    }
}
.btn-danger {
    background: #dc2626;
    color: #ffffff;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.action-form {
    display: inline;
    margin-left: 6px;
}




/* ================= Dashboard ================= */

.dash-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.welcome-banner {
    background: #d9f7e1;
    border-left: 5px solid #16a34a;
    color: #14532d;
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeUp 0.35s ease;
}

.privacy-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6b7280;
    font-size: 14px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 999px;
    transition: 0.25s;
}

.switch-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: 0.25s;
}

.switch input:checked + .switch-slider {
    background: #2563eb;
}

.switch input:checked + .switch-slider:before {
    transform: translateX(22px);
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.dash-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
    animation: fadeUp 0.4s ease;
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

.dash-card h3 {
    margin: 0 0 16px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.dash-card .card-tools select {
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 8px;
    background: #ffffff;
    text-transform: none;
    letter-spacing: normal;
    font-size: 13px;
}

.big-num {
    font-size: 26px;
    font-weight: 800;
    color: #111827;
}

.big-num small {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.sub-label {
    color: #6b7280;
    font-size: 13px;
}

.row-between {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 14px 0 6px;
}

.row-between .col strong {
    display: block;
    font-size: 16px;
}

.row-between .col.right {
    text-align: right;
}

.bar {
    height: 10px;
    border-radius: 6px;
    background: #e5e7eb;
    overflow: hidden;
    display: flex;
    margin: 6px 0 4px;
}

.bar span {
    display: block;
    height: 100%;
    width: 0;
    transition: width 1.1s ease;
}

.bar .seg-grey { background: #9ca3af; }
.bar .seg-light { background: #d1d5db; }
.bar .seg-green-light { background: #8ed64a; }
.bar .seg-green { background: #16a34a; }
.bar .seg-teal { background: #0f766e; }

.link-small {
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
}

.bank-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.bank-row .bank-name {
    font-weight: 700;
}

.bank-row .bank-balance {
    text-align: right;
    font-weight: 700;
}

.bank-footer {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.empty-note {
    color: #6b7280;
    text-align: center;
    margin: auto;
}

/* Carousel */
.carousel-body {
    flex: 1;
}

.carousel-title {
    font-size: 18px;
    font-weight: 800;
    margin: 4px 0 6px;
}

.carousel-title:after {
    content: "";
    display: block;
    width: 60px;
    height: 4px;
    background: #f59e0b;
    border-radius: 2px;
    margin-top: 8px;
}

.carousel-text {
    color: #374151;
    font-size: 14px;
    line-height: 1.5;
}

.carousel-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 18px;
}

.carousel-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    cursor: pointer;
    transition: background 0.2s;
}

.carousel-dots .dot.active {
    background: #16a34a;
}

@media (max-width: 1200px) {
    .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
    .dash-grid { grid-template-columns: 1fr; }
}