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

* {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

:root,
html.theme-clayrat {
    --panel-accent: #2dd4bf;
    --panel-accent-hover: #25b8a6;
    --panel-accent-rgb: 45, 212, 191;
    --panel-exit: #ef4444;
    --panel-exit-rgb: 239, 68, 68;
    --toast-warning-rgb: 245, 158, 11;
    --panel-body-bg: radial-gradient(ellipse at top right, #1a3a3a 0%, #0a0a0a 50%, #0a0a0a 100%);
    --panel-border: rgba(var(--panel-accent-rgb), 0.15);
    --panel-pill-bg: rgba(20, 218, 92, 0.25);
    --panel-pill-color: #2bff7c;
    --panel-sidebar-border: rgba(255, 255, 255, 0.05);
}

html.theme-fenrir {
    --panel-accent: #ec4899;
    --panel-accent-hover: #db2777;
    --panel-accent-rgb: 236, 72, 153;
    --panel-exit: #be185d;
    --panel-exit-rgb: 190, 24, 93;
    --toast-warning-rgb: 244, 114, 182;
    --panel-body-bg: radial-gradient(ellipse at top right, #2a1520 0%, #1a0a12 50%, #0a0a0a 100%);
    --panel-border: rgba(var(--panel-accent-rgb), 0.2);
    --panel-pill-bg: rgba(var(--panel-accent-rgb), 0.25);
    --panel-pill-color: #f9a8d4;
    --panel-sidebar-border: rgba(244, 114, 182, 0.15);
}

html.theme-flame {
    --panel-accent: #f97316;
    --panel-accent-hover: #ea580c;
    --panel-accent-rgb: 249, 115, 22;
    --panel-exit: #c2410c;
    --panel-exit-rgb: 194, 65, 12;
    --toast-warning-rgb: 251, 146, 60;
    --panel-body-bg: radial-gradient(ellipse at top right, #2a1a0a 0%, #1a0f05 50%, #0a0a0a 100%);
    --panel-border: rgba(var(--panel-accent-rgb), 0.2);
    --panel-pill-bg: rgba(var(--panel-accent-rgb), 0.25);
    --panel-pill-color: #fdba74;
    --panel-sidebar-border: rgba(251, 146, 60, 0.15);
}

html.theme-sky {
    --panel-accent: #0ea5e9;
    --panel-accent-hover: #0284c7;
    --panel-accent-rgb: 14, 165, 233;
    --panel-exit: #dc2626;
    --panel-exit-rgb: 220, 38, 38;
    --toast-warning-rgb: 250, 204, 21;
    --panel-body-bg: radial-gradient(ellipse at top right, #0f2a3a 0%, #0a1520 50%, #0a0a0a 100%);
    --panel-border: rgba(var(--panel-accent-rgb), 0.2);
    --panel-pill-bg: rgba(var(--panel-accent-rgb), 0.25);
    --panel-pill-color: #7dd3fc;
    --panel-sidebar-border: rgba(56, 189, 248, 0.15);
}

html.theme-violet {
    --panel-accent: #8b5cf6;
    --panel-accent-hover: #7c3aed;
    --panel-accent-rgb: 139, 92, 246;
    --panel-exit: #be185d;
    --panel-exit-rgb: 190, 24, 93;
    --toast-warning-rgb: 250, 204, 21;
    --panel-body-bg: radial-gradient(ellipse at top right, #1e1a2e 0%, #150a22 50%, #0a0a0a 100%);
    --panel-border: rgba(var(--panel-accent-rgb), 0.2);
    --panel-pill-bg: rgba(var(--panel-accent-rgb), 0.25);
    --panel-pill-color: #c4b5fd;
    --panel-sidebar-border: rgba(167, 139, 250, 0.15);
}

html.theme-emerald {
    --panel-accent: #10b981;
    --panel-accent-hover: #059669;
    --panel-accent-rgb: 16, 185, 129;
    --panel-exit: #dc2626;
    --panel-exit-rgb: 220, 38, 38;
    --toast-warning-rgb: 250, 204, 21;
    --panel-body-bg: radial-gradient(ellipse at top right, #0a2a1e 0%, #051a12 50%, #0a0a0a 100%);
    --panel-border: rgba(var(--panel-accent-rgb), 0.2);
    --panel-pill-bg: rgba(var(--panel-accent-rgb), 0.25);
    --panel-pill-color: #6ee7b7;
    --panel-sidebar-border: rgba(52, 211, 153, 0.15);
}

html.theme-amber {
    --panel-accent: #f59e0b;
    --panel-accent-hover: #d97706;
    --panel-accent-rgb: 245, 158, 11;
    --panel-exit: #b91c1c;
    --panel-exit-rgb: 185, 28, 28;
    --toast-warning-rgb: 251, 191, 36;
    --panel-body-bg: radial-gradient(ellipse at top right, #2a220a 0%, #1a1505 50%, #0a0a0a 100%);
    --panel-border: rgba(var(--panel-accent-rgb), 0.2);
    --panel-pill-bg: rgba(var(--panel-accent-rgb), 0.25);
    --panel-pill-color: #fcd34d;
    --panel-sidebar-border: rgba(251, 191, 36, 0.15);
}

html.theme-coral {
    --panel-accent: #f43f5e;
    --panel-accent-hover: #e11d48;
    --panel-accent-rgb: 244, 63, 94;
    --panel-exit: #9f1239;
    --panel-exit-rgb: 159, 18, 57;
    --toast-warning-rgb: 251, 113, 133;
    --panel-body-bg: radial-gradient(ellipse at top right, #2a1518 0%, #1a0a0d 50%, #0a0a0a 100%);
    --panel-border: rgba(var(--panel-accent-rgb), 0.2);
    --panel-pill-bg: rgba(var(--panel-accent-rgb), 0.25);
    --panel-pill-color: #fda4af;
    --panel-sidebar-border: rgba(251, 113, 133, 0.15);
}

html.theme-fenrir body {
    background: linear-gradient(rgba(10, 8, 12, 0.72), rgba(10, 8, 12, 0.82)), url('/images/rias-bg.png') no-repeat center center / cover;
    background-attachment: fixed;
}

html, body {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }
body {
    font-family: 'Montserrat', sans-serif;
    background: var(--panel-body-bg);
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    overflow-x: hidden;
}

.sidebar {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 70px;
    height: auto;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 24px;
    border-radius: 24px;
    animation: sidebarSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    transition: padding 0.25s ease, gap 0.25s ease, left 0.25s ease, width 0.25s ease, border-radius 0.25s ease, top 0.25s ease, transform 0.25s ease;
}

@keyframes sidebarSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

.no-sidebar-animation .sidebar {
    animation: none;
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
.no-sidebar-animation .sidebar--top {
    animation: none;
    opacity: 1;
    transform: none;
}
/* Верхний бар в потоке — не следует за скроллом, только вверху страницы */
.sidebar--top {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: min(800px, calc(100% - 48px));
    height: 56px;
    margin: max(24px, env(safe-area-inset-top)) auto 24px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
    animation: topbarSlideDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    transition: width 0.25s ease, height 0.25s ease, padding 0.25s ease;
    border-radius: 24px;
    flex-shrink: 0;
}

@keyframes topbarSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes sidebarSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.sidebar--top > div:first-child { flex: 1; }
.sidebar--top-left { flex: 1; display: flex; justify-content: flex-start; align-items: center; }
.sidebar--top-role { font-size: 13px; font-weight: 600; color: var(--panel-accent); }
.sidebar--top .logo { flex: 1; text-align: center; }
.sidebar--top-right { flex: 1; display: flex; justify-content: flex-end; align-items: center; }
.sidebar--top-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--panel-pill-bg);
    color: var(--panel-pill-color);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}
.sidebar--top-pill i { font-size: 12px; }
.sidebar--top-pill.status-pill-unloaded { visibility: hidden; }
.logo {
    color: var(--panel-accent);
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 1px;
    text-decoration: none;
    display: inline-block;
}
.sidebar--top .logo {
    transition: none;
    line-height: 1;
    vertical-align: middle;
}
.sidebar--top .logo:hover {
    color: var(--panel-accent);
    transform: none;
}
.logo:hover { 
    color: var(--panel-accent-hover);
    transform: scale(1.05);
}
.sidebar {
    border-color: var(--panel-sidebar-border);
}
.sidebar--top {
    border-color: var(--panel-sidebar-border);
}
.sidebar-item {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
}
.sidebar-item:hover { 
    background: rgba(255, 255, 255, 0.06); 
    color: var(--panel-accent);
    transform: translateY(-1px);
}
.sidebar-item.active { 
    background: rgba(var(--panel-accent-rgb), 0.15); 
    color: var(--panel-accent);
    transform: scale(1.05);
}
.sidebar-item:active {
    transform: scale(0.95);
}
.sidebar-item i { font-size: 20px; }
.main-content {
    flex: 1;
    padding: 12px 12px 24px 120px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
    transition: padding 0.25s ease;
}
.main-panel {
    flex: 1;
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    padding: 30px;
    backdrop-filter: blur(10px);
    animation: panelFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    transform-origin: center;
}

@keyframes panelFadeIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateZ(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateZ(0);
    }
}

@keyframes panelFadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateZ(0);
    }
    to {
        opacity: 0;
        transform: scale(0.96) translateZ(-30px);
    }
}

.main-panel.page-exit {
    animation: panelFadeOut 0.15s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.section { 
    margin-bottom: 40px;
    animation: sectionFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}
.section:last-child { margin-bottom: 0; }
.section:nth-child(1) { animation-delay: 0.1s; }
.section:nth-child(2) { animation-delay: 0.2s; }
.section:nth-child(3) { animation-delay: 0.3s; }

@keyframes sectionFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    color: #ffffff;
}
.section-title i { opacity: 0.9; }
.page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 28px;
}
.page-title i { color: #ffffff; opacity: 0.9; font-size: 24px; }

.title-tabs {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 15px;
    font-weight: 500;
}

.title-tabs .tab-indicator {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    background: var(--panel-accent);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.title-tabs .tab {
    padding: 4px 0;
    color: rgba(255, 255, 255, 0.35);
    background: none;
    border: none;
    border-radius: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
}
.title-tabs:has(.tab-indicator) .tab::after {
    display: none;
}
.title-tabs .tab:hover { color: rgba(255, 255, 255, 0.7); }
.title-tabs .tab.active { color: var(--panel-accent); }
.title-tabs .tab-sep { color: rgba(255, 255, 255, 0.2); font-weight: 300; user-select: none; }
.tab-pane { 
    display: none;
    opacity: 0;
}
.tab-pane.active { 
    display: block;
    animation: tabFadeIn 0.3s ease forwards;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.field-group { margin-bottom: 20px; }
.field-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
}
.field-input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-family: 'Montserrat', sans-serif;
}
.field-input::placeholder { color: rgba(255, 255, 255, 0.35); }
.field-input:hover { border-color: rgba(255, 255, 255, 0.12); }
.field-input:focus { 
    outline: none; 
    border-color: rgba(var(--panel-accent-rgb), 0.5);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(var(--panel-accent-rgb), 0.1);
}
textarea.field-input { min-height: 120px; resize: vertical; }

.field-select {
    width: 100%;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='rgba(255,255,255,0.6)' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}
.field-select:hover {
    border-color: rgba(255, 255, 255, 0.12);
}
.field-select:focus {
    outline: none;
    border-color: rgba(var(--panel-accent-rgb), 0.5);
    background-color: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(var(--panel-accent-rgb), 0.1);
}
.field-select option {
    background: #1a1a1a;
    color: #ffffff;
    padding: 10px;
}

.field-hint { font-size: 12px; color: rgba(255, 255, 255, 0.5); margin-top: 6px; }
.field-file-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    min-height: 48px;
    cursor: pointer;
}
.field-file-wrap:hover { 
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
}
.field-file-wrap input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.field-file-wrap i { color: rgba(255, 255, 255, 0.5); font-size: 16px; flex-shrink: 0; }
.field-file-display {
    flex: 1;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 15px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    pointer-events: none;
}
.field-file-display::placeholder { color: rgba(255, 255, 255, 0.35); }

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    background: var(--panel-accent);
    border: none;
    border-radius: 4px;
    color: #000000;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.btn-primary:hover { 
    background: var(--panel-accent-hover);
}
.btn-primary:active {
    background: var(--panel-accent-hover);
}
.btn-primary i { font-size: 18px; }

@media (max-width: 1200px) {
    .sidebar--top {
        margin-top: max(24px, env(safe-area-inset-top));
        width: min(800px, calc(100% - 48px));
        height: 52px;
        padding: 0 18px;
        border-radius: 24px;
    }
    .sidebar--top .logo { font-size: 22px; }
    .sidebar--top-pill { padding: 6px 12px; font-size: 12px; }
    .main-content { padding: 12px 12px 24px 108px; }
    .main-panel { padding: 24px; border-radius: 20px; }
    .page-header { gap: 12px; margin-bottom: 24px; }
    .page-title { font-size: 22px; margin-bottom: 24px; }
    .section-title { font-size: 22px; margin-bottom: 20px; }
}

@media (max-width: 992px) {
    .sidebar {
        left: 16px;
        width: 62px;
        padding: 18px 0;
        gap: 20px;
    }
    .sidebar-item { width: 42px; height: 42px; }
    .sidebar-item i { font-size: 18px; }
    .sidebar--top {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        transform: none;
        margin-top: max(24px, env(safe-area-inset-top));
        margin-left: auto;
        margin-right: auto;
        width: calc(100% - 32px);
        height: 50px;
        padding: 0 16px;
        border-radius: 20px;
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
    }
    .sidebar--top .logo { font-size: 20px; grid-column: 2; justify-self: center; }
    .sidebar--top-left { justify-self: start; }
    .sidebar--top-right { justify-self: end; }
    .sidebar--top-role { font-size: 12px; }
    .sidebar--top-pill { padding: 6px 10px; font-size: 12px; }
    .main-content { padding: 12px 12px 24px 92px; }
    .main-panel { padding: 22px; border-radius: 18px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-title { font-size: 20px; margin-bottom: 22px; }
    .title-tabs { font-size: 14px; }
    .section-title { font-size: 20px; }
    .field-input { padding: 12px 16px; font-size: 14px; }
}

@media (max-width: 768px) {
    body {
        padding-bottom: max(100px, calc(76px + 24px + env(safe-area-inset-bottom)));
    }
    .sidebar {
        left: 50%;
        right: auto;
        top: auto;
        bottom: max(20px, env(safe-area-inset-bottom));
        width: auto;
        max-width: calc(100% - 24px);
        height: auto;
        flex-direction: row;
        justify-content: center;
        padding: 12px 16px;
        gap: 8px;
        border-radius: 24px;
        transform: translateX(-50%);
        z-index: 1000;
        animation: sidebarSlideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    }
    .no-sidebar-animation .sidebar {
        animation: none;
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    /* Топбар не должен получать translateX(-50%) при смене вкладок (no-sidebar-animation) */
    .no-sidebar-animation .sidebar.sidebar--top {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        transform: none;
    }
    .sidebar-item {
        width: 44px;
        height: 44px;
        flex: 0 0 auto;
    }
    .sidebar--top {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        transform: none;
        margin-top: max(20px, env(safe-area-inset-top));
        margin-left: auto;
        margin-right: auto;
        width: calc(100% - 24px);
        max-width: 100%;
        height: 48px;
        padding: 0 16px;
        border-radius: 20px;
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 8px;
        animation: topbarSlideDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    }
    .sidebar--top .logo { font-size: 18px; min-width: 0; grid-column: 2; justify-self: center; }
    .sidebar--top-left { min-width: 0; overflow: hidden; justify-self: start; }
    .sidebar--top-right { justify-self: end; padding-left: 8px; }
    .sidebar--top-role { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .sidebar--top-pill { padding: 6px 10px; font-size: 11px; flex-shrink: 0; }
    .sidebar--top-pill span { white-space: nowrap; }
    .main-content {
        padding: 12px 12px 24px 12px;
        padding-top: 12px;
        padding-bottom: max(180px, calc(80px + 28px + 24px + env(safe-area-inset-bottom)));
    }
    .main-panel { padding: 20px; padding-bottom: 40px; border-radius: 16px; }
    .page-title { font-size: 18px; margin-bottom: 20px; }
    .page-title i { font-size: 18px; }
    .title-tabs { flex-wrap: wrap; font-size: 13px; }
    .title-tabs .tab { font-size: 13px; }
    .section-title { font-size: 18px; margin-bottom: 16px; }
    .section { margin-bottom: 28px; }
}

@media (max-width: 576px) {
    body {
        padding-bottom: max(90px, calc(68px + 22px + env(safe-area-inset-bottom)));
    }
    .sidebar {
        bottom: max(16px, env(safe-area-inset-bottom));
        padding: 10px 12px;
        gap: 4px;
        border-radius: 20px;
        max-width: calc(100% - 20px);
        z-index: 1000;
    }
    .no-sidebar-animation .sidebar.sidebar--top {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        transform: none;
    }
    .sidebar-item { width: 40px; height: 40px; }
    .sidebar-item i { font-size: 17px; }
    .sidebar--top {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        transform: none;
        margin-top: max(16px, env(safe-area-inset-top));
        margin-left: auto;
        margin-right: auto;
        width: calc(100% - 20px);
        height: 44px;
        padding: 0 14px;
        border-radius: 18px;
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 6px;
        animation: topbarSlideDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    }
    .sidebar--top .logo { font-size: 16px; letter-spacing: 0.5px; min-width: 0; grid-column: 2; justify-self: center; }
    .sidebar--top-left { min-width: 0; overflow: hidden; justify-self: start; }
    .sidebar--top-right { justify-self: end; padding-left: 6px; }
    .sidebar--top-role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
    .sidebar--top-pill { padding: 5px 8px; font-size: 10px; flex-shrink: 0; }
    .sidebar--top-pill span { white-space: nowrap; }
    .main-content {
        padding: 10px 10px 24px 10px;
        padding-top: 10px;
        padding-bottom: max(170px, calc(72px + 24px + 24px + env(safe-area-inset-bottom)));
    }
    .main-panel { padding: 16px; padding-bottom: 36px; border-radius: 14px; }
    .page-title { font-size: 16px; margin-bottom: 18px; }
    .page-title i { font-size: 16px; }
    .section-title { font-size: 16px; margin-bottom: 14px; }
    .field-group { margin-bottom: 16px; }
    .field-label { font-size: 13px; }
    .field-input { padding: 12px 14px; font-size: 14px; border-radius: 10px; }
    .btn-primary { padding: 12px; font-size: 15px; border-radius: 4px; }
}

.custom-tooltip {
    position: fixed;
    z-index: 99999;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: #fff;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    white-space: nowrap;
    max-width: 280px;
    white-space: normal;
    word-break: break-word;
    opacity: 1;
    animation: customTooltipIn 0.1s ease-out;
}
@keyframes customTooltipIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.theme-fenrir .btn-primary { color: #fff; }
.theme-fenrir .modal-btn--primary { color: #fff; }
.theme-fenrir .settings-theme-choice.selected { border-color: rgba(244, 114, 182, 0.6); }
.theme-fenrir .settings-theme-preview-fenrir { box-shadow: 0 0 0 2px rgba(var(--panel-accent-rgb), 0.4); }
.theme-fenrir .modal-box {
    border-color: rgba(var(--panel-accent-rgb), 0.3);
}
.theme-fenrir .user-pill--current,
.theme-fenrir .session-item.current {
    box-shadow: inset 0 0 0 2px rgba(var(--panel-accent-rgb), 0.45);
}
