/* Topbar Component Styles */
:root {
    --panel: rgba(12, 26, 44, 0.78);
    --panel-soft: rgba(11, 22, 38, 0.62);
    --surface-1: rgba(18, 38, 63, 0.56);
    --surface-2: rgba(24, 50, 81, 0.62);
    --surface-border: rgba(108, 177, 255, 0.24);
    --surface-border-strong: rgba(124, 194, 255, 0.38);
    --surface-shadow: 0 16px 34px rgba(2, 9, 18, 0.42);
    --surface-shadow-lg: 0 22px 46px rgba(2, 9, 18, 0.52);
    --accent: #00aeef;
    --accent-2: #3b82f6;
    --text-1: #edf5ff;
    --muted: #a8c2e3;
    --glow: 0 0 0 1px rgba(120, 201, 255, 0.22), 0 0 22px rgba(52, 127, 255, 0.2);
    --danger-soft: rgba(220, 38, 38, 0.12);
    --danger-text-soft: #f88695;
}

html[data-theme="sunset"] .topbar {
    --panel: rgba(248, 252, 255, 0.94);
    --panel-soft: rgba(240, 248, 255, 0.9);
    --surface-1: rgba(234, 243, 255, 0.95);
    --surface-2: rgba(223, 236, 254, 0.96);
    --surface-border: rgba(106, 151, 207, 0.34);
    --surface-border-strong: rgba(93, 142, 201, 0.45);
    --text-1: #163452;
    --muted: #3f5e81;
    --danger-soft: rgba(209, 73, 94, 0.12);
    --danger-text-soft: #cb4b64;
    border-color: rgba(116, 160, 215, 0.42);
    background: linear-gradient(135deg, rgba(250, 253, 255, 0.9), rgba(241, 248, 255, 0.82));
    box-shadow: 0 16px 34px rgba(92, 129, 182, 0.22);
}

html[data-theme="sunset"] .topbar .brand {
    color: #183656;
}

html[data-theme="sunset"] .topbar .brand-mark {
    background: linear-gradient(145deg, rgba(242, 250, 255, 0.95), rgba(220, 237, 255, 0.88));
    border-color: rgba(109, 158, 218, 0.5);
    box-shadow: 0 0 0 1px rgba(118, 167, 224, 0.24), 0 10px 22px rgba(86, 134, 194, 0.2);
}

html[data-theme="sunset"] .topbar .brand-title .title-sheet {
    color: #2a78c7;
    text-shadow: 0 0 12px rgba(63, 133, 214, 0.22);
}

html[data-theme="sunset"] .topbar .brand-title .title-genie {
    color: #cf9a1f;
    text-shadow: 0 0 12px rgba(207, 154, 31, 0.18);
}

html[data-theme="sunset"] .topbar .brand-subtitle {
    color: #5a7394;
}

html[data-theme="sunset"] .status-pill {
    color: #f7fbff;
    text-shadow: 0 1px 0 rgba(18, 51, 86, 0.22);
    box-shadow: 0 0 0 1px rgba(99, 150, 217, 0.2), 0 0 18px rgba(91, 149, 218, 0.2);
}

html[data-theme="sunset"] .user-pill {
    background: linear-gradient(135deg, rgba(251, 255, 255, 0.94), rgba(238, 247, 255, 0.92));
    border-color: rgba(114, 160, 216, 0.4);
    box-shadow: 0 8px 18px rgba(105, 145, 196, 0.12);
}

html[data-theme="sunset"] .user-pill:hover {
    background: linear-gradient(135deg, rgba(245, 251, 255, 0.98), rgba(231, 242, 255, 0.95));
}

html[data-theme="sunset"] .user-pill[aria-expanded="true"] {
    background: linear-gradient(135deg, rgba(242, 249, 255, 0.99), rgba(225, 239, 255, 0.96));
    border-color: rgba(89, 141, 203, 0.56);
    box-shadow:
        0 0 0 1px rgba(100, 151, 213, 0.18),
        0 14px 28px rgba(103, 146, 199, 0.18);
}

html[data-theme="sunset"] .user-name {
    color: #183656;
}

html[data-theme="sunset"] .user-pill[aria-expanded="true"] .user-name {
    color: #143554;
}

