/* CARgo CRM — design system (based on production Next.js UI) */

:root {
    --primary: 25 95% 53%;
    --primary-fg: 0 0% 100%;
    --background: 220 14% 96%;
    --foreground: 224 71% 4%;
    --card: 0 0% 100%;
    --muted: 220 14% 92%;
    --muted-fg: 220 9% 46%;
    --border: 220 13% 91%;
    --sidebar-bg: 220 20% 10%;
    --sidebar-fg: 210 40% 96%;
    --sidebar-muted: 220 15% 16%;
    --radius: 0.75rem;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.06), 0 2px 4px -2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
    --color-primary: hsl(var(--primary));
    --color-primary-hover: hsl(25 95% 48%);
    --color-primary-bg: hsl(25 95% 53% / 0.1);
    --color-sidebar-bg: hsl(var(--sidebar-bg));
    --color-sidebar-text: hsl(var(--sidebar-fg) / 0.85);
    --color-body-bg: hsl(var(--background));
    --color-card-bg: hsl(var(--card));
    --text-primary: hsl(var(--foreground));
    --text-secondary: hsl(var(--muted-fg));
    --status-new: #3b82f6;
    --status-progress: #f97316;
    --status-completed: #22c55e;
    --status-delivered: #6b7280;
    --layout-sidebar-width: 188px;
    --layout-shell-pad-x: 0.75rem;
    --space-page-y: 0.75rem;
    --space-page-bottom: 1rem;
    --space-section: 0.75rem;
    --space-block: 0.5rem;
    --space-card: 0.85rem;
    --space-card-mb: 0.75rem;
    --space-grid-gap: 0.75rem;
    --space-panel: 0.85rem;
    --layout-content-cap: 1680px;
    --layout-content-max: min(
        var(--layout-content-cap),
        calc(100vw - var(--layout-sidebar-width) - 2 * var(--layout-shell-pad-x))
    );
}

/* Средняя тема — приглушённый «dim» между светлой и тёмной */
.medium {
    --background: 220 12% 88%;
    --foreground: 224 25% 18%;
    --card: 220 14% 94%;
    --muted: 220 11% 82%;
    --muted-fg: 220 9% 38%;
    --border: 220 10% 78%;
    --sidebar-bg: 220 18% 24%;
    --sidebar-fg: 210 25% 92%;
    --sidebar-muted: 220 14% 30%;
    --color-body-bg: hsl(var(--background));
    --color-card-bg: hsl(var(--card));
    --text-primary: hsl(var(--foreground));
    --text-secondary: hsl(var(--muted-fg));
    --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 8px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 20px rgba(0,0,0,.1);
}

.dark {
    --background: 224 71% 4%;
    --foreground: 210 40% 96%;
    --card: 220 20% 8%;
    --muted: 220 15% 16%;
    --muted-fg: 215 20% 65%;
    --border: 220 15% 16%;
    --sidebar-bg: 224 71% 3%;
    --color-body-bg: hsl(var(--background));
    --color-card-bg: hsl(var(--card));
    --text-primary: hsl(var(--foreground));
    --text-secondary: hsl(var(--muted-fg));
    --shadow-sm: 0 1px 3px rgba(0,0,0,.25);
    --shadow-md: 0 4px 6px rgba(0,0,0,.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.4);
}

.vivid-accent {
    --primary: 24 100% 50%;
    --color-primary: hsl(var(--primary));
    --color-primary-hover: hsl(20 100% 45%);
    --color-primary-bg: hsl(25 100% 50% / 0.14);
}

.compact {
    --layout-sidebar-width: 172px;
    --layout-content-cap: 1560px;
}
.compact .sidebar-logo { padding: var(--space-panel) var(--space-card); }
.compact .nav-item { padding: var(--space-block) var(--space-card); font-size: 0.72rem; }
.compact .nav-item .nav-label { display: inline-block; }
.compact .nav-item .nav-icon { display: block !important; }
.compact .nav-group-label { padding-top: 0.5rem; }
.compact .content { padding: 0.05rem var(--layout-shell-pad-x) 0.15rem; }
.compact .top-header-row--global { min-height: 2.15rem; padding: 0.1rem 0; }
.compact .card { padding: var(--space-panel); margin-bottom: var(--space-block); }
.compact .top-header-title { font-size: 1.05rem; }
.compact .stat-card { padding: var(--space-panel); }
.compact .stat-card .value { font-size: 1.5rem; }
.compact h1 { font-size: 1.35rem; }

