:root {
    --bg: #e8e8e8;
    --surface: #f2f2f2;
    --surface-hover: #dddddd;

    --fg: #2b2b2b;
    --fg-muted: #666666;

    --border: #cccccc;

    --accent: #c94b32;
    --accent-soft: #e9c7bf;

    --sidebar-width: 280px;

    --transition: 0.25s ease;
}

[data-theme="dark"] {
    --bg: #202124;
    --surface: #292a2d;
    --surface-hover: #333438;

    --fg: #e6e6e6;
    --fg-muted: #a8a8a8;

    --border: #414247;

    --accent: #e06a45;
    --accent-soft: #5a3026;
}


/* =========================================================
   BASE
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;

    background: var(--bg);
    color: var(--fg);

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    line-height: 1.6;

    transition:
        background-color var(--transition),
        color var(--transition);
}

button,
a {
    font: inherit;
}

button {
    color: inherit;
}


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

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;

    width: var(--sidebar-width);

    display: flex;
    flex-direction: column;

    padding: 24px 18px;

    background: var(--surface);

    border-right: 1px solid var(--border);

    z-index: 100;

    transition:
        transform var(--transition),
        background-color var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 32px;
}

.logo {
    font-size: 1.35rem;
    font-weight: 700;
}


/* =========================================================
   NAVIGATION
   ========================================================= */

.navigation {
    display: flex;
    flex-direction: column;

    gap: 6px;
}

.nav-link,
.sidebar-action {
    display: flex;
    align-items: center;

    gap: 12px;

    width: 100%;

    padding: 11px 12px;

    border: 0;
    border-radius: 8px;

    background: transparent;
    color: var(--fg);

    text-decoration: none;

    cursor: pointer;

    transition:
        background-color var(--transition),
        color var(--transition);
}

.nav-link:hover,
.sidebar-action:hover {
    background: var(--surface-hover);
}

.nav-link.active {
    background: var(--fg);
    color: var(--bg);
}

.nav-link img,
.sidebar-action img {
    width: 20px;
    height: 20px;

    flex-shrink: 0;

    filter:
        brightness(0)
        saturate(100%)
        invert(31%)
        sepia(35%)
        saturate(1450%)
        hue-rotate(333deg)
        brightness(90%);
}

.nav-link.active img {
    filter:
        brightness(0)
        saturate(100%)
        invert(1);
}


/* =========================================================
   SERVICES
   ========================================================= */

.services-navigation {
    width: 100%;
}

.services-row {
    display: flex;
    align-items: center;
}

.services-row .services-link {
    flex: 1;
}

.services-toggle {
    width: 40px;
    height: 40px;

    margin-left: 2px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 8px;

    background: transparent;

    cursor: pointer;
}

.services-toggle:hover {
    background: var(--surface-hover);
}

.services-toggle span {
    width: 8px;
    height: 8px;

    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);

    transform:
        rotate(45deg)
        translateY(-2px);

    transition:
        transform var(--transition);
}

.services-toggle.collapsed span {
    transform:
        rotate(-45deg)
        translateY(2px);
}

.services-submenu {
    display: flex;
    flex-direction: column;

    max-height: 200px;

    overflow: hidden;

    margin-left: 44px;

    transition:
        max-height var(--transition),
        opacity var(--transition);
}

.services-submenu.collapsed {
    max-height: 0;
    opacity: 0;
}

.sub-link {
    padding: 8px 12px;

    border-radius: 7px;

    color: var(--fg-muted);

    text-decoration: none;
    font-size: 0.92rem;

    transition:
        background-color var(--transition),
        color var(--transition);
}

.sub-link:hover {
    background: var(--surface-hover);
    color: var(--accent);
}


/* =========================================================
   SIDEBAR BOTTOM / ACCOUNT
   ========================================================= */

.sidebar-bottom {
    margin-top: auto;

    display: flex;
    flex-direction: column;

    gap: 6px;
}

.notification-count {
    margin-left: auto;

    min-width: 22px;
    height: 22px;

    padding: 0 5px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: var(--accent);
    color: white;

    font-size: 0.75rem;
    font-weight: 700;

    line-height: 1;

    flex-shrink: 0;
}

