/* =====================================================
   CSS V3 — ПОЛНЫЙ МИНИМАЛЬНЫЙ НАБОР КЛАССОВ
   Визуал ПОЛНОСТЬЮ как в V2, с масштабированием через --v3-scale
   ===================================================== */

:root {
    /* ========== МАСШТАБ ========== */
    --v3-scale: 1;

    /* ========== ОТСТУПЫ (масштабируемые) ========== */
    --v3-offset-mini: calc(2px * var(--v3-scale));
    --v3-offset-little: calc(4px * var(--v3-scale));
    --v3-offset-normal: calc(8px * var(--v3-scale));
    --v3-offset-max: calc(12px * var(--v3-scale));

    /* ========== РАЗМЕРЫ ========== */
    --v3-btn-min-height: calc(52px * var(--v3-scale));
    --v3-btn-padding: calc(8px * var(--v3-scale));
    --v3-icon-16px: calc(16px * var(--v3-scale));
    --v3-icon-18px: calc(18px * var(--v3-scale));
    --v3-icon-20px: calc(20px * var(--v3-scale));
    --v3-icon-24px: calc(24px * var(--v3-scale));
    --v3-icon-28px: calc(28px * var(--v3-scale));
    --v3-icon-32px: calc(32px * var(--v3-scale));
    --v3-icon-40px: calc(40px * var(--v3-scale));
    --v3-icon-48px: calc(48px * var(--v3-scale));
    --v3-icon-64px: calc(64px * var(--v3-scale));

    /* ========== ШРИФТЫ ========== */
    --v3-font-0_65rem: calc(0.65rem * var(--v3-scale));
    --v3-font-0_7rem: calc(0.7rem * var(--v3-scale));
    --v3-font-0_75rem: calc(0.75rem * var(--v3-scale));
    --v3-font-0_8rem: calc(0.8rem * var(--v3-scale));
    --v3-font-0_85rem: calc(0.85rem * var(--v3-scale));
    --v3-font-0_9rem: calc(0.9rem * var(--v3-scale));
    --v3-font-0_95rem: calc(0.95rem * var(--v3-scale));
    --v3-font-1rem: calc(1rem * var(--v3-scale));
    --v3-font-1_1rem: calc(1.1rem * var(--v3-scale));
    --v3-font-1_2rem: calc(1.2rem * var(--v3-scale));

    /* ========== ЦВЕТА — ТОЧНО КАК В V2 ========== */
    --v3-primary-base: #1a143d;
    --v3-primary-dark: #38325c;
    --v3-primary-primary: #564f7a;
    --v3-primary-hover: #746d99;
    --v3-primary-secondary: #928ab7;
    --v3-primary-light: #b0a8d6;
    --v3-primary-bg: #cec5f4;

    --v3-success-base: #0d7d23;
    --v3-success-dark: #2b9b42;
    --v3-success-primary: #49b860;
    --v3-success-hover: #67d67f;
    --v3-success-secondary: #85f39d;
    --v3-success-light: #a3ffbc;
    --v3-success-bg: #c1ffda;

    --v3-info-base: #153579;
    --v3-info-dark: #335398;
    --v3-info-primary: #5170b6;
    --v3-info-hover: #6f8ed5;
    --v3-info-secondary: #8dabf3;
    --v3-info-light: #abc9ff;
    --v3-info-bg: #c9e6ff;

    --v3-error-base: #821717;
    --v3-error-dark: #a03536;
    --v3-error-primary: #be5254;
    --v3-error-hover: #dc7073;
    --v3-error-secondary: #fa8d91;
    --v3-error-light: #ffabb0;
    --v3-error-bg: #ffc8ce;

    --v3-text-primary: var(--v3-primary-base);
    --v3-text-secondary: var(--v3-primary-secondary);
    --v3-text-muted: var(--v3-primary-secondary);
    --v3-text-disabled: color-mix(in srgb, var(--v3-primary-base) 50%, transparent);

    --v3-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --v3-radius: calc(8px * var(--v3-scale));
    --v3-header-bg: linear-gradient(135deg, var(--v3-primary-dark) 0%, var(--v3-primary-base) 100%);
    --v3-white: #ffffff;
}