.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

@media (prefers-reduced-motion: reduce) {
    :root:not(.reduce-motion-off) .stat-card,
    :root:not(.reduce-motion-off) .content,
    :root:not(.reduce-motion-off) .auth-panel-inner {
        animation: none;
    }
}

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

[hidden] { display: none !important; }

/* SVG без width/height в разметке — 300×150 px и ломают вёрстку */
.sidebar .nav-icon,
.appearance-menu-trigger > svg,
.input-icon,
.sidebar-logo .brand-mark > svg,
.auth-feature-icon > svg {
    display: block;
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
}

.theme-option-icon > svg {
    display: block;
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
}

.btn svg:not([width]) {
    display: inline-block;
    vertical-align: middle;
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-body-bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

::selection { background: hsl(var(--primary) / 0.2); color: hsl(var(--primary)); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-fg) / 0.5); }

/* ——— Auth (split layout) ——— */
.auth-page { min-height: 100vh; }

.auth-shell { display: flex; min-height: 100vh; }

.auth-hero {
    display: none;
    width: 45%;
    position: relative;
    overflow: hidden;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem;
    background: linear-gradient(135deg, hsl(220 20% 10%) 0%, hsl(220 20% 14%) 40%, hsl(25 30% 16%) 100%);
    color: #fff;
}

@media (min-width: 1024px) {
    .auth-hero { display: flex; }
}

.auth-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: orb-float 8s ease-in-out infinite;
}
.auth-orb--1 {
    top: -10%; right: -15%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, hsl(25 95% 53% / 0.12), transparent 70%);
}
.auth-orb--2 {
    bottom: -20%; left: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, hsl(25 95% 53% / 0.06), transparent 70%);
    animation-delay: -4s;
}

@keyframes orb-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(12px, -8px) scale(1.03); }
}

.auth-hero-car {
    position: absolute;
    bottom: 4rem;
    right: 2rem;
    width: 16rem;
    height: 16rem;
    opacity: 0.04;
    color: #fff;
}

.auth-hero-top, .auth-hero-mid, .auth-hero-copy { position: relative; z-index: 1; }

.auth-brand-link {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius);
}
.auth-brand-link:hover { opacity: 0.88; }
.auth-brand-link:focus-visible {
    outline: 2px solid #fb923c;
    outline-offset: 4px;
}
.auth-mobile-brand.auth-brand-link { align-items: center; }

.brand-mark {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f97316, #d97706);
    box-shadow: 0 8px 24px hsl(25 95% 53% / 0.3);
    color: #fff;
    margin-bottom: 0.75rem;
}
.brand-mark--sm { width: 3.5rem; height: 3.5rem; margin: 0 auto 0.75rem; }

.brand-text { display: flex; align-items: baseline; gap: 1px; }
.brand-text strong { font-size: 1.5rem; font-weight: 800; color: #fff; letter-spacing: -0.02em; }
.brand-text span { font-size: 1.5rem; font-weight: 600; color: #fb923c; }
.brand-text--lg strong, .brand-text--lg span { font-size: 1.25rem; }
.brand-text--lg strong { color: var(--text-primary); }
.brand-text--lg span { color: var(--color-primary); }

.auth-tagline { color: rgba(255,255,255,.4); font-size: 0.875rem; margin-top: 0.25rem; }

.auth-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255,255,255,.06);
    font-size: 0.75rem;
    color: rgba(255,255,255,.6);
}
.auth-status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

.auth-hero-mid h2 {
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 2rem;
}