.notification-count[hidden] {
    display: none;
}

.account {
    display: flex;
    align-items: center;

    width: 100%;

    gap: 12px;

    margin-top: 12px;
    padding: 10px;

    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;

    background: transparent;
    color: var(--fg);

    text-align: left;

    cursor: pointer;
}

.avatar {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 50%;

    object-fit: cover;
}

.avatar.large {
    width: 46px;
    height: 46px;
}

.account-info {
    display: flex;
    flex-direction: column;

    min-width: 0;
}

.account-info strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-info small,
.popup small {
    color: var(--fg-muted);
}


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

.main {
    min-height: 100vh;

    margin-left: var(--sidebar-width);

    padding: 60px 48px;
}

.content {
    width: min(100%, 1000px);

    margin: 0 auto;
}

.hero {
    padding: 60px 0 80px;

    animation:
        page-enter 0.25s ease;
}

@keyframes page-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.eyebrow {
    margin: 0 0 12px;

    color: var(--accent);

    font-size: 0.8rem;
    font-weight: 700;

    letter-spacing: 0.12em;
}

.hero h2 {
    margin: 0 0 24px;

    font-size:
        clamp(2.2rem, 6vw, 4.5rem);

    line-height: 1.05;
}

.lead {
    max-width: 700px;

    color: var(--fg-muted);

    font-size: 1.2rem;
}

.content-section {
    padding: 48px 0;

    border-top: 1px solid var(--border);
}

.content-section h2 {
    margin-top: 0;

    font-size: 1.8rem;
}

.content-section p {
    max-width: 750px;
}


/* =========================================================
   CARDS
   ========================================================= */

.cards {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 18px;

    margin-top: 28px;
}

.card {
    padding: 24px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 12px;
}

.card h3 {
    margin-top: 0;

    color: var(--accent);
}

.card p {
    margin-bottom: 0;

    color: var(--fg-muted);
}


/* =========================================================
   MOBILE HEADER
   ========================================================= */

.mobile-header {
    display: none;
}

.icon-button,
.avatar-button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;

    padding: 0;

    border: 0;
    border-radius: 8px;

    background: transparent;

    cursor: pointer;
}

.icon-button:hover,
.avatar-button:hover {
    background: var(--surface-hover);
}

.icon-button img {
    width: 21px;
    height: 21px;

    filter:
        brightness(0)
        saturate(100%)
        invert(31%)
        sepia(35%)
        saturate(1450%)
        hue-rotate(333deg)
        brightness(90%);
}

.mobile-actions {
    display: flex;
    align-items: center;

    gap: 4px;
}

.mobile-title {
    margin: 0;

    font-size: 1rem;
}

.avatar-button {
    overflow: hidden;

    border-radius: 50%;
}

.avatar-button img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}


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

.overlay {
    display: none;

    position: fixed;

    inset: 0;

    background: rgb(0 0 0 / 40%);

    opacity: 0;

    z-index: 90;

    transition:
        opacity var(--transition);
}

.overlay.visible {
    display: block;
    opacity: 1;
}


/* =========================================================
   POPUPS
   ========================================================= */

.popup {
    display: none;

    position: fixed;

    width: 280px;

    padding: 18px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 12px;

    box-shadow:
        0 12px 40px rgb(0 0 0 / 15%);

    z-index: 300;
}

.popup.visible {
    display: block;
}

.popup-header {
    display: flex;
    align-items: center;

    gap: 12px;

    margin-bottom: 12px;
}

.popup-header > div {
    display: flex;
    flex-direction: column;
}

.popup hr {
    margin: 14px 0;

    border: 0;
    border-top: 1px solid var(--border);
}


/* =========================================================
   ACCOUNT POPUP
   ========================================================= */

.account-popup button {
    display: flex;
    align-items: center;

    gap: 12px;

    width: 100%;

    padding: 10px;

    border: 0;
    border-radius: 7px;

    background: transparent;
    color: var(--fg);

    text-align: left;

    cursor: pointer;

    transition:
        background-color var(--transition);
}