html[data-theme="sunset"] .user-pill[aria-expanded="true"] .avatar {
    background: linear-gradient(135deg, #2f8df2, #5b6cff);
    box-shadow: 0 8px 16px rgba(75, 121, 196, 0.24);
}

html[data-theme="sunset"] .settings-menu {
    background: rgba(252, 255, 255, 0.95);
    border-color: rgba(115, 161, 216, 0.42);
    box-shadow: 0 14px 30px rgba(92, 129, 182, 0.22);
}

html[data-theme="sunset"] .quick-user-head {
    background: rgba(244, 250, 255, 0.92);
    border-color: rgba(115, 161, 216, 0.34);
}

html[data-theme="sunset"] .quick-user-avatar {
    box-shadow: 0 0 0 1px rgba(111, 158, 214, 0.3), 0 8px 16px rgba(96, 144, 201, 0.2);
}

html[data-theme="sunset"] .quick-user-plan {
    color: #274b73;
    border-color: rgba(99, 147, 206, 0.34);
    background: rgba(228, 240, 255, 0.94);
}

html[data-theme="sunset"] .quick-upgrade-hint {
    color: #31577f;
    background: linear-gradient(135deg, rgba(213, 238, 255, 0.84), rgba(205, 225, 255, 0.8));
    border-color: rgba(102, 150, 209, 0.34);
}

html[data-theme="sunset"] .settings-group .settings-item {
    border-color: rgba(116, 161, 217, 0.18);
    background: rgba(246, 251, 255, 0.8);
}

html[data-theme="sunset"] .quick-plan-status,
html[data-theme="sunset"] .quick-plan-usage {
    color: #21476b;
    background: rgba(228, 241, 255, 0.94);
    border-color: rgba(102, 151, 210, 0.34);
}

html[data-theme="sunset"] .quick-plan-hint {
    color: #31577f;
}

html[data-theme="sunset"] .settings-item.upgrade-item {
    border-color: rgba(96, 145, 205, 0.52);
    background: linear-gradient(135deg, rgba(90, 139, 208, 0.2), rgba(101, 169, 236, 0.18));
    box-shadow: 0 0 0 1px rgba(101, 151, 210, 0.24), 0 10px 22px rgba(103, 153, 211, 0.24);
}

html[data-theme="sunset"] .settings-item.logout-item {
    background: rgba(255, 244, 247, 0.82);
    border-color: rgba(216, 122, 142, 0.26);
}

html[data-theme="sunset"] .settings-header {
    border-bottom-color: rgba(112, 158, 214, 0.26);
}

html[data-theme="sunset"] .settings-title,
html[data-theme="sunset"] .settings-item-title {
    color: #163454;
}

html[data-theme="sunset"] .settings-subtitle,
html[data-theme="sunset"] .settings-item-desc {
    color: #3f5e81;
    font-weight: 500;
}

html[data-theme="sunset"] .settings-item:hover {
    background: rgba(236, 246, 255, 0.8);
}

html[data-theme="sunset"] .settings-item-icon {
    background: rgba(226, 239, 255, 0.86);
    color: #346391;
}

html[data-theme="sunset"] .language-switcher,
html[data-theme="sunset"] .theme-switcher {
    background: rgba(250, 254, 255, 0.88);
    border-color: rgba(112, 158, 214, 0.3);
}

html[data-theme="sunset"] .lang-btn,
html[data-theme="sunset"] .theme-btn {
    color: #5a7394;
}

html[data-theme="sunset"] .lang-btn.active,
html[data-theme="sunset"] .lang-btn:hover,
html[data-theme="sunset"] .theme-btn.active,
html[data-theme="sunset"] .theme-btn:hover {
    color: #143554;
    border-color: rgba(95, 146, 207, 0.46);
    background: linear-gradient(135deg, rgba(104, 159, 224, 0.18), rgba(125, 176, 236, 0.14));
    box-shadow: 0 0 0 1px rgba(100, 151, 213, 0.2), 0 0 18px rgba(114, 166, 228, 0.2);
}

html[data-theme="sunset"] .theme-label {
    color: #5a7394;
}

html[data-theme="sunset"] .icon-btn {
    background: rgba(248, 253, 255, 0.9);
    border-color: rgba(111, 158, 214, 0.32);
    color: #1d3b5f;
}

html[data-theme="sunset"] .nav-link-pill {
    background: transparent;
    border-color: transparent;
    color: #4c6989;
}

html[data-theme="sunset"] .nav-link-pill:hover,
html[data-theme="sunset"] .nav-link-pill.active {
    color: #143554;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

html[data-theme="sunset"] .topbar-utility-dock {
    background: linear-gradient(135deg, rgba(250, 253, 255, 0.9), rgba(241, 248, 255, 0.82));
    border-color: rgba(116, 160, 215, 0.42);
    box-shadow: 0 16px 34px rgba(92, 129, 182, 0.2);
}

html[data-theme="sunset"] .utility-dock-toggle {
    background: linear-gradient(135deg, rgba(248, 253, 255, 0.92), rgba(234, 244, 255, 0.88));
    border-color: rgba(111, 158, 214, 0.34);
    color: #183656;
}

html[data-theme="sunset"] .utility-dock-toggle:hover {
    border-color: rgba(95, 146, 207, 0.48);
    box-shadow: 0 0 0 1px rgba(100, 151, 213, 0.16), 0 14px 28px rgba(114, 166, 228, 0.16);
}

html[data-theme="sunset"] .topbar-utility-dock.is-collapsed {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

html[data-theme="sunset"] .topbar-utility-dock.is-collapsed .utility-dock-toggle {
    background: linear-gradient(135deg, rgba(251, 255, 255, 0.96), rgba(232, 243, 255, 0.9));
    border-color: rgba(95, 146, 207, 0.42);
    box-shadow:
        0 0 0 1px rgba(100, 151, 213, 0.14),
        0 14px 30px rgba(114, 166, 228, 0.18);
}

html[data-theme="sunset"] .utility-toggle-icon {
    background: rgba(226, 239, 255, 0.86);
    color: #1d4c80;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

html[data-theme="sunset"] .utility-toggle-label {
    color: #183656;
}

html[data-theme="sunset"] .utility-toggle-chevron {
    border-color: rgba(63, 94, 129, 0.8);
}

html[data-theme="sunset"] .utility-label {
    color: #5a7394;
}
.topbar {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: min(1320px, calc(100% - 32px));
    min-height: 78px;
    padding: 0 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    z-index: 1000;
    border-radius: 30px;
    border: 1px solid var(--surface-border-strong);
    background: linear-gradient(135deg, var(--panel), color-mix(in srgb, var(--panel-soft) 85%, transparent));
    box-shadow: var(--surface-shadow-lg, var(--surface-shadow));
    backdrop-filter: blur(24px);
}

.topbar.reveal-item {
    transform: translateX(-50%) translateY(24px);
}

.topbar.reveal-item.is-visible {
    transform: translateX(-50%) translateY(0);
}

.topbar-utility-dock {
    position: fixed;
    top: 50%;
    right: 18px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: min(212px, calc(100vw - 36px));
    padding: 10px;
    border-radius: 26px;
    border: 1px solid var(--surface-border-strong);
    background: linear-gradient(135deg, var(--panel), color-mix(in srgb, var(--panel-soft) 88%, transparent));
    box-shadow: var(--surface-shadow);
    backdrop-filter: blur(22px);
    transform: translateY(-50%);
    z-index: 990;
    overflow: hidden;
    transition:
        width 0.28s ease,
        padding 0.28s ease,
        border-color 0.24s ease,
        box-shadow 0.24s ease,
        background 0.24s ease,
        transform 0.18s ease;
    touch-action: none;
    user-select: none;
}

.topbar-utility-dock.is-collapsed {
    width: 56px;
    padding: 0;
    border-radius: 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    overflow: visible;
}

.topbar-utility-dock.is-dragging {
    transition: none;
    cursor: grabbing;
    box-shadow: 0 0 0 1px rgba(120, 201, 255, 0.32), 0 22px 42px rgba(2, 9, 18, 0.38), 0 0 28px rgba(59, 130, 246, 0.24);
}

.utility-dock-toggle {
    width: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--surface-border);
    border-radius: 18px;
    background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
    color: var(--text-1);
    cursor: pointer;
    transition:
        transform 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease,
        background 0.22s ease;
    touch-action: none;
}

.utility-dock-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--surface-border-strong);
    box-shadow: var(--glow);
}

.topbar-utility-dock.is-dragging .utility-dock-toggle,
.topbar-utility-dock.is-dragging .utility-dock-toggle:hover {
    transform: none;
    cursor: grabbing;
}

.utility-toggle-main {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.utility-toggle-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 174, 239, 0.2), rgba(59, 130, 246, 0.18));
    color: #d8ecff;
    font-size: 1rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.utility-toggle-icon .topbar-inline-icon,