.auth-features { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.auth-features li { display: flex; align-items: flex-start; gap: 0.75rem; font-size: 0.875rem; color: rgba(255,255,255,.7); }
.auth-features--news li { align-items: flex-start; }
.auth-feature-body { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.auth-feature-title { font-weight: 600; color: rgba(255,255,255,.92); line-height: 1.35; }
.auth-feature-desc { font-size: 0.8125rem; color: rgba(255,255,255,.55); line-height: 1.4; }

.auth-whats-new-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fb923c;
    margin-bottom: 0.75rem;
}
.auth-hero-mid .auth-whats-new-label { display: none; }

.auth-whats-new--panel {
    display: block;
    margin-top: 1.75rem;
    padding: 1rem 1rem 0.25rem;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    background: hsl(var(--muted) / 0.35);
}
@media (min-width: 1024px) {
    .auth-whats-new--panel { display: none; }
}
.auth-whats-new--panel .auth-whats-new-label { display: block; color: var(--color-primary); }
.auth-whats-new--panel .auth-features { gap: 0.875rem; }
.auth-whats-new--panel .auth-features li { color: var(--text-secondary); }
.auth-whats-new--panel .auth-feature-title { color: var(--text-primary); font-size: 0.875rem; }
.auth-whats-new--panel .auth-feature-desc { color: var(--text-secondary); }
.auth-whats-new--panel .auth-feature-icon {
    width: 2rem; height: 2rem;
    background: hsl(var(--primary) / 0.12);
    color: var(--color-primary);
}
.auth-feature-icon {
    width: 2.5rem; height: 2.5rem;
    border-radius: 0.5rem;
    background: hsl(25 95% 53% / 0.15);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: #fb923c;
}
.auth-feature-icon svg { width: 1.25rem; height: 1.25rem; }

.auth-hero-copy { font-size: 0.75rem; color: rgba(255,255,255,.2); }

.auth-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--color-body-bg);
    position: relative;
}

.auth-panel-inner { width: 100%; max-width: 28rem; animation: fade-up 0.4s ease; }

.auth-mobile-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}
@media (min-width: 1024px) {
    .auth-mobile-brand { display: none; }
}

.auth-form-header { margin-bottom: 2rem; }
.auth-form-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.auth-form-header p { font-size: 0.875rem; color: var(--text-secondary); }
.text-warning { color: #d97706 !important; }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }

/* Клиентское приложение на /login и в auth */
.auth-panel .client-app-download--login {
    margin: 0 0 1.25rem;
    padding: 1rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-md);
    background: hsl(var(--muted) / 0.2);
}
.auth-panel .client-app-download--login .client-app-download__pwa-btn {
    font-weight: 600;
}
.auth-panel .client-app-download--login .client-app-download__actions {
    justify-content: flex-start;
}
.client-app-download__title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 600;
}
.client-app-download__lead {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.client-app-download__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}
.client-app-store-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.85rem;
    border-radius: 10px;
    text-decoration: none;
    color: #fff;
    background: #111827;
    border: 1px solid #374151;
    min-width: 10.5rem;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.client-app-store-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
    color: #fff;
}
.client-app-store-btn--android {
    background: #0f766e;
    border-color: #0d9488;
}
.client-app-store-btn__text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.client-app-store-btn__small {
    font-size: 0.65rem;
    opacity: 0.9;
}
.client-app-store-btn__big {
    font-size: 0.95rem;
    font-weight: 700;
}
.client-app-download__hint {
    margin: 0;
    font-size: 0.875rem;
}

/* Кликабельная строка таблицы (data-href на tr). */
tr.table-row-clickable {
    cursor: pointer;
}
tr.table-row-clickable:hover td,
tr.table-row-clickable:focus-within td {
    background: hsl(var(--muted) / 0.35);
}
tr.table-row-clickable:focus {
    outline: 2px solid hsl(var(--primary) / 0.45);
    outline-offset: -2px;
}

/* PWA-баннер на публичных клиентских страницах (book/track/estimate). */
.client-pwa-install {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border: 1px dashed hsl(var(--border));
    border-radius: var(--radius-md);
    background: hsl(var(--muted) / 0.25);
}
.client-pwa-install__title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
}
.client-pwa-install__text {
    margin: 0.35rem 0 0.5rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.client-pwa-install__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.client-pwa-install__tip {
    font-size: 0.75rem;
}
.client-pwa-install__guide {
    margin: 0.5rem 0;
    padding: 0.55rem 0.65rem;
    font-size: 0.8rem;
    line-height: 1.45;
    border-radius: var(--radius-sm);
    background: hsl(var(--background));
    color: var(--text-secondary);
}
.client-pwa-install__guide[hidden] {
    display: none;
}

.input-icon-wrap { position: relative; }
.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: var(--text-secondary);
    pointer-events: none;
}
.input-icon-wrap input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: var(--color-card-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input-icon-wrap input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.2);
}
.input-icon-wrap input::placeholder { color: var(--text-secondary); }

.auth-hint {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: hsl(var(--muted) / 0.5);
}

