/*
 * Amnezia Panel — Apple-inspired interface layer.
 *
 * This file intentionally sits on top of the legacy stylesheet. Keeping the
 * redesign isolated makes rollback a one-link change and leaves every
 * existing JavaScript/DOM contract untouched.
 */

:root,
:root[data-theme="light"] {
    color-scheme: light;

    --bg: #f5f5f7;
    --bg-primary: #f5f5f7;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafc;
    --bg-input: #ffffff;
    --bg-modal: rgba(0, 0, 0, 0.38);

    --border: #e0e0e0;
    --border-color: #e0e0e0;
    --border-hover: #b8b8bd;
    --border-focus: #c2410c;

    --text-primary: #1d1d1f;
    --text-secondary: #333333;
    --text-muted: #7a7a7a;
    --text-accent: #c2410c;

    --primary: #c2410c;
    --accent-color: #c2410c;
    --accent: #c2410c;
    --accent-light: #ea580c;
    --accent-dark: #9a3412;
    --accent-glow: rgba(194, 65, 12, 0.18);
    --accent-gradient: #c2410c;

    --success: #248a3d;
    --success-bg: #edf8f0;
    --success-border: #b8dec1;
    --danger: #d70015;
    --danger-bg: #fff1f2;
    --danger-border: #f2b8be;
    --warning: #9a6700;
    --warning-bg: #fff8e6;
    --info: #c2410c;
    --info-bg: #fff7ed;

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-section: 80px;

    --radius: 18px;
    --radius-sm: 8px;
    --radius-md: 11px;
    --radius-lg: 18px;
    --radius-xl: 18px;
    --radius-full: 9999px;

    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    --shadow-glow: none;
    --shadow-card: none;

    --transition-fast: 120ms ease;
    --transition-base: 180ms ease;
    --transition-slow: 220ms ease;
    --font-family: "SF Pro Text", "SF Pro Display", system-ui, -apple-system,
        BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-shadow: none !important;
    text-shadow: none !important;
}

html {
    min-width: 320px;
    background: var(--bg-primary);
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.47;
    letter-spacing: -0.022em;
}

body::before {
    display: none !important;
    content: none !important;
    background: none !important;
}

.panel-shell .ico,
.login-page .ico {
    background-color: currentColor !important;
}

::selection {
    background: rgba(194, 65, 12, 0.2);
    color: var(--text-primary);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb,
:root[data-theme="light"] ::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    background: rgba(29, 29, 31, 0.3);
    background-clip: padding-box;
}

a {
    color: #c2410c;
    text-decoration: none;
}

