* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6fb;
    color: #111827;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
}

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

/* =========================
   SIDEBAR / HEADER
========================= */

.sidebar {
    width: 220px;
    min-height: 100vh;
    background: #111827;
    color: #fff;
    padding: 18px;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 20;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
}

.logo-mark {
    width: 34px;
    height: 34px;
    background: #2563eb;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    color: #cbd5e1;
    transition: 0.15s;
}

.menu-link:hover {
    background: #1f2937;
    color: #fff;
}

.menu-link.active {
    background: #2563eb;
    color: #fff;
}

.menu-icon {
    width: 22px;
    text-align: center;
}

.sidebar-bottom {
    margin-top: auto;
}

.mini-card {
    background: #1f2937;
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #cbd5e1;
}

.mini-card strong {
    color: #fff;
}

/* =========================
   MAIN
========================= */

.main {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-height: 100vh;
}

/* =========================
   TOPBAR
========================= */

.topbar {
    height: 72px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
}

.topbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

/* Balance */

.balance-btn {
    background: #ecfdf5;
    color: #047857;
    padding: 10px 15px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 14px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.balance-btn:hover {
    background: #d1fae5;
}

.balance-label {
    color: #065f46;
    font-weight: 700;
}

/* Plan switcher desktop */

.plan-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    padding: 5px;
    border-radius: 999px;
    max-width: 100%;
}

.plan-btn {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    color: #4b5563;
    white-space: nowrap;
}

.plan-btn:hover {
    background: #e5e7eb;
}

.plan-btn.active {
    background: #2563eb;
    color: #fff;
}

/* Plan dropdown mobile / small screens */

.plan-dropdown {
    display: none;
    position: relative;
}

.plan-dropdown-btn {
    border: 0;
    background: #2563eb;
    color: #fff;
    padding: 10px 15px;
    border-radius: 999px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.plan-dropdown-btn:hover {
    background: #1d4ed8;
}

.plan-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16);
    padding: 8px;
    z-index: 50;
}

.plan-dropdown.is-open .plan-dropdown-menu {
    display: block;
}

.plan-dropdown-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 12px;
    font-weight: 700;
    color: #374151;
}

.plan-dropdown-link:hover {
    background: #f3f4f6;
}

.plan-dropdown-link.active {
    background: #eff6ff;
    color: #2563eb;
}

/* User */

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 999px;
    background: #f9fafb;
    min-width: 0;
}

.user-btn:hover {
    background: #f3f4f6;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex: 0 0 auto;
}

.user-name {
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

/* Buttons */

.icon-btn {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: #eef2ff;
    cursor: pointer;
    font-size: 18px;
}

.icon-btn:hover {
    background: #dbeafe;
}

.menu-button {
    display: none;
}

.mobile-only {
    display: none;
}

/* =========================
   CONTENT
========================= */

.content {
    padding: 28px;
}

.page-head {
    margin-bottom: 24px;
}

.page-head h1 {
    margin: 0 0 6px;
    font-size: 30px;
}

.page-head p {
    margin: 0;
    color: #6b7280;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.card {
    background: #fff;
    border-radius: 18px;
    padding: 22px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.card h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.card p {
    color: #6b7280;
}

.big {
    font-size: 30px;
    font-weight: 800;
    color: #111827 !important;
    margin: 0;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.btn {
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    background: #e5e7eb;
    cursor: pointer;
    font-weight: 700;
}

.btn:hover {
    background: #d1d5db;
}

.btn.primary {
    background: #2563eb;
    color: #fff;
}

.btn.primary:hover {
    background: #1d4ed8;
}

.btn.danger {
    background: #ef4444;
    color: #fff;
}

.btn.danger:hover {
    background: #dc2626;
}

/* =========================
   OVERLAY
========================= */

.overlay {
    display: none;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1100px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .topbar {
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        padding: 0 14px;
        gap: 8px;
    }

    .plan-switcher-desktop {
        display: none;
    }

    .plan-dropdown {
        display: block;
    }

    .balance-btn {
        padding: 9px 11px;
        font-size: 13px;
    }

    .user-name {
        display: none;
    }
}

@media (max-width: 850px) {
    .sidebar {
        left: auto;
        right: 0;
        transform: translateX(100%);
        transition: transform 0.2s ease;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        width: 100%;
    }

    .menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-only {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 15;
    }

    .overlay.is-visible {
        display: block;
    }

    .content {
        padding: 18px;
    }
}

@media (max-width: 600px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .page-head h1 {
        font-size: 26px;
    }
}

@media (max-width: 520px) {
    .topbar {
        height: 66px;
        padding: 0 10px;
        gap: 6px;
    }

    .balance-label {
        display: none;
    }

    .balance-btn {
        padding: 9px 10px;
        font-size: 13px;
    }

    .plan-dropdown-btn {
        padding: 9px 12px;
        font-size: 13px;
    }

    .user-btn {
        padding: 4px;
        background: transparent;
    }

    .avatar {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 390px) {
    .balance-btn {
        max-width: 84px;
        overflow: hidden;
    }

    .plan-dropdown-btn {
        padding: 8px 10px;
    }
}