.appearance-menu--auth { position: absolute; top: 1rem; right: 1rem; z-index: 50; }
.appearance-menu--auth .appearance-menu-trigger {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    justify-content: center;
}
.appearance-menu--auth .appearance-menu-trigger-label { display: none !important; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ——— App shell ——— */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--layout-sidebar-width);
    background: var(--color-sidebar-bg);
    color: var(--color-sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid hsl(var(--sidebar-muted));
}

.sidebar-logo {
    padding: var(--space-panel) var(--space-card);
    display: flex;
    align-items: center;
    gap: var(--space-block);
    border-bottom: 1px solid hsl(var(--sidebar-muted));
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s ease;
}
.sidebar-logo:hover { opacity: 0.85; }
.sidebar-logo .brand-mark { width: 2.125rem; height: 2.125rem; margin: 0; flex-shrink: 0; }
.sidebar-logo .brand-mark svg { width: 1.125rem; height: 1.125rem; }
.sidebar-logo .brand-text strong { font-size: 1.05rem; }
.sidebar-logo .brand-text span { font-size: 1.05rem; }

.sidebar-nav {
    padding: var(--space-block) var(--space-block);
    flex: 1;
    overflow-y: auto;
}

.nav-group-label {
    padding: var(--space-card) var(--space-card) var(--space-block);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: hsl(var(--sidebar-fg) / 0.35);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-block);
    padding: var(--space-block) var(--space-card);
    margin-bottom: 1px;
    color: hsl(var(--sidebar-fg) / 0.75);
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 0.78rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.nav-item:hover {
    background: hsl(var(--sidebar-muted));
    color: #fff;
}
.nav-item.active {
    background: hsl(var(--primary) / 0.15);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--color-primary);
}
.nav-icon {
    display: block;
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    opacity: 0.9;
}
.nav-item.active .nav-icon { color: #fb923c; opacity: 1; }

/* Пункт меню: иконка + подпись */
.nav-item .nav-icon {
    display: block !important;
}
.nav-item .nav-label {
    display: inline-block;
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}
.sidebar .sidebar-logo .brand-text {
    display: flex;
}
.sidebar-note {
    margin: 0;
    padding: 0 var(--space-card) var(--space-panel);
    font-size: 0.72rem;
    line-height: 1.35;
    color: hsl(var(--sidebar-fg) / 0.45);
    border-bottom: 1px solid hsl(var(--sidebar-muted));
}

.sidebar-footer {
    padding: var(--space-card);
    border-top: 1px solid hsl(var(--sidebar-muted));
    font-size: 0.7rem;
    color: hsl(var(--sidebar-fg) / 0.3);
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--color-body-bg);
}

.top-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: hsl(var(--card) / 0.92);
    border-bottom: 1px solid hsl(var(--border));
    backdrop-filter: blur(10px);
}

.top-header-shell {
    max-width: var(--layout-content-max);
    margin: 0 auto;
    padding: 0 var(--layout-shell-pad-x);
}

.top-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-panel) var(--space-card);
}

.top-header-row--global {
    padding: var(--space-block) 0;
    min-height: 2.2rem;
}

.top-header-row--page {
    padding: var(--space-block) 0 var(--space-card);
    border-top: 1px solid hsl(var(--border) / 0.65);
    align-items: center;
    min-height: 2.75rem;
}

.top-header-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    justify-content: flex-end;
    min-height: 2rem;
    flex-shrink: 0;
}

.top-header-start {
    display: flex;
    align-items: center;
    gap: var(--space-panel);
    flex: 1;
    min-width: 0;
}

.top-header-page-meta {
    flex: 1;
    min-width: 0;
}

.top-header-crumb {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 0.05rem;
}

.top-header-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.top-header-subtitle {
    margin: var(--space-block) 0 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.top-header-subtitle:empty,
.top-header-subtitle[hidden] {
    display: none;
}

.top-header-page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-block);
    flex-shrink: 0;
    max-width: 100%;
}

.top-header-page-actions:empty {
    display: none;
}

.search-form {
    flex: 1;
    max-width: min(36rem, calc(100vw - var(--layout-sidebar-width) - 22rem));
    position: relative;
    min-width: 0;
}
.search-form input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.25rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--muted) / 0.4);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.15);
    background: var(--color-card-bg);
}
.search-form::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    background-size: contain;
    pointer-events: none;
}
.search-kbd {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    border: 1px solid hsl(var(--border));
    color: var(--text-secondary);
    background: var(--color-card-bg);
    font-family: inherit;
    pointer-events: none;
}