a:hover {
    color: #9a3412;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 3000;
    padding: 10px 16px;
    border-radius: 8px;
    background: #ffffff;
    color: #c2410c;
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea,
[tabindex]:not([tabindex="-1"]) {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2px solid #c2410c !important;
    outline-offset: 2px !important;
}

/* Layout */

.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

.app-container > main {
    width: min(100%, 1440px);
    min-width: 0;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

/* Global navigation */

.app-header {
    position: sticky;
    top: 0;
    z-index: 900;
    display: flex;
    width: 100%;
    min-height: 66px;
    align-items: center;
    gap: 24px;
    margin: 0;
    padding: 0 max(24px, calc((100vw - 1440px) / 2 + 24px));
    border: 0;
    background: #000000;
    color: #ffffff;
}

.app-logo {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    flex: 0 1 auto;
}

.app-logo:hover {
    color: #ffffff;
}

.logo-icon,
.server-icon,
.client-avatar,
.protocol-icon,
.empty-icon,
.day-user-avatar,
.device-session-icon {
    background: #f5f5f7 !important;
    color: #c2410c !important;
}

.app-header .logo-icon {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent !important;
    color: #ffffff !important;
    font-size: 20px;
}

.logo-lockup {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.logo-text,
:root[data-theme="light"] .logo-text {
    overflow: hidden;
    max-width: 150px;
    background: none !important;
    color: currentColor;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
    -webkit-text-fill-color: currentColor;
}

.logo-product-badge {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 3px 8px;
    border: 1px solid rgba(251, 146, 60, 0.55);
    border-radius: var(--radius-full);
    background: rgba(194, 65, 12, 0.24);
    color: #fdba74;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
}

.app-header .logo-subtitle {
    display: none;
}

.header-nav,
:root[data-theme="light"] .header-nav {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.nav-link {
    position: relative;
    display: inline-flex;
    min-height: 66px;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    border-radius: 0;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.76);
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active,
:root[data-theme="light"] .nav-link:hover,
:root[data-theme="light"] .nav-link.active {
    color: #ffffff;
    background: transparent !important;
    font-weight: 400;
}

.nav-link.active::after {
    position: absolute;
    right: 14px;
    bottom: 7px;
    left: 14px;
    height: 2px;
    border-radius: var(--radius-full);
    background: #fb923c;
    content: "";
}

.app-header .ico {
    width: 18px;
    height: 18px;
    color: currentColor !important;
}

.app-header .nav-link .ico {
    width: 21px;
    height: 21px;
    margin-right: 0;
    color: #fb923c !important;
    opacity: 1;
}

.nav-user {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

.nav-username {
    max-width: 120px;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.76);
    font-size: 14px;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-header .theme-toggle,
:root[data-theme="light"] .app-header .theme-toggle {
    width: 32px;
    height: 32px;
    min-height: 32px;
    margin: 0 !important;
    border: 0;
    border-radius: 50%;
    background: #1d1d1f;
    color: #ffffff;
    transform: none;
}

.app-header .theme-toggle:hover,
:root[data-theme="light"] .app-header .theme-toggle:hover {
    background: #333336;
    transform: none;
}

.app-header .nav-user .badge {
    padding: 4px 7px;
    border-color: rgba(255, 255, 255, 0.18);
    background: #1d1d1f;
    color: rgba(255, 255, 255, 0.82);
    font-size: 10px !important;
    font-weight: 600;
    letter-spacing: 0;
}

.app-header .nav-user .btn {
    min-height: 32px;
    padding: 6px 11px;
    border-color: #333336;
    border-radius: 8px;
    background: #1d1d1f;
    color: #ffffff;
    font-size: 14px;
}

.app-header .nav-user .btn:hover {
    border-color: #4a4a4d;
    background: #2a2a2c;
}

.mobile-nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
}

.mobile-nav-toggle span {
    display: block;
    width: 16px;
    height: 1px;
    background: currentColor;
    transition: transform var(--transition-base);
}

.app-header.nav-open .mobile-nav-toggle span:first-child {
    transform: translateY(3px) rotate(45deg);
}

.app-header.nav-open .mobile-nav-toggle span:last-child {
    transform: translateY(-3px) rotate(-45deg);
}

/* Type hierarchy */

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 24px;
    color: #1d1d1f;
    font-family: "SF Pro Display", var(--font-family);
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.section-title .icon {
    display: inline-grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 11px;
    background: #ffffff;
    color: #c2410c;
}

.section-title .ico {
    width: 23px;
    height: 23px;
}

main h1,
main h2,
main h3,
.card-title,
.modal-title,
.protocol-name,
.client-name,
.server-name,
.empty-title,
.marketplace-category-title,
.marketplace-app-title {
    color: #1d1d1f;
    font-family: "SF Pro Display", var(--font-family);
    font-weight: 600 !important;
    letter-spacing: -0.02em;
}

main .card h1 {
    font-size: 24px !important;
    line-height: 1.15;
}

.card-title,
.modal-title,
.protocol-name {
    font-size: 17px;
    line-height: 1.24;
}

.card-subtitle,
.protocol-desc,
.marketplace-app-desc,
.empty-desc,
.form-hint,
.text-muted {
    color: #7a7a7a;
    font-weight: 400;
}

/* Buttons */

.btn {
    min-height: 44px;
    gap: 8px;
    padding: 11px 22px;
    overflow: visible;
    border: 1px solid transparent;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: -0.016em;
    transform: none;
}

.btn::before,
.btn:hover::before {
    display: none !important;
    content: none !important;
    background: none !important;
}

.btn:hover {
    transform: none;
}

.btn:active:not(:disabled) {
    transform: scale(0.95);
}

.btn-primary,
:root[data-theme="light"] .btn-primary {
    border-color: #c2410c;
    border-radius: var(--radius-full);
    background: #c2410c;
    color: #ffffff;
}

.btn-primary:hover,
:root[data-theme="light"] .btn-primary:hover {
    border-color: #9a3412;
    background: #9a3412;
    color: #ffffff;
}

.btn-secondary {
    border-color: #d2d2d7;
    border-radius: 8px;
    background: #fafafc;
    color: #1d1d1f;
}

.btn-secondary:hover {
    border-color: #a8a8ad;
    background: #ffffff;
    color: #1d1d1f;
}

.btn-danger {
    border-color: #d70015;
    border-radius: 8px;
    background: #ffffff;
    color: #d70015;
}

.btn-danger:hover {
    background: #fff1f2;
    color: #b50012;
}

.btn-success {
    border-color: #248a3d;
    border-radius: 8px;
    background: #ffffff;
    color: #248a3d;
}

.btn-warning {
    border-color: #9a6700;
    border-radius: 8px;
    background: #ffffff;
    color: #765000;
}

.btn-sm {
    min-height: 44px;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 14px;
}

.btn-icon,
.btn.btn-icon {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
}

.btn:disabled {
    opacity: 0.48;
}

/* Cards, lists and utility surfaces */

.card,
.client-item,
.marketplace-app-card,
.device-session,
.day-user-row,
.tunnel-row {
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    background: #ffffff;
}

.card {
    padding: 24px;
}

.card-hover:hover,
.client-item:hover,
.device-session-toggle:hover,
.day-user-row:hover {
    border-color: #b8b8bd;
    background: #ffffff;
    transform: none;
}

.card-header {
    gap: 16px;
    margin-bottom: 24px;
}

.server-grid,
.protocol-cards {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.server-card {
    cursor: grab;
}

.server-card.drag-over {
    border: 2px solid #c2410c;
    transform: none;
}

.server-icon {
    width: 48px;
    height: 48px;
    border: 1px solid #e0e0e0;
    border-radius: 11px;
}

.server-card .server-name {
    font-size: 17px;
}

.server-card .server-host,
.font-mono,
.config-text,
.log-output,
.vpn-link-box,
.protocol-info-value {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0;
}

.server-card .server-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-color: #e0e0e0;
}

.server-card .server-icon {
    border-color: #fed7aa;
    background: #fff7ed !important;
    color: #c2410c !important;
}

.server-card .server-icon .ico {
    width: 22px;
    height: 22px;
    color: #c2410c !important;
}

.server-card .server-actions .btn-secondary.btn-icon {
    border-color: #fdba74;
    background: #fff7ed;
    color: #9a3412;
}

.server-card .server-actions .btn-secondary.btn-icon:hover {
    border-color: #c2410c;
    background: #c2410c;
    color: #ffffff;
}

.server-card .server-actions .btn-icon .ico {
    width: 19px;
    height: 19px;
    color: inherit !important;
}

.protocol-card {
    overflow: hidden;
}

.protocol-card::before,
.protocol-card:hover::before {
    display: none !important;
    content: none !important;
    background: none !important;
}

.protocol-icon {
    width: 52px;
    height: 52px;
    margin-bottom: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 11px;
}

.protocol-awg .protocol-icon,
.protocol-legacy .protocol-icon,
.protocol-xray .protocol-icon,
.protocol-telemt .protocol-icon,
.protocol-dns .protocol-icon,
.protocol-wireguard .protocol-icon,
.protocol-adguard .protocol-icon,
.protocol-socks5 .protocol-icon,
.protocol-nginx .protocol-icon {
    background: #f5f5f7 !important;
    color: #c2410c;
}

.protocol-desc {
    min-height: 0;
    font-size: 14px;
    line-height: 1.43;
}

.protocol-info {
    gap: 8px;
}

.protocol-info-item,
.stat-pill,
.traffic-badge {
    border: 1px solid #e0e0e0;
    background: #f5f5f7;
    color: #333333;
    font-weight: 400;
}

.protocol-info-value {
    font-weight: 400;
}

.clients-list {
    gap: 12px;
}

#usersGrid,
#usersGrid > *,
#usersGrid .client-info,
#usersGrid .client-actions {
    min-width: 0;
    max-width: 100%;
}

#usersGrid .client-meta,
#usersGrid .client-meta span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.client-item {
    padding: 16px 20px;
}

.client-avatar {
    width: 40px;
    height: 40px;
    border: 1px solid #e0e0e0;
    border-radius: 11px;
    font-size: 15px;
    font-weight: 600;
}

.client-name {
    font-size: 17px;
}

.client-meta {
    color: #7a7a7a;
    font-size: 12px;
    line-height: 1.45;
}

#usersGrid .user-connections-count {
    color: #c2410c !important;
    font-weight: 600;
    text-decoration-color: rgba(194, 65, 12, 0.45) !important;
    text-underline-offset: 2px;
}

#usersGrid .client-actions .btn-icon:not(.btn-danger) {
    border-color: #fdba74;
    background: #fff7ed;
    color: #9a3412;
}

