/* Leonid Fitness CRM - AAA Design System */
:root {
    --bg-main: #05040c;
    --bg-card: rgba(16, 12, 34, 0.45);
    --bg-card-hover: rgba(26, 20, 52, 0.6);
    --border-color: rgba(255, 255, 255, 0.05);
    --border-glow: rgba(139, 92, 246, 0.25);
    
    /* Neon accents */
    --color-primary: #8b5cf6;
    --color-primary-light: #a78bfa;
    --color-secondary: #ec4899;
    --color-accent: #06b6d4;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #111827;
    
    --sidebar-width: 270px;
    --mobile-nav-height: 68px;
    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    
    --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.12);
    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition-speed: 0.25s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.1) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-light);
}

/* TYPOGRAPHY */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #ffffff;
}

/* SCREENS */
.screen {
    display: none;
    min-height: 100vh;
}
.screen.active {
    display: flex;
}

/* LOGIN SCREEN */
#login-screen {
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    border-radius: 28px;
    padding: 45px 35px;
    width: 100%;
    max-width: 440px;
    text-align: center;
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}
.logo-icon {
    font-size: 30px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, #ffffff, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 30px;
}

/* SHELL & SIDEBAR */
#app-shell {
    display: flex;
    flex-direction: row;
    width: 100%;
}
.sidebar {
    width: var(--sidebar-width);
    background: rgba(8, 6, 16, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}
.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}
.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 19px;
    letter-spacing: 0.03em;
    background: linear-gradient(135deg, #ffffff, #d8b4fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-nav {
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}
.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 12px 18px;
    border-radius: 14px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition-speed);
}
.nav-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(2px);
}
.nav-item.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(236, 72, 153, 0.06));
    border-left: 3px solid var(--color-primary);
    box-shadow: inset 0 0 16px rgba(139, 92, 246, 0.08);
}
.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
}

/* MAIN CONTENT */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 35px;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
}
.main-content > * {
    width: min(100%, 1680px);
    margin-left: auto;
    margin-right: auto;
}
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
}
.content-header h2 {
    font-size: 28px;
    font-weight: 800;
}
.badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.pulse-dot {
    width: 9px;
    height: 9px;
    background: var(--color-success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-success);
    animation: pulse 2.2s infinite;
}

/* GLASS CARD */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 26px;
    box-shadow: var(--shadow-card);
    transition: var(--transition-speed);
}
.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-card), 0 0 20px rgba(139, 92, 246, 0.05);
}

.content-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}
.content-section.active {
    display: block;
}
.card-subtitle {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 13px;
}

/* STATS GRID - Bento Style */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 24px;
    margin-bottom: 35px;
}
.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-card);
    transition: var(--transition-speed);
}
.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-card), 0 8px 25px rgba(139, 92, 246, 0.05);
}
.stat-icon {
    font-size: 26px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.05));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary-light);
}
.stat-info {
    display: flex;
    flex-direction: column;
}
.stat-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.stat-info h3 {
    font-size: 24px;
    font-weight: 800;
    margin: 4px 0 2px 0;
    color: #ffffff;
}
.stat-subtext {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-success);
}
.stat-subtext.negative {
    color: var(--color-danger);
}

/* CHARTS GRID */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 28px;
}
.charts-grid > *,
.category-charts > *,
.chart-card,
.chart-container {
    min-width: 0;
}
.chart-card {
    overflow: hidden;
}
.chart-container canvas {
    max-width: 100% !important;
}
.chart-card h4 {
    margin-bottom: 20px;
    color: var(--text-main);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.chart-container {
    position: relative;
    height: 270px;
    width: 100%;
}

/* FORMS AND INPUTS */
.form-group {
    margin-bottom: 18px;
    text-align: left;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
    width: 100%;
    background: rgba(14, 11, 28, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 14px;
    transition: var(--transition-speed);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary-light);
    background: rgba(24, 18, 46, 0.8);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.35);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 22px;
    border-radius: 12px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-speed);
    border: none;
    gap: 10px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}
.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
}
.btn-outline {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
}
.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
}
.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}
.btn-block {
    display: flex;
    width: 100%;
}
.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
    border-radius: 9px;
}
.btn:focus-visible,
.nav-item:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* SECTION LAYOUTS */
.section-layout {
    display: grid;
    grid-template-columns: 2.1fr 1fr;
    gap: 28px;
}
.wellness-layout {
    margin-top: 28px;
}

.schedule-list,
.wellness-grid,
.backups-list {
    display: grid;
    gap: 12px;
}
.schedule-item,
.wellness-card,
.backup-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
}
.schedule-item.is-done {
    opacity: 0.62;
}
.schedule-date {
    min-width: 92px;
    color: var(--color-primary-light);
    font-weight: 800;
}
.schedule-main,
.wellness-main {
    flex: 1;
    min-width: 0;
}
.schedule-title,
.wellness-title {
    color: #fff;
    font-weight: 700;
}
.schedule-meta,
.wellness-meta,
.backup-meta {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 3px;
}
.wellness-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.wellness-card {
    align-items: flex-start;
}
.wellness-score {
    color: var(--color-accent);
    font-weight: 800;
}
.schedule-actions,
.backup-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.provider-cooldowns {
    color: var(--color-warning);
    font-size: 12px;
}

/* TABLES */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
}
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    text-align: left;
    font-size: 14px;
}
th, td {
    padding: 14px 18px;
    vertical-align: middle;
}
th {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
}
@media (min-width: 769px) {
    th, td {
        white-space: nowrap;
    }
    td[data-label="Комментарий"],
    td[data-label="Примечания"] {
        white-space: normal;
        max-width: 280px;
        min-width: 180px;
    }
}
tbody tr td {
    background: rgba(255, 255, 255, 0.015);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-speed);
}
tbody tr td:first-child {
    border-left: 1px solid var(--border-color);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}
tbody tr td:last-child {
    border-right: 1px solid var(--border-color);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}
tbody tr:hover td {
    background: rgba(255, 255, 255, 0.035);
    border-color: var(--border-glow);
}
tbody tr:hover {
    transform: scale(1.002);
}

/* Action buttons in table */
.action-btns {
    display: flex;
    gap: 6px;
    align-items: center;
}
.action-btns .btn {
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1;
}