.header-actions { display: flex; align-items: center; gap: var(--space-block); }
.user-name { font-weight: 500; font-size: 0.875rem; }
.user-role.badge {
    background: var(--color-primary-bg);
    color: var(--color-primary);
    text-transform: capitalize;
}

/* ——— Меню оформления ——— */
.appearance-menu { position: relative; }

.appearance-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 2.25rem;
    padding: 0 0.65rem;
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    background: hsl(var(--muted) / 0.35);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.appearance-menu-trigger:hover {
    background: hsl(var(--muted));
    color: var(--text-primary);
    border-color: hsl(var(--primary) / 0.35);
}
.appearance-menu-trigger svg { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.appearance-menu-trigger[aria-expanded="true"] {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-bg);
}

.appearance-menu-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: min(360px, calc(100vw - 2rem));
    max-width: 360px;
    padding: 0;
    background: var(--color-card-bg);
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
}
.appearance-menu-panel:not([hidden]) {
    display: block;
    animation: appearance-in 0.2s ease;
}
.appearance-menu--auth .appearance-menu-panel { right: 0; left: auto; }

@keyframes appearance-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.appearance-menu-head {
    padding: var(--space-panel) var(--space-card);
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.appearance-menu-head strong { font-size: 0.9rem; }
.appearance-menu-hint { font-size: 0.7rem; color: var(--text-secondary); }

.appearance-section { padding: var(--space-panel) var(--space-card); }
.appearance-section + .appearance-section { border-top: 1px solid hsl(var(--border)); }
.appearance-section-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: var(--space-panel);
}
.appearance-section-note {
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.theme-picker {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.4rem;
    border: 2px solid hsl(var(--border));
    border-radius: 0.65rem;
    background: hsl(var(--muted) / 0.25);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    position: relative;
}
.theme-option:hover { border-color: hsl(var(--primary) / 0.4); transform: translateY(-1px); }
.theme-option.is-active {
    border-color: var(--color-primary);
    background: var(--color-primary-bg);
    box-shadow: 0 0 0 1px hsl(var(--primary) / 0.2);
}
.theme-option-icon svg { width: 1rem; height: 1rem; color: var(--text-secondary); }
.theme-option.is-active .theme-option-icon svg { color: var(--color-primary); }
.theme-option-label { font-size: 0.7rem; font-weight: 600; color: var(--text-primary); }

.theme-preview {
    width: 100%;
    height: 1.75rem;
    border-radius: 0.35rem;
    border: 1px solid rgba(0,0,0,.08);
}
.theme-preview--light { background: linear-gradient(90deg, #f8fafc 60%, #1e293b 60%); }
.theme-preview--medium { background: linear-gradient(90deg, #d4d4d8 55%, #3f3f46 55%); }
.theme-preview--dark { background: linear-gradient(90deg, #0f172a 55%, #020617 55%); }
.theme-preview--system {
    background: linear-gradient(135deg, #f8fafc 25%, #d4d4d8 50%, #1e293b 75%);
}

.appearance-toggles { list-style: none; display: flex; flex-direction: column; gap: 0.35rem; }
.appearance-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.55rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.15s;
}
.appearance-toggle:hover { background: hsl(var(--muted) / 0.5); }
.appearance-toggle strong { display: block; font-size: 0.8125rem; font-weight: 500; }
.appearance-toggle small { display: block; font-size: 0.68rem; color: var(--text-secondary); margin-top: 0.1rem; }
.appearance-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

.appearance-switch {
    flex-shrink: 0;
    width: 2.25rem;
    height: 1.25rem;
    border-radius: 999px;
    background: hsl(var(--border));
    position: relative;
    transition: background 0.2s;
}
.appearance-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(1.25rem - 4px);
    height: calc(1.25rem - 4px);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
    transition: transform 0.2s;
}
.appearance-toggle input:checked + .appearance-switch {
    background: var(--color-primary);
}
.appearance-toggle input:checked + .appearance-switch::after {
    transform: translateX(1rem);
}

.appearance-menu-foot {
    padding: var(--space-panel) var(--space-card);
    border-top: 1px solid hsl(var(--border));
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: right;
}
.appearance-kbd {
    font-family: inherit;
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--muted) / 0.5);
}

.content {
    flex: 1;
    padding: var(--space-page-y) var(--layout-shell-pad-x) var(--space-page-bottom);
    animation: fade-up 0.35s ease;
}

.content-shell {
    max-width: var(--layout-content-max);
    margin: 0 auto;
    width: 100%;
}

/* ——— Typography & layout ——— */
h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: var(--space-section); letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; font-weight: 600; margin: var(--space-section) 0 var(--space-block); }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-section);
    flex-wrap: wrap;
    gap: var(--space-block);
}
.page-header h1 { margin-bottom: 0; }

.page-header--merged,
.dash-header--merged,
.help-page-header--merged {
    display: none !important;
}

.planner-workspace-top--merged {
    display: none;
}

/* ——— Меню пользователя в шапке ——— */
.user-menu { position: relative; }

.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-block);
    height: 2rem;
    padding: 0 var(--space-panel) 0 var(--space-card);
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    background: hsl(var(--muted) / 0.35);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    max-width: 12rem;
    transition: background 0.15s, border-color 0.15s;
}
.user-menu-trigger:hover {
    background: hsl(var(--muted));
    border-color: hsl(var(--primary) / 0.35);
}