#usersGrid .client-actions .btn-icon:not(.btn-danger):hover {
    border-color: #c2410c;
    background: #c2410c;
    color: #ffffff;
}

#usersGrid .client-actions .btn-icon .ico {
    width: 18px;
    height: 18px;
    color: inherit !important;
}

#usersGrid .client-actions .btn-danger {
    border-color: #ef4444;
    background: #fff1f2;
    color: #b50012;
}

#usersGrid .client-actions .btn-danger:hover {
    border-color: #b50012;
    background: #b50012;
    color: #ffffff;
}

/* Status remains semantic; it is not a second brand accent. */

.badge {
    min-height: 24px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
}

.badge-success {
    border-color: #b8dec1;
    background: #edf8f0;
    color: #1d7532;
}

.badge-danger {
    border-color: #f2b8be;
    background: #fff1f2;
    color: #b50012;
}

.badge-warn {
    border-color: #ead7a1;
    background: #fff8e6;
    color: #765000;
}

.badge-info,
.badge-secondary {
    border-color: #fdba74;
    background: #fff7ed;
    color: #9a3412;
}

.ping-dot.ping-ok,
.ping-dot.ping-fail,
.ping-dot.ping-pending {
    background-color: currentColor;
}

.ping-dot.ping-ok {
    color: #248a3d;
}

.ping-dot.ping-fail {
    color: #d70015;
}

.ping-dot.ping-pending {
    color: #7a7a7a;
}

/* Forms */

.form-group {
    margin-bottom: 17px;
}

.form-label {
    margin-bottom: 6px;
    color: #333333;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.016em;
    text-transform: none;
}

.form-input,
.form-select,
.form-textarea {
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    background-color: #ffffff;
    color: #1d1d1f;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.35;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: #a8a8ad;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: #c2410c;
    background-color: #ffffff;
    outline: 2px solid #c2410c;
    outline-offset: 1px;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #7a7a7a;
    opacity: 1;
}

.form-select {
    background-color: #ffffff;
}

.form-textarea {
    min-height: 120px;
}

#userSearch,
input[type="search"] {
    border-radius: var(--radius-full);
    padding-right: 20px;
    padding-left: 20px;
}

.form-hint {
    font-size: 12px;
    line-height: 1.45;
}

.switch .slider,
.slider {
    border: 1px solid #d2d2d7;
    background: #d2d2d7;
}

input:checked + .slider {
    border-color: #c2410c;
    background: #c2410c;
}

/* Tabs and compact navigation */

.tabs,
.config-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    overflow-x: auto;
    border: 0;
    border-radius: var(--radius-full);
    background: #e8e8ed;
}

.tab,
.config-tab {
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    background: transparent;
    color: #333333;
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
}

.tab:hover,
.config-tab:hover {
    color: #1d1d1f;
}