.settings-item-icon .topbar-inline-icon {
    width: 18px;
    height: 18px;
    display: block;
    color: currentColor;
}

.utility-toggle-label {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--text-1);
    white-space: nowrap;
}

.utility-toggle-chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid rgba(168, 194, 227, 0.84);
    border-bottom: 2px solid rgba(168, 194, 227, 0.84);
    transform: rotate(45deg);
    transition: transform 0.24s ease, opacity 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.utility-dock-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 260px;
    opacity: 1;
    overflow: hidden;
    transform: translateY(0);
    transition: max-height 0.28s ease, opacity 0.2s ease, transform 0.28s ease;
}

.topbar-utility-dock.is-collapsed .utility-dock-toggle {
    width: 56px;
    min-width: 56px;
    min-height: 56px;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    border-color: var(--surface-border-strong);
    background: linear-gradient(135deg, rgba(14, 31, 52, 0.96), rgba(25, 52, 84, 0.9));
    box-shadow:
        0 0 0 1px rgba(120, 201, 255, 0.2),
        0 12px 26px rgba(2, 9, 18, 0.34),
        0 0 24px rgba(59, 130, 246, 0.2);
}

.topbar-utility-dock.is-collapsed .utility-toggle-label,
.topbar-utility-dock.is-collapsed .utility-toggle-chevron {
    opacity: 0;
    width: 0;
    margin: 0;
    overflow: hidden;
}