.user-menu-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 999px;
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-menu-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.user-menu-role {
    text-transform: capitalize;
    font-size: 0.62rem;
    padding: 0.1rem 0.35rem;
}

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    min-width: 11.5rem;
    padding: 0.35rem;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    background: var(--color-card-bg);
    box-shadow: var(--shadow-lg);
    z-index: 60;
}

.user-menu-head {
    padding: 0.45rem 0.55rem 0.35rem;
    border-bottom: 1px solid hsl(var(--border));
    margin-bottom: 0.25rem;
}
.user-menu-head strong {
    display: block;
    font-size: 0.8125rem;
}
.user-menu-hint {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.user-menu-link {
    display: block;
    padding: 0.45rem 0.55rem;
    border-radius: 0.4rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.8125rem;
}
.user-menu-link:hover {
    background: hsl(var(--muted) / 0.55);
}
.user-menu-link--danger { color: #dc2626; }
.user-menu-link--danger:hover { background: #fef2f2; }
.dark .user-menu-link--danger:hover { background: hsl(0 60% 20% / 0.4); }

/* ——— Cards & stats ——— */
.card {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    padding: var(--space-card);
    box-shadow: var(--shadow-sm);
    border: 1px solid hsl(var(--border));
    margin-bottom: var(--space-card-mb);
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-grid-gap);
    margin-bottom: var(--space-section);
}

.stat-card {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    padding: var(--space-card);
    border: 1px solid hsl(var(--border));
    border-left: 4px solid var(--color-primary);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: fade-up 0.4s ease backwards;
}
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.02em;
}
.stat-card .label { color: var(--text-secondary); font-size: 0.85rem; margin-top: 0.25rem; }

/* ——— Buttons ——— */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: var(--space-panel) var(--space-card);
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-gradient {
    background: linear-gradient(135deg, #f97316, #d97706);
    color: #fff;
    box-shadow: 0 4px 14px hsl(25 95% 53% / 0.25);
}
.btn-gradient:hover {
    background: linear-gradient(135deg, #ea580c, #b45309);
    box-shadow: 0 6px 20px hsl(25 95% 53% / 0.35);
}
.btn-block { width: 100%; padding: 0.75rem 1rem; }
.btn-outline {
    background: transparent;
    border: 1px solid hsl(var(--border));
    color: var(--text-primary);
}
.btn-outline:hover { background: hsl(var(--muted)); }
.btn-sm { padding: var(--space-block) var(--space-panel); font-size: 0.8rem; }
.btn-danger { background: #ef4444; color: #fff; }

/* ——— Tables ——— */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-card-bg);
    border-radius: var(--radius);
    overflow: hidden;
}
th, td {
    padding: var(--space-block) var(--space-card);
    text-align: left;
    border-bottom: 1px solid hsl(var(--border));
}
th {
    background: hsl(var(--muted) / 0.5);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
tr:hover td { background: hsl(var(--muted) / 0.3); }
tr.row-warning td { background: #fef2f2; }
.dark tr.row-warning td { background: hsl(0 62% 30% / 0.2); }

.text-muted {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ——— Badges ——— */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-new { background: #dbeafe; color: var(--status-new); }
.badge-progress { background: var(--color-primary-bg); color: var(--status-progress); }
.badge-completed { background: #dcfce7; color: var(--status-completed); }
.badge-delivered { background: hsl(var(--muted)); color: var(--status-delivered); }
.badge-waiting { background: #fef3c7; color: #b45309; }
.badge.complexity-low { background: #dcfce7; color: #166534; }
.badge.complexity-medium { background: #fef9c3; color: #854d0e; }
.badge.complexity-high { background: #fee2e2; color: #991b1b; }

/* ——— Forms ——— */
.form-group { margin-bottom: var(--space-section); }
.form-group label {
    display: block;
    margin-bottom: 0.2rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-panel) var(--space-card);
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: var(--color-card-bg);
    color: var(--text-primary);
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.15);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-grid-gap); }
.form-actions { display: flex; gap: var(--space-block); margin-top: var(--space-section); flex-wrap: wrap; }

/* ——— Alerts ——— */
.alert {
    padding: var(--space-block) var(--space-card);
    border-radius: 0.5rem;
    margin-bottom: var(--space-card-mb);
    font-size: 0.875rem;
}
.telephony-popup {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 9999;
    max-width: 280px;
    padding: 0.75rem 2rem 0.75rem 0.85rem;
    background: var(--color-card-bg);
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
}
.telephony-popup button {
    position: absolute;
    top: 0.25rem;
    right: 0.35rem;
    border: none;
    background: transparent;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
}
.telephony-popup a { display: inline-block; margin-top: 0.35rem; font-weight: 600; }

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.dark .alert-success { background: hsl(142 50% 20%); color: #86efac; border-color: hsl(142 50% 30%); }
.dark .alert-error { background: hsl(0 50% 20%); color: #fca5a5; border-color: hsl(0 50% 30%); }

.filters { display: flex; gap: var(--space-block); flex-wrap: wrap; margin-bottom: var(--space-card-mb); }
.filters input, .filters select {
    padding: var(--space-block) var(--space-card);
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    background: var(--color-card-bg);
    color: var(--text-primary);
}

/* ——— Posts & kanban ——— */
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-grid-gap); }
.post-card {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    padding: var(--space-panel);
    border: 2px solid hsl(var(--border));
    min-height: 140px;
    transition: border-color 0.15s, transform 0.15s;
}
.post-card:hover { transform: translateY(-2px); }
.post-card.free { border-color: #22c55e; }
.post-card.busy { border-color: var(--color-primary); }
.post-card h3 { font-size: 0.95rem; margin-bottom: 0.5rem; }

.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-grid-gap); }
.kanban-col {
    background: hsl(var(--muted) / 0.5);
    border-radius: var(--radius);
    padding: var(--space-panel);
    min-height: 300px;
}
.kanban-col h3 { font-size: 0.85rem; margin-bottom: var(--space-block); color: var(--text-secondary); }
.kanban-card {
    background: var(--color-card-bg);
    padding: var(--space-panel);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid hsl(var(--border));
    position: relative;
}
.kanban-drag-handle {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    cursor: grab;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1;
    padding: 0.15rem 0.25rem;
    user-select: none;
    touch-action: none;
}
.kanban-drag-handle:active { cursor: grabbing; }
.kanban-card-chosen { box-shadow: var(--shadow-md); }
.kanban-card-ghost { opacity: 0.45; }
.kanban-drop { min-height: 120px; }

.sort-th {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}
.sort-th:hover { color: var(--color-primary); }

.data-table { width: 100%; border-collapse: collapse; margin-top: var(--space-block); }
.data-table th, .data-table td {
    padding: var(--space-block) var(--space-card);
    text-align: left;
    border-bottom: 1px solid hsl(var(--border));
}
.data-table th { font-size: 0.8rem; color: var(--text-secondary); }

/* ——— Search results ——— */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--color-card-bg);
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 320px;
    overflow-y: auto;
    z-index: 50;
}
.search-results a.search-hit {
    display: block;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid hsl(var(--border));
    font-size: 0.875rem;
}
.search-results a.search-hit:hover { background: var(--color-primary-bg); }
.search-results a.search-hit.is-active { background: var(--color-primary-bg); outline: 2px solid var(--color-primary); outline-offset: -2px; }
.search-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--color-primary);
    font-weight: 600;
    margin-right: 0.35rem;
}

.dashboard-alerts { margin-left: 1.25rem; line-height: 1.8; list-style: disc; }
.dashboard-alerts a { color: var(--color-primary-hover); text-decoration: none; }
.dashboard-alerts a:hover { text-decoration: underline; }

/* ——— Responsive ——— */
@media (max-width: 1024px) {
    .kanban { grid-template-columns: 1fr; }
    .header-action-text {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        min-width: 2rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .header-action-text .header-btn-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }
    .user-menu-name { display: none; }
    .user-menu-role { display: none; }
}

/* ——— Переключение разделов во вкладках ——— */
.tab-section-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-block);
    margin: 0 0 var(--space-card-mb);
}
.tab-section-nav--bottom {
    margin: var(--space-section) 0 0;
}
.tab-section-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    border: 1px solid hsl(var(--border));
    background: var(--color-card-bg);
    transition: border-color 0.15s, color 0.15s;
    max-width: 48%;
}
.tab-section-nav-link:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.tab-section-nav-link--next {
    margin-left: auto;
    text-align: right;
}
.tab-section-nav-spacer {
    flex: 1;
    min-width: 0;
}