/* ========== БАЗОВЫЕ СБРОСЫ ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--v3-primary-bg);
    color: var(--v3-primary-base);
    height: 100vh;
    overflow: hidden;
}

.v3-app { display: flex; flex-direction: column; height: 100vh; }

/* ========== ШАПКА ========== */
.v3-header {
    background: linear-gradient(135deg, var(--v2-primary-primary) 0%, var(--v2-primary-hover) 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    /*
    background: var(--v3-header-bg);
    box-shadow: var(--v3-shadow);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;

     */
}

.v3-header-top {
    padding: var(--v2-offset-little) var(--v2-offset-max);
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.7rem;
    font-weight: 500;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /*
    padding: calc(4px * var(--v3-scale)) calc(10px * var(--v3-scale));
    background: rgba(0,0,0,0.1);
    font-size: var(--v3-font-1_1rem);
    color: var(--v3-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: calc(44px * 0.4 * var(--v3-scale));

     */
}

.v3-header-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--v2-offset-max);
    gap: var(--v2-offset-max);
    min-height: 60px;
    /*
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(8px * var(--v3-scale)) calc(10px * var(--v3-scale));
    gap: calc(10px * var(--v3-scale));
    min-height: calc(48px * var(--v3-scale));

     */
}

.v3-header-left,
.v3-header-right {
    display: flex;
    align-items: center;
    gap: calc(8px * var(--v3-scale));
    flex-shrink: 0;
    min-width: calc(32px * var(--v3-scale));
}