.topbar-utility-dock.is-collapsed .utility-toggle-main {
    gap: 0;
}

.topbar-utility-dock.is-collapsed .utility-toggle-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 174, 239, 0.24), rgba(59, 130, 246, 0.18));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 18px rgba(0, 174, 239, 0.18);
}

.topbar-utility-dock.is-collapsed .utility-dock-panel {
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
}

.utility-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.utility-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    padding-left: 4px;
}

.language-switcher,
.theme-switcher {
    width: 100%;
    justify-content: space-between;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.topbar-left {
    flex: 1 1 auto;
    gap: 24px;
    justify-content: flex-start;
}

.topbar-right {
    flex: 0 0 auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    margin-left: auto;
}

.topbar-right .language-switcher {
    order: 1;
}

.topbar-right .theme-switcher {
    order: 2;
}

.topbar-right .status-pill {
    order: 3;
}

.topbar-right .settings-wrap {
    order: 4;
    margin-left: 8px;
}

.topbar[data-topbar-mode="index"] {
    width: min(1320px, calc(100% - 32px));
    max-width: none;
    justify-content: space-between;
    gap: 18px;
    padding-inline: 22px;
}

.topbar[data-topbar-mode="index"] .topbar-left,
.topbar[data-topbar-mode="index"] .topbar-right {
    flex: 0 0 auto;
}

.topbar[data-topbar-mode="index"] .topbar-left {
    flex: 1 1 auto;
}

.topbar[data-topbar-mode="index"] .topbar-right {
    margin-left: auto;
    justify-content: flex-end;
}

/* Brand */
.topbar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 0 0 auto;
    color: var(--text-1);
    text-decoration: none;
}

.topbar .brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, rgba(10, 27, 44, 0.94), rgba(20, 44, 72, 0.82));
    border: 1px solid rgba(123, 200, 255, 0.46);
    box-shadow: 0 0 0 1px rgba(129, 207, 255, 0.2), 0 10px 22px rgba(0, 174, 239, 0.22);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    transition: transform 0.24s ease, box-shadow 0.24s ease;
}

.topbar .brand-mark::before {
    content: "";
    position: absolute;
    inset: -35%;
    background: radial-gradient(circle, rgba(0, 174, 239, 0.4), rgba(0, 174, 239, 0));
    pointer-events: none;
    opacity: 0.7;
}

.topbar .brand-logo {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
    z-index: 1;
}

.topbar .brand:hover .brand-mark {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 0 0 1px rgba(129, 207, 255, 0.3), 0 14px 28px rgba(0, 174, 239, 0.28);
}

.topbar .brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar .brand-title {
    font-family: "Space Grotesk", "Plus Jakarta Sans", sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.08;
    display: inline-flex;
    align-items: baseline;
    gap: 1px;
}

.topbar .brand-title .title-sheet {
    color: #8be8ff;
    text-shadow: 0 0 14px rgba(0, 174, 239, 0.42);
}

.topbar .brand-title .title-genie {
    color: #ffd06e;
    text-shadow: 0 0 14px rgba(245, 158, 11, 0.3);
}

.topbar .brand-subtitle {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.2;
}

.topbar-nav {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    gap: 18px;
    flex-wrap: wrap;
    margin-left: auto;
    justify-content: flex-end;
    padding-right: 12px;
}

/* Navigation */
.nav-link-pill {
    position: relative;
    min-height: auto;
    padding: 0;
    border-radius: 0;
    border: none;
    background: transparent;
    color: color-mix(in srgb, var(--text-1) 74%, transparent);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: color 0.22s ease, opacity 0.22s ease;
}

.nav-link-pill::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -8px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(0, 174, 239, 0.92), rgba(59, 130, 246, 0.92));
    transform: scaleX(0);
    transform-origin: center;
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.nav-link-pill:hover,
.nav-link-pill.active {
    background: transparent;
    border-color: transparent;
    color: var(--text-1);
    box-shadow: none;
}