.tab.active,
.config-tab.active {
    border-color: #d2d2d7;
    background: #ffffff;
    color: #1d1d1f;
    font-weight: 600;
}

/* Modal and feedback surfaces */

.modal-backdrop {
    padding: 24px;
    background: rgba(0, 0, 0, 0.38);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
}

.modal {
    width: min(100%, 560px);
    max-height: min(90vh, 900px);
    padding: 24px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    background: #ffffff;
    color: #1d1d1f;
    transform: translateY(12px) scale(0.98);
}

.modal-backdrop.active .modal {
    transform: none;
}

.modal-header {
    gap: 16px;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 21px;
    line-height: 1.19;
}

.modal-close {
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(210, 210, 215, 0.64);
    color: #1d1d1f;
}

.modal-close:hover {
    background: #d2d2d7;
    color: #1d1d1f;
}

.modal-footer {
    gap: 8px;
    margin-top: 24px;
    padding-top: 24px;
    border-color: #e0e0e0;
}

.toast-container {
    top: 60px;
    right: 24px;
}

.toast {
    max-width: min(400px, calc(100vw - 32px));
    padding: 14px 18px;
    border: 1px solid #e0e0e0;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.94);
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 400;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
}

.toast-success {
    border-color: #b8dec1;
    color: #1d7532;
}

.toast-error {
    border-color: #f2b8be;
    color: #b50012;
}

.toast-info {
    border-color: #fdba74;
    color: #9a3412;
}

.progress-bar {
    height: 4px;
    background: #e8e8ed;
}

.progress-fill {
    background: #c2410c;
}

.progress-fill::after {
    display: none;
    content: none;
}

.loading-spinner,
.spinner {
    border-color: #d2d2d7;
    border-top-color: #c2410c;
}

.empty-state {
    padding: 64px 32px;
    color: #7a7a7a;
}

.empty-state .empty-icon {
    display: grid;
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    place-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    opacity: 1;
}

.empty-state .empty-title {
    color: #1d1d1f;
    font-size: 21px;
}

.back-link {
    min-height: 44px;
    margin-bottom: 16px;
    color: #c2410c;
    font-size: 14px;
}

.back-link::before {
    content: "‹";
    font-size: 22px;
    line-height: 1;
}

.divider {
    background: #e0e0e0;
}

/* Technical content */

.config-display,
.config-text,
.vpn-link-box,
.log-output {
    border-color: #e0e0e0;
    border-radius: 11px;
    background: #f5f5f7;
    color: #333333;
}

.config-text,
.vpn-link-box,
.log-output {
    font-size: 12px;
    line-height: 1.55;
}

.qr-container {
    border-color: #e0e0e0;
    border-radius: 18px;
    background: #ffffff;
}

.config-editor-wrap {
    border-color: #e0e0e0 !important;
    border-radius: 11px !important;
}

/* Marketplace and promotional blocks */

.marketplace-grid {
    gap: 24px !important;
}

.marketplace-category-title {
    font-size: 21px;
}

.marketplace-app-card {
    padding: 24px !important;
    background: #ffffff !important;
}

.promo-block,
.promo-aivpn,
.promo-revproxy {
    min-height: 0;
    padding: 32px;
    overflow: hidden;
    border: 0;
    border-radius: 18px;
    background: #272729 !important;
    color: #ffffff;
}

.promo-revproxy {
    background: #2a2a2c !important;
}

.promo-block::before,
.promo-block::after,
.promo-grid-bg,
.promo-orbs {
    display: none !important;
    content: none !important;
    background: none !important;
}

.promo-title,
.promo-subtitle,
.promo-block .promo-icon,
.promo-block .promo-lock-badge {
    color: #ffffff !important;
}

.promo-subtitle {
    color: #cccccc !important;
}

.promo-cta {
    border-color: #c2410c !important;
    border-radius: var(--radius-full) !important;
    background: #c2410c !important;
    color: #ffffff !important;
}

/* Calendar */

.payment-calendar {
    gap: 8px !important;
}

.payment-calendar.weekdays {
    color: #7a7a7a !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

.calendar-day {
    min-height: 120px;
    padding: 10px;
    border: 1px solid #e0e0e0 !important;
    border-radius: 11px !important;
    background: #ffffff !important;
    transform: none !important;
}

.calendar-day:not(.other-month):hover,
.calendar-day.today {
    border-color: #c2410c !important;
    transform: none !important;
}

.calendar-number {
    color: #333333 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

.calendar-user {
    border-radius: 8px !important;
    background: #fff7ed !important;
    color: #9a3412 !important;
}

.day-user-row {
    background: #ffffff !important;
}

.day-user-avatar {
    border-radius: 50%;
    background: #c2410c !important;
    color: #ffffff !important;
}

/* User device sessions */

.device-sessions-summary {
    color: #7a7a7a !important;
    font-size: 12px !important;
}

.device-sessions-summary::before {
    background: #c2410c !important;
}

.device-session {
    border-radius: 18px !important;
    background: #ffffff !important;
}

.device-session-toggle {
    min-height: 64px;
    color: #1d1d1f !important;
}

.device-session-icon {
    border-color: #fed7aa !important;
    border-radius: 11px !important;
    background: #fff7ed !important;
    color: #c2410c !important;
}

.device-session-icon .ico {
    width: 20px;
    height: 20px;
    color: #c2410c !important;
}

.device-session-kicker {
    color: #7a7a7a !important;
    font-weight: 600 !important;
}

.device-session-name {
    color: #1d1d1f !important;
    font-size: 17px !important;
    font-weight: 600 !important;
}

.device-key-row.client-item {
    border-color: #e0e0e0 !important;
    background: #ffffff !important;
}

.connections-modal-title {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.modal-title-icon {
    display: inline-grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    background: #fff7ed;
    color: #c2410c;
}

.modal-title-icon .ico {
    width: 19px;
    height: 19px;
    color: #c2410c !important;
}

#userConnsModal .connection-key-icon {
    border-color: #fdba74;
    background: #fff7ed !important;
    color: #c2410c !important;
}

#userConnsModal .connection-key-icon .ico {
    width: 18px;
    height: 18px;
    color: #c2410c !important;
}

#userConnsModal .connection-split-badge {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid #b8dec1;
    border-radius: var(--radius-full);
    background: #eef7f0;
    color: #1f6b38;
    font-weight: 600;
}