.v3-header-center {
    flex: 1;
    text-align: center;
    color: var(--v3-white);
    font-size: var(--v3-font-0_9rem);
    font-weight: 500;
    padding: 0 calc(8px * var(--v3-scale));
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ========== ОСНОВНАЯ ОБЛАСТЬ ========== */
.v3-main {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    height: 100%;
}

/* ========== ПАНЕЛИ СТРУКТУРЫ (ПЕРЕНОС ИЗ V2) ========== */

/* Левая панель */
.v3-left-panel {
    width: 25vw;
    min-width: 50px;
    max-width: 300px;
    background: var(--v3-primary-bg);
    border-right: 1px solid var(--v3-primary-base);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Центральная панель */
.v3-center-panel {
    width: 25vw;
    min-width: 200px;
    max-width: 400px;
    background: var(--v3-primary-bg);
    border-right: 1px solid var(--v3-primary-base);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
}

/* Правая панель */
.v3-right-panel {
    flex: 1;
    background: var(--v3-primary-bg);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Лог-панель */
.v3-log-panel {
    width: 15vw;
    min-width: 200px;
    background: var(--v3-primary-bg);
    border-left: 1px solid var(--v3-primary-base);
    display: none;
    flex-direction: column;
    flex-shrink: 0;
}

/* Управление видимостью центральной панели */
.v3-center-panel:not(.v3-visible) {
    display: none !important;
}

/* ========== СТРУКТУРА ПАНЕЛИ V3 ========== */
.v3-panel {
    display: flex;
    flex-direction: column;
    gap: var(--v3-offset-normal);
    height: 100%;
    background: var(--v3-primary-bg);
    overflow: hidden;
    min-height: 0;
    padding: var(--v3-offset-max);
}

.v3-panel-header {
    display: flex;
    align-items: center;
    gap: var(--v3-offset-normal);
    padding: var(--v3-offset-little) 0 var(--v3-offset-normal) 0;
    flex-shrink: 0;
    border-bottom: 1px solid var(--v3-primary-base);
    background: var(--v3-primary-bg);
    min-height: calc(36px * var(--v3-scale) + 8px * var(--v3-scale));
}

.v3-panel-header h2,
.v3-panel-header h3 {
    margin: 0;
    color: var(--v3-primary-base);
    font-size: clamp(var(--v3-font-0_9rem), 3vw, var(--v3-font-1_1rem));
}

.v3-panel-header img {
    width: var(--v3-icon-32px);
    height: var(--v3-icon-32px);
    flex-shrink: 0;
}

.v3-panel-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    background: var(--v3-primary-bg);
    font-size: var(--v3-font-0_9rem);
    scrollbar-width: thin;
    scrollbar-color: var(--v3-primary-secondary) var(--v3-primary-light);
    padding-right: calc(var(--v3-offset-normal) + 2px);
}

.v3-panel-body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.v3-panel-body::-webkit-scrollbar-track {
    background: var(--v3-primary-light);
    border-radius: 3px;
}

.v3-panel-body::-webkit-scrollbar-thumb {
    background: var(--v3-primary-secondary);
    border-radius: 3px;
}

.v3-panel-body::-webkit-scrollbar-thumb:hover {
    background: var(--v3-primary-base);
}

.v3-panel-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: var(--v3-offset-normal) 0 0 0;
    border-top: 1px solid var(--v3-primary-base);
    background: var(--v3-primary-bg);
    display: flex;
    flex-direction: column;
    gap: var(--v3-offset-max);
}

/* ========== КНОПКИ (ПОЛНОСТЬЮ КАК В V2) ========== */
.v3-btn {
    display: flex;
    align-items: center;
    gap: var(--v3-offset-normal);
    width: 100%;
    min-height: var(--v3-btn-min-height);
    padding: var(--v3-btn-padding);
    border-radius: var(--v3-radius);
    font-family: inherit;
    font-weight: 500;
    font-size: var(--v3-font-1_1rem);
    cursor: pointer;
    border: 1px solid var(--v3-primary-base);
    background: none;
    justify-content: flex-start;
    transition: all 0.2s ease;
    text-wrap: wrap;
    word-break: break-word;
    line-height: 1.2;
}

/* Кнопка с авто-шириной (как btn-auto-v2) */
.v3-btn.v3-width-auto {
    width: auto !important;
    min-width: 33%;
}

/* Кнопка без текста (квадратная) — центрируем иконку */
.v3-btn:not(:has(span)) {
    gap: 0;
    justify-content: center;
}

.v3-btn img {
    width: var(--v3-icon-28px);
    height: var(--v3-icon-28px);
    flex-shrink: 0;
}

.v3-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.v3-btn:disabled img {
    filter: invert(1) saturate(0) brightness(2);
    opacity: 0.6;
}

/* Цветовые варианты — ТОЧНО КАК В V2 */
.v3-btn-primary {
    background: var(--v3-primary-primary);
    border-color: var(--v3-primary-base);
    color: var(--v3-primary-base);
}

.v3-btn-primary:hover:not(:disabled) {
    background: var(--v3-primary-hover);
    border-color: var(--v3-primary-base);
    color: var(--v3-primary-base);
}

.v3-btn-secondary {
    background: var(--v3-primary-secondary);
    border-color: var(--v3-primary-base);
    color: var(--v3-primary-base);
}

.v3-btn-secondary:hover:not(:disabled) {
    background: var(--v3-primary-hover);
    border-color: var(--v3-primary-base);
    color: var(--v3-primary-base);
}

.v3-btn-success {
    background: var(--v3-success-secondary);
    border-color: var(--v3-success-base);
    color: var(--v3-success-base);
}

.v3-btn-success:hover:not(:disabled) {
    background: var(--v3-success-hover);
    border-color: var(--v3-success-base);
    color: var(--v3-success-base);
}

.v3-btn-error {
    background: var(--v3-error-secondary);
    border-color: var(--v3-error-base);
    color: var(--v3-error-base);
}

.v3-btn-error:hover:not(:disabled) {
    background: var(--v3-error-hover);
    border-color: var(--v3-error-base);
    color: var(--v3-error-base);
}

.v3-btn-info {
    background: var(--v3-info-secondary);
    border-color: var(--v3-info-base);
    color: var(--v3-info-base);
}

.v3-btn-info:hover:not(:disabled) {
    background: var(--v3-info-hover);
    border-color: var(--v3-info-base);
    color: var(--v3-info-base);
}

/* ========== КВАДРАТНЫЕ КНОПКИ ========== */
.v3-btn-square-32px {
    width: calc(32px * var(--v3-scale));
    height: calc(32px * var(--v3-scale));
    padding: calc(4px * var(--v3-scale));
    justify-content: center;
    align-items: center;
    border: 1px solid var(--v3-primary-base);
    border-radius: var(--v3-radius);
    cursor: pointer;
    background: none;
    transition: all 0.2s ease;
    display: inline-flex;
    flex-shrink: 0;
}

.v3-btn-square-32px img {
    max-width: calc(24px * var(--v3-scale));
    max-height: calc(24px * var(--v3-scale));
    width: auto;
    height: auto;
    flex-shrink: 0;
}

.v3-btn-square-40px {
    width: calc(40px * var(--v3-scale));
    height: calc(40px * var(--v3-scale));
    padding: calc(4px * var(--v3-scale));
    justify-content: center;
    align-items: center;
    border: 1px solid var(--v3-primary-base);
    border-radius: var(--v3-radius);
    cursor: pointer;
    background: none;
    transition: all 0.2s ease;
    display: inline-flex;
    flex-shrink: 0;
}

.v3-btn-square-40px img {
    max-width: calc(32px * var(--v3-scale));
    max-height: calc(32px * var(--v3-scale));
    width: auto;
    height: auto;
    flex-shrink: 0;
}

.v3-btn-square-52px {
    width: calc(52px * var(--v3-scale));
    height: calc(52px * var(--v3-scale));
    padding: calc(4px * var(--v3-scale));
    justify-content: center;
    align-items: center;
    border: 1px solid var(--v3-primary-base);
    border-radius: var(--v3-radius);
    cursor: pointer;
    background: none;
    transition: all 0.2s ease;
    display: inline-flex;
    flex-shrink: 0;
}

.v3-btn-square-52px img {
    max-width: calc(40px * var(--v3-scale));
    max-height: calc(40px * var(--v3-scale));
    width: auto;
    height: auto;
    flex-shrink: 0;
}

/* ========== КАРТОЧКИ ========== */
.v3-card {
    width: 100%;
    height: auto;
    padding: var(--v3-offset-normal);
    border: 1px solid var(--v3-primary-base);
    border-radius: var(--v3-radius);
    background: transparent;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: var(--v3-offset-normal);
}

.v3-card.v3-selected {
    background: color-mix(in srgb, var(--v3-primary-base) 15%, transparent);
    border-width: var(--v3-offset-mini);
}

.v3-card-success {
    background: var(--v3-success-bg);
    border-color: var(--v3-success-base);
    color: var(--v3-success-base);
}

.v3-card-info {
    background: var(--v3-info-bg);
    border-color: var(--v3-info-base);
    color: var(--v3-info-base);
}

.v3-card-primary {
    background: var(--v3-primary-light);
    border-color: var(--v3-primary-base);
    color: var(--v3-primary-base);
}

.v3-card-secondary {
    background: var(--v3-primary-bg);
    border-color: var(--v3-primary-base);
    color: var(--v3-primary-base);
}

.v3-card-error {
    background: var(--v3-error-bg);
    border-color: var(--v3-error-base);
    color: var(--v3-error-base);
}

.v3-card-title {
    font-size: var(--v3-font-1_1rem);
    font-weight: 600;
}

.v3-card-subtitle {
    font-size: var(--v3-font-0_9rem);
    color: var(--v3-text-secondary);
}

/* ========== ПАНЕЛИ ДЛЯ КАРТОЧЕК ========== */
.v3-panel-for-card {
    display: flex;
    flex-direction: column;
    gap: var(--v3-offset-little);
    border-radius: var(--v3-offset-max);
    overflow: hidden;
    height: auto;
    background: var(--v3-primary-light);
    border: 1px solid var(--v3-primary-base);
}

.v3-panel-for-card-primary {
    background: var(--v3-primary-light);
    border: 1px solid var(--v3-primary-base);
}

.v3-panel-for-card-success {
    background: var(--v3-success-light);
    border: 1px solid var(--v3-success-base);
}

.v3-panel-for-card-error {
    background: var(--v3-error-light);
    border: 1px solid var(--v3-error-base);
}

.v3-panel-for-card-info {
    background: var(--v3-info-light);
    border: 1px solid var(--v3-info-base);
}

/* ========== СЕКЦИИ ========== */
.v3-section {
    background: var(--v3-primary-bg);
    border-radius: var(--v3-radius);
    border: 1px solid var(--v3-primary-base);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.v3-section-header {
    display: flex;
    align-items: center;
    gap: var(--v3-offset-normal);
    padding: 0 var(--v3-offset-normal);
    height: calc(40px * var(--v3-scale));
    background: var(--v3-primary-light);
    border-bottom: 1px solid var(--v3-primary-base);
    flex-shrink: 0;
}

.v3-section-header h3,
.v3-section-header h4 {
    font-size: var(--v3-font-0_9rem);
    font-weight: 600;
    margin: 0;
}

.v3-section-content {
    padding: var(--v3-offset-normal);
    display: flex;
    flex-direction: column;
    gap: var(--v3-offset-normal);
    flex: 1;
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding-right: calc(var(--v3-offset-normal) + 2px);
}

/* PRIMARY секция */
.v3-section-primary {
    border-color: var(--v3-primary-base);
}

.v3-section-primary .v3-section-header {
    background: var(--v3-primary-light);
    border-bottom-color: var(--v3-primary-base);
    color: var(--v3-primary-base);
}

.v3-section-primary .v3-section-content {
    background: var(--v3-primary-bg);
}

/* SUCCESS секция */
.v3-section-success {
    border-color: var(--v3-success-base);
}

.v3-section-success .v3-section-header {
    background: var(--v3-success-light);
    border-bottom-color: var(--v3-success-base);
    color: var(--v3-success-base);
}

.v3-section-success .v3-section-content {
    background: var(--v3-success-bg);
}

/* INFO секция */
.v3-section-info {
    border-color: var(--v3-info-base);
}

.v3-section-info .v3-section-header {
    background: var(--v3-info-light);
    border-bottom-color: var(--v3-info-base);
    color: var(--v3-info-base);
}

.v3-section-info .v3-section-content {
    background: var(--v3-info-bg);
}

/* ========== ФОРМЫ ========== */
.v3-field-group {
    display: flex;
    flex-direction: column;
    gap: var(--v3-offset-mini);
}

.v3-field-label {
    font-size: var(--v3-font-0_8rem);
    font-weight: 500;
    color: var(--v3-text-secondary);
}

.v3-field-input {
    width: 100%;
    height: var(--v3-btn-min-height);
    padding: var(--v3-offset-normal) var(--v3-offset-max);
    border: 1px solid var(--v3-primary-base);
    border-radius: var(--v3-radius);
    background: var(--v3-primary-light);
    color: var(--v3-primary-base);
    font-size: var(--v3-font-0_9rem);
    font-family: inherit;
    transition: all 0.2s;
}

.v3-field-input:focus {
    outline: none;
    border-color: var(--v3-primary-base);
    box-shadow: 0 0 0 var(--v3-offset-mini) var(--v3-primary-light);
}

.v3-field-input:disabled {
    opacity: 0.5;
    background: var(--v3-primary-bg);
    cursor: not-allowed;
}

.v3-field-input.v3-error {
    border-color: var(--v3-error-base);
}

.v3-field-input:invalid {
    border-color: var(--v3-error-base);
}

.v3-field-input:user-valid {
    border-color: var(--v3-success-base);
}

select.v3-field-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b5b95' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--v3-offset-max) center;
}

.v3-field-checkbox {
    display: flex;
    align-items: center;
    gap: var(--v3-offset-normal);
}

.v3-field-checkbox input {
    width: calc(18px * var(--v3-scale));
    height: calc(18px * var(--v3-scale));
    margin: 0;
}

/* ========== КЛИКАБЕЛЬНЫЕ ПОЛЯ ========== */
.v3-field-clickable {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--v3-offset-max);
    padding: var(--v3-offset-max);
    background: var(--v3-primary-light);
    border: 1px solid var(--v3-primary-base);
    border-radius: var(--v3-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: var(--v3-btn-min-height);
}

.v3-field-clickable:hover:not(.v3-disabled) {
    border-color: var(--v3-primary-base);
    background: var(--v3-primary-hover);
}

.v3-field-clickable.v3-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--v3-primary-bg);
}

