/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Corporate Theme - Inspired by RGS */
    --bg-primary: #ffffff;
    --bg-secondary: #f9f9fa;
    --bg-tertiary: #f2f2f5;
    --bg-sidebar: #F4F4F7;

    --text-primary: #28292b;
    --text-secondary: #505254;
    --text-muted: #6a6b6d;

    /* RGS Brand Colors */
    --accent-red: #b70037;
    --accent-red-hover: #dd0042;
    --accent-red-active: #81002a;

    --accent-blue: #0066cc;
    --accent-blue-hover: #0052a3;
    --accent-blue-light: #e6f0ff;
    --accent-green: #22c55e;
    --accent-yellow: #f59e0b;
    --accent-orange: #f97316;

    --border-color: #E7E7EB;
    --border-hover: #cbcfd6;

    /* Semantic colors */
    --primary-color: #b70037;
    --success-color: #4caf50;
    --warning-color: #ffa726;
    --error-color: #ef5350;

    /* Professional shadows like RGS */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 9px 19px 5px rgba(34, 60, 80, 0.15);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --transition: all 0.25s ease;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Inter - Local Fonts */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    src: url('/fonts/Inter-Regular.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    src: url('/fonts/Inter-Medium.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    src: url('/fonts/Inter-SemiBold.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    src: url('/fonts/Inter-Bold.woff2') format('woff2');
    font-display: swap;
}

/* Material Symbols Outlined - Local Font */
@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 100 700;
    src: url('/fonts/MaterialSymbolsOutlined.woff2') format('woff2');
    font-display: swap;
}

/* Ensure Material Icons load properly */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined', sans-serif;
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'liga';
    font-display: swap;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; }

/* ========== LAYOUT ========== */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 200px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

.logo {
    padding: 16px 24px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.nav-menu {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 4px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(183, 0, 55, 0.08);
    color: var(--accent-red);
    font-weight: 600;
}

.nav-item .icon {
    margin-right: 6px;
    font-size: 20px;
}

.nav-item .material-symbols-outlined {
    margin-right: 6px;
    font-size: 20px;
    font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 20;
}

/* User profile in header */
.user-profile-header {
    position: relative;
}

.user-profile-header .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.user-profile-header .avatar:hover {
    opacity: 0.9;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1000;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-info {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.user-dropdown .user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.user-dropdown .user-role {
    font-size: 12px;
    color: var(--text-muted);
}

.user-dropdown .logout-btn {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
    border-radius: 0 0 8px 8px;
}

.user-dropdown .logout-btn:hover {
    background: var(--bg-tertiary);
    color: var(--accent-red);
}

.user-dropdown .logout-btn .material-symbols-outlined {
    font-size: 18px;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    overflow-y: auto;
    overflow-y: overlay; /* Overlay scrollbar (Chrome/Edge) */
    background: var(--bg-primary);
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: rgba(203, 213, 225, 0.5) transparent;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 24px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
}

/* Sticky header on product edit page */
#product-edit-page .page-header {
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 !important;
    color: var(--accent-red);
    font-weight: 500;
    background: transparent !important;
}

.btn-back .material-symbols-outlined {
    font-size: 18px;
    font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 18;
    transition: color 0.2s ease;
}

.btn-back:hover {
    background: transparent !important;
    filter: brightness(0.7);
}

.page-header .btn {
    border-radius: 18px;
    height: 36px;
    padding: 6px 16px;
    display: inline-flex;
    align-items: center;
}

.page-content {
    padding: 24px 24px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Для страниц без page-content wrapper */
.page > *:not(.page-header):not(.page-content):not(.product-title-bar) {
    margin-left: 24px;
    margin-right: 24px;
}

.page > *:not(.page-header):not(.page-content):not(.product-title-bar):first-of-type {
    margin-top: 24px;
}

.page-header h1 {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.product-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--bg-primary);
}

.product-title-bar h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ========== BUTTONS (RGS Style) ========== */
/* Ensure all button elements have pointer cursor */
button {
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 2px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

/* Primary Button - RGS Red */
.btn-primary {
    background: var(--accent-red);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-red-hover);
}

.btn-primary:active {
    background: var(--accent-red-active);
}

.btn-primary:disabled {
    background: #f2f2f5;
    color: #6a6b6d;
    cursor: not-allowed;
    pointer-events: none;
}

/* Secondary Button - RGS Style */
.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-hover);
}