/* Edit mode indicator */
#workout-form button[type=submit].editing {
    background: linear-gradient(135deg, var(--color-warning), #d97706);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

/* Date separator rows */
tr.date-separator td {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(236, 72, 153, 0.03)) !important;
    border: none;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary-light);
    letter-spacing: 0.04em;
    border-radius: 10px;
}
.card-divider {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin: 20px 0 14px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

/* KNOWLEDGE BASE / NOTES */
.notes-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.notes-viewer {
    min-height: 450px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}
.header-btns {
    display: flex;
    gap: 12px;
}
.notes-editor textarea {
    height: 60vh;
    min-height: 350px;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.5;
    background: rgba(0, 0, 0, 0.3);
}
.markdown-body {
    color: var(--text-main);
    font-size: 15px;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin: 22px 0 12px 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}
.markdown-body p {
    margin-bottom: 14px;
}
.markdown-body ul, .markdown-body ol {
    margin-bottom: 18px;
    padding-left: 22px;
}
.markdown-body li {
    margin-bottom: 8px;
}
.markdown-body table {
    margin: 18px 0;
    border: 1px solid var(--border-color);
}
.markdown-body th {
    background: rgba(255, 255, 255, 0.04);
}

/* FILES GALLERY */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 20px;
    margin-top: 10px;
}
.file-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px;
    text-align: center;
    position: relative;
    transition: var(--transition-speed);
}
.file-card:hover {
    border-color: var(--color-primary-light);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.08);
}
.file-thumb {
    font-size: 44px;
    margin-bottom: 12px;
    height: 85px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.file-thumb img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
    object-fit: cover;
}
.file-name {
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    margin-bottom: 4px;
    color: #ffffff;
}
.file-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.file-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* SETTINGS */
.settings-container {
    max-width: 820px;
}
.settings-container h3 {
    margin-bottom: 24px;
}
.api-status-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin: 26px 0;
}
.api-status-card h4 {
    font-size: 14px;
    margin-bottom: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    padding-bottom: 8px;
}
.status-row:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}
.status-badge {
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.status-badge.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.25);
}
.status-badge.inactive {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.settings-tip {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 14px;
}

/* NAVIGATION */
.mobile-nav {
    display: none;
}

/* UTILS */
.hidden {
    display: none !important;
}
.error-msg {
    color: var(--color-danger);
    font-size: 13px;
    margin-bottom: 16px;
    font-weight: 500;
}

/* ANIMATIONS */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* RESPONSIVE STYLES */
@media (max-width: 1200px) {
    .section-layout {
        grid-template-columns: 1fr;
    }
    .form-panel {
        order: -1;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        min-width: 0;
        padding: 16px;
        padding-bottom: calc(var(--mobile-nav-height) + 24px);
    }
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 24px;
        padding-bottom: 12px;
    }
    .content-header h2 {
        font-size: 24px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-bottom: 24px;
    }
    .stat-card {
        padding: 14px;
        gap: 12px;
        border-radius: 18px;
    }
    .stat-icon {
        font-size: 22px;
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }
    .stat-info h3 {
        font-size: 19px;
    }
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .chart-container {
        height: 220px;
    }
    
    /* MOBILE NAV */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 76px;
        background: rgba(10, 8, 20, 0.94);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        border-top: 1px solid var(--border-color);
        z-index: 1000;
        justify-content: flex-start;
        gap: 2px;
        padding: 4px 8px calc(10px + env(safe-area-inset-bottom));
        overflow-x: auto;
        scrollbar-width: none;
    }
    .mobile-nav::-webkit-scrollbar { display: none; }
    .mobile-nav .nav-item {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 4px 0;
        border-left: none;
        gap: 2px;
        width: auto;
        min-width: 62px;
        flex: 0 0 auto;
        border-radius: 10px;
    }
    .mobile-nav .nav-item.active {
        color: var(--color-primary-light);
        background: none;
        border-left: none;
        box-shadow: none;
    }
    .mobile-nav .nav-item .icon {
        font-size: 20px;
    }
    .mobile-nav .nav-item .label {
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }
    
    /* RESPONSIVE TABLES — stack wide tables into readable cards on phones */
    .table-wrapper { overflow-x: visible; }
    .table-wrapper table,
    .table-wrapper tbody,
    .table-wrapper tr,
    .table-wrapper td {
        display: block;
        width: 100%;
    }
    .table-wrapper thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }
    .table-wrapper tr {
        margin-bottom: 16px;
        border: 1px solid var(--border-color);
        border-radius: 16px;
        padding: 6px 8px;
        background: rgba(255, 255, 255, 0.015);
    }
    .table-wrapper td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 14px;
        text-align: right;
        border-bottom: 1px solid rgba(255, 255, 255, 0.02);
        padding: 10px 12px;
        min-height: 0;
    }
    .table-wrapper tbody tr td {
        background: none;
        border-top: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.02);
        border-left: none;
        border-right: none;
        border-radius: 0;
    }
    .table-wrapper tbody tr td:first-child {
        border-left: none;
        border-radius: 0;
    }
    .table-wrapper tbody tr td:last-child {
        border-right: none;
        border-bottom: none;
        border-radius: 0;
    }
    .table-wrapper td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        text-align: left;
        flex-shrink: 0;
    }
    .table-wrapper td:empty { display: none; }

    /* Date separator mobile overrides */
    .table-wrapper tr.date-separator {
        display: block !important;
        margin: 22px 0 12px 0 !important;
        border: none !important;
        background: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
    }
    .table-wrapper tr.date-separator td {
        display: block !important;
        text-align: left !important;
        padding: 12px 16px !important;
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(236, 72, 153, 0.06)) !important;
        border: 1px solid rgba(139, 92, 246, 0.15) !important;
        border-radius: 12px !important;
        font-weight: 700 !important;
        color: #ffffff !important;
    }
    .table-wrapper tr.date-separator td::before {
        display: none !important;
    }

    .category-charts { grid-template-columns: 1fr !important; }
    .schedule-item,
    .backup-item {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .schedule-actions,
    .backup-actions {
        width: 100%;
    }
    .schedule-actions .btn,
    .backup-actions .btn {
        flex: 1;
    }
    .category-summary-widgets { grid-template-columns: repeat(2, 1fr) !important; }
    .category-tabs { flex-wrap: wrap; }
}

/* MUSCLE MAP INTERACTIVE DASHBOARD */
.muscle-map-card {
    margin-top: 10px;
}
.muscle-map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.muscle-map-content {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 30px;
    align-items: start;
}
.muscle-svg-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}
#human-body-svg {
    width: 100%;
    max-width: 440px;
    height: auto;
}
.svg-label {
    fill: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
}
.body-outline-head {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1.5;
}
.body-outline-neck {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1.5;
}
.muscle-path {
    fill: rgba(255, 255, 255, 0.03);
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 1.5;
    cursor: pointer;
    transition: fill 0.3s, stroke 0.3s, filter 0.3s, transform 0.2s;
}
.muscle-path:hover {
    stroke: var(--color-primary-light);
    filter: drop-shadow(0 0 8px var(--color-primary));
}

