/* ===========================
   CSS STYLES - Pandor Tools
   =========================== */

/* System font stack for better performance and native feel */
/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

/* Базовые переменные */
:root {
    --color-black: #000000;
    --color-white: #ffffff;
    --color-gray-light: #f5f5f7;
    --color-gray-medium: #86868b;
    --color-gray-dark: #1d1d1f;
    --color-bg: #ffffff;
    --color-surface: #f5f5f7;
    --color-surface-hover: rgba(0, 0, 0, 0.04);
    --color-surface-active: rgba(0, 0, 0, 0.06);
    --color-border: #e5e5e7;
    --color-border-light: #eee;
    --color-input-bg: #ffffff;
    --color-text: #000000;
    --color-text-secondary: #86868b;
    --color-shadow: rgba(0, 0, 0, 0.04);
    --color-shadow-lg: rgba(0, 0, 0, 0.08);
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --user-accent: #0a84ff;
}

/* Плавная анимация переключения темы */
html {
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Dark AMOLED Theme */
[data-theme="dark"] {
    --color-black: #ffffff;
    --color-white: #000000;
    --color-gray-light: #0a0a0a;
    --color-gray-medium: #86868b;
    --color-gray-dark: #e0e0e0;
    --color-bg: #000000;
    --color-surface: #0a0a0a;
    --color-surface-hover: rgba(255, 255, 255, 0.06);
    --color-surface-active: rgba(255, 255, 255, 0.1);
    --color-border: #1c1c1e;
    --color-border-light: #1c1c1e;
    --color-input-bg: #1c1c1e;
    --color-text: #ffffff;
    --color-text-secondary: #86868b;
    --color-shadow: rgba(0, 0, 0, 0.2);
    --color-shadow-lg: rgba(0, 0, 0, 0.4);
}

/* Сброс стилей */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Логотип PT */
.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background-color: var(--color-black);
    border-radius: 16px;
    margin: 0 auto 20px;
}

.logo-text {
    font-size: 38px;
    font-weight: 800;
    color: var(--color-white);
    letter-spacing: -2px;
}

/* Контейнер авторизации */
.auth-container {
    width: 100%;
    max-width: 850px;
    padding: 30px 20px;
    text-align: center;
}

.auth-box {
    background: transparent;
    padding: 0;
}

.auth-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    font-size: 15px;
    font-weight: 400;
    color: var(--color-gray-medium);
    margin-bottom: 32px;
}

/* Формы */
.form-group {
    margin-bottom: 12px;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-black);
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    font-size: 14px;
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
    outline: none;
}

.form-input:focus {
    border-color: var(--color-black);
    box-shadow: 0 0 0 3px var(--color-shadow-lg);
}

.form-input::placeholder {
    color: var(--color-gray-medium);
}

/* Кнопки */
.btn {
    display: inline-block;
    width: 100%;
    height: 42px;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-family);
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    box-sizing: border-box;
    line-height: 42px;
}

.btn-primary {
    background-color: var(--user-accent);
    color: var(--color-white);
    margin-top: 12px;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-gray-dark);
    opacity: 0.9;
}

.btn-primary:active:not(:disabled) {
    opacity: 0.8;
}

.btn-secondary {
    background-color: var(--color-white);
    color: var(--color-black);
    border: 1px solid var(--color-gray-medium);
    margin-top: 12px;
}

.btn-secondary:hover {
    background-color: var(--color-gray-light);
    border-color: var(--color-black);
}

.btn-link {
    background-color: transparent;
    color: var(--color-gray-medium);
    border: none;
    margin-top: 12px;
    font-weight: 500;
    transition: var(--transition);
}

.btn-link:hover {
    color: var(--color-black);
    background-color: transparent;
    transform: none;
    box-shadow: none;
}

/* Текстовые ссылки */
.text-link {
    display: inline-block;
    margin-top: 24px;
    font-size: 14px;
    color: var(--color-gray-medium);
    text-decoration: none;
    transition: var(--transition);
}

.text-link:hover {
    color: var(--color-black);
}

/* Сообщения */
.message {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 500;
}

.message-error {
    background-color: #fff5f5;
    color: #c41e3a;
    border: 1px solid #ffd0d0;
}

.message-success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.message-info {
    background-color: var(--color-surface);
    color: var(--color-gray-dark);
    border: 1px solid var(--color-border);
}

/* Поле пароля с глазком */
.password-wrapper {
    position: relative;
}

.password-wrapper .form-input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-medium);
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--color-black);
}

.eye-icon {
    width: 18px;
    height: 18px;
}

/* Разделитель "Или" */
.divider {
    position: relative;
    text-align: center;
    margin: 24px 0 20px;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background-color: var(--color-border);
}

.divider span {
    position: relative;
    display: inline-block;
    padding: 0 12px;
    background-color: var(--color-bg);
    font-size: 13px;
    color: var(--color-gray-medium);
}

/* Текст регистрации */
.register-text {
    font-size: 14px;
    color: var(--color-gray-medium);
    margin-top: 24px;
}

.register-link {
    color: var(--color-black);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    border-bottom: 1px solid var(--color-black);
}

.register-link:hover {
    opacity: 0.7;
}

/* Форма регистрации - Grid Layout */
.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.form-group-full {
    grid-column: 1 / -1;
}

/* Select стили */
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23000' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    cursor: pointer;
}

select.form-input:focus {
    border-color: var(--color-black);
}

/* Подсказки под полями */
.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--color-gray-medium);
}

/* Валидация пароля */
.password-requirements {
    margin-top: 8px;
    padding: 10px;
    background: var(--color-surface);
    border-radius: 6px;
    text-align: left;
}