.nav-link-pill:hover::after,
.nav-link-pill.active::after {
    transform: scaleX(1);
    opacity: 1;
}

/* Status Pill */
.status-pill {
    padding: 6px 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: var(--glow);
    white-space: nowrap;
}

/* User / Settings */
.settings-wrap {
    position: relative;
    z-index: 5;
}

.mobile-topbar-menu-btn {
    display: none;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border-radius: 16px;
    border: 1px solid var(--surface-border);
    background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
    color: var(--text-1);
    box-shadow: 0 10px 22px rgba(2, 9, 18, 0.24);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.mobile-topbar-menu-btn:hover,
.mobile-topbar-menu-btn[aria-expanded="true"] {
    transform: translateY(-1px);
    border-color: var(--surface-border-strong);
    box-shadow: var(--glow);
}

.mobile-topbar-menu-line {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--surface-1);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    pointer-events: auto;
    position: relative;
    z-index: 6;
}

.lang-btn {
    min-width: 0;
    width: auto;
    padding: 0;
}

.language-switcher .lang-btn {
    flex: 1 1 0;
}

.user-pill:hover {
    background: var(--surface-2);
    transform: translateY(-1px);
    box-shadow: var(--surface-shadow);
}

.user-pill[aria-expanded="true"] {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: var(--accent);
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-pill[aria-expanded="true"] .avatar {
    background: rgba(255, 255, 255, 0.2);
}

.user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-1);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-pill[aria-expanded="true"] .user-name {
    color: white;
}

.settings-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(372px, calc(100vw - 30px));
    min-width: 330px;
    padding: 14px;
    background: linear-gradient(145deg, rgba(10, 23, 42, 0.88), rgba(8, 18, 36, 0.78));
    border: 1px solid rgba(116, 189, 255, 0.34);
    border-radius: 22px;
    box-shadow: 0 0 0 1px rgba(113, 190, 255, 0.16), 0 26px 48px rgba(2, 9, 18, 0.52), 0 0 36px rgba(40, 122, 255, 0.22);
    backdrop-filter: blur(24px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.985);
    transition: all 0.22s ease;
    z-index: 1100;
}

.settings-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.mobile-settings-shell {
    display: none;
}

.mobile-settings-title {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--text-1);
    margin-bottom: 10px;
}

.mobile-settings-block {
    display: grid;
    gap: 10px;
}

.mobile-settings-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.mobile-nav-links {
    display: grid;
    gap: 8px;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(123, 191, 255, 0.16);
    background: rgba(14, 31, 54, 0.46);
    color: var(--text-1);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link.active,
.mobile-nav-link:focus-visible {
    background: rgba(19, 43, 72, 0.68);
    border-color: rgba(132, 199, 255, 0.32);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(5, 14, 28, 0.24);
}

.mobile-quick-user-head {
    margin: 0;
}

.mobile-login-item {
    margin-top: 2px;
}

.quick-user-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid rgba(123, 194, 255, 0.24);
    border-radius: 16px;
    background: rgba(15, 34, 61, 0.64);
}

.quick-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #f3f9ff;
    font-size: 0.92rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 0 1px rgba(126, 196, 255, 0.32), 0 10px 20px rgba(18, 75, 167, 0.34);
}

.quick-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
}

.quick-user-name {
    color: var(--text-1);
    font-size: 0.93rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-user-plan {
    width: fit-content;
    font-size: 0.72rem;
    font-weight: 700;
    color: #b7d4f7;
    border: 1px solid rgba(126, 192, 255, 0.22);
    border-radius: 999px;
    padding: 3px 10px;
    background: rgba(31, 58, 95, 0.58);
}

.quick-upgrade-hint {
    margin-top: 10px;
    border: 1px solid rgba(115, 188, 255, 0.3);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(27, 76, 140, 0.48), rgba(34, 93, 167, 0.32));
    color: #d5e9ff;
    font-size: 0.76rem;
    line-height: 1.35;
    padding: 8px 10px;
    font-weight: 600;
}

.settings-group {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.settings-divider {
    margin: 10px 4px;
    height: 1px;
    background: linear-gradient(90deg, rgba(125, 189, 255, 0), rgba(125, 189, 255, 0.42), rgba(125, 189, 255, 0));
}

.is-hidden {
    display: none !important;
}

.settings-item {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 12px;
    background: rgba(14, 31, 54, 0.46);
    border: 1px solid rgba(123, 191, 255, 0.14);
    border-radius: 14px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.settings-item:hover {
    background: rgba(19, 43, 72, 0.68);
    border-color: rgba(132, 199, 255, 0.32);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(3, 14, 30, 0.3);
}

.settings-item.danger {
    color: var(--danger-text-soft, #dc2626);
}

.settings-item.danger:hover {
    background: var(--danger-soft, rgba(220, 38, 38, 0.1));
    border-color: rgba(220, 38, 38, 0.3);
}

.settings-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--surface-1);
    flex-shrink: 0;
    line-height: 0;
    overflow: hidden;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #cbe1ff;
}

.settings-item-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.settings-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-1);
    line-height: 1.25;
}

