* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1a1a1a;
    background-color: #f5f5f5;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: #2563eb;
    text-decoration: none;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.env-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #e0e7ff;
    color: #3730a3;
    border-radius: 4px;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.version {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* ---- Top Bar ---- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 56px;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1a1a1a;
}

.topbar-logo {
    width: 28px;
    height: 28px;
}

.topbar-env-badge {
    padding: 0.125rem 0.5rem;
    background-color: #e0e7ff;
    color: #3730a3;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Per-environment colours (prod has no badge). Each bg is saturated enough that
   white text reads clearly. */
.topbar-env-badge[data-env="preview"] {
    background-color: #dc2626;
    color: #ffffff;
}

.topbar-env-badge[data-env="dev"] {
    background-color: #2563eb;
    color: #ffffff;
}

.topbar-env-badge[data-env="staging"] {
    background-color: #16a34a;
    color: #ffffff;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-user-name {
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-btn:hover {
    opacity: 0.85;
}

.topbar-avatar {
    display: block;
    width: 32px;
    height: 32px;
}

.topbar-avatar-img {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.topbar-avatar-placeholder {
    display: flex;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #e0e7ff;
    color: #3730a3;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8125rem;
}

/* ---- Hamburger Menu ---- */

.hamburger-menu {
    position: fixed;
    top: 56px;
    right: 1rem;
    width: 280px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 200;
    overflow: hidden;
}

.menu-section {
    padding: 0.75rem 1rem;
}

.menu-profile-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.menu-profile-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.menu-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.menu-avatar-placeholder {
    display: flex;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e0e7ff;
    color: #3730a3;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.menu-profile-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #1a1a1a;
}

.menu-profile-email {
    font-size: 0.8125rem;
    color: #6b7280;
}

.menu-profile-tz {
    font-size: 0.75rem;
    color: #9ca3af;
}

.menu-divider {
    height: 1px;
    background-color: #e5e7eb;
}

.menu-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    padding: 0.5rem 1rem 0.25rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

.menu-item:hover {
    background-color: #f3f4f6;
}

.menu-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.menu-item-external {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    margin-left: auto;
    opacity: 0.45;
}

.menu-item-danger {
    color: #991b1b;
}

.menu-env-item {
    font-size: 0.8125rem;
}

/* Non-prod env links: 3px smaller than the 13px base. */
.menu-env-nonprod {
    font-size: 0.625rem;
}

/* Colored dot before each non-prod env name; 1em so it tracks the text size.
   Colors match the per-environment topbar badge colors above. */
.menu-env-dot {
    display: inline-block;
    width: 1em;
    height: 1em;
    border-radius: 50%;
    flex-shrink: 0;
}

.menu-env-dot-preview {
    background-color: #dc2626;
}

.menu-env-dot-dev {
    background-color: #2563eb;
}

.menu-env-dot-staging {
    background-color: #16a34a;
}

.menu-env-current {
    background-color: #eff6ff;
    font-weight: 600;
    color: #1d4ed8;
}

.menu-env-section {
    padding-bottom: 0.25rem;
}

/* ---- Impersonation Banner ---- */

.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    background-color: #7c3aed;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 500;
    position: sticky;
    top: 56px;
    z-index: 99;
}

.impersonation-actions {
    display: flex;
    gap: 0.5rem;
}

.impersonation-btn {
    padding: 0.25rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
}

.impersonation-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ---- Main Content ---- */

.main-content {
    min-height: calc(100vh - 56px);
}

/* ---- Responsive ---- */

@media (max-width: 640px) {
    .topbar {
        padding: 0 1rem;
    }

    .topbar-user-name {
        display: none;
    }

    .hamburger-menu {
        width: calc(100vw - 2rem);
        right: 1rem;
    }

    .impersonation-banner {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
}

/* Build / version chip in the hamburger menu (spec 0095). */
.menu-build {
    padding: 0.5rem 1rem 0.625rem;
    font-size: 0.6875rem;
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.menu-build-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.menu-build-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: #6b7280;
}
.menu-build-sha {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: #4f46e5;
    text-decoration: none;
}
.menu-build-branch {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 11rem;
}
.menu-build-time { color: #9ca3af; }