.requirement {
    font-size: 11px;
    line-height: 1.6;
    color: #dc3545;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.requirement::before {
    content: '✗';
    font-weight: bold;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.requirement.valid {
    color: #28a745;
}

.requirement.valid::before {
    content: '✓';
}

/* Адаптивность */
@media (max-width: 768px) {
    .auth-container {
        max-width: 100%;
        padding: 20px 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .auth-title {
        font-size: 24px;
    }
}

/* Кнопка disabled */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* ===========================
   MOBILE APP STYLES
   =========================== */

/* Базовые мобильные оптимизации */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    body {
        -webkit-text-size-adjust: 100%;
        overscroll-behavior: none;
    }

    input, select, textarea, button {
        font-size: 16px !important;
    }

    .btn {
        min-height: 44px;
    }

    .form-input {
        min-height: 44px;
    }
}

/* === Sidebar Collapse === */
.sidebar {
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1), padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Sidebar logo */

/* Collapsed state */
.sidebar.collapsed {
    width: 68px !important;
    min-width: 68px !important;
    padding: 20px 10px !important;
    overflow: visible;
    align-items: center;
}

/* Logo — center icon only */
.sidebar.collapsed .sidebar-logo {
    justify-content: center;
    margin-bottom: 24px;
    padding: 0;
    gap: 0;
}

.sidebar.collapsed .sidebar-logo-text {
    display: none;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    font-size: 17px;
    flex-shrink: 0;
}

/* Toggle button — bottom of sidebar */
.sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: #86868b;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    margin-top: 4px;
}

.sidebar-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
}

[data-theme="dark"] .sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #86868b;
}

[data-theme="dark"] .sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* Expanded: show left arrows (« / collapse), hide right arrows (» / expand) */
.sidebar-toggle-btn .toggle-icon-left {
    display: block;
}

.sidebar-toggle-btn .toggle-icon-right {
    display: none;
}

/* Collapsed: show right arrows (» / expand), hide left arrows (« / collapse) */
.sidebar.collapsed .sidebar-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: transparent;
    margin: 4px auto 0;
}

.sidebar.collapsed .sidebar-toggle-btn .toggle-icon-left {
    display: none;
}

.sidebar.collapsed .sidebar-toggle-btn .toggle-icon-right {
    display: block;
}

.sidebar.collapsed .sidebar-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #000;
}

[data-theme="dark"] .sidebar.collapsed .sidebar-toggle-btn {
    background: transparent;
}

[data-theme="dark"] .sidebar.collapsed .sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
/* Top user section */
.sidebar.collapsed .sidebar-top-user {
    padding: 0 0 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e5e5ea;
}

[data-theme="dark"] .sidebar.collapsed .sidebar-top-user {
    border-bottom-color: #1c1c1e;
}

.sidebar.collapsed .sidebar-top-user .sidebar-user-row {
    justify-content: center;
    padding: 0;
}

.sidebar.collapsed .sidebar-top-user .sidebar-user-row .profile-menu-wrapper {
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .sidebar-user-info {
    display: none;
}

.sidebar.collapsed .sidebar-user {
    justify-content: center;
    width: auto;
}

.sidebar.collapsed .sidebar-user-avatar {
    margin: 0;
}

/* Nav items — icon only, centered */
.sidebar.collapsed .sidebar-nav {
    gap: 2px;
}

.sidebar.collapsed .sidebar-nav-item {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
    position: relative;
    width: 100%;
}

.sidebar.collapsed .sidebar-nav-item span,
.sidebar.collapsed .sidebar-nav-item .chevron {
    display: none;
}

.sidebar.collapsed .sidebar-nav-item svg {
    flex-shrink: 0;
}

/* Collapsed: active indicator = colored icon only, no square background */
.sidebar.collapsed .sidebar-nav-item.active {
    background: transparent;
    color: #000;
}

.sidebar.collapsed .sidebar-nav-item.active svg {
    color: #000;
}

[data-theme="dark"] .sidebar.collapsed .sidebar-nav-item.active,
[data-theme="dark"] .sidebar.collapsed .sidebar-nav-item.active svg {
    color: #fff;
}

/* Tooltip on hover for collapsed nav items */
.sidebar.collapsed .sidebar-nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1c1c1e;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 100;
}

.sidebar.collapsed .sidebar-nav-item:hover::after {
    opacity: 1;
}

/* Hide simple tooltip for items that have sub-items (they get dropdown instead) */
.sidebar.collapsed .sidebar-nav-item:has(+ .sidebar-subitems)::after {
    display: none;
}

.sidebar.collapsed .sidebar-nav-item + .sidebar-subitems {
    position: fixed;
    background: rgba(44, 44, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 6px;
    min-width: 180px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 0.5px rgba(255,255,255,0.12);
    z-index: 200;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1), transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(0.95) translateX(-4px);
    transform-origin: left center;
}

.sidebar.collapsed .sidebar-nav-item + .sidebar-subitems .sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 400;
    color: #d1d1d6;
    border-radius: 7px;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.1s ease, color 0.1s ease;
}

.sidebar.collapsed .sidebar-nav-item + .sidebar-subitems .sidebar-nav-item:hover {
    background: #0a84ff;
    color: #fff;
}

.sidebar.collapsed .sidebar-nav-item + .sidebar-subitems .sidebar-nav-item.active {
    color: #fff;
}

.sidebar.collapsed .sidebar-nav-item + .sidebar-subitems .sidebar-nav-item + .sidebar-nav-item {
    margin-top: 2px;
    border-top: 0.5px solid rgba(255,255,255,0.08);
    padding-top: 10px;
}

/* Hide simple tooltip when dropdown is shown */
.sidebar.collapsed .sidebar-nav-item + .sidebar-subitems ~ .sidebar-nav-item::after {
    display: none;
}

[data-theme="dark"] .sidebar.collapsed .sidebar-nav-item::after {
    background: #2c2c2e;
}

[data-theme="dark"] .sidebar.collapsed .sidebar-nav-item + .sidebar-subitems {
    background: rgba(44, 44, 46, 0.95);
    box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 0 0.5px rgba(255,255,255,0.12);
}

[data-theme="dark"] .sidebar.collapsed .sidebar-nav-item + .sidebar-subitems .sidebar-nav-item {
    color: #d1d1d6;
}