.btn-secondary:hover {
    color: var(--accent-red-hover);
    border-color: var(--accent-red-hover);
}

.btn-secondary:active {
    color: var(--accent-red-active);
    border-color: var(--accent-red-active);
}

/* Text Button */
.btn-text {
    background: transparent;
    color: var(--accent-red);
    padding: 6px 12px;
}

.btn-text:hover {
    background: rgba(183, 0, 55, 0.05);
    color: var(--accent-red-hover);
}

/* Small Button */
.btn-small {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-rounded {
    border-radius: 20px;
}

/* Icon Button */
.btn-icon {
    padding: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.btn-icon.btn-danger {
    color: #dc3545;
}

.btn-icon.btn-danger:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #c82333;
}

.btn-icon .material-symbols-outlined {
    font-size: 20px;
}

/* ========== METRICS ========== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-color);
}

.metric-card.yellow {
    border-left-color: var(--accent-yellow);
}

.metric-card.orange {
    border-left-color: var(--accent-orange);
}

.metric-card.green {
    border-left-color: var(--accent-green);
}

.metric-card.blue {
    border-left-color: var(--accent-blue);
}

.metric-card.red {
    border-left-color: var(--accent-red);
}

.metric-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.metric-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    margin-left: auto;
}

/* ========== PRODUCTS SECTION ========== */
.products-section {
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.filters {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    align-items: center;
    gap: 16px;
}

.filters-left {
    display: flex;
    gap: 16px;
    align-items: center;
}

.status-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.status-tab {
    cursor: pointer;
    border: none;
    transition: var(--transition);
    opacity: 1;
}

.status-tab:not(.active) {
    opacity: 0.3;
    filter: grayscale(50%);
}

.status-tab:hover {
    filter: brightness(0.9);
}

.status-count {
    display: inline-block;
    margin-left: 4px;
    font-weight: 600;
}

.filter-select {
    padding: 8px 40px 8px 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236a6b6d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px;
}

.search-input-wrapper {
    position: relative;
    width: 240px;
}

.search-input {
    width: 240px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    outline: none;
}

.search-input:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(183, 0, 55, 0.1);
}

.products-list {
    min-height: 200px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

/* ========== PRODUCT CARD ========== */
.product-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}


.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 24px;
}

.product-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.product-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.status-badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    height: 28px;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}

.status-badge.draft {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.status-badge.approval {
    background: #fed7aa;
    color: #9a3412;
    border: 1px solid #fb923c;
}

.status-badge.approved {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #34d399;
}

.status-badge.sent,
.status-badge.sent_to_cb {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #60a5fa;
}

.status-badge.rejected {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
}

/* Locked product indicator */
.status-indicator-locked {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.3);
    border: 1px solid #d32f2f;
}

.product-meta {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 6px;
}

.product-meta-with-progress {
    display: flex;
    align-items: center;
    gap: 6px;
}

.product-progress {
    margin: 8px 0;
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    width: 100px;
    flex-shrink: 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #cbd5e1 0%, #94a3b8 100%);
    border-radius: 10px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(148, 163, 184, 0.15);
}

.progress-text {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
}

.product-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-actions {
    display: flex;
    gap: 16px;
    margin-top: auto;
    padding-top: 12px;
}

.product-actions .btn {
    background: transparent;
    border: none;
    padding: 6px 0;
}

.product-actions .btn-primary {
    color: var(--accent-red);
}

.product-actions .btn-primary:hover {
    filter: brightness(0.8);
}

