@font-face {
    font-family: "IBM Plex Sans";
    src: url("assets/fonts/IBMPlexSans-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: "IBM Plex Sans";
    src: url("assets/fonts/IBMPlexSans-Text.woff2") format("woff2");
    font-weight: 450;
    font-style: normal;
}

@font-face {
    font-family: "IBM Plex Sans";
    src: url("assets/fonts/IBMPlexSans-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: "IBM Plex Sans";
    src: url("assets/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    html {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}
body {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 64px;
    height: 100vh;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    cursor: pointer;
}

.sidebar button {
    width: 32px;
    height: 32px;
    padding: 4px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 300ms ease;
    position: relative;
}

.sidebar button::after {
    content: "";
    position: absolute;
    inset: -4px;
}

.sidebar button svg path {
    transition: none;
}

@media (hover: hover) and (pointer: fine) {
    body:not(.keyboard-mode) .sidebar button:hover {
        background: rgba(0, 0, 0, 0.04);
    }

    body:not(.keyboard-mode) .sidebar button:hover svg path,
    body:not(.keyboard-mode) .sidebar button:hover svg circle {
        fill: #1f1f1f;
    }

    .sidebar button:not(.active) {
        opacity: 1;
    }

}

.spacer {
    height: 24px;
    width: 100%;
    flex-shrink: 0;
}

.profile-wrapper {
    margin-top: auto;
    flex-shrink: 0;
}

.profile {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 500;
    color: #707070;
    cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
    .profile:hover {
        background: rgba(0, 0, 0, 0.08);
    }
}

/* ── Profile Dropdown ─────────────────────────────────────────────────── */

.profile-dropdown {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 256px;
    min-width: 176px;
    padding: 8px 0;
    border-radius: 12px;
    border: 1px solid #E6E6E6;
    background: #FFF;
    box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.08);
    position: fixed;
    bottom: 56px;
    left: 16px;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 150ms ease-out, transform 150ms ease-out;
}

.profile-dropdown.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 200ms ease-out, transform 200ms ease-out;
}

.pd-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 4px 12px 12px;
    width: 100%;
}

.pd-avatar {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #767676;
    text-align: center;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 450;
    line-height: 24px;
    letter-spacing: 0;
    flex-shrink: 0;
}

.pd-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pd-name {
    overflow: hidden;
    color: #000;
    text-overflow: ellipsis;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 450;
    line-height: 24px;
    letter-spacing: 0;
    white-space: nowrap;
}

.pd-email {
    overflow: hidden;
    color: #767676;
    text-overflow: ellipsis;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 500;
    line-height: 22px;
    white-space: nowrap;
}

.pd-sep {
    width: 100%;
    height: 1px;
    background: #E6E6E6;
    flex-shrink: 0;
}

.pd-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    width: 100%;
}

.pd-items:last-child {
    padding-bottom: 0;
}

.pd-item {
    display: flex;
    width: 240px;
    padding: 4px;
    align-items: flex-start;
    gap: 8px;
    border-radius: 6px;
    cursor: pointer;
}


@media (hover: hover) and (pointer: fine) {
    .pd-item:hover {
        background: #F2F2F2;
    }
}

.pd-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.pd-item-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.pd-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pd-label {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 16px;
    font-weight: 450;
    color: #000;
    line-height: 24px;
}

.pd-sublabel {
    overflow: hidden;
    color: #767676;
    text-overflow: ellipsis;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 500;
    line-height: 22px;
    white-space: nowrap;
}

.menu-panel {
    width: 256px;
    height: 100vh;
    background: #fff;
    box-shadow: 40px 0 40px -40px rgba(31, 31, 31, 0.08);
    display: flex;
    flex-direction: column;
    overflow: visible;
    padding: 0;
    position: fixed;
    left: 64px;
    top: 0;
    transform: translateX(-4px);
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 150ms ease-out,
        transform 150ms ease-out;
}

.menu-panel.visible {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    transition:
        opacity 200ms ease-out,
        transform 200ms ease-out;
}