.settings-item-desc {
    font-size: 0.76rem;
    color: var(--muted);
    line-height: 1.35;
}

.quick-plan-status,
.quick-plan-usage {
    width: fit-content;
    margin-top: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #d8ebff;
    border: 1px solid rgba(121, 192, 255, 0.26);
    border-radius: 999px;
    padding: 3px 9px;
    background: rgba(30, 62, 103, 0.52);
}

.quick-plan-hint {
    margin-top: 5px;
    font-size: 0.72rem;
    color: #9ed1ff;
    font-weight: 600;
}

.settings-item.upgrade-item {
    margin-top: 2px;
    border-color: rgba(117, 193, 255, 0.54);
    background: linear-gradient(135deg, rgba(0, 174, 239, 0.3), rgba(74, 101, 255, 0.36));
    box-shadow: 0 0 0 1px rgba(118, 192, 255, 0.18), 0 12px 24px rgba(23, 76, 170, 0.34), 0 0 28px rgba(69, 130, 255, 0.28);
}

.settings-item.upgrade-item .settings-item-title,
.settings-item.upgrade-item .settings-item-desc,
.settings-item.upgrade-item .settings-item-icon {
    color: #f4f9ff;
}

.settings-item.upgrade-item:hover {
    box-shadow: 0 0 0 1px rgba(137, 204, 255, 0.26), 0 15px 28px rgba(29, 88, 189, 0.42), 0 0 34px rgba(75, 139, 255, 0.34);
    filter: brightness(1.04);
}

.settings-item.logout-item {
    margin-top: 8px;
    background: rgba(86, 20, 33, 0.3);
    border-color: rgba(231, 105, 130, 0.2);
}

.settings-item.logout-item .settings-item-desc {
    color: color-mix(in srgb, var(--danger-text-soft, #f88695) 72%, white);
}

.settings-item.danger .settings-item-title {
    color: inherit;
}

/* Switchers */
.language-switcher {
    display: flex;
    gap: 4px;
    background: var(--surface-1);
    border: 1px solid var(--surface-border);
    border-radius: 18px;
    padding: 4px;
}

.lang-btn,
.theme-btn {
    min-width: 0;
    height: 36px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1 1 0;
}

.lang-btn.active,
.lang-btn:hover,
.theme-btn.active,
.theme-btn:hover {
    color: var(--text-1);
    border-color: var(--surface-border-strong);
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--accent-2) 14%, transparent));
    box-shadow: var(--glow);
}

.theme-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-radius: 18px;
    border: 1px solid var(--surface-border);
    background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
    box-shadow: inset 0 1px 0 var(--surface-1);
    flex-shrink: 0;
}

.theme-label {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--muted);
    padding: 0 4px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--surface-border);
    background: var(--surface-1);
    color: var(--text-1);
    cursor: pointer;
    transition: all 0.2s ease;
    display: grid;
    place-items: center;
}