.analytics-tabs-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-block);
    margin: var(--space-card-mb) 0;
}
.analytics-tabs-wrap--bottom {
    margin-top: var(--space-section);
    margin-bottom: 0;
}
.analytics-tabs-wrap .analytics-tabs {
    flex: 1;
    margin: 0;
    min-width: 0;
}
.analytics-tab-flip {
    flex-shrink: 0;
    min-width: 2.25rem;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
}

.list-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: var(--space-card-mb);
}
.list-pagination-more,
.list-pagination-meta {
    align-self: center;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.sidebar-toggle {
    display: none;
    flex-shrink: 0;
}
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(15, 23, 42, 0.45);
}
body.sidebar-open .sidebar-backdrop {
    display: block;
}

/* Узкая колонка меню с иконками — всегда на экране (не прячется за ☰) */
@media (max-width: 1024px) {
    :root {
        --layout-sidebar-width: 4.25rem;
        --layout-content-max: calc(100vw - var(--layout-sidebar-width) - 2 * var(--layout-shell-pad-x));
    }
    .sidebar-toggle { display: none !important; }
    .sidebar-backdrop { display: none !important; }
    .app-layout { flex-direction: row; }
    .sidebar {
        position: sticky;
        top: 0;
        align-self: flex-start;
        height: 100vh;
        height: 100dvh;
        width: var(--layout-sidebar-width);
        z-index: 50;
        transform: none;
        flex-shrink: 0;
        overflow: hidden;
    }
    .sidebar-logo {
        justify-content: center;
        padding: 0.65rem 0.35rem;
    }
    .sidebar-logo .brand-text { display: none; }
    .sidebar-nav {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 0.35rem 0.25rem;
    }
    .nav-item-row .help-tip { display: none; }
    .nav-item {
        justify-content: center;
        padding: 0.55rem 0.35rem;
        gap: 0;
    }
    .nav-item .nav-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }
    .nav-item .nav-icon {
        width: 1.35rem;
        height: 1.35rem;
        opacity: 1;
    }
    .sidebar-footer {
        display: none;
    }
    .main-area {
        flex: 1;
        min-width: 0;
        width: auto;
    }
}