[data-theme="dark"] .sidebar.collapsed .sidebar-nav-item + .sidebar-subitems .sidebar-nav-item:hover {
    background: #0a84ff;
    color: #fff;
}

[data-theme="light"] .sidebar.collapsed .sidebar-nav-item + .sidebar-subitems {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 40px rgba(0,0,0,0.18), 0 0 0 0.5px rgba(0,0,0,0.1);
}

[data-theme="light"] .sidebar.collapsed .sidebar-nav-item + .sidebar-subitems .sidebar-nav-item {
    color: #1d1d1f;
}

[data-theme="light"] .sidebar.collapsed .sidebar-nav-item + .sidebar-subitems .sidebar-nav-item:hover {
    background: #0a84ff;
    color: #fff;
}

[data-theme="light"] .sidebar.collapsed .sidebar-nav-item + .sidebar-subitems .sidebar-nav-item + .sidebar-nav-item {
    border-top-color: rgba(0,0,0,0.08);
}

/* Footer */
.sidebar.collapsed .sidebar-footer {
    padding: 12px 0;
    margin-top: auto;
    border-top: none;
    width: 100%;
}

.sidebar.collapsed .sidebar-footer .sidebar-user-row {
    justify-content: center;
    padding: 0;
    margin-bottom: 8px;
}

.sidebar.collapsed .sidebar-footer .profile-menu-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: none;
}

.sidebar.collapsed .sidebar-footer .sidebar-user {
    justify-content: center;
    flex: none;
}

.sidebar.collapsed .sidebar-footer .sidebar-user-avatar {
    margin: 0;
}

.sidebar.collapsed .sidebar-user-row {
    justify-content: center;
    padding: 0;
}

.sidebar.collapsed .sidebar-actions-row {
    padding: 0;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.sidebar.collapsed .sidebar-version {
    display: none;
}

.sidebar.collapsed .notif-wrapper {
    display: none;
}

.sidebar.collapsed .notif-btn {
    display: none;
}

/* Smooth transition for text elements */
.sidebar .sidebar-logo-text,
.sidebar .sidebar-nav-item span,
.sidebar .sidebar-version,
.sidebar .sidebar-user-info {
    transition: opacity 0.15s ease;
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-nav-item span,
.sidebar.collapsed .sidebar-version,
.sidebar.collapsed .sidebar-user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Нижний таббар (bottom tab bar) */
.mobile-tabbar {
    display: none;
}

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

    /* Override collapsed sidebar on mobile — force full width */
    .sidebar.collapsed {
        width: 280px !important;
        min-width: 280px !important;
        padding: 20px !important;
        align-items: stretch;
    }

    .sidebar.collapsed .sidebar-logo {
        justify-content: flex-start;
        margin-bottom: 36px;
        padding: 0 12px;
        gap: 12px;
    }

    .sidebar.collapsed .sidebar-logo-text {
        display: block;
        opacity: 1;
        width: auto;
    }

    .sidebar.collapsed .sidebar-nav-item {
        justify-content: flex-start;
        padding: 10px 16px;
        gap: 10px;
    }

    .sidebar.collapsed .sidebar-nav-item span,
    .sidebar.collapsed .sidebar-nav-item .chevron {
        display: inline;
        opacity: 1;
        width: auto;
    }

    .sidebar-toggle-btn {
        display: none !important;
    }

    .sidebar.collapsed .notif-btn {
        display: flex;
    }

    .sidebar.collapsed .sidebar-version {
        display: block;
        opacity: 1;
        width: auto;
    }

    .sidebar.collapsed .sidebar-user-info {
        display: block;
        opacity: 1;
        width: auto;
    }

    .sidebar.collapsed .sidebar-footer {
        padding: 16px;
        border-top: 1px solid #e0e0e0;
    }

    .sidebar.collapsed .sidebar-top-user {
        padding: 0 12px 12px;
        border-bottom: 1px solid #e5e5ea;
        margin-bottom: 8px;
    }

    .sidebar.collapsed .sidebar-top-user .sidebar-user-row {
        justify-content: space-between;
        padding: 0;
    }

    .sidebar.collapsed .sidebar-top-user .sidebar-user-row .profile-menu-wrapper {
        display: block;
    }

    /* Dark mode for mobile collapsed sidebar */
    [data-theme="dark"] .sidebar.collapsed .sidebar-footer {
        border-top-color: #1c1c1e;
    }

    [data-theme="dark"] .sidebar.collapsed .sidebar-top-user {
        border-bottom-color: #1c1c1e;
    }

    .mobile-tabbar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: var(--color-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 0.5px solid var(--color-border);
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom, 0);
        align-items: center;
        justify-content: space-around;
    }

    .mobile-tabbar a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        text-decoration: none;
        color: var(--color-text-secondary);
        font-size: 10px;
        font-weight: 500;
        padding: 4px 12px;
        border-radius: 8px;
        transition: color 0.15s ease;
        min-width: 64px;
    }

    .mobile-tabbar a.active {
        color: var(--color-text);
    }

    .mobile-tabbar a svg {
        width: 22px;
        height: 22px;
    }
}

/* Бургер-кнопка */
.mobile-header {
    display: none;
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: var(--color-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 0.5px solid var(--color-border);
        z-index: 1001;
        align-items: center;
        padding: 0 16px;
        padding-top: env(safe-area-inset-top, 0);
    }

    .mobile-header-logo {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1;
    }

    .mobile-header-logo-icon {
        width: 32px;
        height: 32px;
        background: var(--color-black);
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        font-weight: 800;
        color: var(--color-white);
        letter-spacing: -1px;
        transition: background-color 0.4s ease, color 0.4s ease;
    }

    .mobile-header-logo-text {
        font-size: 16px;
        font-weight: 700;
        color: var(--color-text);
    }

    .mobile-hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        background: transparent;
        cursor: pointer;
        border-radius: 8px;
        color: var(--color-text);
        transition: background 0.15s;
    }

    .mobile-hamburger:active {
        background: var(--color-surface-hover);
    }

    .mobile-hamburger svg {
        width: 22px;
        height: 22px;
    }
}