html[data-theme="dark"] #userConnsModal .connection-split-badge {
    border-color: rgba(50, 215, 75, 0.42);
    background: rgba(50, 215, 75, 0.14);
    color: #32d74b;
}

#userConnsModal .connection-country-badge {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid #fed7aa;
    border-radius: var(--radius-full);
    background: #fff7ed;
    color: #9a3412;
    font-weight: 600;
}

#userConnsModal .device-key-row .client-actions,
#connectionsListInner .client-actions {
    max-width: none;
}

#userConnsModal .device-key-row .client-actions .btn-icon:not(.btn-danger),
#connectionsListInner .client-actions .btn-icon:not(.btn-danger) {
    border-color: #fdba74;
    background: #fff7ed;
    color: #9a3412;
}

#userConnsModal .device-key-row .client-actions .btn-icon:not(.btn-danger):hover,
#connectionsListInner .client-actions .btn-icon:not(.btn-danger):hover {
    border-color: #c2410c;
    background: #c2410c;
    color: #ffffff;
}

#userConnsModal .device-key-row .client-actions .btn-icon .ico,
#connectionsListInner .client-actions .btn-icon .ico {
    width: 19px;
    height: 19px;
}

#userConnsModal .device-key-row .client-actions .btn-icon:hover .ico,
#connectionsListInner .client-actions .btn-icon:hover .ico {
    color: inherit !important;
}

#userConnsModal .device-key-row .client-actions .btn-danger,
#connectionsListInner .client-actions .btn-danger {
    border-color: #ef4444;
    background: #fff1f2;
    color: #b50012;
}

#userConnsModal .device-key-row .client-actions .btn-danger:hover,
#connectionsListInner .client-actions .btn-danger:hover {
    border-color: #b50012;
    background: #b50012;
    color: #ffffff;
}

#connectionsListInner .client-avatar {
    border-color: #fed7aa;
    background: #fff7ed !important;
    color: #c2410c !important;
}

#connectionsListInner .client-avatar.avatar-online {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #16a34a;
}

/* Login and public access */

.login-page {
    background: #f5f5f7;
}

.login-wrapper {
    min-height: 100svh !important;
    padding: 64px 24px !important;
    background: #f5f5f7 !important;
}

.login-card {
    max-width: 440px !important;
}

.login-logo {
    margin-bottom: 32px !important;
}

.login-logo .logo-icon {
    width: 64px !important;
    height: 64px !important;
    border: 1px solid #e0e0e0;
    border-radius: 18px !important;
    background: #ffffff !important;
    color: #c2410c !important;
}

.login-logo .logo-text {
    max-width: none;
    color: #1d1d1f;
    font-size: clamp(28px, 7vw, 40px) !important;
    font-weight: 600 !important;
    line-height: 1.1;
    letter-spacing: -0.025em;
    white-space: normal;
}

.login-logo .logo-subtitle {
    margin-top: 8px;
    color: #7a7a7a !important;
    font-size: 17px !important;
    font-weight: 400;
    letter-spacing: -0.022em;
    text-transform: none;
}

.login-card > .card {
    padding: 32px;
}

.login-card > .card h2 {
    font-size: 21px !important;
}

.login-error {
    border-color: #f2b8be !important;
    border-radius: 11px !important;
    background: #fff1f2 !important;
    color: #b50012 !important;
}

#newTokenModal .modal > div[style*="rgba(255, 255, 255"] {
    border-color: #ead7a1 !important;
    background: #fff8e6 !important;
}

.login-page > .theme-toggle,
:root[data-theme="light"] .login-page > .theme-toggle {
    width: 44px;
    height: 44px;
    border-color: #e0e0e0;
    background: rgba(255, 255, 255, 0.8);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
}

/* Motion and accessibility */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Responsive layout */