.v3-field-clickable .v3-value {
    flex: 1;
    font-size: var(--v3-font-0_9rem);
    color: var(--v3-primary-base);
    word-break: break-word;
}

.v3-field-clickable .v3-value.v3-placeholder {
    color: var(--v3-text-secondary);
    opacity: 0.6;
    font-style: italic;
}

.v3-field-clickable .v3-icon {
    flex-shrink: 0;
    width: var(--v3-icon-20px);
    height: var(--v3-icon-20px);
    color: var(--v3-text-secondary);
    font-size: var(--v3-font-0_8rem);
    transition: color 0.2s;
}

.v3-field-clickable:hover:not(.v3-disabled) .v3-icon {
    color: var(--v3-primary-base);
}

/* ========== ТАБЛИЦЫ ========== */
.v3-table-wrapper {
    overflow-x: auto;
    border-radius: var(--v3-radius);
    border: 1px solid var(--v3-primary-base);
}

.v3-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--v3-font-0_75rem);
    background: var(--v3-primary-light);
}

.v3-table th,
.v3-table td {
    border: 1px solid var(--v3-primary-base);
    padding: var(--v3-offset-normal) var(--v3-offset-max);
    vertical-align: middle;
}

.v3-table th {
    background: var(--v3-primary-bg);
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.v3-table.v3-sticky-header th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--v3-primary-bg);
    box-shadow: inset 0 1px 0 var(--v3-primary-base);
}