/* Оверлей для сайдбара */
.sidebar-overlay {
    display: none;
}

@media (max-width: 768px) {
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    .sidebar-overlay.visible {
        opacity: 1;
        visibility: visible;
    }
}

/* Safe area для iPhone с вырезом */
@supports (padding: env(safe-area-inset-top)) {
    .mobile-header {
        height: calc(56px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
    }

    .mobile-tabbar {
        height: calc(56px + env(safe-area-inset-bottom));
    }

    .mobile-fab {
        bottom: calc(76px + env(safe-area-inset-bottom)) !important;
    }
}

/* Плавающая кнопка (FAB) */
.mobile-fab {
    display: none;
}

@media (max-width: 768px) {
    .mobile-fab {
        display: none;
        position: fixed;
        bottom: 76px;
        left: 50%;
        transform: translateX(-50%);
        width: 52px;
        height: 52px;
        border-radius: 50%;
        background: var(--color-black);
        color: var(--color-white);
        border: none;
        cursor: pointer;
        z-index: 998;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 16px var(--color-shadow-lg);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .mobile-fab:active {
        transform: translateX(-50%) scale(0.92);
        box-shadow: 0 2px 8px var(--color-shadow-lg);
    }

    .mobile-fab svg {
        width: 24px;
        height: 24px;
    }
}

/* === Notifications Popover === */
.notif-wrapper {
    position: relative;
}

.notif-popover {
    display: none;
    position: fixed;
    width: 340px;
    max-height: 420px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--color-shadow-lg);
    z-index: 2000;
    overflow: hidden;
    flex-direction: column;
}

.notif-popover.open {
    display: flex;
}

.notif-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--color-border);
}

.notif-popover-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.notif-mark-all {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--color-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 6px;
    flex-shrink: 0;
}

.notif-mark-all:hover {
    background: var(--color-surface-hover);
    color: var(--color-primary);
}

.notif-list {
    overflow-y: auto;
    flex: 1;
}

.notif-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}

.notif-item {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border-light, var(--color-border));
    cursor: pointer;
    transition: background 0.15s;
}

.notif-item:hover {
    background: var(--color-bg-secondary);
}

.notif-item.unread {
    background: rgba(0, 119, 255, 0.04);
}

.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.notif-icon.approval {
    background: rgba(52, 199, 89, 0.12);
    color: #34c759;
}

.notif-icon.rejection {
    background: rgba(255, 59, 48, 0.12);
    color: #ff3b30;
}

.notif-icon.info {
    background: rgba(0, 119, 255, 0.12);
    color: #0077ff;
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

.notif-message {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-time {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 3px;
    opacity: 0.7;
}

/* Badge on bell */
.sidebar-icon-btn.notif-btn {
    position: relative;
}

.sidebar-icon-btn.notif-btn .bell-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #ff3b30;
    border-radius: 50%;
    border: 2px solid var(--color-sidebar-bg, var(--color-white));
    display: none;
}

.sidebar-icon-btn.notif-btn .bell-dot.visible {
    display: block;
}

@media (max-width: 768px) {
    .notif-popover {
        position: fixed;
        left: 8px;
        right: 8px;
        width: auto;
        max-height: 60vh;
        border-radius: 12px;
    }
}

[data-theme="dark"] .notif-popover {
    background: #0a0a0a;
    border-color: #1c1c1e;
}

[data-theme="dark"] .notif-popover-header {
    border-bottom-color: #1c1c1e;
}

[data-theme="dark"] .notif-popover-header h3 {
    color: #fff;
}

[data-theme="dark"] .notif-mark-all {
    color: #86868b;
}

[data-theme="dark"] .notif-mark-all:hover {
    background: rgba(255,255,255,0.1);
    color: #0077ff;
}

[data-theme="dark"] .notif-item {
    border-bottom-color: #1c1c1e;
}

[data-theme="dark"] .notif-item:hover {
    background: rgba(255,255,255,0.06);
}

[data-theme="dark"] .notif-item.unread {
    background: rgba(0,119,255,0.08);
}

[data-theme="dark"] .notif-title {
    color: #fff;
}

[data-theme="dark"] .notif-message {
    color: #86868b;
}

[data-theme="dark"] .notif-time {
    color: #86868b;
}

[data-theme="dark"] .sidebar-icon-btn.notif-btn .bell-dot {
    border-color: #0a0a0a;
}

/* === Profile Dropdown === */
.profile-menu-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}

.profile-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 200px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px var(--color-shadow-lg);
    z-index: 2001;
    overflow: hidden;
}

.profile-dropdown.open {
    display: block;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--color-text);
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.profile-dropdown-item:hover {
    background: var(--color-surface-hover);
}

.profile-dropdown-item svg {
    flex-shrink: 0;
    color: var(--color-text-muted);
}

[data-theme="dark"] .profile-dropdown {
    background: #1c1c1e;
    border-color: #2c2c2e;
}

[data-theme="dark"] .profile-dropdown-item {
    color: #fff;
}

[data-theme="dark"] .profile-dropdown-item:hover {
    background: rgba(255,255,255,0.06);
}

[data-theme="dark"] .profile-dropdown-item svg {
    color: #86868b;
}

.sidebar-top-user {
    padding: 0 12px 12px;
    border-bottom: 1px solid #e5e5ea;
    margin-bottom: 8px;
}

[data-theme="dark"] .sidebar-top-user {
    border-bottom-color: #1c1c1e;
}

/* Top layout: dropdown opens downward below the avatar */
.sidebar[data-layout="top"] .sidebar-top-user .profile-dropdown {
    bottom: auto;
    top: calc(100% + 8px);
}

/* === Settings Modal === */
.sp-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 5000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.sp-overlay.open {
    display: flex;
}