.icon-btn:hover {
    background: var(--surface-2);
    border-color: var(--surface-border-strong);
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 920px) {
    .topbar {
        width: calc(100% - 20px);
        padding: 14px 16px;
        height: auto;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .topbar-left,
    .topbar-right {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .topbar-right {
        gap: 10px;
        justify-content: flex-end;
    }

    .topbar-nav {
        width: 100%;
        margin-left: 0;
        padding-right: 0;
        justify-content: flex-start;
    }

    .brand-subtitle,
    .status-pill {
        display: none;
    }

    .user-name {
        max-width: 140px;
    }

    .topbar[data-topbar-mode="index"] {
        width: calc(100% - 20px);
        max-width: calc(100% - 20px);
        gap: 12px;
        padding: 14px 16px;
    }

    .topbar[data-topbar-mode="index"] .topbar-left,
    .topbar[data-topbar-mode="index"] .topbar-right {
        flex: 1 1 auto;
    }

    .topbar-utility-dock {
        top: auto;
        bottom: 18px;
        right: 18px;
        left: auto;
        transform: none;
        width: min(360px, calc(100vw - 24px));
    }

    .topbar-utility-dock.is-collapsed {
        width: 56px;
    }
}

@media (max-width: 640px) {
    .topbar {
        width: calc(100% - 16px);
        padding: 12px;
        gap: 10px;
        border-radius: 24px;
        top: calc(10px + env(safe-area-inset-top, 0px));
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
    }

    .topbar-nav,
    .topbar-right .status-pill {
        display: none;
    }

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

    .settings-wrap .user-pill {
        display: none;
    }

    .topbar-right {
        width: auto;
        flex: 0 0 auto;
        margin-left: auto;
        justify-content: flex-end;
    }

    .topbar-right .settings-wrap {
        margin-left: 0;
    }

    .topbar-left {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        gap: 10px;
        flex-wrap: nowrap;
    }

    .topbar .brand {
        width: auto;
        flex: 1 1 auto;
        min-width: 0;
        gap: 10px;
    }

    .topbar .brand-text {
        min-width: 0;
        overflow: hidden;
    }

    .topbar .brand-title {
        display: block;
        font-size: 0.98rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-utility-dock {
        display: none;
    }

    .settings-menu.has-mobile-panel {
        position: fixed;
        top: calc(84px + env(safe-area-inset-top, 0px));
        left: max(8px, env(safe-area-inset-left, 0px));
        right: max(8px, env(safe-area-inset-right, 0px));
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: min(78vh, calc(100svh - 112px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        z-index: 1200;
        background: linear-gradient(180deg, rgba(7, 18, 35, 0.98), rgba(8, 20, 38, 0.96));
        border-color: rgba(114, 190, 255, 0.28);
        box-shadow: 0 24px 56px rgba(2, 9, 18, 0.58), 0 0 0 1px rgba(116, 194, 255, 0.14);
        backdrop-filter: blur(28px);
    }

.settings-menu.has-mobile-panel .mobile-settings-shell {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
}

.settings-menu.has-mobile-panel .settings-group .settings-item,
.settings-menu.has-mobile-panel .mobile-nav-link,
.settings-menu.has-mobile-panel .quick-user-head,
.settings-menu.has-mobile-panel .quick-upgrade-hint {
    background: rgba(15, 31, 54, 0.88);
}

    .settings-menu.has-mobile-panel .quick-user-head,
    .settings-menu.has-mobile-panel .quick-upgrade-hint {
        margin-top: 0;
    }

    .topbar-utility-dock {
        width: min(320px, calc(100vw - 16px));
        bottom: 12px;
        right: 8px;
        padding: 10px;
        gap: 8px;
        transform: none;
    }

    .topbar-utility-dock.is-collapsed {
        width: 56px;
        right: 8px;
    }

    .utility-group {
        flex: 1 1 100%;
    }

    .language-switcher,
    .theme-switcher {
        width: 100%;
        justify-content: space-between;
    }

    .theme-label {
        display: none;
    }

    .nav-link-pill {
        flex: 0 0 auto;
        font-size: 0.82rem;
    }

    .user-name {
        display: none;
    }

    .topbar-right {
        justify-content: flex-end;
    }

    .settings-menu {
        min-width: 0;
        right: 8px;
        left: 8px;
        max-height: min(78vh, 560px);
        overflow-y: auto;
    }

    .lang-btn,
    .theme-btn {
        min-width: 64px;
        flex: 1 1 0;
    }

    .topbar[data-topbar-mode="index"] {
        width: calc(100% - 16px);
        max-width: calc(100% - 16px);
        padding: 12px;
    }

    .topbar .brand-mark {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }

    .topbar .brand-title {
        font-size: 1.05rem;
    }
}

@media (max-width: 640px) {
    html[data-theme="sunset"] .topbar {
        border-color: rgba(113, 160, 214, 0.46);
        background: linear-gradient(180deg, rgba(250, 253, 255, 0.98), rgba(239, 247, 255, 0.95));
        box-shadow:
            0 18px 34px rgba(112, 145, 192, 0.18),
            0 0 0 1px rgba(119, 163, 214, 0.16);
    }

    html[data-theme="sunset"] .topbar .brand {
        color: #143554;
    }

    html[data-theme="sunset"] .topbar .brand-mark {
        background: linear-gradient(145deg, rgba(244, 251, 255, 0.98), rgba(223, 239, 255, 0.92));
        border-color: rgba(111, 159, 216, 0.48);
        box-shadow:
            0 0 0 1px rgba(115, 162, 218, 0.18),
            0 12px 24px rgba(109, 148, 197, 0.18);
    }

    html[data-theme="sunset"] .mobile-topbar-menu-btn {
        border-color: rgba(105, 153, 211, 0.42);
        background: linear-gradient(180deg, rgba(246, 251, 255, 0.98), rgba(229, 241, 255, 0.94));
        color: #1b436d;
        box-shadow:
            0 0 0 1px rgba(110, 158, 214, 0.16),
            0 12px 22px rgba(106, 146, 197, 0.18);
    }

    html[data-theme="sunset"] .mobile-topbar-menu-btn:hover,
    html[data-theme="sunset"] .mobile-topbar-menu-btn[aria-expanded="true"] {
        border-color: rgba(90, 141, 202, 0.52);
        background: linear-gradient(180deg, rgba(240, 248, 255, 0.98), rgba(219, 234, 252, 0.95));
        box-shadow:
            0 0 0 1px rgba(101, 151, 212, 0.18),
            0 14px 26px rgba(101, 142, 194, 0.2);
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel {
        background: linear-gradient(180deg, rgba(251, 254, 255, 0.985), rgba(240, 247, 255, 0.975));
        border-color: rgba(108, 155, 212, 0.42);
        box-shadow:
            0 24px 46px rgba(109, 142, 188, 0.22),
            0 0 0 1px rgba(112, 159, 214, 0.14);
        backdrop-filter: blur(28px);
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel .mobile-settings-title,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .settings-item-title,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .quick-user-name,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .mobile-nav-link {
        color: #143554;
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel .mobile-settings-label,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .settings-item-desc,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .quick-plan-hint,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .quick-user-plan,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .quick-plan-status,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .quick-plan-usage {
        color: #466482;
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel .settings-group .settings-item,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .mobile-nav-link,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .quick-user-head,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .quick-upgrade-hint {
        background: rgba(246, 251, 255, 0.96);
        border-color: rgba(111, 158, 214, 0.26);
        box-shadow: 0 8px 18px rgba(112, 144, 188, 0.08);
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel .settings-group .settings-item:hover,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .mobile-nav-link:hover,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .mobile-nav-link.active,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .mobile-nav-link:focus-visible {
        background: rgba(237, 246, 255, 0.98);
        border-color: rgba(96, 145, 206, 0.42);
        box-shadow:
            0 10px 22px rgba(111, 142, 186, 0.12),
            0 0 0 1px rgba(106, 152, 211, 0.12);
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel .settings-item-icon {
        background: rgba(224, 238, 255, 0.92);
        color: #23517c;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel .quick-user-avatar {
        box-shadow:
            0 0 0 1px rgba(108, 156, 214, 0.24),
            0 10px 20px rgba(87, 133, 190, 0.18);
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel .quick-user-plan,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .quick-plan-status,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .quick-plan-usage {
        background: rgba(231, 243, 255, 0.92);
        border-color: rgba(107, 155, 212, 0.28);
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel .quick-upgrade-hint {
        color: #31577f;
        background: linear-gradient(135deg, rgba(215, 238, 255, 0.92), rgba(223, 234, 255, 0.9));
        border-color: rgba(101, 149, 209, 0.34);
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel .settings-divider {
        background: linear-gradient(90deg, rgba(112, 158, 214, 0), rgba(112, 158, 214, 0.34), rgba(112, 158, 214, 0));
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel .language-switcher,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .theme-switcher {
        background: rgba(247, 252, 255, 0.96);
        border-color: rgba(111, 158, 214, 0.3);
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel .lang-btn,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .theme-btn {
        color: #506b8a;
    }

    html[data-theme="sunset"] .settings-menu.has-mobile-panel .lang-btn.active,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .lang-btn:hover,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .theme-btn.active,
    html[data-theme="sunset"] .settings-menu.has-mobile-panel .theme-btn:hover {
        color: #143554;
        border-color: rgba(95, 146, 207, 0.44);
        background: linear-gradient(135deg, rgba(104, 159, 224, 0.18), rgba(125, 176, 236, 0.14));
        box-shadow:
            0 0 0 1px rgba(100, 151, 213, 0.14),
            0 10px 18px rgba(109, 148, 198, 0.12);
    }
}

@media (max-width: 420px) {
    .topbar {
        top: calc(8px + env(safe-area-inset-top, 0px));
        width: calc(100% - 12px);
        padding: 10px;
    }

    .topbar .brand {
        width: auto;
        gap: 8px;
    }

    .topbar-left,
    .topbar-right {
        gap: 8px;
    }

    .topbar-right .settings-wrap {
        margin-left: 0;
    }

    .status-pill {
        padding: 5px 10px;
        font-size: 0.74rem;
    }

    .user-pill {
        padding: 7px 10px;
    }

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

    .topbar .brand-mark {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .topbar .brand-title {
        font-size: 0.92rem;
    }

    .topbar-utility-dock {
        width: min(300px, calc(100vw - 12px));
        right: 6px;
        bottom: 8px;
    }

    .topbar-utility-dock.is-collapsed {
        right: 6px;
    }
}