.v3-table .v3-text-right { text-align: right; }
.v3-table .v3-text-center { text-align: center; }

/* ИТОГОВЫЕ СТРОКИ ДЛЯ ОТЧЁТОВ */
.v3-table .v3-total-row-base td {
    background: var(--v3-primary-base);
    color: var(--v3-white);
    font-weight: bold;
}

.v3-table .v3-total-row-dark td {
    background: var(--v3-primary-dark);
    color: var(--v3-white);
    font-weight: bold;
}

.v3-table .v3-total-row-primary td {
    background: var(--v3-primary-primary);
    color: var(--v3-white);
    font-weight: bold;
}

.v3-table .v3-total-row-hover td {
    background: var(--v3-primary-hover);
    color: var(--v3-white);
    font-weight: bold;
}

.v3-table .v3-total-row-secondary td {
    background: var(--v3-primary-secondary);
    color: var(--v3-primary-base);
    font-weight: bold;
}

.v3-table .v3-total-row-light td {
    background: var(--v3-primary-light);
    color: var(--v3-primary-base);
    font-weight: bold;
}

.v3-table .v3-total-row-bg td {
    background: var(--v3-primary-bg);
    color: var(--v3-primary-base);
    font-weight: bold;
}

/* ========== ДИАЛОГИ ========== */
.v3-dialog {
    border: none;
    padding: 0;
    background: transparent;
    width: auto;
    max-width: 90%;
    margin: auto;
    position: fixed;
    inset: 0;
}