.sp-window {
    background: #1c1c1e;
    border-radius: 12px;
    width: 100%;
    max-width: 720px;
    height: 520px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    animation: spIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes spIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.sp-titlebar {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #2c2c2e;
    border-bottom: 1px solid #3a3a3c;
}

.sp-titlebar-title {
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.sp-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: rgba(255,255,255,0.08);
    color: #86868b;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sp-close-btn:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

.sp-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sp-sidebar {
    width: 200px;
    min-width: 200px;
    background: #2c2c2e;
    border-right: 1px solid #3a3a3c;
    overflow-y: auto;
    padding: 8px;
}

.sp-sidebar-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin: 0 0 8px;
    background: #3a3a3c;
    border-radius: 6px;
    color: #86868b;
}

.sp-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
}

.sp-search-input::placeholder {
    color: #86868b;
}

.sp-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sp-sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #d1d1d6;
    transition: background 0.1s;
}

.sp-sidebar-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.sp-sidebar-item.active {
    background: var(--user-accent);
    color: #fff;
}

.sp-sidebar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.sp-divider {
    width: 1px;
    background: #3a3a3c;
}

.sp-content {
    flex: 1;
    overflow-y: auto;
    background: #1c1c1e;
}

.sp-content-inner {
    padding: 20px 24px;
}

.sp-section {
    margin-bottom: 24px;
}

.sp-section:last-child {
    margin-bottom: 0;
}

.sp-section-header {
    font-size: 13px;
    font-weight: 600;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 12px;
}

.sp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #2c2c2e;
    border-radius: 8px;
    margin-bottom: 1px;
}

.sp-row-label-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sp-row:first-of-type {
    border-radius: 8px 8px 1px 1px;
}

.sp-row:last-of-type {
    border-radius: 1px 1px 8px 8px;
    margin-bottom: 0;
}

.sp-row:only-of-type {
    border-radius: 8px;
}

.sp-row-label {
    font-size: 14px;
    color: #fff;
}

.sp-row-desc {
    font-size: 12px;
    color: #86868b;
    margin-top: 2px;
}

.sp-row-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sp-link {
    font-size: 14px;
    color: #0a84ff;
    text-decoration: none;
}

.sp-link:hover {
    text-decoration: underline;
}

/* Theme choices */
.theme-choices {
    display: flex;
    gap: 12px;
}

.theme-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.theme-choice span {
    font-size: 11px;
    color: #86868b;
}

.theme-choice.active span {
    color: #0a84ff;
}

.theme-preview {
    width: 56px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}

.theme-choice.active .theme-preview {
    border-color: #0a84ff;
}

