/* Основные переменные и настройки */
:root {
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --accent: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #e2e8f0;
    --shadow-1: 0 6px 18px rgba(0,0,0,0.08);
    --shadow-2: 0 2px 8px rgba(0,0,0,0.06);
    font-family: "Segoe UI", Roboto, Inter, sans-serif;
}

/* Базовые стили */
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Roboto, Inter, sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 14px;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}

/* Контейнеры и компоновка */
.category-container {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-2);
}

.category-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 8px;
}

.troop-families-container {
    display: block;
}

.troop-family-container {
    background: var(--bg);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.troop-item {
    vertical-align: middle;
}

.troop-family-name {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

/* Flex системы */
.flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.flex-row-container {
    flex-direction: row;
    flex-grow: 1;
}

.flex-column-container {
    flex-direction: column;
    flex-grow: 1;
}

.flex-element {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin: 0;
    min-width: 200px;
    box-shadow: var(--shadow-2);
}

/* Формы и инпуты */
input[type="number"],
input[type="text"] {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text);
    font-size: 14px;
    transition: all 0.2s ease;
}

input[type="number"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input[type="number"] {
    width: 100px;
}

.text-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: #fefce8;
    border-radius: 6px;
}

.text-input:read-only {
    background: #f8fafc;
    color: var(--muted);
    font-weight: 500;
}

/* Кнопки */
.btn {
    background: linear-gradient(270deg, #2563eb, #1e40af, #3b82f6);
    background-size: 400% 400%;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: var(--shadow-1);
    transition: all 0.2s ease;
    animation: gradientShift 6s ease infinite;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-1), 0 4px 12px rgba(37, 99, 235, 0.2);
}

.button-stack {
    padding: 12px 28px;
    margin-bottom: 12px;
    min-width: 200px;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Ссылки */
a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:visited {
    color: var(--accent);
}

a:hover {
    text-decoration: underline;
    color: #1e40af;
}

/* Текстовые элементы */
.text-label {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    display: block;
}

.text-description {
    font-style: normal;
    font-size: 13px;
    color: var(--muted);
    max-width: 800px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.separator {
    font-size: 1.25rem;
    font-weight: 600;
    padding-bottom: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    color: var(--text);
}

/* Счетчики и бейджи */
.troop-count {
    display: inline-block;
    background: var(--success);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    padding: 4px 12px;
    min-width: 50px;
    text-align: center;
    font-weight: 500;
}

.troop-count-warning {
    background: var(--warning);
    color: var(--text);
}

/* Состояния предупреждений */
.alerted {
    color: var(--danger);
}

.alerted-input {
    border: 2px solid var(--danger);
    background-color: #fef2f2 !important;
}

/* Секции отчетов */
.report-section {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-2);
}

.report-squad {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

.report-squad-basic {
    font-size: 13px;
    align-items: stretch;
}

.report-squad-details {
    font-size: 12px;
    font-style: italic;
    color: var(--muted);
}

.report-squad-details>div {
    padding-right: 8px;
}

.report-squad-name {
    flex: 1;
    height: 1.5em;
    font-weight: 600;
    border-bottom: 1px dotted var(--border);
}

.report-squad-count {
    flex: .25;
    height: 1.5em;
    border-bottom: 1px dotted var(--border);
    text-align: right;
}

/* Теги и бейджи */
.tag {
    background: #e2e8f0;
    color: var(--text);
    border-radius: 6px;
    font-size: 11px;
    padding: 2px 8px;
    font-family: 'Courier New', Courier, monospace;
    text-align: center;
    font-weight: 500;
}

.bonus-tag {
    background: var(--success);
    color: white;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11px;
}

/* Рейтинги и показатели */
.rating-display {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 16px;
    margin-right: 16px;
    min-width: 120px;
    box-shadow: var(--shadow-2);
}

.rating-title {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
}

.rating-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Визуальные тиры */
.visual-tier-9 { background: #059669; color: white; }
.visual-tier-8 { background: #e2e8f0; color: var(--text); }
.visual-tier-7 { background: #f59e0b; color: white; }
.visual-tier-6 { background: #dc2626; color: white; }
.visual-tier-5 { background: #ea580c; color: white; }
.visual-tier-4 { background: #7c3aed; color: white; }
.visual-tier-3 { background: #2563eb; color: white; }
.visual-tier-2 { background: #059669; color: white; }
.visual-tier-1 { background: #6b7280; color: white; }

/* Суммаризации */
.summary {
    background: #fefce8;
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
    border: 1px solid #fbbf24;
}

.summary-lite {
    font-size: 13px;
    background: var(--bg);
    border-radius: 8px;
    padding: 16px;
}

.summary-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 12px;
}

.summary-body {
    margin-bottom: 16px;
}

/* Импорт/экспорт */
.import-export-box {
    width: 100%;
    min-height: 200px;
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    resize: vertical;
}

.import-export-box:read-only {
    background: #f8fafc;
    color: var(--muted);
}

/* Адаптивность */
@media screen and (max-width: 768px) {
    body {
        padding: 12px;
        font-size: 16px;
    }

    .category-container {
        padding: 16px;
        margin-bottom: 16px;
    }

    .flex-element {
        min-width: 100%;
    }

    .rating-display {
        max-width: 100%;
        margin-right: 0;
    }

    .btn {
        min-width: 100%;
    }

    .button-stack {
        min-width: 100%;
    }
}

@media screen and (max-width: 480px) {
    body {
        font-size: 14px;
        padding: 8px;
    }

    .category-name {
        font-size: 1.1rem;
    }

    .summary, .summary-lite {
        font-size: 12px;
        padding: 12px;
    }

    .import-export-content {
        height: calc(100vh - 10%);
    }
}

/* Утилитарные классы */
.block {
    display: block;
    width: 100%;
}

.lad-amount {
    font-size: 12px;
    text-align: right;
    color: var(--muted);
}

.section {
    margin-bottom: 24px;
}

.summary-accordion-header {
    background: var(--accent) !important;
    color: white !important;
}