.product-actions .btn-secondary {
    color: var(--text-secondary);
    border: none;
}

.product-actions .btn-secondary:hover {
    filter: brightness(0.7);
}

/* ========== TABS ========== */
.tabs {
    display: flex;
    gap: 32px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 32px;
}

.tab-btn {
    padding: 14px 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: var(--transition-smooth);
    position: relative;
    margin-bottom: -2px;
}

.tab-btn:hover {
    filter: brightness(0.7);
}

.tab-btn.active {
    color: var(--accent-red);
    border-bottom-color: var(--accent-red);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========== FORMS ========== */
.component-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

/* ========== INSURANCE FORM LAYOUT ========== */
.insurance-form-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 12px;
    align-items: start;
}

.form-actions {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px !important;
    justify-content: flex-start !important;
    align-items: center !important;
    margin-top: 24px;
}

.form-actions .btn {
    display: inline-flex !important;
    width: auto !important;
}

.modal .form-actions {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px !important;
    justify-content: flex-start !important;
}

.modal .form-actions .btn {
    display: inline-flex !important;
    width: auto !important;
}

.modal .form-actions .btn-secondary {
    font-size: 14px;
}

.modal .form-actions .btn-primary {
    border-radius: 20px;
}

#add-standard-kv-btn,
#add-asset-kv-btn {
    border-radius: 20px;
}

.date-range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.date-range-inputs input[type="date"] {
    flex: 1;
    min-width: 0;
}

.date-range-inputs span {
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.form-group.span-2 {
    grid-column: span 2;
}

.form-group.span-3 {
    grid-column: span 3;
}

.form-group.span-4 {
    grid-column: span 4;
}

.section-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    padding: 6px 0;
    transition: var(--transition);
}

.checkbox-inline:hover {
    color: var(--accent-red);
}

.checkbox-inline input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

@media (max-width: 1400px) {
    .form-row {
        grid-template-columns: repeat(3, 1fr);
    }
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1200px) {
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .form-group.span-2,
    .form-group.span-3,
    .form-group.span-4 {
        grid-column: span 1;
    }
}

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

.form-group label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    padding: 11px 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: var(--transition-smooth);
    font-family: 'Inter', sans-serif;
}

.form-group select {
    padding: 11px 14px;
    padding-right: 40px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: var(--transition-smooth);
    font-family: 'Inter', sans-serif;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236a6b6d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 10px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-red);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(183, 0, 55, 0.1);
}

.form-group input[required]:invalid,
.form-group select[required]:invalid {
    border-color: var(--accent-red);
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.multi-select-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

/* Красная рамка для обязательных незаполненных чекбокс-групп */
.multi-select-container.required-invalid {
    border-color: var(--accent-red);
    border-width: 2px;
}

.multi-select-container label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    color: var(--text-primary);
}

.multi-select-container input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

/* ========== TABLES ========== */
.table-container {
    overflow-x: auto;
    margin-top: 16px;
    margin-bottom: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: var(--bg-tertiary);
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table input {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
}

.data-table input:focus {
    border-color: var(--accent-red);
    outline: none;
    box-shadow: 0 0 0 3px rgba(183, 0, 55, 0.1);
}

.data-table select {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
}

.data-table .delete-btn {
    background: transparent;
    border: none;
    color: var(--accent-red);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

.data-table .delete-btn:hover {
    color: #ff1744;
}

.empty-state-row td {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
}

.dynamic-table-section {
    margin-top: 32px;
}

.dynamic-table-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.help-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ========== WYSIWYG EDITOR ========== */
.editor-container {
    display: flex;
    gap: 24px;
    margin-top: 16px;
}

.fields-panel {
    width: 240px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 16px;
    height: fit-content;
}

.fields-panel h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
}

.field-category {
    margin-bottom: 16px;
}

.field-category h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.field-item {
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    user-select: none;
}

.field-item::after {
    content: '📋';
    position: absolute;
    right: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.field-item:hover {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
    transform: translateX(2px);
}

.field-item:hover::after {
    opacity: 0.7;
}

.field-item:active {
    transform: scale(0.98);
}

.wysiwyg-editor {
    flex: 1;
    background: var(--bg-primary);
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    min-height: 500px;
    outline: none;
    box-shadow: var(--shadow-sm);
}

.wysiwyg-editor:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(183, 0, 55, 0.1);
}

.wysiwyg-editor h1 {
    font-size: 24px;
    margin-bottom: 16px;
}

.wysiwyg-editor p {
    margin-bottom: 12px;
}

.editor-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

/* Role Selector */
.role-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 12px;
}