@media (max-width: 1068px) {
    .app-header {
        gap: 10px;
        padding-right: 20px;
        padding-left: 20px;
    }

    .nav-link {
        padding-right: 8px;
        padding-left: 8px;
    }

    .app-container > main {
        padding-right: 20px;
        padding-left: 20px;
    }

    .settings-page .grid,
    main > .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 1100px) {
    .app-header {
        min-height: 66px;
        flex-direction: row;
        align-items: center;
        gap: 4px;
    }

    .app-logo {
        order: 1;
        margin-right: auto;
    }

    .nav-user {
        order: 2;
        padding: 0;
        border: 0;
    }

    .mobile-nav-toggle {
        display: flex;
        order: 3;
    }

    .header-nav,
    :root[data-theme="light"] .header-nav {
        position: absolute;
        top: 66px;
        right: 0;
        left: 0;
        display: none;
        order: 4;
        max-height: calc(100vh - 66px);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        overflow-y: auto;
        padding: 8px 16px 16px;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        background: rgba(0, 0, 0, 0.94);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
    }

    .app-header.nav-open .header-nav {
        display: flex;
    }

    .nav-link {
        width: 100%;
        min-height: 48px;
        justify-content: flex-start;
        padding: 0 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        font-size: 18px;
    }

    .nav-link.active::after {
        top: 12px;
        right: auto;
        bottom: 12px;
        left: 0;
        width: 2px;
        height: auto;
        background: #fb923c;
    }

    .nav-username,
    .app-header .nav-user .badge {
        display: none;
    }

    .app-header .theme-toggle,
    :root[data-theme="light"] .app-header .theme-toggle {
        width: 44px;
        height: 44px;
        min-height: 44px;
    }

    .app-header .nav-user .btn {
        min-height: 36px;
    }

    .app-container > main {
        padding-top: 48px;
        padding-bottom: 64px;
    }

    .server-grid,
    .protocol-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-row,
    .user-detail-grid,
    .settings-page .grid,
    main > .grid {
        grid-template-columns: 1fr !important;
    }

    .clients-header,
    .card-header,
    .server-status-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 734px) {
    .app-container > main {
        padding-top: 40px;
    }

    .server-grid,
    .protocol-cards {
        grid-template-columns: 1fr;
    }

    .client-item {
        align-items: flex-start;
        gap: 16px;
    }

    .client-actions {
        width: auto;
        max-width: none;
    }

    .modal-footer,
    .config-actions {
        flex-wrap: wrap;
    }

    .modal-footer .btn,
    .config-actions .btn {
        flex: 1 1 auto;
    }
}

@media (max-width: 640px) {
    .app-header .nav-user .btn {
        display: none;
    }

    .app-container > main {
        padding: 32px 16px 48px;
    }

    .section-title {
        font-size: 34px;
    }

    .section-title .icon {
        width: 40px;
        height: 40px;
    }

    .card,
    .login-card > .card {
        padding: 20px;
    }

    .modal-backdrop {
        align-items: flex-end;
        padding: 8px;
    }

    .modal {
        width: 100% !important;
        max-height: calc(100svh - 16px);
        padding: 20px;
    }

    .toast-container {
        right: 16px;
        left: 16px;
    }

    .toast {
        max-width: none;
    }

    .payment-calendar {
        gap: 3px !important;
    }

    .calendar-day {
        min-height: 76px !important;
        padding: 4px !important;
        border-radius: 8px !important;
    }

    .calendar-user {
        padding: 3px !important;
        font-size: 10px !important;
    }

    .calendar-sum {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding-right: 8px;
        padding-left: 12px;
    }

    .app-header .logo-text {
        max-width: 130px;
    }

    .app-container > main {
        padding-right: 12px;
        padding-left: 12px;
    }

    .section-title {
        gap: 8px;
        font-size: 28px;
    }

    .section-title .icon {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }

    .btn:not(.btn-icon) {
        white-space: normal;
    }

    .client-item {
        flex-direction: column;
    }

    .client-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

    .login-wrapper {
        padding: 72px 12px 32px !important;
    }

    .login-card > .card {
        padding: 20px;
    }

    .login-logo .logo-text {
        font-size: 28px !important;
    }
}

.device-session.is-drop-target {
    border-color: #c2410c !important;
    box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.16);
}

.device-session-new-drop.is-drop-target {
    border-color: #c2410c !important;
    background: #fff7ed !important;
    color: #c2410c !important;
}

.device-key-row.is-dragging {
    opacity: 0.4;
}

.finance-kpi-value.is-profit {
    color: #c2410c !important;
}

/* Dark theme */

:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #000000;
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --bg-card: #1c1c1e;
    --bg-card-hover: #2c2c2e;
    --bg-input: #1c1c1e;
    --bg-modal: rgba(0, 0, 0, 0.72);

    --border: #3a3a3c;
    --border-color: #3a3a3c;
    --border-hover: #636366;
    --border-focus: #fb923c;

    --text-primary: #f5f5f7;
    --text-secondary: #d1d1d6;
    --text-muted: #8e8e93;
    --text-accent: #fb923c;

    --primary: #ea580c;
    --accent-color: #ea580c;
    --accent: #ea580c;
    --accent-light: #fb923c;
    --accent-dark: #c2410c;
    --accent-glow: rgba(234, 88, 12, 0.28);
    --accent-gradient: #ea580c;

    --success: #32d74b;
    --success-bg: #102418;
    --success-border: #1f6b38;
    --danger: #ff453a;
    --danger-bg: #3a1216;
    --danger-border: #7a2e34;
    --warning: #ffd60a;
    --warning-bg: #2a2208;
    --info: #fb923c;
    --info-bg: #2a1608;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb,
:root[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(245, 245, 247, 0.28);
}

html[data-theme="dark"] a {
    color: #fb923c;
}

html[data-theme="dark"] a:hover {
    color: #fdba74;
}

html[data-theme="dark"] .skip-link {
    background: #1c1c1e;
    color: #fb923c;
}