.tp-light {
    background: linear-gradient(135deg, #f5f5f7 50%, #e5e5ea 50%);
}

.tp-dark {
    background: linear-gradient(135deg, #1c1c1e 50%, #0a0a0a 50%);
}

/* Layout choices */
.layout-choices-modal {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.layout-choice-modal {
    cursor: pointer;
    text-align: center;
}

.layout-choice-modal-label {
    font-size: 12px;
    color: #86868b;
    margin-top: 6px;
}

.layout-choice-modal.active .layout-choice-modal-label {
    color: #0a84ff;
}

.layout-preview-modal {
    width: 100px;
    height: 64px;
    border-radius: 6px;
    border: 2px solid #3a3a3c;
    overflow: hidden;
    display: flex;
    transition: border-color 0.15s;
}

.layout-choice-modal.active .layout-preview-modal {
    border-color: #0a84ff;
}

.lpm-sidebar {
    width: 35%;
    background: #3a3a3c;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lpm-logo {
    height: 8px;
    background: #555;
    border-radius: 2px;
    margin-bottom: 4px;
}

.lpm-nav {
    height: 5px;
    background: #555;
    border-radius: 2px;
    opacity: 0.6;
}

.lpm-spacer {
    flex: 1;
}

.lpm-user {
    height: 8px;
    background: #0a84ff;
    border-radius: 2px;
    opacity: 0.5;
}

.lpm-content {
    flex: 1;
    background: #1c1c1e;
    margin: 3px;
    border-radius: 3px;
}

/* Light theme for settings modal */
[data-theme="light"] .sp-window {
    background: #ffffff;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0,0,0,0.08);
}

[data-theme="light"] .sp-titlebar {
    background: #f5f5f7;
    border-bottom: 1px solid #e5e5e7;
}

[data-theme="light"] .sp-titlebar-title {
    color: #1d1d1f;
}

[data-theme="light"] .sp-close-btn {
    background: rgba(0,0,0,0.06);
    color: #86868b;
}

[data-theme="light"] .sp-close-btn:hover {
    background: rgba(0,0,0,0.1);
    color: #1d1d1f;
}

[data-theme="light"] .sp-sidebar {
    background: #f5f5f7;
    border-right: 1px solid #e5e5e7;
}

[data-theme="light"] .sp-sidebar-search {
    background: #e5e5e7;
    color: #86868b;
}

[data-theme="light"] .sp-search-input {
    color: #1d1d1f;
}

[data-theme="light"] .sp-search-input::placeholder {
    color: #86868b;
}

[data-theme="light"] .sp-sidebar-item {
    color: #1d1d1f;
}

[data-theme="light"] .sp-sidebar-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .sp-divider {
    background: #e5e5e7;
}

[data-theme="light"] .sp-content {
    background: #ffffff;
}

[data-theme="light"] .sp-section-header {
    color: #86868b;
}

[data-theme="light"] .sp-row {
    background: #f5f5f7;
}

[data-theme="light"] .sp-row-label {
    color: #1d1d1f;
}

[data-theme="light"] .sp-row-desc {
    color: #86868b;
}

[data-theme="light"] .layout-preview-modal {
    border-color: #e5e5e7;
}

[data-theme="light"] .lpm-sidebar {
    background: #e5e5e7;
}

[data-theme="light"] .lpm-logo {
    background: #86868b;
}

[data-theme="light"] .lpm-nav {
    background: #86868b;
}

[data-theme="light"] .lpm-content {
    background: #ffffff;
}

/* Settings modal — grouped rows (works on all screen sizes) */
.sp-grouped {
    background: #1c1c1e;
    border-radius: 10px;
    overflow: hidden;
}

.sp-ios-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    min-height: 44px;
    cursor: pointer;
    transition: background 0.15s;
}

.sp-ios-row:active {
    background: rgba(255, 255, 255, 0.06);
}

.sp-ios-row + .sp-ios-row {
    border-top: 0.5px solid #3a3a3c;
}

.sp-ios-icon {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sp-ios-label {
    flex: 1;
    font-size: 16px;
    color: #fff;
}

.sp-ios-check {
    flex-shrink: 0;
}

/* Theme Preview Cards */
.sp-theme-previews {
    display: flex;
    gap: 16px;
}

.sp-theme-card {
    flex: 1;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.sp-theme-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.sp-theme-card.active {
    border-color: #0a84ff;
}

.sp-theme-preview {
    height: 120px;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
    position: relative;
}

.tp-light-preview {
    background: #f5f5f7;
}

.tp-dark-preview {
    background: #1c1c1e;
}

.tp-bar {
    height: 18px;
    display: flex;
    align-items: center;
    padding: 0 8px;
}

.tp-light-preview .tp-bar { background: #e8e8ed; }
.tp-dark-preview .tp-bar { background: #2c2c2e; }

.tp-dots {
    display: flex;
    gap: 3px;
}

.tp-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.tp-light-preview .tp-dots span:nth-child(1) { background: #ff5f57; }
.tp-light-preview .tp-dots span:nth-child(2) { background: #febc2e; }
.tp-light-preview .tp-dots span:nth-child(3) { background: #28c840; }
.tp-dark-preview .tp-dots span:nth-child(1) { background: #ff5f57; }
.tp-dark-preview .tp-dots span:nth-child(2) { background: #febc2e; }
.tp-dark-preview .tp-dots span:nth-child(3) { background: #28c840; }

.tp-body {
    display: flex;
    height: calc(100% - 18px);
}

.tp-side {
    width: 28%;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tp-light-preview .tp-side { background: #e8e8ed; }
.tp-dark-preview .tp-side { background: #2c2c2e; }

.tp-nav-item {
    height: 6px;
    border-radius: 3px;
}

.tp-light-preview .tp-nav-item { background: #d1d1d6; }
.tp-dark-preview .tp-nav-item { background: #3a3a3c; }

.tp-light-preview .tp-nav-item.active-item { background: #0a84ff; }
.tp-dark-preview .tp-nav-item.active-item-dark { background: #0a84ff; }

.tp-spacer { flex: 1; }

.tp-avatar-sm {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.tp-light-preview .tp-avatar-sm { background: #c7c7cc; }
.tp-dark-preview .tp-avatar-sm { background: #48484a; }

.tp-main {
    flex: 1;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tp-light-preview .tp-main { background: #ffffff; }
.tp-dark-preview .tp-main { background: #000000; }

.tp-card-sm {
    height: 30px;
    border-radius: 4px;
}

.tp-light-preview .tp-card-sm { background: #f5f5f7; border: 1px solid #e5e5ea; }
.tp-dark-preview .tp-card-sm { background: #1c1c1e; border: 1px solid #3a3a3c; }

.tp-lines {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tp-lines span {
    display: block;
    height: 4px;
    border-radius: 2px;
    width: 100%;
}

.tp-light-preview .tp-lines span { background: #e5e5ea; }
.tp-dark-preview .tp-lines span { background: #2c2c2e; }

.sp-theme-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    position: relative;
}

.sp-theme-label svg:first-child {
    flex-shrink: 0;
}

.sp-theme-check {
    position: absolute;
    right: 12px;
}

.tp-light-preview + .sp-theme-label { background: #f5f5f7; color: #1d1d1f; }
.tp-dark-preview + .sp-theme-label { background: #2c2c2e; color: #fff; }

/* Layout Preview Cards */
.sp-layout-previews {
    display: flex;
    gap: 16px;
}

.sp-layout-card {
    flex: 1;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #3a3a3c;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.sp-layout-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    border-color: #48484a;
}

.sp-layout-card.active {
    border-color: #0a84ff;
}

.sp-layout-card:last-child .sp-layout-preview {
    flex-direction: column;
}

.sp-layout-preview {
    height: 100px;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
    display: flex;
    background: #0a0a0a;
    border-bottom: 1px solid #3a3a3c;
}

.sp-layout-sidebar {
    width: 35%;
    background: #1c1c1e;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-right: 1px solid #3a3a3c;
}

.sp-layout-logo {
    height: 8px;
    width: 8px;
    background: #48484a;
    border-radius: 2px;
    margin-bottom: 4px;
}

.sp-layout-nav {
    height: 5px;
    background: #3a3a3c;
    border-radius: 2px;
}

.sp-layout-nav-row {
    height: 5px;
    background: #3a3a3c;
    border-radius: 2px;
    width: 80%;
}

.sp-layout-spacer {
    flex: 1;
}

.sp-layout-user {
    height: 8px;
    background: #0a84ff;
    border-radius: 2px;
    opacity: 0.5;
}

.sp-layout-content {
    flex: 1;
    background: #141414;
    margin: 4px;
    border-radius: 3px;
    border: 1px solid #2a2a2c;
}

.sp-layout-sidebar-top {
    width: 100%;
    background: #1c1c1e;
    padding: 6px;
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Top layout preview */
.sp-layout-top-sidebar {
    width: 100%;
    background: #1c1c1e;
    padding: 5px 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-bottom: 1px solid #3a3a3c;
}

.sp-layout-top-nav {
    display: flex;
    gap: 6px;
}

.sp-layout-nav-item-sm {
    width: 24px;
    height: 5px;
    border-radius: 2px;
    background: #3a3a3c;
}

.sp-layout-nav-item-sm.active-nav {
    background: #0a84ff;
}

.sp-layout-top-user {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sp-layout-avatar-top {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #48484a;
}

.sp-layout-card .sp-theme-label { background: #2c2c2e; color: #fff; }

[data-theme="light"] .sp-theme-card.active { border-color: #0a84ff; }
[data-theme="light"] .sp-layout-card { border-color: #d1d1d6; }
[data-theme="light"] .sp-layout-card.active { border-color: #0a84ff; }
[data-theme="light"] .sp-layout-card:hover { border-color: #b0b0b5; }
[data-theme="light"] .tp-light-preview + .sp-theme-label { background: #f5f5f7; color: #1d1d1f; }
[data-theme="light"] .tp-dark-preview + .sp-theme-label { background: #2c2c2e; color: #fff; }
[data-theme="light"] .sp-layout-card .sp-theme-label { background: #f5f5f7; color: #1d1d1f; }

[data-theme="light"] .sp-theme-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
[data-theme="light"] .sp-layout-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.1); }

[data-theme="light"] .sp-grouped {
    background: #f5f5f7;
}

[data-theme="light"] .sp-ios-row:active {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .sp-ios-row + .sp-ios-row {
    border-top-color: #e5e5e7;
}

[data-theme="light"] .sp-ios-label {
    color: #1d1d1f;
}

/* Sidebar user avatar image */
.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-user-avatar .avatar-fallback,
.user-card-avatar-placeholder,
.user-table-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .sp-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .sp-window {
        max-width: 100%;
        height: 92vh;
        border-radius: 12px 12px 0 0;
        animation: spSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes spSlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .sp-titlebar {
        padding: 14px 16px;
        background: #1c1c1e;
        border-bottom: none;
    }

    .sp-close-btn {
        position: absolute;
        right: 12px;
        top: 10px;
    }

    .sp-titlebar .sp-close-btn {
        display: none;
    }

    .sp-body {
        flex-direction: column;
    }

    .sp-sidebar {
        display: none;
    }

    .sp-divider {
        display: none;
    }

    .sp-content {
        background: #000;
    }

    .sp-content-inner {
        padding: 0;
    }

    .sp-mobile-nav {
        display: flex !important;
        align-items: center;
        padding: 12px 16px;
        background: #1c1c1e;
        border-bottom: 0.5px solid #3a3a3c;
    }

    .sp-mobile-nav-title {
        flex: 1;
        font-size: 17px;
        font-weight: 600;
        color: #fff;
        text-align: center;
    }

    .sp-mobile-nav-back {
        display: flex;
        align-items: center;
        gap: 4px;
        background: none;
        border: none;
        color: #0a84ff;
        font-size: 17px;
        cursor: pointer;
        padding: 0;
        margin-left: -4px;
    }

    .sp-mobile-nav-back span {
        margin-left: 2px;
    }

    .sp-section {
        margin: 0;
    }

    .sp-section-header {
        font-size: 13px;
        font-weight: 400;
        color: #86868b;
        text-transform: none;
        letter-spacing: 0;
        padding: 24px 16px 8px;
    }

    .sp-section:first-child .sp-section-header {
        padding-top: 16px;
    }

    .sp-row {
        background: #1c1c1e;
        border-radius: 0;
        margin: 0;
        padding: 12px 16px;
        border-bottom: 0.5px solid #3a3a3c;
        min-height: 44px;
    }

    .sp-row:first-of-type {
        border-radius: 10px 10px 0 0;
        margin: 0 16px;
        border-bottom: 0.5px solid #3a3a3c;
    }

    .sp-row:last-of-type {
        border-radius: 0 0 10px 10px;
        margin: 0 16px;
        border-bottom: none;
    }

    .sp-row:only-of-type {
        border-radius: 10px;
        margin: 0 16px;
    }

    .sp-row-label {
        font-size: 16px;
        color: #fff;
    }

    .sp-row-desc {
        font-size: 13px;
        color: #86868b;
        margin-top: 2px;
    }

    .sp-row-control {
        flex-direction: column;
        align-items: flex-end;
    }

    .theme-choices {
        gap: 16px;
    }

    .theme-choice span {
        font-size: 10px;
    }

    .theme-preview {
        width: 52px;
        height: 36px;
    }

    .layout-choices-modal {
        flex-direction: column;
        gap: 0;
    }

    .layout-choice-modal {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 0;
        text-align: left;
    }

    .layout-preview-modal {
        width: 80px;
        height: 52px;
        flex-shrink: 0;
    }

    .layout-choice-modal-label {
        margin-top: 0;
        font-size: 15px;
        color: #fff;
    }

    .layout-choice-modal.active .layout-choice-modal-label {
        color: #0a84ff;
    }

    .layout-choice-modal.active .layout-preview-modal {
        border-color: #0a84ff;
    }

    /* Mobile-only override for sp-grouped */
    .sp-grouped {
        margin: 0 16px 16px;
    }

    [data-theme="light"] .sp-titlebar {
        background: #f5f5f7;
        border-bottom: none;
    }

    [data-theme="light"] .sp-content {
        background: #ffffff;
    }

    [data-theme="light"] .sp-mobile-nav {
        background: #f5f5f7;
        border-bottom: 0.5px solid #e5e5e7;
    }

    [data-theme="light"] .sp-mobile-nav-title {
        color: #1d1d1f;
    }

    [data-theme="light"] .sp-row {
        background: #f5f5f7;
        border-bottom: 0.5px solid #e5e5e7;
    }

    [data-theme="light"] .sp-row:first-of-type {
        border-bottom: 0.5px solid #e5e5e7;
    }

    [data-theme="light"] .sp-row-label {
        color: #1d1d1f;
    }

    [data-theme="light"] .sp-row-desc {
        color: #86868b;
    }

    [data-theme="light"] .layout-choice-modal-label {
        color: #1d1d1f;
    }
}

/* Notification header actions */
.notif-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.notif-header-actions .notif-mark-all.active {
    background: #000;
    color: #fff;
}

[data-theme="dark"] .notif-header-actions .notif-mark-all.active {
    background: #fff;
    color: #000;
}

/* Notification item read state */
.notif-item.read {
    opacity: 0.6;
}

/* === Settings Modal — New Elements === */

/* Profile card */
.sp-profile-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #2c2c2e;
    border-radius: 12px;
}

.sp-profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3a3a3c;
}

.sp-profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-profile-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #0a84ff, #5856d6);
}

.sp-profile-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sp-profile-name {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.sp-profile-role {
    font-size: 13px;
    color: #86868b;
}

/* iOS row value */
.sp-ios-value {
    font-size: 14px;
    color: #86868b;
    flex-shrink: 0;
}

/* Color picker */
.sp-color-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sp-color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
}

.sp-color-swatch:hover {
    transform: scale(1.1);
}

.sp-color-swatch.active {
    border-color: #fff;
    transform: scale(1.15);
}

.sp-color-fill {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.sp-color-swatch.active svg {
    position: absolute;
}

/* Font picker */
.sp-font-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sp-font-option {
    padding: 12px 16px;
    background: #2c2c2e;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

:root:not([data-theme="dark"]) .sp-font-option {
    background: #f5f5f7;
    border-color: #e5e5e7;
}

.sp-font-option:hover {
    border-color: var(--user-accent);
}

.sp-font-option.active {
    border-color: var(--user-accent);
    background: rgba(10, 132, 255, 0.1);
}

:root:not([data-theme="dark"]) .sp-font-option.active {
    background: rgba(10, 132, 255, 0.08);
}

.sp-font-label {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

:root:not([data-theme="dark"]) .sp-font-label {
    color: #000;
}

.sp-font-preview {
    font-size: 16px;
    color: #86868b;
}

:root:not([data-theme="dark"]) .sp-font-preview {
    color: #6e6e73;
}

.sp-font-check {
    position: absolute;
    top: 12px;
    right: 12px;
    color: var(--user-accent);
}

/* Toggle switch */
.sp-ios-toggle {
    cursor: pointer;
    flex-shrink: 0;
}

.sp-toggle-track {
    width: 51px;
    height: 31px;
    border-radius: 16px;
    background: #39393d;
    position: relative;
    transition: background 0.25s;
}

.sp-ios-toggle.on .sp-toggle-track {
    background: #30d158;
}

.sp-toggle-thumb {
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.25s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.sp-ios-toggle.on .sp-toggle-thumb {
    transform: translateX(20px);
}

/* Security form */
.sp-security-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sp-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sp-input-label {
    font-size: 13px;
    font-weight: 500;
    color: #86868b;
}

/* Light theme label */
:root:not([data-theme="dark"]) .sp-input-label {
    color: #6e6e73;
}

.sp-input-wrap {
    position: relative;
}

.sp-input {
    width: 100%;
    padding: 10px 14px;
    background: #3a3a3c;
    border: 1px solid #48484a;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
    box-sizing: border-box;
}

/* Light theme inputs */
:root:not([data-theme="dark"]) .sp-input {
    background: #f5f5f7;
    border: 1px solid #d1d1d6;
    color: #000;
}

:root:not([data-theme="dark"]) .sp-input:focus {
    border-color: #0a84ff;
    background: #fff;
}

:root:not([data-theme="dark"]) .sp-input::placeholder {
    color: #86868b;
}

.sp-input:focus {
    border-color: #0a84ff;
}

.sp-input::placeholder {
    color: #636366;
}

.sp-input:-webkit-autofill,
.sp-input:-webkit-autofill:hover,
.sp-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff;
    -webkit-box-shadow: 0 0 0 1000px #3a3a3c inset;
    box-shadow: 0 0 0 1000px #3a3a3c inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Light theme autofill */
:root:not([data-theme="dark"]) .sp-input:-webkit-autofill,
:root:not([data-theme="dark"]) .sp-input:-webkit-autofill:hover,
:root:not([data-theme="dark"]) .sp-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #000;
    -webkit-box-shadow: 0 0 0 1000px #f5f5f7 inset;
    box-shadow: 0 0 0 1000px #f5f5f7 inset;
}

.sp-pass-hint {
    font-size: 13px;
    min-height: 20px;
    color: #86868b;
}

/* Light theme hint */
:root:not([data-theme="dark"]) .sp-pass-hint {
    color: #6e6e73;
}

.sp-pass-error {
    color: #ff453a;
}

.sp-pass-success {
    color: #30d158;
}

.sp-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: background 0.15s, opacity 0.15s;
    align-self: flex-start;
}

.sp-btn-primary {
    background: var(--user-accent);
    color: #fff;
}

.sp-btn-primary:hover {
    opacity: 0.9;
}

.sp-btn-primary:active {
    opacity: 0.8;
}
}

/* === Light theme overrides — new elements === */
[data-theme="light"] .sp-profile-card {
    background: #f5f5f7;
}

[data-theme="light"] .sp-profile-avatar-fallback {
    background: linear-gradient(135deg, #0a84ff, #5856d6);
}

[data-theme="light"] .sp-profile-name {
    color: #1d1d1f;
}

[data-theme="light"] .sp-ios-value {
    color: #86868b;
}

[data-theme="light"] .sp-color-swatch.active {
    border-color: #1d1d1f;
}

[data-theme="light"] .sp-toggle-track {
    background: #e5e5ea;
}

[data-theme="light"] .sp-ios-toggle.on .sp-toggle-track {
    background: #30d158;
}

/* === Mobile overrides — new elements === */
@media (max-width: 768px) {
    .sp-profile-card {
        margin: 16px;
        padding: 16px;
    }

    .sp-profile-avatar {
        width: 56px;
        height: 56px;
    }

    .sp-profile-name {
        font-size: 16px;
    }

    .sp-color-picker {
        padding: 0 16px;
    }

    .sp-security-form {
        padding: 0 16px;
    }

    .sp-input {
        font-size: 16px;
    }

    [data-theme="light"] .sp-profile-card {
        background: #f5f5f7;
    }
}