.v3-dialog .v3-dialog-content {
    background: var(--v3-primary-light);
    border-radius: var(--v3-radius);
    padding: var(--v3-offset-max);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    box-shadow: var(--v3-shadow);
    animation: v3-dialog-in 0.2s ease;
    font-size: var(--v3-font-0_9rem);
    overscroll-behavior: contain;
}

.v3-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: v3-backdrop-in 0.2s ease;
}

.v3-dialog .v3-dialog-content h3 {
    margin: 0 0 var(--v3-offset-max) 0;
    font-size: var(--v3-font-0_85rem);
    font-weight: 600;
    color: var(--v3-primary-base);
    text-align: left;
}

.v3-dialog .v3-dialog-content input,
.v3-dialog .v3-dialog-content select {
    width: 100%;
    margin-bottom: var(--v3-offset-max);
}

.v3-dialog .v3-dialog-footer {
    display: flex;
    justify-content: center;
    gap: var(--v3-offset-normal);
    margin-top: var(--v3-offset-max);
}

.v3-dialog .v3-dialog-footer .v3-btn {
    width: auto;
    min-width: 100px;
    flex: 1;
    justify-content: center;
    font-size: var(--v3-font-0_9rem);
}

@keyframes v3-dialog-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes v3-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== TOAST-УВЕДОМЛЕНИЯ ========== */
.v3-toast-area {
    position: fixed;
    top: var(--v3-offset-max);
    left: 50%;
    transform: translateX(-50%);
    z-index: 30000;
    display: flex;
    flex-direction: column;
    gap: var(--v3-offset-normal);
    pointer-events: none;
    width: max-content;
    max-width: 90vw;
}