@media (max-width: 768px) {
    .top-header-row--global { flex-wrap: wrap; padding: 0.45rem 0; }
    .top-header-start { flex: 1 1 auto; min-width: 0; }
    .search-form { max-width: 100%; flex: 1; }
    .search-kbd { display: none; }
    .top-header-row--page { flex-direction: column; align-items: stretch; }
    .top-header-page-actions { justify-content: flex-start; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .cards-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .header-actions .user-role { display: none; }
    .appearance-menu-trigger-label { display: none; }
    .appearance-menu-panel { right: 0; width: min(300px, calc(100vw - 1.5rem)); }
}

/* Панели модулей — только переменные отступов */
.content .card:not(.planner-workspace):not(.company-dashboard-card),
.content .stat-card,
.content .post-card,
.content .kanban-col,
.content .kanban-card,
.company-dashboard-card-inner,
.client-card,
.settings-page .card,
.help-page .help-block,
.parts-cart-page .card {
    padding: var(--space-card);
    margin-bottom: var(--space-card-mb);
}

.content .filters,
.content .tab-section-nav,
.content .settings-tabs,
.content .analytics-tabs {
    margin-bottom: var(--space-card-mb);
    gap: var(--space-block);
}

@media print {
    .sidebar, .top-header, .btn, .form-actions, .appearance-menu { display: none !important; }
    .content { padding: 0; }
}