/* Active Load Intensity Colors */
.muscle-path.active-low {
    fill: url(#grad-active-low);
    stroke: var(--color-primary);
}
.muscle-path.active-med {
    fill: url(#grad-active-med);
    stroke: var(--color-primary-light);
    filter: drop-shadow(0 0 4px rgba(139, 92, 246, 0.4));
}
.muscle-path.active-high {
    fill: url(#grad-active-high);
    stroke: var(--color-secondary);
    filter: drop-shadow(0 0 8px rgba(236, 72, 153, 0.6));
}

/* Detail container styles */
.muscle-details-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.muscle-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 20px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}
.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}
.legend-color.color-empty { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.12); }
.legend-color.color-low { background: rgba(139, 92, 246, 0.3); border: 1px solid var(--color-primary); }
.legend-color.color-med { background: rgba(236, 72, 153, 0.5); border: 1px solid var(--color-secondary); }
.legend-color.color-high { background: rgba(239, 68, 68, 0.85); border: 1px solid #ef4444; }
.legend-text {
    color: var(--text-muted);
}
.muscle-active-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}
.muscle-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 290px;
    overflow-y: auto;
    padding-right: 6px;
}
.muscle-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-speed);
}
.muscle-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(2px);
}
.muscle-card.active-muscle {
    border-left: 3px solid var(--color-primary);
}
.muscle-card-info {
    display: flex;
    flex-direction: column;
}
.muscle-card-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}
.muscle-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.muscle-card-metrics {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.muscle-card-sets {
    font-weight: 700;
    font-size: 14px;
    color: var(--color-primary-light);
}
.muscle-card-tonnage {
    font-size: 11px;
    color: var(--text-muted);
}
.muscle-empty-notice {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 13px;
}
.btn-range {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-range:hover {
    background: rgba(255, 255, 255, 0.08);
}
.btn-range.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Mobile responsive for muscle atlas */
@media (max-width: 1024px) {
    .muscle-map-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .muscle-svg-container {
        padding: 10px;
    }
    .muscle-legend {
        justify-content: space-around;
        padding: 8px;
        gap: 8px;
    }
    .muscle-list {
        max-height: none;
    }
}

/* Extra mobile UI polishing */
@media (max-width: 768px) {
    /* Stack long cell content like Comments, Exercises, Meals, Notes on mobile cards */
    .table-wrapper td[data-label="Упражнение"],
    .table-wrapper td[data-label="Прием пищи"],
    .table-wrapper td[data-label="Комментарий"],
    .table-wrapper td[data-label="Примечания"] {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        gap: 4px;
    }
    
    .table-wrapper td[data-label="Упражнение"]::before,
    .table-wrapper td[data-label="Прием пищи"]::before,
    .table-wrapper td[data-label="Комментарий"]::before,
    .table-wrapper td[data-label="Примечания"]::before {
        margin-bottom: 2px;
    }
}

@media (max-width: 480px) {
    /* Stack bento stats sub-widgets vertically on very small mobile screens to prevent squishing */
    .category-summary-widgets {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Body composition snapshot */
.body-composition-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-width: 0;
    min-height: 148px;
    overflow: visible;
    background:
        radial-gradient(circle at 92% 8%, rgba(78, 217, 200, .12), transparent 42%),
        linear-gradient(145deg, rgba(18, 23, 30, .98), rgba(12, 16, 21, .98));
}

.body-composition-card::after {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, #4ed9c8, #4f7cff 55%, #ff728f);
    opacity: .8;
}

.composition-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.composition-heading small {
    display: block;
    margin-top: 2px;
    color: #667386;
    font-family: var(--font-utility);
    font-size: 9px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.composition-icon {
    flex: 0 0 auto;
    border-color: rgba(78, 217, 200, .28);
    background: rgba(78, 217, 200, .08);
    color: #73e5d7;
    font-size: 23px;
}

.composition-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    gap: 1px;
    overflow: visible;
    border: 1px solid rgba(176, 195, 220, .1);
    border-radius: 7px;
    background: rgba(176, 195, 220, .1);
}

.composition-value {
    min-width: 0;
    padding: 10px 12px;
    background: rgba(9, 13, 18, .88);
}

.composition-value span {
    display: block;
    color: #718094;
    font-family: var(--font-utility);
    font-size: 9px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.composition-value strong {
    display: block;
    margin-top: 4px;
    overflow: visible;
    font-family: var(--font-heading);
    font-size: clamp(22px, 2vw, 28px);
    line-height: 1;
    white-space: normal;
}

.muscle-value strong { color: #79e5d7; }
.fat-value strong { color: #ff849b; }

.composition-visceral {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid rgba(176, 195, 220, .08);
    border-radius: 6px;
    background: rgba(176, 195, 220, .035);
    color: #9aa8ba;
    font-family: var(--font-utility);
    font-size: 10px;
    line-height: 1.4;
    letter-spacing: .03em;
    overflow-wrap: anywhere;
}

/* Anatomical SVG atlas */
.muscle-svg-container {
    position: relative;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border-color: rgba(142, 167, 198, .15);
    border-radius: 14px;
    background:
        linear-gradient(rgba(89, 111, 139, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(89, 111, 139, .035) 1px, transparent 1px),
        radial-gradient(circle at 50% 48%, #151e2a, #090d13 72%);
    background-size: 24px 24px, 24px 24px, auto;
    box-shadow: inset 0 0 46px rgba(0, 0, 0, .42), 0 16px 45px rgba(0, 0, 0, .2);
}

#human-body-svg {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 620px;
    filter: drop-shadow(0 22px 22px rgba(0, 0, 0, .28));
}

.atlas-divider {
    fill: none;
    stroke: rgba(163, 184, 211, .1);
    stroke-dasharray: 3 8;
}

.body-figure {
    filter: url(#body-shadow);
}

.body-base {
    fill: url(#body-surface);
    stroke: url(#body-edge);
    stroke-width: 1.25;
    vector-effect: non-scaling-stroke;
}

.anatomy-line {
    fill: none;
    stroke: rgba(196, 211, 231, .12);
    stroke-width: .8;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.svg-label {
    fill: #77879c;
    font-family: var(--font-utility);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .16em;
}

.muscle-path {
    fill: url(#muscle-rest);
    stroke: rgba(186, 205, 230, .2);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
    transform-box: fill-box;
    transform-origin: center;
    transition: fill .25s ease, stroke .25s ease, filter .25s ease, transform .25s ease;
}

.muscle-path:hover,
.muscle-path:focus-visible {
    stroke: #b9cbff;
    stroke-width: 1.8;
    filter: drop-shadow(0 0 8px rgba(79, 124, 255, .75));
    transform: scale(1.025);
    outline: none;
}

.muscle-path.is-selected {
    stroke: #f4f7ff;
    stroke-width: 2.2px;
    filter: drop-shadow(0 0 9px rgba(79, 124, 255, .9));
}

@media (max-width: 768px) {
    .body-composition-card {
        min-height: 166px;
        padding: 16px;
    }

    .composition-values {
        width: 100%;
    }

    .muscle-svg-container {
        justify-content: center;
        overflow-x: hidden;
    }
}

@media (max-width: 480px) {
    .body-composition-card {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        min-height: 0;
    }

    .composition-heading {
        width: 100%;
    }
}

/* Interactive progress and editable journal controls */
.records-layout .form-panel {
    order: -1;
}

.editor-heading,
.table-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.editor-heading {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(176, 195, 220, .1);
}

.editor-heading h3 {
    margin: 3px 0 5px;
}

.editor-heading p {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
}

.editor-heading .btn {
    flex: 0 0 auto;
}

.table-controls {
    align-items: flex-end;
}

.day-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.day-toggle-label {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.day-toggle-meta {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
}

.day-toggle-icon {
    color: var(--color-primary-light);
    font-size: 15px;
    transition: transform .2s ease;
}

.date-separator.is-collapsed .day-toggle-icon {
    transform: rotate(-90deg);
}

tr.log-row.is-day-collapsed {
    display: none;
}

.muscle-path.is-selected {
    stroke: #fff;
    stroke-width: 3px;
    filter: drop-shadow(0 0 10px rgba(79, 124, 255, .9));
}

.muscle-progress-panel {
    margin-bottom: 18px;
    overflow: hidden;
    border: 1px solid rgba(79, 124, 255, .22);
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(79, 124, 255, .12), rgba(10, 14, 19, .95) 48%);
}

.muscle-progress-empty {
    padding: 22px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

.muscle-progress-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid rgba(176, 195, 220, .1);
}

.muscle-progress-head span,
.muscle-progress-date {
    color: #728096;
    font-family: var(--font-utility);
    font-size: 8px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.muscle-progress-head h5 {
    margin: 4px 0 0;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 26px;
    line-height: 1;
    text-transform: uppercase;
}

.muscle-progress-count {
    flex: 0 0 auto;
    padding: 6px 8px;
    border: 1px solid rgba(79, 124, 255, .25);
    border-radius: 5px;
    color: #b9caff;
    font-family: var(--font-utility);
    font-size: 9px;
}

.muscle-progress-compare {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    background: rgba(176, 195, 220, .1);
}

.progress-metric {
    min-width: 0;
    padding: 13px 14px;
    background: rgba(9, 13, 18, .9);
}

.progress-metric small {
    display: block;
    margin-bottom: 6px;
    color: #728096;
    font-family: var(--font-utility);
    font-size: 8px;
    text-transform: uppercase;
}

.progress-metric strong {
    display: block;
    overflow: hidden;
    color: #edf3fb;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-metric b {
    color: var(--color-success);
    font-size: 10px;
}

.progress-metric b.is-negative {
    color: var(--color-warning);
}

.muscle-timeline {
    max-height: 210px;
    overflow-y: auto;
    padding: 8px 16px 12px;
}

.muscle-timeline-row {
    position: relative;
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0 10px 15px;
    border-bottom: 1px solid rgba(176, 195, 220, .08);
}

.muscle-timeline-row::before {
    content: "";
    position: absolute;
    left: 0;
    width: 6px;
    height: 6px;
    border: 2px solid var(--color-primary);
    border-radius: 50%;
    background: #0a0e13;
}

.muscle-timeline-row:last-child {
    border-bottom: 0;
}

.muscle-timeline-info {
    min-width: 0;
}

.muscle-timeline-info strong,
.muscle-timeline-info span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.muscle-timeline-info strong {
    color: #e9eff7;
    font-size: 12px;
}

.muscle-timeline-info span,
.muscle-timeline-value small {
    color: var(--text-muted);
    font-size: 9px;
}

.muscle-timeline-value {
    color: #b9caff;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    text-align: right;
}

.muscle-card.is-selected {
    border-color: rgba(79, 124, 255, .65);
    background: rgba(79, 124, 255, .12);
}

@media (max-width: 768px) {
    .editor-heading,
    .table-controls {
        align-items: flex-start;
        flex-direction: column;
    }

    .editor-heading .btn,
    .table-controls .btn {
        width: 100%;
    }

    .muscle-progress-compare {
        grid-template-columns: 1fr;
    }

    .muscle-timeline-row {
        grid-template-columns: 68px minmax(0, 1fr);
    }

    .muscle-timeline-value {
        grid-column: 2;
        text-align: left;
    }

    .table-wrapper tr.log-row.is-day-collapsed {
        display: none !important;
    }
}

/* =========================================================
   TRAINBOT 4.0 — ATHLETE OPERATIONS SYSTEM
   ========================================================= */
:root {
    --bg-main: #080a0d;
    --bg-card: #10141a;
    --bg-card-hover: #151b23;
    --border-color: rgba(176, 195, 220, 0.13);
    --border-glow: rgba(79, 124, 255, 0.34);
    --color-primary: #4f7cff;
    --color-primary-light: #8ca9ff;
    --color-secondary: #ff7548;
    --color-accent: #4ed9c8;
    --color-success: #55d98b;
    --color-warning: #ffbd57;
    --color-danger: #ff5f68;
    --text-main: #edf2f8;
    --text-muted: #8591a2;
    --sidebar-width: 232px;
    --font-heading: 'Barlow Condensed', sans-serif;
    --font-body: 'Manrope', sans-serif;
    --font-utility: 'IBM Plex Mono', monospace;
    --shadow-card: 0 18px 60px rgba(0, 0, 0, 0.24);
    --shadow-glow: 0 0 50px rgba(79, 124, 255, 0.08);
}

body {
    background:
        linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
        radial-gradient(circle at 82% 0%, rgba(79,124,255,.13), transparent 28%),
        #080a0d;
    background-size: 52px 52px, 52px 52px, auto, auto;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.55;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    letter-spacing: .01em;
    text-transform: uppercase;
}

.eyebrow {
    display: block;
    color: var(--color-primary-light);
    font-family: var(--font-utility);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .14em;
    margin-bottom: 6px;
}

.sidebar {
    background: rgba(8, 10, 13, .94);
    border-right: 1px solid rgba(176,195,220,.12);
    backdrop-filter: blur(18px);
}

.sidebar-header {
    min-height: 78px;
    padding: 18px 20px;
    border-bottom-color: rgba(176,195,220,.12);
}

.logo-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: var(--color-primary);
    color: #fff;
    font-family: var(--font-utility);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -.04em;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: currentColor;
}

.logo-text,
.logo h1 {
    color: #fff;
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: currentColor;
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: .06em;
}

.sidebar-nav {
    padding: 22px 12px;
    gap: 4px;
}

.nav-item {
    min-height: 45px;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #8995a5;
    font-size: 13px;
    font-weight: 600;
    gap: 11px;
}

.nav-item .icon {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 24px;
    color: #657185;
    font-family: var(--font-utility);
    font-size: 9px;
    letter-spacing: .04em;
}

.nav-item:hover {
    background: rgba(255,255,255,.035);
    border-color: rgba(176,195,220,.1);
    transform: none;
}

.nav-item.active {
    background: rgba(79,124,255,.12);
    border: 1px solid rgba(79,124,255,.3);
    border-left: 1px solid rgba(79,124,255,.3);
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.nav-item.active .icon { color: var(--color-primary-light); }

.main-content {
    padding: 24px clamp(20px, 3vw, 52px) 52px;
}

.main-content > * { width: min(100%, 1720px); }

.content-header {
    min-height: 54px;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(176,195,220,.12);
}

.content-header h2 {
    font-size: 27px;
    font-weight: 700;
    letter-spacing: .04em;
}

.badge {
    background: #0d1117;
    border: 1px solid rgba(176,195,220,.15);
    border-radius: 7px;
    color: #c8d1dc;
    font-family: var(--font-utility);
    font-size: 10px;
    letter-spacing: .04em;
}

.glass-card,
.stat-card,
.api-status-card,
.settings-grid {
    background: linear-gradient(145deg, rgba(18,23,30,.98), rgba(12,16,21,.98));
    border: 1px solid rgba(176,195,220,.12);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    backdrop-filter: none;
}

.glass-card:hover,
.stat-card:hover {
    border-color: rgba(176,195,220,.2);
    transform: none;
    box-shadow: var(--shadow-card);
}

.command-hero {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(330px, 1.1fr) minmax(320px, .9fr) minmax(250px, .65fr);
    min-height: 285px;
    margin-bottom: 18px;
    overflow: hidden;
    border: 1px solid rgba(111,143,203,.22);
    border-radius: 14px;
    background:
        linear-gradient(110deg, rgba(79,124,255,.14), transparent 38%),
        linear-gradient(145deg, #121820, #0b0e13 70%);
    box-shadow: 0 28px 80px rgba(0,0,0,.32);
}

.command-hero::before {
    content: "";
    position: absolute;
    z-index: -1;
    width: 360px;
    height: 360px;
    right: 19%;
    top: -240px;
    border: 58px solid rgba(79,124,255,.13);
    border-radius: 50%;
}

.command-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(28px, 4vw, 54px);
}

.command-copy h1 {
    max-width: 620px;
    margin: 4px 0 16px;
    color: #f5f8fb;
    font-size: clamp(48px, 5vw, 78px);
    font-weight: 800;
    line-height: .86;
    letter-spacing: -.025em;
}

.command-copy h1 span { color: var(--color-primary-light); }
.command-copy p { max-width: 520px; color: #929dad; font-size: 13px; }

.command-ai {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 34px;
    border-left: 1px solid rgba(176,195,220,.12);
    border-right: 1px solid rgba(176,195,220,.12);
    background: rgba(6,9,13,.36);
}

.command-ai-head {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #7f8b9c;
    font-family: var(--font-utility);
    font-size: 9px;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.live-signal {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 0 5px rgba(85,217,139,.09), 0 0 16px rgba(85,217,139,.5);
}

.command-ai > strong {
    margin: 18px 0 5px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: clamp(34px, 3vw, 50px);
    line-height: 1;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.command-meta {
    min-height: 32px;
    color: var(--text-muted);
    font-family: var(--font-utility);
    font-size: 10px;
}

.model-route {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 24px;
    overflow-x: auto;
}

.route-node {
    flex: 0 0 auto;
    padding: 6px 8px;
    border: 1px solid rgba(176,195,220,.14);
    border-radius: 5px;
    color: #687486;
    font-family: var(--font-utility);
    font-size: 8px;
    text-transform: uppercase;
}
.route-node.is-ready { color: #aeb9c7; }
.route-node.is-active { border-color: var(--color-primary); background: var(--color-primary); color: #fff; }
.route-link { color: #465265; font-family: var(--font-utility); font-size: 10px; }

.command-snapshot {
    display: grid;
    grid-template-rows: 1fr 1fr;
}

.snapshot-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 28px;
}
.snapshot-cell + .snapshot-cell { border-top: 1px solid rgba(176,195,220,.12); }
.snapshot-cell > span { color: #748093; font-family: var(--font-utility); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.snapshot-cell strong { margin: 7px 0 2px; overflow: hidden; color: #f4f7fa; font-family: var(--font-heading); font-size: 25px; line-height: 1; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.snapshot-cell small { color: #778396; font-size: 10px; }
.recovery-cell strong { color: var(--color-accent); }

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.stat-card { min-height: 104px; padding: 18px; border-radius: 10px; gap: 14px; }
.stat-icon {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(79,124,255,.22);
    border-radius: 8px;
    background: rgba(79,124,255,.08);
    font-size: 19px;
}
.stat-info h3 { font-size: 25px; font-weight: 700; letter-spacing: .01em; }
.stat-label,
.stat-subtext { font-family: var(--font-utility); font-size: 9px; letter-spacing: .04em; }

.charts-grid { gap: 14px; }
.chart-card { padding: 20px; }
.chart-card h4 { font-size: 18px; letter-spacing: .03em; }

.section-layout { grid-template-columns: minmax(0, 1.55fr) minmax(300px, .65fr); gap: 16px; }
.records-layout { grid-template-columns: minmax(0, 1fr); }
.records-layout .data-view,
.records-layout .form-panel { min-width: 0; }
.records-layout .form-panel { order: 0; }
.records-layout .form-panel form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}
.records-layout .form-panel form > .form-row { display: contents; }
.records-layout .form-panel form > .form-group { grid-column: span 2; margin-bottom: 0; }
.records-layout .form-panel .form-row .form-group { margin-bottom: 0; }
.records-layout .form-panel form > button { min-height: 44px; }

.data-view,
.form-panel { padding: 20px; }
.card-header { align-items: flex-end; margin-bottom: 14px; }
.card-header h3 { font-size: 24px; line-height: 1; }
.table-hint { color: #697588; font-family: var(--font-utility); font-size: 9px; letter-spacing: .04em; }

.table-wrapper {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    border: 1px solid rgba(176,195,220,.1);
    border-radius: 9px;
    scrollbar-color: #3c4b61 #0c1015;
}
.records-table { border-spacing: 0; margin: 0; }
.workouts-table { min-width: 1120px; }
.nutrition-table { min-width: 940px; }
.metrics-table { min-width: 1180px; }
.records-table th,
.records-table td { padding: 11px 13px; }
.records-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #111720;
    color: #748197;
    font-family: var(--font-utility);
    font-size: 9px;
    letter-spacing: .06em;
}
.records-table tbody tr td {
    background: #0d1218;
    border: 0;
    border-bottom: 1px solid rgba(176,195,220,.08);
    border-radius: 0;
    font-size: 12px;
}
.records-table tbody tr:hover td { background: #121923; }
.records-table tr.date-separator td { background: rgba(79,124,255,.1); color: #b7c8ff; font-family: var(--font-utility); font-size: 10px; }

input, textarea, select {
    min-height: 44px;
    border: 1px solid rgba(176,195,220,.14);
    border-radius: 7px;
    background: #0a0e13;
    color: #e7edf5;
    font-family: var(--font-body);
}
input:focus, textarea:focus, select:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(79,124,255,.1); }
label { color: #8d99aa; font-family: var(--font-utility); font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }

.btn { min-height: 40px; border-radius: 7px; font-family: var(--font-utility); font-size: 10px; letter-spacing: .04em; }
.btn-primary { background: var(--color-primary); box-shadow: none; }
.btn-primary:hover { background: #6790ff; box-shadow: 0 8px 24px rgba(79,124,255,.22); }
.btn-outline { border-color: rgba(176,195,220,.17); background: #0c1015; }

.settings-container { max-width: 1320px; }
.settings-heading { margin-bottom: 18px; }
.settings-heading h3 { font-size: 42px; line-height: 1; }
.settings-heading p { color: var(--text-muted); }
.settings-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; padding: 20px; }
.settings-grid .form-group { margin: 0; }
.api-status-card { padding: 22px; }
.api-status-card h4 { margin: 0; color: #fff; font-size: 22px; letter-spacing: .03em; }
.provider-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.runtime-status { display: grid; grid-template-columns: .8fr 1fr 1.4fr; gap: 1px; margin: 18px 0; overflow: hidden; border: 1px solid rgba(176,195,220,.12); border-radius: 8px; background: rgba(176,195,220,.12); }
.runtime-status > div { display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 14px; background: #0c1117; }
.runtime-status span { color: #6f7b8d; font-family: var(--font-utility); font-size: 8px; letter-spacing: .06em; text-transform: uppercase; }
.runtime-status strong { overflow: hidden; color: #e8edf4; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.provider-status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 10px; }
.provider-card { position: relative; min-width: 0; padding: 16px; overflow: hidden; border: 1px solid rgba(176,195,220,.12); border-radius: 9px; background: #0b1016; }
.provider-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: #3b4657; }
.provider-card.is-ready::before { background: var(--color-success); }
.provider-card.is-paused::before { background: var(--color-warning); }
.provider-rank { position: absolute; top: 10px; right: 12px; color: rgba(176,195,220,.08); font-family: var(--font-heading); font-size: 42px; font-weight: 800; line-height: 1; }
.provider-card-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.provider-card-head span { overflow: hidden; color: #fff; font-family: var(--font-heading); font-size: 21px; font-weight: 700; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.provider-card-head b { padding: 4px 6px; border: 1px solid rgba(176,195,220,.14); border-radius: 4px; color: #8b96a7; font-family: var(--font-utility); font-size: 8px; text-transform: uppercase; }
.provider-card.is-ready .provider-card-head b { color: var(--color-success); }
.provider-card.is-paused .provider-card-head b { color: var(--color-warning); }
.provider-card code { display: block; margin: 4px 0 15px; color: #697688; font-family: var(--font-utility); font-size: 9px; }
.provider-metrics { display: flex; gap: 24px; }
.provider-metrics > span { color: #eaf0f7; font-family: var(--font-heading); font-size: 26px; font-weight: 700; }
.provider-metrics small { display: block; color: #697588; font-family: var(--font-utility); font-size: 8px; font-weight: 400; letter-spacing: .04em; text-transform: uppercase; }
.provider-probe { margin-top: 13px; color: #b8c2d0; font-size: 11px; line-height: 1.4; }
.provider-billing { margin-top: 7px; color: #8da8ff; font-family: var(--font-utility); font-size: 9px; line-height: 1.4; }
.provider-checked { display: block; margin-top: 7px; color: #697588; font-family: var(--font-utility); font-size: 8px; }
.provider-last { display: block; margin-top: 13px; overflow: hidden; color: #697588; font-family: var(--font-utility); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.provider-cooldowns { margin-top: 13px; font-family: var(--font-utility); font-size: 9px; }
.settings-tip { color: #6f7b8d; font-family: var(--font-utility); font-size: 9px; }

.schedule-item,
.wellness-card,
.backup-item,
.file-card { border-radius: 8px; background: #0d1218; }

@media (max-width: 1450px) {
    .command-hero { grid-template-columns: 1fr 1fr; }
    .command-copy h1 { font-size: clamp(48px, 5vw, 64px); }
    .command-ai > strong { font-size: clamp(34px, 3.5vw, 46px); }
    .command-snapshot { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; grid-template-rows: auto; border-top: 1px solid rgba(176,195,220,.12); }
    .snapshot-cell + .snapshot-cell { border-top: 0; border-left: 1px solid rgba(176,195,220,.12); }
    .settings-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .records-layout .form-panel form { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .records-layout .form-panel { order: 0; }
}

@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .provider-status-grid { grid-template-columns: 1fr; }
    .runtime-status { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    body { background-size: 36px 36px, 36px 36px, auto, auto; }
    .main-content { padding: 14px 12px 94px; }
    .content-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
    .content-header h2 { font-size: 22px; }
    .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .command-hero { display: block; min-height: 0; }
    .command-copy { padding: 30px 22px; }
    .command-copy h1 { font-size: clamp(45px, 14vw, 68px); }
    .command-ai { padding: 24px 22px; border: 0; border-top: 1px solid rgba(176,195,220,.12); }
    .command-snapshot { display: grid; grid-template-columns: 1fr 1fr; }
    .snapshot-cell { padding: 20px 16px; }
    .snapshot-cell strong { font-size: 20px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
    .stat-card { min-height: 126px; flex-direction: column; align-items: flex-start; }
    .stat-info h3 { font-size: 22px; }
    .charts-grid { gap: 10px; }
    .chart-card { padding: 14px; }
    .section-layout { gap: 10px; }
    .records-layout .form-panel form { grid-template-columns: 1fr; }
    .records-layout .form-panel form > .form-group { grid-column: auto; }
    .table-hint { display: none; }
    .table-wrapper { border: 0; }
    .table-wrapper tr { border-radius: 9px; background: #0d1218; }
    .table-wrapper tbody tr td { background: transparent; }
    .table-wrapper tr.date-separator td { background: rgba(79,124,255,.11) !important; border-color: rgba(79,124,255,.22) !important; color: #bed0ff !important; }
    .settings-heading h3 { font-size: 34px; }
    .settings-grid { grid-template-columns: 1fr; padding: 16px; }
    .api-status-card { padding: 16px; }
    .api-status-card .card-header { align-items: flex-start; gap: 12px; }
    .mobile-nav { height: 74px; background: rgba(8,10,13,.96); border-top-color: rgba(176,195,220,.14); }
    .mobile-nav .nav-item { min-width: 60px; border-radius: 6px; }
    .mobile-nav .nav-item .icon { height: 20px; color: #687588; font-family: var(--font-utility); font-size: 9px; }
    .mobile-nav .nav-item.active .icon,
    .mobile-nav .nav-item.active { color: var(--color-primary-light); }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 96px; flex-direction: row; align-items: center; }
    .command-snapshot { grid-template-columns: 1fr; }
    .snapshot-cell + .snapshot-cell { border-left: 0; border-top: 1px solid rgba(176,195,220,.12); }
    .model-route { padding-bottom: 4px; }
}

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

/* Keep journal editors above their tables after the final responsive overrides. */
.records-layout .form-panel { order: -1; }
.muscle-card { width: 100%; color: inherit; font: inherit; text-align: left; }
#nutrition-form button[type=submit].editing { background: linear-gradient(135deg, var(--color-warning), #d97706); }
[hidden] { display: none !important; }

.muscle-measurement-history {
    padding: 14px 16px;
    border-top: 1px solid rgba(176, 195, 220, .08);
    border-bottom: 1px solid rgba(176, 195, 220, .08);
    background: rgba(79, 124, 255, .045);
}

.muscle-measurement-title,
.muscle-timeline-title {
    color: #78869a;
    font-family: var(--font-utility);
    font-size: 8px;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.muscle-measurement-points {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 3px;
}

.muscle-measurement-point {
    flex: 0 0 auto;
    min-width: 88px;
    padding: 9px 10px;
    border: 1px solid rgba(176, 195, 220, .1);
    border-radius: 7px;
    background: #0b1016;
}

.muscle-measurement-point span,
.muscle-measurement-point strong {
    display: block;
}

.muscle-measurement-point span {
    color: #68768a;
    font-size: 8px;
}

.muscle-measurement-point strong {
    margin-top: 4px;
    color: #dce6f4;
    font-family: var(--font-heading);
    font-size: 16px;
}

.muscle-measurement-point.is-latest {
    border-color: rgba(79, 124, 255, .55);
    background: rgba(79, 124, 255, .13);
}

.muscle-timeline-title {
    padding: 13px 16px 0;
}

/* Compact command banner: operational data only, without promotional copy. */
.command-hero {
    grid-template-columns: minmax(320px, .9fr) minmax(440px, 1.1fr);
    min-height: 210px;
}

.command-ai {
    min-width: 0;
    padding: 30px 34px;
    border-left: 0;
}

.command-ai > strong {
    font-size: clamp(32px, 3.2vw, 48px);
}

.command-snapshot {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 1fr;
}

.snapshot-cell + .snapshot-cell {
    border-top: 0;
    border-left: 1px solid rgba(176,195,220,.12);
}

@media (max-width: 1100px) {
    .command-hero {
        grid-template-columns: 1fr;
    }

    .command-ai {
        border-right: 0;
    }

    .command-snapshot {
        border-top: 1px solid rgba(176,195,220,.12);
    }
}

@media (max-width: 480px) {
    .command-ai {
        padding: 22px 18px;
    }

    .command-ai > strong {
        font-size: 30px;
    }

    .command-snapshot {
        grid-template-columns: 1fr;
    }

    .snapshot-cell + .snapshot-cell {
        border-top: 1px solid rgba(176,195,220,.12);
        border-left: 0;
    }
}

/* Keep body metrics readable after all generic stat-card responsive rules. */
.stat-card.body-composition-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 148px;
    overflow: visible;
}

@media (max-width: 768px) {
    .stat-card.body-composition-card {
        flex-direction: column;
        align-items: stretch;
        min-height: 166px;
    }
}

@media (max-width: 480px) {
    .stat-card.body-composition-card {
        flex-direction: column;
        align-items: stretch;
        min-height: 0;
    }
}

/* Brand logo (nav + login) — fixed box so any image cannot break the layout */
.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    object-fit: cover;
    flex: 0 0 auto;
    display: block;
    background: rgba(176, 195, 220, .08);
}
.login-card .brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    margin: 0 auto;
}

/* Body-composition card: widened to 2 columns + SVG silhouette beside the numbers */
@media (min-width: 769px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
        grid-auto-flow: dense;
    }
}
.stat-card.body-composition-card {
    grid-column: span 2;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    min-height: 132px;
}
.composition-figure {
    flex: 0 0 auto;
    width: 76px;
    height: auto;
    max-height: 146px;
    filter: drop-shadow(0 6px 16px rgba(79, 124, 255, .28));
}
.composition-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 9px;
}
@media (max-width: 768px) {
    .stat-card.body-composition-card {
        flex-direction: row;
        align-items: center;
        min-height: 0;
    }
}
@media (max-width: 480px) {
    .stat-card.body-composition-card {
        grid-column: 1 / -1;
        gap: 12px;
    }
    .composition-figure { width: 64px; }
}

/* Production polish v5: tighter CRM tables and readable body-composition card. */
.main-content,
.content-section,
.glass-card,
.data-view,
.form-panel {
    min-width: 0;
}

.records-layout {
    align-items: start;
}

.records-layout .form-panel {
    position: relative;
    z-index: 1;
}

.table-wrapper {
    width: 100%;
    max-width: 100%;
}

.records-table {
    table-layout: auto;
}

.records-table th:last-child,
.records-table td:last-child {
    width: 104px;
}

.workouts-table {
    min-width: 980px;
}

.nutrition-table {
    min-width: 820px;
}

.metrics-table {
    min-width: 1020px;
}

.records-table td[data-label="Комментарий"],
.records-table td[data-label="Примечания"],
.records-table td[data-label="Упражнение"],
.records-table td[data-label="Прием пищи"] {
    max-width: 360px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.action-btns {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.action-btns .btn,
.records-table .action-delete {
    min-width: 48px;
    min-height: 30px;
    padding: 6px 8px;
    font-size: 9px;
    letter-spacing: .03em;
}

.stat-card.body-composition-card {
    overflow: visible !important;
    padding: 18px;
}

.composition-body,
.composition-values,
.composition-value {
    overflow: visible;
}

.composition-values {
    grid-template-columns: repeat(2, minmax(82px, 1fr));
}

.composition-value strong {
    min-width: 0;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.composition-heading,
.composition-heading > div {
    min-width: 0;
}

@media (min-width: 769px) {
    .stat-card.body-composition-card {
        min-height: 150px;
    }
}

@media (max-width: 768px) {
    .records-table th:last-child,
    .records-table td:last-child {
        width: auto;
    }

    .table-wrapper tr.log-row {
        box-shadow: inset 0 0 0 1px rgba(176, 195, 220, .08);
    }

    .table-wrapper td {
        align-items: flex-start;
    }

    .table-wrapper td::before {
        max-width: 42%;
    }

    .table-wrapper td[data-label=""] {
        justify-content: flex-end;
    }

    .table-wrapper td[data-label=""]::before {
        display: none;
    }

    .action-btns {
        width: 100%;
        justify-content: flex-end;
    }

    .stat-card.body-composition-card {
        display: grid;
        grid-template-columns: 74px minmax(0, 1fr);
        min-height: 0;
    }

    .composition-figure {
        width: 70px;
    }
}

@media (max-width: 480px) {
    .stat-card.body-composition-card {
        grid-template-columns: 58px minmax(0, 1fr);
        padding: 16px;
    }

    .composition-figure {
        width: 56px;
    }

    .composition-values {
        grid-template-columns: 1fr;
    }

    .composition-value {
        padding: 9px 10px;
    }
}

/* ============================================================
   V5.0 PRODUCTION POLISH LAYER
   Тосты, мобильные фиксы (iOS-зум, safe-area), доступность.
   ============================================================ */

/* Toast notifications */
#toast-host {
    position: fixed;
    bottom: calc(var(--mobile-nav-height, 68px) + 14px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 99999;
    pointer-events: none;
    width: min(92vw, 420px);
}
@media (min-width: 769px) {
    #toast-host { bottom: 24px; }
}
.toast {
    width: 100%;
    padding: 11px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(14, 18, 24, 0.97);
    color: var(--text-main);
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .3s ease, transform .3s ease;
}
.toast.toast-in { opacity: 1; transform: translateY(0); }
.toast-success { border-color: rgba(85, 217, 139, .45); box-shadow: 0 12px 34px rgba(85, 217, 139, .12); }
.toast-error { border-color: rgba(255, 95, 104, .5); box-shadow: 0 12px 34px rgba(255, 95, 104, .14); }

/* iOS: инпуты <16px вызывают автозум при фокусе — фиксируем на мобильных */
@media (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    textarea,
    select {
        font-size: 16px;
    }
}

/* iPhone: нижняя навигация и контент не должны прятаться за home-индикатор */
.mobile-nav {
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(var(--mobile-nav-height, 68px) + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 768px) {
    .main-content {
        padding-bottom: calc(var(--mobile-nav-height, 68px) + env(safe-area-inset-bottom, 0px) + 24px);
    }
}

/* Липкие заголовки длинных таблиц на десктопе */
@media (min-width: 769px) {
    .table-wrapper { max-height: 72vh; overflow-y: auto; }
    .table-wrapper thead th {
        position: sticky;
        top: 0;
        z-index: 5;
        background: #0d1117;
    }
}

/* Крупнее зона нажатия на мобильной навигации и кнопках-действиях */
@media (max-width: 768px) {
    .mobile-nav .nav-item { min-height: 52px; }
    .action-btns .btn, .btn-sm { min-height: 38px; min-width: 38px; }
}

/* Доступность: видимый фокус только с клавиатуры */
:focus-visible {
    outline: 2px solid var(--color-primary, #4f7cff);
    outline-offset: 2px;
    border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* Уважение к reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Плавный скролл контента без дёрганья на якорях */
html { scroll-behavior: smooth; }

/* ============================================================
   V5.3 TRAINING PROGRAM
   A flexible session rail: the order matters, calendar dates do not.
   ============================================================ */
.program-shell {
    display: grid;
    gap: 16px;
}

.program-command {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 28px;
    align-items: end;
    min-height: 220px;
    padding: 32px;
    overflow: hidden;
    border: 1px solid rgba(88, 214, 212, .26);
    border-radius: 14px;
    background:
        linear-gradient(90deg, rgba(88,214,212,.11), transparent 44%),
        #0c1116;
}

.program-command::after {
    content: "3 + 1";
    position: absolute;
    right: 24px;
    top: -38px;
    color: rgba(255,255,255,.035);
    font-family: var(--font-heading);
    font-size: 180px;
    font-weight: 800;
    letter-spacing: -.08em;
    line-height: 1;
    pointer-events: none;
}

.program-title-line {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.program-title-line h3 {
    font-size: clamp(32px, 4vw, 56px);
    line-height: .98;
}

.program-status {
    padding: 6px 9px;
    border: 1px solid rgba(255,189,87,.42);
    border-radius: 5px;
    color: var(--color-warning);
    font-family: var(--font-utility);
    font-size: 10px;
    letter-spacing: .12em;
}

.program-command-copy > p {
    position: relative;
    z-index: 1;
    max-width: 820px;
    margin-top: 16px;
    color: #aab4c1;
}

.program-command-stats {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(110px, 1fr));
    gap: 1px;
    min-width: 410px;
    background: rgba(176,195,220,.12);
    border: 1px solid rgba(176,195,220,.12);
}

.program-command-stats > div {
    display: grid;
    align-content: center;
    min-height: 94px;
    padding: 15px;
    background: #0b0f14;
}

.program-command-stats strong {
    color: #fff;
    font-family: var(--font-heading);
    font-size: 30px;
    line-height: 1;
}

.program-command-stats span {
    margin-top: 8px;
    color: var(--text-muted);
    font-family: var(--font-utility);
    font-size: 9px;
    line-height: 1.3;
    text-transform: uppercase;
}

.program-relay {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 24px minmax(0, 1fr) 24px minmax(0, 1fr);
    align-items: stretch;
    gap: 6px;
}

.program-relay-node {
    position: relative;
    display: grid;
    align-content: center;
    min-height: 104px;
    padding: 16px;
    overflow: hidden;
    border: 1px solid rgba(176,195,220,.13);
    border-radius: 9px;
    background: #0b1016;
}

.program-relay-node::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: #58d6d4;
}

.program-relay-node.is-brain::before { background: #9d7cff; }
.program-relay-node.is-visual::before { background: #ffbd57; }

.program-relay-node span,
.program-relay-node small {
    color: #68778a;
    font-family: var(--font-utility);
    font-size: 8px;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.program-relay-node strong {
    margin: 5px 0;
    color: #e8eef5;
    font-family: var(--font-heading);
    font-size: 19px;
    line-height: 1;
    text-transform: uppercase;
}

.program-relay-node.is-brain strong { color: #b9a4ff; }
.program-relay-node.is-visual strong { color: #ffd18b; }

.program-relay-arrow {
    display: grid;
    place-items: center;
    color: #4f5d70;
    font-family: var(--font-utility);
}

.program-lifecycle-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr .72fr;
    gap: 12px;
}

.program-lifecycle-card {
    display: grid;
    align-content: start;
    gap: 12px;
    min-height: 210px;
    padding: 20px;
    border: 1px solid rgba(176,195,220,.12);
    border-radius: 10px;
    background: #0c1117;
}

.program-version-line,
.program-cycle-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.program-version-line > strong,
.program-progress-score > strong {
    color: #fff;
    font-family: var(--font-heading);
    font-size: 38px;
    line-height: 1;
}

.program-version-line > span {
    padding: 5px 8px;
    color: #ffbd57;
    border: 1px solid rgba(255,189,87,.34);
    border-radius: 4px;
    font-family: var(--font-utility);
    font-size: 9px;
    letter-spacing: .08em;
}

.program-lifecycle-card > p,
.program-lifecycle-card > small {
    color: #8290a2;
    font-size: 11px;
    line-height: 1.45;
}

.program-budget {
    display: flex;
    justify-content: space-between;
    padding: 9px 10px;
    color: #8795a8;
    border: 1px solid rgba(157,124,255,.2);
    background: rgba(157,124,255,.06);
    font-family: var(--font-utility);
    font-size: 9px;
    text-transform: uppercase;
}

.program-budget strong { color: #b9a4ff; }

.program-lifecycle-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: auto;
}

.program-lifecycle-actions .btn {
    flex: 1 1 120px;
    min-height: 34px;
    padding: 8px 10px;
    font-size: 10px;
}

.program-cycle-line label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #7c899b;
    font-size: 9px;
}

.program-cycle-line input {
    max-width: 132px;
    padding: 7px;
}

.program-calendar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.program-calendar-day {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 9px;
    border: 1px solid rgba(176,195,220,.1);
    border-top: 2px solid #58d6d4;
    background: #090d12;
}

.program-calendar-day time,
.program-calendar-day span {
    overflow: hidden;
    color: #6d7a8c;
    font-family: var(--font-utility);
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.program-calendar-day strong {
    color: #dce5ee;
    font-family: var(--font-heading);
    font-size: 15px;
}

.program-calendar-day.is-completed { border-top-color: #55d98b; }
.program-calendar-day.is-skipped { border-top-color: #ff6b73; opacity: .66; }

.program-progress-score {
    display: grid;
    gap: 4px;
}

.program-progress-score span {
    color: #718095;
    font-family: var(--font-utility);
    font-size: 8px;
    text-transform: uppercase;
}

.program-progress-decisions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.program-progress-decisions span {
    min-width: 44px;
    padding: 6px 8px;
    color: #aeb9c6;
    background: #090d12;
    border: 1px solid rgba(176,195,220,.1);
    font-family: var(--font-utility);
    font-size: 9px;
}

.program-progress-decisions .is-increase { color: #55d98b; }
.program-progress-decisions .is-hold { color: #58d6d4; }
.program-progress-decisions .is-reduce { color: #ffbd57; }
.program-progress-decisions .is-stop { color: #ff6b73; }

.program-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: start;
}

.program-session-panel,
.program-control-card,
.program-analysis-card,
.program-library-panel {
    border: 1px solid rgba(176,195,220,.12);
    border-radius: 12px;
    background: #0d1117;
}

.program-session-panel,
.program-library-panel {
    padding: 24px;
}

.program-panel-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.program-panel-head h4,
.program-control-card h4,
.program-analysis-card h4 {
    font-size: 23px;
}

.program-week-control {
    display: grid;
    gap: 6px;
    min-width: 180px;
    color: var(--text-muted);
    font-family: var(--font-utility);
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.program-session-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.program-session-tab {
    display: grid;
    gap: 4px;
    min-height: 86px;
    padding: 12px;
    text-align: left;
    color: #9aa6b5;
    background: #090d12;
    border: 1px solid rgba(176,195,220,.1);
    border-radius: 7px;
    cursor: pointer;
}

.program-session-tab:hover,
.program-session-tab.active {
    border-color: rgba(88,214,212,.45);
    background: rgba(88,214,212,.07);
}

.program-session-tab span,
.program-session-tab small {
    color: #6f7d8f;
    font-family: var(--font-utility);
    font-size: 9px;
    text-transform: uppercase;
}

.program-session-tab strong {
    color: #dce4ed;
    font-family: var(--font-heading);
    font-size: 17px;
    line-height: 1.05;
    text-transform: uppercase;
}

.program-session-tab.active span,
.program-session-tab.active strong {
    color: #58d6d4;
}

.program-exercises {
    display: grid;
    gap: 8px;
}

.program-exercise {
    display: grid;
    grid-template-columns: 44px 156px minmax(0, 1fr);
    gap: 14px;
    min-height: 150px;
    padding: 12px;
    border: 1px solid rgba(176,195,220,.09);
    background: #0a0e13;
}

.program-exercise-number {
    padding-top: 5px;
    color: #566174;
    font-family: var(--font-utility);
    font-size: 12px;
}

.program-exercise-image {
    width: 156px;
    height: 116px;
    object-fit: cover;
    align-self: center;
    border: 1px solid rgba(176,195,220,.13);
    border-radius: 7px;
    background: #141923;
}

.program-exercise-image.is-missing {
    object-fit: contain;
}

.program-exercise-copy {
    min-width: 0;
}

.program-exercise-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
}

.program-exercise-head > div > span {
    color: #798699;
    font-family: var(--font-utility);
    font-size: 9px;
    text-transform: uppercase;
}

.program-exercise-head h5 {
    margin-top: 2px;
    font-size: 20px;
    line-height: 1.05;
}

.program-exercise-head > strong {
    flex: 0 0 auto;
    color: var(--color-warning);
    font-family: var(--font-utility);
    font-size: 12px;
}

.program-prescription {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.program-prescription > * {
    padding: 4px 7px;
    color: #aeb8c5;
    background: #111820;
    border: 1px solid rgba(176,195,220,.11);
    font-family: var(--font-utility);
    font-size: 9px;
}

.program-prescription b {
    color: #58d6d4;
}

.program-set-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.program-set-targets span {
    padding: 4px 6px;
    color: #bac5d1;
    border: 1px solid rgba(88,214,212,.14);
    border-radius: 4px;
    background: rgba(88,214,212,.04);
    font-family: var(--font-utility);
    font-size: 8px;
}

.program-set-targets b {
    margin-right: 5px;
    color: #58d6d4;
}

.program-exercise-copy > p {
    margin-top: 9px;
    color: #8d98a8;
    font-size: 12px;
}

.program-alternatives {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.program-alternatives small {
    color: #6c7889;
    font-family: var(--font-utility);
    font-size: 8px;
    text-transform: uppercase;
}

.program-alt {
    padding: 3px 7px;
    color: #c5ced8;
    border-left: 2px solid #5667d8;
    background: rgba(86,103,216,.09);
    font-size: 10px;
}

.program-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

.program-fact-form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    padding: 18px;
    border: 1px solid rgba(157,124,255,.24);
    border-radius: 8px;
    background: rgba(157,124,255,.035);
}

.program-fact-form[hidden] { display: none; }

.program-fact-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
}

.program-fact-head input { max-width: 170px; }

.program-fact-sets {
    display: grid;
    gap: 12px;
}

.program-fact-exercise {
    display: grid;
    gap: 7px;
}

.program-fact-exercise h5 {
    color: #dfe7ef;
    font-size: 15px;
}

.program-fact-set {
    display: grid;
    grid-template-columns: 84px repeat(6, minmax(72px, 1fr));
    gap: 7px;
    align-items: end;
    padding: 9px;
    border: 1px solid rgba(176,195,220,.09);
    background: #090d12;
}

.program-fact-set > strong {
    align-self: center;
    color: #9d7cff;
    font-family: var(--font-utility);
    font-size: 9px;
    text-transform: uppercase;
}

.program-fact-set label,
.program-fact-form > label {
    display: grid;
    gap: 4px;
    color: #748196;
    font-size: 8px;
    text-transform: uppercase;
}

.program-fact-set input,
.program-fact-set select {
    min-width: 0;
    padding: 7px;
    font-size: 10px;
}

.program-control-stack {
    display: grid;
    gap: 16px;
}

.program-control-card {
    display: grid;
    gap: 13px;
    padding: 20px;
}

.program-control-card > label,
.readiness-grid label {
    display: grid;
    gap: 6px;
    color: #8d98a8;
    font-size: 11px;
}

.readiness-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.readiness-result {
    padding: 10px;
    color: #8d98a8;
    border: 1px solid rgba(176,195,220,.1);
    background: #090d12;
    font-size: 11px;
}

.readiness-result.is-green { color: #55d98b; border-color: rgba(85,217,139,.35); }
.readiness-result.is-yellow { color: #ffbd57; border-color: rgba(255,189,87,.35); }
.readiness-result.is-red { color: #ff6b73; border-color: rgba(255,95,104,.4); }

.program-analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.program-analysis-card {
    padding: 22px;
    border-top: 2px solid #58d6d4;
}

.program-analysis-card.is-growth {
    border-top-color: #ffbd57;
}

.program-analysis-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
}

.program-analysis-list article {
    padding: 13px;
    border: 1px solid rgba(176,195,220,.09);
    background: #090d12;
}

.program-analysis-list strong {
    color: #e4eaf1;
    font-size: 12px;
}

.program-analysis-list p {
    margin-top: 7px;
    color: #8d98a8;
    font-size: 11px;
}

.program-analysis-list span {
    display: block;
    margin-top: 8px;
    color: #b8c3cf;
    font-size: 11px;
}

.program-library-panel input[type="search"] {
    width: min(360px, 100%);
}

.equipment-results {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.equipment-card {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 12px;
    min-height: 112px;
    padding: 10px;
    border: 1px solid rgba(176,195,220,.09);
    background: #090d12;
}

.equipment-card img {
    width: 110px;
    height: 88px;
    align-self: center;
    object-fit: cover;
    border-radius: 5px;
    background: #141923;
}

.equipment-card span {
    color: #647186;
    font-family: var(--font-utility);
    font-size: 8px;
    text-transform: uppercase;
}

.equipment-card h5 {
    margin-top: 3px;
    font-size: 16px;
    line-height: 1;
}

.equipment-card p {
    margin-top: 6px;
    color: #9aa6b5;
    font-size: 10px;
}

.equipment-card small {
    display: block;
    margin-top: 6px;
    color: #667386;
    font-size: 9px;
    line-height: 1.25;
}

@media (max-width: 1260px) {
    .program-main-grid { grid-template-columns: 1fr; }
    .program-control-stack { grid-template-columns: 1fr 1fr; }
    .equipment-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .program-lifecycle-grid { grid-template-columns: 1fr 1fr; }
    .program-lifecycle-card:last-child { grid-column: 1 / -1; }
    .program-fact-set { grid-template-columns: 80px repeat(3, minmax(80px, 1fr)); }
}

@media (max-width: 900px) {
    .program-command { grid-template-columns: 1fr; }
    .program-command-stats { min-width: 0; }
    .program-session-tabs { grid-template-columns: 1fr 1fr; }
    .program-analysis-grid { grid-template-columns: 1fr; }
    .program-relay { grid-template-columns: 1fr 1fr; }
    .program-relay-arrow { display: none; }
    .program-lifecycle-grid { grid-template-columns: 1fr; }
    .program-lifecycle-card:last-child { grid-column: auto; }
}

@media (max-width: 640px) {
    .program-command { min-height: 0; padding: 22px 18px; }
    .program-command::after { font-size: 110px; right: 8px; }
    .program-command-stats { grid-template-columns: 1fr; }
    .program-command-stats > div { min-height: 66px; }
    .program-panel-head { align-items: stretch; flex-direction: column; }
    .program-week-control { min-width: 0; }
    .program-session-panel,
    .program-library-panel { padding: 15px; }
    .program-exercise {
        grid-template-columns: 34px minmax(0, 1fr);
    }
    .program-exercise-image {
        grid-column: 2;
        width: 100%;
        height: 150px;
    }
    .program-exercise-copy { grid-column: 2; }
    .program-exercise-head { flex-direction: column; gap: 6px; }
    .program-control-stack { grid-template-columns: 1fr; }
    .program-analysis-list { grid-template-columns: 1fr; }
    .equipment-results { grid-template-columns: 1fr; }
    .program-actions { flex-direction: column; }
    .program-actions .btn { width: 100%; }
    .program-relay { grid-template-columns: 1fr; }
    .program-relay-arrow { display: none; }
    .program-calendar { grid-template-columns: 1fr 1fr; }
    .program-fact-head { align-items: stretch; flex-direction: column; }
    .program-fact-head input { max-width: none; }
    .program-fact-set { grid-template-columns: 1fr 1fr; }
    .program-fact-set > strong { grid-column: 1 / -1; }
}