.v3-toast {
    display: flex;
    align-items: center;
    gap: var(--v3-offset-normal);
    padding: var(--v3-offset-max) var(--v3-offset-max);
    border-radius: var(--v3-radius);
    border: 1px solid var(--v3-primary-base);
    font-size: var(--v3-font-0_9rem);
    font-weight: 500;
    min-width: 380px;
    max-width: 560px;
    box-shadow: var(--v3-shadow);
    pointer-events: auto;
    animation: v3-toast-in 0.3s ease forwards;
}

.v3-toast.v3-removing {
    animation: v3-toast-out 0.3s ease forwards;
}

.v3-toast-success {
    background: var(--v3-success-bg);
    border-color: var(--v3-success-base);
    color: var(--v3-success-base);
}

.v3-toast-error {
    background: var(--v3-error-bg);
    border-color: var(--v3-error-base);
    color: var(--v3-error-base);
}

.v3-toast-info {
    background: var(--v3-primary-light);
    border-color: var(--v3-primary-base);
    color: var(--v3-primary-base);
}

@keyframes v3-toast-in {
    from { opacity: 0; transform: translateY(-100%); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes v3-toast-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-100%); }
}

/* ========== ЛОАДЕР ========== */
.v3-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(var(--v3-offset-normal));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.v3-loader-content {
    background: var(--v3-primary-light);
    border-radius: var(--v3-radius);
    padding: var(--v3-offset-max);
    text-align: center;
    animation: v3-fade-in 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: var(--v3-offset-max);
    align-items: center;
}

.v3-loader-spinner {
    width: var(--v3-icon-48px);
    height: var(--v3-icon-48px);
    border: var(--v3-offset-little) solid var(--v3-primary-base);
    border-top-color: var(--v3-primary-base);
    border-radius: 50%;
    animation: v3-spin 1s linear infinite;
}

@keyframes v3-spin {
    to { transform: rotate(360deg); }
}

@keyframes v3-fade-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* ========== ПУСТЫЕ СОСТОЯНИЯ ========== */
.v3-empty {
    text-align: center;
    padding: var(--v3-offset-max);
    color: var(--v3-text-secondary);
    font-size: var(--v3-font-0_9rem);
}

/* ========== БЭЙДЖИ ========== */
.v3-badge {
    padding: var(--v3-offset-little) var(--v3-offset-max);
    border-radius: var(--v3-offset-little);
    font-size: var(--v3-font-0_8rem);
    white-space: nowrap;
}

.v3-badge-primary {
    background: var(--v3-primary-base);
    color: var(--v3-white);
}

.v3-badge-success {
    background: var(--v3-success-base);
    color: var(--v3-white);
}

.v3-badge-info {
    background: var(--v3-info-base);
    color: var(--v3-white);
}

.v3-badge-error {
    background: var(--v3-error-base);
    color: var(--v3-white);
}

/* ========== FLEX ========== */
.v3-flex-row {
    display: flex;
    flex-direction: row;
    gap: var(--v3-offset-max);
}

.v3-flex-col {
    display: flex;
    flex-direction: column;
    gap: var(--v3-offset-max);
}

.v3-flex-wrap {
    flex-wrap: wrap;
}