html[data-theme="dark"] .section-title,
html[data-theme="dark"] main h1,
html[data-theme="dark"] main h2,
html[data-theme="dark"] main h3,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .modal-title,
html[data-theme="dark"] .protocol-name,
html[data-theme="dark"] .client-name,
html[data-theme="dark"] .server-name,
html[data-theme="dark"] .empty-title,
html[data-theme="dark"] .marketplace-category-title,
html[data-theme="dark"] .marketplace-app-title {
    color: var(--text-primary);
}

html[data-theme="dark"] .section-title .icon,
html[data-theme="dark"] .logo-icon,
html[data-theme="dark"] .server-icon,
html[data-theme="dark"] .client-avatar,
html[data-theme="dark"] .protocol-icon,
html[data-theme="dark"] .empty-icon,
html[data-theme="dark"] .day-user-avatar,
html[data-theme="dark"] .device-session-icon {
    background: #2c2c2e !important;
    color: #fb923c !important;
}

html[data-theme="dark"] .card-subtitle,
html[data-theme="dark"] .protocol-desc,
html[data-theme="dark"] .marketplace-app-desc,
html[data-theme="dark"] .empty-desc,
html[data-theme="dark"] .form-hint,
html[data-theme="dark"] .text-muted {
    color: var(--text-muted);
}

html[data-theme="dark"] .btn-secondary {
    border-color: #3a3a3c;
    background: #2c2c2e;
    color: #f5f5f7;
}

html[data-theme="dark"] .btn-secondary:hover {
    border-color: #636366;
    background: #3a3a3c;
    color: #f5f5f7;
}

html[data-theme="dark"] .btn-danger,
html[data-theme="dark"] .btn-success,
html[data-theme="dark"] .btn-warning {
    background: #1c1c1e;
}

html[data-theme="dark"] .btn-danger {
    border-color: #7a2e34;
    color: #ff6b6b;
}

html[data-theme="dark"] .btn-danger:hover {
    background: #3a1216;
    color: #ff8a8a;
}

html[data-theme="dark"] .btn-success {
    border-color: #1f6b38;
    color: #32d74b;
}

html[data-theme="dark"] .btn-warning {
    border-color: #6b5a12;
    color: #ffd60a;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .client-item,
html[data-theme="dark"] .marketplace-app-card,
html[data-theme="dark"] .device-session,
html[data-theme="dark"] .day-user-row,
html[data-theme="dark"] .tunnel-row {
    border-color: var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
}

html[data-theme="dark"] .card-hover:hover,
html[data-theme="dark"] .client-item:hover,
html[data-theme="dark"] .device-session-toggle:hover,
html[data-theme="dark"] .day-user-row:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

html[data-theme="dark"] .server-icon,
html[data-theme="dark"] .protocol-icon {
    border-color: var(--border);
}

html[data-theme="dark"] .server-card .server-icon,
html[data-theme="dark"] .protocol-awg .protocol-icon,
html[data-theme="dark"] .protocol-legacy .protocol-icon,
html[data-theme="dark"] .protocol-xray .protocol-icon,
html[data-theme="dark"] .protocol-telemt .protocol-icon,
html[data-theme="dark"] .protocol-dns .protocol-icon,
html[data-theme="dark"] .protocol-wireguard .protocol-icon,
html[data-theme="dark"] .protocol-adguard .protocol-icon,
html[data-theme="dark"] .protocol-socks5 .protocol-icon,
html[data-theme="dark"] .protocol-nginx .protocol-icon {
    background: rgba(234, 88, 12, 0.16) !important;
    border-color: rgba(251, 146, 60, 0.35);
    color: #fb923c !important;
}

html[data-theme="dark"] .server-card .server-actions {
    border-color: var(--border);
}

html[data-theme="dark"] .server-card .server-actions .btn-secondary.btn-icon {
    border-color: rgba(251, 146, 60, 0.4);
    background: rgba(234, 88, 12, 0.16);
    color: #fdba74;
}

/* Light cream action circles + forced-white mask glyphs cancel each other
   out. Keep the dark-theme buttons dark, and let the glyph follow color. */
html[data-theme="dark"] .panel-shell .btn-icon .ico,
html[data-theme="dark"] .panel-shell .modal-title-icon .ico,
html[data-theme="dark"] .panel-shell .connection-key-icon .ico,
html[data-theme="dark"] .panel-shell .device-session-icon .ico,
html[data-theme="dark"] .panel-shell .server-icon .ico,
html[data-theme="dark"] .login-page .ico {
    background-color: currentColor !important;
}

html[data-theme="dark"] #usersGrid .client-actions .btn-icon:not(.btn-danger),
html[data-theme="dark"] #userConnsModal .device-key-row .client-actions .btn-icon:not(.btn-danger),
html[data-theme="dark"] #connectionsListInner .client-actions .btn-icon:not(.btn-danger),
html[data-theme="dark"] .device-session-header-actions .btn-icon:not(.btn-danger) {
    border-color: rgba(251, 146, 60, 0.4);
    background: #2c2c2e;
    color: #fdba74;
}

html[data-theme="dark"] #usersGrid .client-actions .btn-icon:not(.btn-danger):hover,
html[data-theme="dark"] #userConnsModal .device-key-row .client-actions .btn-icon:not(.btn-danger):hover,
html[data-theme="dark"] #connectionsListInner .client-actions .btn-icon:not(.btn-danger):hover,
html[data-theme="dark"] .device-session-header-actions .btn-icon:not(.btn-danger):hover {
    border-color: #ea580c;
    background: #ea580c;
    color: #ffffff;
}

html[data-theme="dark"] #usersGrid .client-actions .btn-danger,
html[data-theme="dark"] #userConnsModal .device-key-row .client-actions .btn-danger,
html[data-theme="dark"] #connectionsListInner .client-actions .btn-danger,
html[data-theme="dark"] .device-session-header-actions .btn-danger {
    border-color: #7a2e34;
    background: #3a1216;
    color: #ff8a8a;
}

html[data-theme="dark"] #usersGrid .client-actions .btn-danger:hover,
html[data-theme="dark"] #userConnsModal .device-key-row .client-actions .btn-danger:hover,
html[data-theme="dark"] #connectionsListInner .client-actions .btn-danger:hover,
html[data-theme="dark"] .device-session-header-actions .btn-danger:hover {
    border-color: #b50012;
    background: #b50012;
    color: #ffffff;
}

html[data-theme="dark"] .modal-title-icon,
html[data-theme="dark"] #userConnsModal .connection-key-icon {
    border-color: rgba(251, 146, 60, 0.4);
    background: #2c2c2e !important;
    color: #fdba74 !important;
}