.account-popup button:hover {
    background: var(--surface-hover);
}

.account-popup button img {
    width: 19px;
    height: 19px;

    flex-shrink: 0;

    filter:
        brightness(0)
        saturate(100%)
        invert(31%)
        sepia(35%)
        saturate(1450%)
        hue-rotate(333deg)
        brightness(90%);
}


/* =========================================================
   NOTIFICATIONS
   ========================================================= */

.notifications-popup {
    width: min(
        380px,
        calc(100vw - 40px)
    );

    max-height: min(
        600px,
        calc(100vh - 40px)
    );

    overflow: hidden;

    padding-bottom: 12px;
}

.notifications-list {
    display: flex;
    flex-direction: column;

    max-height: min(
        520px,
        calc(100vh - 120px)
    );

    overflow-y: auto;

    margin-right: -6px;
    padding-right: 6px;
}

.notification {
    display: block;

    padding: 13px 12px;

    border-top: 1px solid var(--border);

    color: var(--fg);

    text-decoration: none;

    overflow-wrap: anywhere;

    transition:
        background-color var(--transition);
}

.notification:first-child {
    border-top: 0;
}

.notification strong {
    display: block;

    margin: 0;
}

.notification p {
    margin: 5px 0 0;

    color: var(--fg-muted);

    font-size: 0.9rem;

    line-height: 1.45;
}

.notification-link {
    cursor: pointer;
}

.notification-link:hover {
    background: var(--surface-hover);
}

.notifications-empty {
    padding: 18px 8px;

    color: var(--fg-muted);

    text-align: center;

    font-size: 0.95rem;
}


/* =========================================================
   ACCOUNT PAGE
   ========================================================= */

.account-page {
    max-width: 800px;
}

.account-profile {
    display: flex;
    align-items: center;

    gap: 24px;

    padding: 28px;

    margin-bottom: 28px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 16px;
}

.account-page-avatar {
    width: 76px;
    height: 76px;

    flex-shrink: 0;

    border-radius: 50%;

    object-fit: cover;
}

.account-profile h2 {
    margin: 0 0 3px;
}

.account-profile p {
    margin: 0;

    color: var(--fg-muted);
}

.account-details {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 12px;
}

.account-detail {
    min-width: 0;

    padding: 18px 20px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 12px;
}

.account-detail span {
    display: block;

    margin-bottom: 5px;

    color: var(--fg-muted);

    font-size: 0.85rem;
}

.account-detail strong {
    display: block;

    overflow-wrap: anywhere;
}


/* =========================================================
   MOBILE
   ========================================================= */

.mobile-close-button {
    display: none;
}

.mobile-account-popup {
    display: none;
}

@media (max-width: 768px) {

    .sidebar {
        transform: translateX(-100%);

        width: min(300px, 85vw);

        box-shadow:
            12px 0 30px rgb(0 0 0 / 12%);
    }

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

    .mobile-header {
        position: sticky;

        top: 0;

        height: 60px;

        display: flex;
        align-items: center;
        justify-content: space-between;

        padding: 10px 14px;

        background: var(--surface);

        border-bottom: 1px solid var(--border);

        z-index: 250;
    }

    .mobile-close-button {
        display: flex;
    }

    .main {
        margin-left: 0;

        padding:
            30px 20px 50px;
    }

    .hero {
        padding:
            40px 0 55px;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .account-profile {
        padding: 22px;

        gap: 18px;
    }

    .account-page-avatar {
        width: 64px;
        height: 64px;
    }

    .account-details {
        grid-template-columns: 1fr;
    }

    .account-detail {
        padding: 16px 18px;
    }

    .notifications-popup {
        width: calc(100vw - 28px);

        max-width: 380px;

        max-height: calc(100vh - 28px);
    }

    .notifications-list {
        max-height: calc(100vh - 120px);
    }
}

@media (max-width: 600px) {

    .account-profile {
        align-items: flex-start;
    }

    .account-profile h2 {
        font-size: 1.4rem;
    }

    .notification-count {
        min-width: 21px;
        height: 21px;

        font-size: 0.7rem;
    }
}