.menu-panel::before,
.menu-panel::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 48px;
    pointer-events: none;
    z-index: 1;
}

.menu-panel::before {
    top: 0;
    background: linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, 0) 100%);
}

.menu-panel::after {
    bottom: 0;
    background: linear-gradient(0deg, #fff 0%, rgba(255, 255, 255, 0) 100%);
}

@media (prefers-reduced-motion: reduce) {
    .menu-panel {
        transition: none !important;
    }
}

body.panel-pinned .sidebar,
body.panel-pinned .menu-panel {
    background: #fafafa;
}

body.panel-pinned .menu-panel::before {
    background: linear-gradient(180deg, #FAFAFA 0%, rgba(250, 250, 250, 0.00) 100%);
}

body.panel-pinned .menu-panel::after {
    background: linear-gradient(0deg, #FAFAFA 0%, rgba(250, 250, 250, 0.00) 100%);
}

body.panel-pinned .menu-panel {
    opacity: 1 !important;
    transform: translateX(0) !important;
    pointer-events: auto !important;
    box-shadow: none;
}

body.panel-pinned .main-content {
    margin-left: 256px;
}

.panel-action-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    padding: 4px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 100ms linear;
    z-index: 2;
    pointer-events: all;
}

@media (hover: hover) and (pointer: fine) {
    .panel-action-btn:hover {
        background: rgba(0, 0, 0, 0.04);
    }

    body.panel-pinned .panel-action-btn:hover {
        cursor: w-resize;
    }
}

.sidebar button:focus-visible,
.panel-action-btn:focus-visible,
.profile:focus-visible,
.pd-item:focus-visible,
.dp-item:focus-visible,
.menu-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.16);
}

.sidebar .logo:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.16);
    border-radius: 6px;
}

.menu-section {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 4px;
}

.menu-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 68px 16px 64px 0;
    scrollbar-width: thin;
    scrollbar-color: #dbdbdb transparent;
}

.menu-scroll::-webkit-scrollbar {
    width: 4px;
}

.menu-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.menu-scroll::-webkit-scrollbar-thumb {
    background: #dbdbdb;
    border-radius: 99px;
}

.menu-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.24);
}

.menu-section + .menu-section {
    margin-top: 40px;
}

.menu-section:not(:has(.section-label)) + .menu-section:not(:has(.section-label)) {
    margin-top: 4px;
}

.menu-divider {
    height: 12px;
}

.section-label {
    color: #767676;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 12px;
    font-style: normal;
    font-weight: 450;
    line-height: 16px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 0 0 4px 8px;
    white-space: nowrap;
}

.menu-item {
    overflow: hidden;
    color: #000;
    text-overflow: ellipsis;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 450;
    line-height: 24px;
    letter-spacing: 0;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 6px;
    text-decoration: none;
    display: block;
    transition: color 200ms ease;
}

@media (hover: hover) and (pointer: fine) {
    body:not(.keyboard-mode) .menu-item:hover {
        background: rgba(0, 0, 0, 0.04);
    }
}

.menu-panel[data-active] .menu-section.active .menu-item {
    color: #000;
}

.menu-item.selected,
.menu-panel[data-active] .menu-item.selected {
    background: rgba(0, 0, 0, 0.06);
    color: #000;
}

.menu-item.first-hover {
    background: rgba(0, 0, 0, 0.04);
}

.sidebar button.active {
    background: rgba(0, 0, 0, 0.08);
}

.sidebar button.active svg path,
.sidebar button.active svg circle {
    fill: #1f1f1f;
}

/* ── Domain Picker ───────────────────────────────────────────────────── */

.domain-picker {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 256px;
    min-width: 176px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid #E6E6E6;
    background: #FFF;
    box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.08);
    position: fixed;
    z-index: 101;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-1px);
    transition: opacity 150ms ease-out, transform 150ms ease-out;
}

.domain-picker.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    transition: opacity 200ms ease-out, transform 200ms ease-out;
}