html[data-theme="dark"] .protocol-info-item,
html[data-theme="dark"] .stat-pill,
html[data-theme="dark"] .traffic-badge {
    border-color: var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

html[data-theme="dark"] .form-label {
    color: var(--text-secondary);
}

html[data-theme="dark"] .form-input,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .form-textarea,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    border-color: var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
}

html[data-theme="dark"] .form-input:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] .form-textarea:focus {
    border-color: var(--border-focus);
}

html[data-theme="dark"] .tab,
html[data-theme="dark"] .config-tab {
    color: var(--text-muted);
}

html[data-theme="dark"] .tab:hover,
html[data-theme="dark"] .config-tab:hover {
    color: var(--text-primary);
}

html[data-theme="dark"] .tab.active,
html[data-theme="dark"] .config-tab.active {
    border-color: var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
}

html[data-theme="dark"] .modal {
    border-color: var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
}

html[data-theme="dark"] .modal-close {
    background: #3a3a3c;
    color: var(--text-primary);
}

html[data-theme="dark"] .modal-close:hover {
    background: #48484a;
    color: var(--text-primary);
}

html[data-theme="dark"] .modal-footer {
    border-color: var(--border);
}

html[data-theme="dark"] .toast {
    border-color: var(--border);
    background: rgba(28, 28, 30, 0.94);
    color: var(--text-primary);
}

html[data-theme="dark"] .toast-success {
    border-color: #1f6b38;
    color: #32d74b;
}

html[data-theme="dark"] .toast-error {
    border-color: #7a2e34;
    color: #ff6b6b;
}

html[data-theme="dark"] .toast-info {
    border-color: rgba(251, 146, 60, 0.5);
    color: #fdba74;
}

html[data-theme="dark"] .badge-success,
html[data-theme="dark"] .status-ok {
    background: var(--success-bg);
    color: var(--success);
}

html[data-theme="dark"] .badge-danger,
html[data-theme="dark"] .status-fail {
    background: var(--danger-bg);
    color: var(--danger);
}

html[data-theme="dark"] .badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

html[data-theme="dark"] .badge-info {
    background: var(--info-bg);
    color: var(--info);
}

html[data-theme="dark"] .login-error {
    border-color: #7a2e34 !important;
    background: #3a1216 !important;
    color: #ff8a8a !important;
}

html[data-theme="dark"] .login-page > .theme-toggle,
html[data-theme="dark"] .login-page > .lang-toggle,
:root[data-theme="dark"] .login-page > .theme-toggle,
:root[data-theme="dark"] .login-page > .lang-toggle {
    border-color: #3a3a3c;
    background: rgba(28, 28, 30, 0.88);
    color: #f5f5f7;
}

html[data-theme="dark"] .device-session-new-drop.is-drop-target {
    background: rgba(234, 88, 12, 0.16) !important;
}

html[data-theme="dark"] table,
html[data-theme="dark"] th,
html[data-theme="dark"] td {
    border-color: var(--border);
    color: var(--text-primary);
}

html[data-theme="dark"] tr:hover td {
    background: var(--bg-card-hover);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #1d1d1f;
    color: #ffffff;
    cursor: pointer;
}

.theme-icon {
    display: none;
    width: 18px;
    height: 18px;
    background: currentColor;
    -webkit-mask: center / contain no-repeat;
    mask: center / contain no-repeat;
}

.theme-icon-sun {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E");
}

.theme-icon-moon {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M21 14.5A8.5 8.5 0 1 1 9.5 3 7 7 0 0 0 21 14.5z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M21 14.5A8.5 8.5 0 1 1 9.5 3 7 7 0 0 0 21 14.5z'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .theme-icon-sun,
:root[data-theme="dark"] .theme-icon-sun {
    display: block;
}

html[data-theme="light"] .theme-icon-moon,
:root[data-theme="light"] .theme-icon-moon {
    display: block;
}

.login-page > .lang-toggle,
:root[data-theme="light"] .login-page > .lang-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    font-size: 1.25rem;
    cursor: pointer;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
}

.login-page > .theme-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10;
    width: 44px;
    height: 44px;
}

html[dir="rtl"] .login-page > .theme-toggle {
    right: 20px;
    left: auto;
}