.v3-flex-fill {
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.v3-flex-center {
    align-items: center;
    justify-content: center;
}

.v3-flex-align-center {
    align-items: center;
}

.v3-flex-justify-center {
    justify-content: center;
}

.v3-flex-justify-between {
    justify-content: space-between;
}

.v3-push-right {
    margin-left: auto;
}

/* ========== GRID ========== */
.v3-grid {
    display: grid;
    gap: var(--v3-offset-max);
}

.v3-grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.v3-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.v3-grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.v3-grid-auto-fill { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.v3-grid-auto-fit { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.v3-grid-fill { height: 100%; min-height: 0; align-items: stretch; }

/* ========== ИКОНКИ ========== */
.v3-icon-16px { width: var(--v3-icon-16px); height: var(--v3-icon-16px); flex-shrink: 0; }
.v3-icon-18px { width: var(--v3-icon-18px); height: var(--v3-icon-18px); flex-shrink: 0; }
.v3-icon-20px { width: var(--v3-icon-20px); height: var(--v3-icon-20px); flex-shrink: 0; }
.v3-icon-24px { width: var(--v3-icon-24px); height: var(--v3-icon-24px); flex-shrink: 0; }
.v3-icon-28px { width: var(--v3-icon-28px); height: var(--v3-icon-28px); flex-shrink: 0; }
.v3-icon-32px { width: var(--v3-icon-32px); height: var(--v3-icon-32px); flex-shrink: 0; }
.v3-icon-40px { width: var(--v3-icon-40px); height: var(--v3-icon-40px); flex-shrink: 0; }
.v3-icon-48px { width: var(--v3-icon-48px); height: var(--v3-icon-48px); flex-shrink: 0; }
.v3-icon-64px { width: var(--v3-icon-64px); height: var(--v3-icon-64px); flex-shrink: 0; }

/* ========== УТИЛИТЫ ========== */
.v3-text-right { text-align: right; }
.v3-text-center { text-align: center; }
.v3-text-bold { font-weight: bold; }
.v3-text-small { font-size: var(--v3-font-0_9rem); }
.v3-text-muted { color: var(--v3-text-muted); }

.v3-text-status-verified {
    color: var(--v3-success-base);
    font-weight: bold;
}

.v3-text-status-unverified {
    color: var(--v3-error-base);
    font-weight: bold;
}

.v3-gap-6 { gap: calc(6px * var(--v3-scale)); }
.v3-gap-8 { gap: var(--v3-offset-normal); }
.v3-gap-20 { gap: calc(20px * var(--v3-scale)); }
.v3-margin-0 { margin: 0; }
.v3-margin-top-4 { margin-top: var(--v3-offset-little); }

.v3-place-center { display: grid; place-items: center; }
.v3-place-content-center { display: grid; place-content: center; }
.v3-text-wrap { overflow-wrap: anywhere; }
.v3-text-fluid {
    font-size: clamp(var(--v3-font-0_9rem), 4vw, var(--v3-font-1_1rem));
    line-height: 1.3;
}

/* ========== SCROLLBAR ========== */
.v3-scrollbar-thin { scrollbar-width: thin; }
.v3-scrollbar-gutter-stable { scrollbar-gutter: stable; }

/* ========== ПРОЗРАЧНОСТЬ ========== */
.v3-opacity-1 { opacity: 1; }
.v3-opacity-2 { opacity: 0.7; }
.v3-opacity-3 { opacity: 0.5; }

/* ========== HOVER-ЭФФЕКТЫ (ТОЛЬКО ДЛЯ УСТРОЙСТВ С КУРСОРОМ) ========== */
@media (hover: hover) {
    .v3-btn:hover:not(:disabled) {
        transform: translateY(-1px);
    }

    .v3-card:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .v3-field-clickable:hover:not(.v3-disabled) {
        transform: translateX(var(--v3-offset-mini));
    }
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 1024px) {
    .v3-left-panel,
    .v3-center-panel {
        width: 25vw;
    }

    .v3-log-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    .v3-left-panel,
    .v3-center-panel {
        width: 25vw;
    }
}

/* ========== ЗАПРЕТ ВЫДЕЛЕНИЯ ИКОНОК ========== */
.v3-btn img,
.v3-btn:disabled img {
    user-select: none;
    pointer-events: none;
    -webkit-user-drag: none;
    -webkit-tap-highlight-color: transparent;
}

/* ========== ASPECT-RATIO ДЛЯ КАРТОЧЕК ========== */
.v3-card-icon {
    aspect-ratio: 1 / 1;
    object-fit: contain;
}