.role-option {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.role-option:hover {
    border-color: var(--accent-red);
    background: var(--bg-secondary);
}

.role-option.selected {
    border-color: var(--accent-red);
    background: rgba(183, 0, 55, 0.05);
}

.role-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.role-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.role-description {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.btn-block {
    width: 100%;
    margin-top: 16px;
}

/* Approval Panel */
/* ========== APPROVAL PROGRESS BAR ========== */
.approval-progress-bar {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.approval-progress-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.approval-progress-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 700px;
    margin: 0 auto;
}

.approval-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    flex: 0 0 auto;
}

.approval-progress-step .step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
    position: relative;
}

.approval-progress-step.approved .step-icon {
    background: rgba(76, 175, 80, 0.1);
    border-color: var(--accent-green);
}

.approval-progress-step.pending .step-icon {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    opacity: 0.6;
}

.approval-progress-step.current .step-icon {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.approval-progress-step .step-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
}

.approval-progress-step.approved .step-label {
    color: var(--accent-green);
}

.approval-progress-step.current .step-label {
    color: var(--accent-blue);
    font-weight: 600;
}

.approval-progress-step .step-status {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.approval-progress-step.approved .step-status {
    background: var(--accent-green);
    color: white;
}

.approval-progress-step.approved .step-status::after {
    content: '✓';
}

.approval-progress-line {
    flex: 1;
    height: 2px;
    background: var(--border-color);
    margin: 0 6px;
    position: relative;
    top: -16px;
}

.approval-progress-step.approved ~ .approval-progress-line {
    background: var(--accent-green);
}

.approval-panel {
    margin-bottom: 20px;
}

.approval-panel h3 {
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
}

.approvals-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.approval-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    transition: var(--transition);
}

.approval-card.current-user-card {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    background: rgba(52, 152, 219, 0.05);
}

.approval-card .role-name {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 13px;
}

.approval-status {
    font-size: 12px;
    margin-bottom: 10px;
    min-height: 30px;
}