.dp-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    width: 100%;
}

.dp-search svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.dp-input {
    border: none;
    outline: none;
    background: transparent;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 16px;
    font-weight: 450;
    color: #000;
    line-height: 24px;
    width: 100%;
    min-width: 0;
}

.dp-input::placeholder {
    color: #767676;
}

.dp-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    width: 100%;
}

.dp-item {
    display: flex;
    width: 240px;
    padding: 4px 8px;
    align-items: center;
    justify-content: space-between;
    border-radius: 6px;
    cursor: pointer;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 16px;
    font-weight: 450;
    color: #000;
    line-height: 24px;
}

.dp-item--active {
    background: #F2F2F2;
}

@media (hover: hover) and (pointer: fine) {
    .dp-item:hover {
        background: #F2F2F2;
    }
}

.dp-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Main content + Header ───────────────────────────────────────────── */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.app-header {
    width: 100%;
    height: 64px;
    display: flex;
    align-items: center;
    padding: 16px 0 16px 16px;
    flex-shrink: 0;
}

.app-header-title {
    color: #1F1F1F;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 24px;
    font-style: normal;
    font-weight: 500;
    line-height: 32px;
}

/* ── Mobile menu button (hidden on desktop) ──────────────────────────── */

.mobile-menu-btn {
    display: none;
    width: 32px;
    height: 32px;
    padding: 4px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 49;
}

.mobile-header-profile {
    display: none;
}

/* ── Mobile Panel ────────────────────────────────────────────────────── */

.mobile-panel {
    display: none;
}

/* ── Mobile layout ───────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .app-header {
        padding-left: 16px;
        padding-right: 16px;
        gap: 16px;
    }

    .menu-panel {
        display: none !important;
    }

    body.panel-pinned .main-content {
        margin-left: 0;
    }

    /* Mobile panel */
    .mobile-panel {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        z-index: 50;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
    }

    .mobile-panel.visible {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-panel-scroll {
        flex: 1;
        overflow-y: auto;
        padding: 16px 16px 32px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* Pin button active state when panel is open */
    body.mobile-panel-open .mobile-menu-btn {
        background: rgba(0, 0, 0, 0.08);
    }

    /* Header title takes remaining space so profile aligns right */
    .app-header .app-header-title {
        flex: 1;
    }

    body.mobile-panel-open .app-header-title {
        visibility: hidden;
    }


    /* Profile avatar in header — hidden by default, shown when panel open */
    .mobile-header-profile {
        display: none;
    }

    body.mobile-panel-open .mobile-header-profile {
        display: flex;
        width: 32px;
        height: 32px;
        border-radius: 6px;
        background: rgba(0, 0, 0, 0.04);
        align-items: center;
        justify-content: center;
        font-family: "IBM Plex Sans", sans-serif;
        font-size: 14px;
        font-weight: 500;
        color: #707070;
        flex-shrink: 0;
        cursor: pointer;
    }

    .mp-row {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 40px;
        padding: 8px;
        gap: 8px;
        border: none;
        background: transparent;
        cursor: pointer;
        text-align: left;
        border-radius: 6px;
    }

    .mp-row svg:first-child {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
    }

    .mp-row span {
        flex: 1;
        font-family: "IBM Plex Sans", sans-serif;
        font-size: 16px;
        font-weight: 450;
        color: #000;
        line-height: 24px;
    }

    .mp-chevron {
        flex-shrink: 0;
    }

    .mp-section.expanded .mp-chevron {
        transform: rotate(180deg);
    }

    .mp-subitems {
        display: none;
        flex-direction: column;
        gap: 4px;
        padding: 8px 0 8px 40px;
    }

    .mp-subitems .menu-item {
        border-radius: 6px;
        min-height: 40px;
        padding: 8px 12px;
        display: flex;
        align-items: center;
    }

    .mp-section.expanded .mp-subitems {
        display: flex;
    }

    .mp-row.mp-active {
        background: rgba(0, 0, 0, 0.06);
    }

}