.approval-actions button {
    margin-right: 8px;
    margin-bottom: 8px;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* ========== VALIDATION MODAL ========== */
.validation-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.validation-modal-content {
    background: var(--bg-primary);
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.validation-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.validation-modal-header h3 {
    margin: 0;
    color: #FF9800;
    font-size: 18px;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.validation-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.validation-modal-body p {
    margin-top: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.missing-fields-list {
    margin-top: 16px;
}

.role-fields-group {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border-left: 3px solid #FF9800;
}

.role-fields-group h4 {
    margin: 0 0 12px 0;
    color: var(--accent-blue);
    font-size: 15px;
}

.role-fields-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.role-fields-group li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
}

.role-fields-group li:last-child {
    border-bottom: none;
}

.role-fields-group li:before {
    content: "▸";
    position: absolute;
    left: 8px;
    color: #FF9800;
}

.validation-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.validation-modal-footer .btn {
    min-width: 120px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========== FILLING PROGRESS BY ROLES ========== */
.filling-progress-section {
    margin-top: 24px;
    display: flex;
    gap: 8px;
}

.role-progress-header {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    border-radius: 20px;
    padding: 6px 12px;
    border: 1px solid;
    font-size: 12px;
    font-weight: 500;
    height: 32px;
    box-sizing: border-box;
}

/* Роль с прогрессом 100% - зеленая */
.role-progress-header.complete {
    background: #d1fae5;
    border-color: #34d399;
    color: #065f46;
}

/* Роль с прогрессом < 100% - серая */
.role-progress-header.incomplete {
    background: rgba(244, 244, 247, 0.5);
    border-color: #E7E7EB;
    color: var(--text-secondary);
}


.progress-fill {
    height: 100%;
    transition: width 0.3s ease, background 0.3s ease;
    border-radius: 3px;
}

/* ========== TOAST NOTIFICATIONS ========== */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left-color: var(--accent-green);
}

.toast.error {
    border-left-color: var(--accent-red);
}

.toast.warning {
    border-left-color: var(--accent-yellow);
}

.toast.info {
    border-left-color: var(--accent-blue);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========== UTILITIES ========== */
.autosave-indicator {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

#autosave-status {
    color: var(--success-color);
    font-weight: 500;
}

.new-row {
    animation: highlight 2s ease;
}

@keyframes highlight {
    0% { background: rgba(74, 158, 255, 0.3); }
    100% { background: transparent; }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(203, 213, 225, 0.5);
    border-radius: 7px;
    border: 2px solid transparent;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.7);
}

/* ========== ARCHIVE PAGE ========== */
#archive-page .filters {
    justify-content: flex-start;
}

#archive-page .metric-card,
#analytics-page .metric-card {
    padding: 12px 16px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.metric-card.gray {
    background: linear-gradient(135deg, #6B6B6B 0%, #4A4A4A 100%);
    color: white;
}

.metric-card.green {
    background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
    color: white;
}

.metric-card.yellow {
    background: linear-gradient(135deg, #ffca28 0%, #ffa000 100%);
    color: white;
}

.metric-card.red {
    background: linear-gradient(135deg, #ef5350 0%, #c62828 100%);
    color: white;
}

.metric-card.purple {
    background: linear-gradient(135deg, #ab47bc 0%, #8e24aa 100%);
    color: white;
}

.metric-card.blue {
    background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
    color: white;
}

.metric-card.orange {
    background: linear-gradient(135deg, #ffa726 0%, #fb8c00 100%);
    color: white;
}

.metric-card.gray .metric-label,
.metric-card.green .metric-label,
.metric-card.yellow .metric-label,
.metric-card.red .metric-label,
.metric-card.purple .metric-label,
.metric-card.blue .metric-label,
.metric-card.orange .metric-label,
.metric-card.gray .metric-value,
.metric-card.green .metric-value,
.metric-card.yellow .metric-value,
.metric-card.red .metric-value,
.metric-card.purple .metric-value,
.metric-card.blue .metric-value,
.metric-card.orange .metric-value {
    color: white;
}

/* ========== SETTINGS PAGE ========== */
/* Settings now use standard .tabs and .tab-btn classes */

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.backup-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.backup-info {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: 6px;
    border-left: 3px solid var(--accent-blue);
}

.backup-info p {
    margin: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.backup-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ========== BUTTON VARIANTS ========== */
.btn.btn-danger {
    background: var(--status-error);
    color: white;
}

.btn.btn-danger:hover {
    background: #c62828;
}

/* ========== ANALYTICS PAGE ========== */
/* Analytics now use standard .tabs and .tab-btn classes */

/* Metric Cards additional colors for analytics */
.metric-card.teal {
    background: linear-gradient(135deg, #26a69a 0%, #00796b 100%);
    color: white;
}

.metric-card.amber {
    background: linear-gradient(135deg, #ffa726 0%, #f57c00 100%);
    color: white;
}

.metric-card.indigo {
    background: linear-gradient(135deg, #5c6bc0 0%, #3949ab 100%);
    color: white;
}

#analytics-page .metrics-grid {
    margin-bottom: 0;
}

#analytics-page .metric-card.blue,
#analytics-page .metric-card.orange,
#analytics-page .metric-card.purple,
#analytics-page .metric-card.green {
    border-left: none;
    border: none;
}

#analytics-page .metric-detail {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    margin-left: auto;
}

/* Bottleneck Chart */
.bottleneck-chart {
    margin-top: 24px;
}

.bottleneck-item {
    display: grid;
    grid-template-columns: 150px 1fr 100px;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.bottleneck-label {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.bottleneck-bar-container {
    background: var(--bg-secondary);
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.bottleneck-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, #2196f3 100%);
    border-radius: 12px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 12px;
    font-weight: 500;
}

.bottleneck-value {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: right;
}

/* Products Table */
.products-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.products-table th {
    background: var(--bg-secondary);
    padding: 12px;
    text-align: left;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 2px solid var(--border-color);
}

.products-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.products-table tbody tr:hover {
    background: var(--bg-secondary);
}

/* Progress Overview */
.progress-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.progress-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.progress-card h3 {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.circular-progress {
    display: flex;
    justify-content: center;
    align-items: center;
}

.progress-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(
        var(--success-color) 0deg,
        var(--success-color) calc(var(--progress, 0) * 3.6deg),
        var(--bg-tertiary) calc(var(--progress, 0) * 3.6deg),
        var(--bg-tertiary) 360deg
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.progress-circle::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: var(--bg-secondary);
    border-radius: 50%;
}

.progress-circle span {
    position: relative;
    z-index: 1;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
}

/* Blocking Elements */
.blocking-elements {
    margin-top: 24px;
}

.blocking-elements h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.blocking-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--warning-color);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.blocking-item .icon {
    font-size: 20px;
}

.blocking-item .content {
    flex: 1;
}

.blocking-item .field-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.blocking-item .tab-name {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Roles Status */
.roles-status {
    margin-top: 24px;
    display: grid;
    gap: 12px;
}

.role-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.role-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 50%;
}

.role-info {
    flex: 1;
}

.role-info h4 {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.role-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.role-status {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.role-status.completed {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success-color);
}

.role-status.pending {
    background: rgba(255, 167, 38, 0.2);
    color: var(--warning-color);
}

.role-status.not-started {
    background: rgba(158, 158, 158, 0.2);
    color: var(--text-secondary);
}

/* Audit Filters */
.audit-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

/* Audit Timeline */
.audit-timeline {
    position: relative;
    padding-left: 32px;
}

.audit-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.audit-entry {
    position: relative;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.audit-entry::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 20px;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

.audit-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.audit-entry-title {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.audit-entry-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.audit-entry-user {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.audit-entry-details {
    font-size: 13px;
    color: var(--text-primary);
    margin-top: 8px;
}

.audit-entry-product {
    display: inline-block;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.audit-action-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 8px;
}

.audit-action-badge.create {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success-color);
}

.audit-action-badge.update {
    background: rgba(74, 158, 255, 0.2);
    color: var(--primary-color);
}

.audit-action-badge.delete {
    background: rgba(239, 83, 80, 0.2);
    color: var(--error-color);
}

.audit-action-badge.status {
    background: rgba(255, 167, 38, 0.2);
    color: var(--warning-color);
}

/* Product Selector */
#product-selector {
    max-width: 400px;
    margin-bottom: 24px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
    margin-bottom: 8px;
}

.empty-state-subtext {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1400px) {
    .page-header {
        padding: 0 20px;
    }

    .page-content {
        padding: 24px 20px;
    }

    .form-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .form-row {
        grid-template-columns: repeat(3, 1fr);
    }
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1200px) {
    .page-header {
        padding: 0 20px;
    }

    .page-content {
        padding: 24px 20px;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }

    .page {
        padding: 16px;
    }

    .page-header {
        padding: 0 16px;
    }

    .page-content {
        padding: 16px 16px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

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

    .form-group.span-2,
    .form-group.span-3,
    .form-group.span-4 {
        grid-column: span 1;
    }
}

/* ========== ROLE-BASED SECTIONS ========== */
.role-section {
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.role-section.editable {
    /* Removed colored borders */
}

.role-section.readonly {
    /* Removed colored borders */
}

.role-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
}

.role-section.editable .role-section-header {
    /* Removed colored gradient */
}

.role-section.readonly .role-section-header {
    /* Removed colored gradient */
}

.role-section-header:hover {
    background: var(--bg-tertiary);
}

.role-section.collapsed .role-section-header {
    border-bottom: none;
}

.role-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 600;
}

.role-section-icon {
    display: none;
}

.role-section-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.role-section-badge .status-icon {
    font-size: 16px;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 16;
}

.role-section.editable .role-section-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.role-section.readonly .role-section-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.role-section-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.toggle-text {
    display: none;
}

.role-section-toggle-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
    font-variation-settings:
        'FILL' 0,
        'wght' 300,
        'GRAD' 0,
        'opsz' 20;
}

.role-section.collapsed .role-section-toggle-icon {
    transform: rotate(-90deg);
}

.role-section-content {
    padding: 24px 20px;
    transition: all 0.3s ease;
}

.role-section.collapsed .role-section-content {
    display: none;
}

.role-section-description {
    margin-top: -4px;
    padding: 0 20px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

/* Сохраняем существующие стили для component-section, но делаем их совместимыми */
.role-section .component-section {
    margin-bottom: 0;
    background: transparent;
    border: none;
    padding: 0;
}

.role-section .component-section .section-title {
    margin-top: 0;
    margin-bottom: 20px;
}

/* Убираем двойные отступы для вложенных секций */
.role-section .form-grid,
.role-section .dynamic-table-section {
    margin-top: 0;
}

/* ========== NOTIFICATION SYSTEM ========== */
.btn-notification {
    position: relative;
    background: #ECECF0;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-notification:hover {
    background: #E5E5E9;
    border-color: var(--border-hover);
}

.notification-icon {
    font-size: 16px;
    font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 16;
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef5350;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.notification-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 16px rgba(0,0,0,0.1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.notification-panel.active {
    right: 0;
}

.notification-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.notification-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.notification-item:hover {
    background: var(--bg-primary);
    border-color: var(--border-hover);
}

.notification-item.unread {
    border-left: 3px solid var(--accent-red);
    background: rgba(183, 0, 55, 0.05);
}

.notification-item.read {
    opacity: 0.7;
}

.notification-item .notification-icon {
    font-size: 12px;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.notification-time {
    font-size: 12px;
    color: var(--text-muted);
}

.notification-unread-dot {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--accent-blue);
    border-radius: 50%;
}

.notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.notification-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.notification-empty-text {
    font-size: 16px;
    color: var(--text-secondary);
}

/* ========== LARGE SCREENS ========== */
@media (min-width: 1540px) {
    /* page-header: фон и border на всю ширину, контент центрирован */
    .page-header {
        padding-left: calc((100vw - 200px - 1240px) / 2);
        padding-right: calc((100vw - 200px - 1240px) / 2);
    }

    /* product-title-bar: фон на всю ширину, контент центрирован */
    .product-title-bar {
        padding-left: calc((100vw - 200px - 1240px) / 2);
        padding-right: calc((100vw - 200px - 1240px) / 2);
    }

    /* Убираем боковые паддинги у page-content на больших экранах */
    .page-content {
        padding-left: 0;
        padding-right: 0;
    }

    /* Центрируем контент внутри всех страниц */
    .page-content,
    .component-section,
    .role-section,
    .products-section,
    .section-header,
    .filters,
    .products-list,
    .metrics-grid,
    .audit-timeline,
    .approval-progress-bar,
    #product-edit-page .tabs,
    #product-edit-page .approval-panel,
    #product-edit-page .launch-readiness-section {
        max-width: 1240px;
        margin-left: auto;
        margin-right: auto;
    }
}
