:root {
    --bg: #f3f5f8;
    --panel: #ffffff;
    --primary: #1f4bd8;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #0f172a;
    color: #e2e8f0;
    padding: 24px 16px;
}

.sidebar h2 {
    margin: 0 0 24px;
    font-size: 20px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
}

.sidebar a.active,
.sidebar a:hover {
    background: #1e3a8a;
    color: #fff;
}

.language-switcher {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #334155;
}

.language-switcher-label {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 6px;
}

.language-switcher-select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 14px;
}

.login-card .language-switcher {
    margin-top: 0;
    margin-bottom: 16px;
    padding-top: 0;
    border-top: none;
}

.login-card .language-switcher-select {
    background: #fff;
    color: #0f172a;
    border-color: #cbd5e1;
}

.content {
    padding: 24px;
}

.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.note.success {
    background: #ecfdf5;
    border-color: #86efac;
    color: #166534;
}

.note.warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.page-head h1 {
    margin: 0;
}

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.row-actions {
    justify-content: flex-end;
}

.toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    min-width: 220px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #1e3a8a;
    background: #1e3a8a;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.btn.secondary {
    background: #0f172a;
    border-color: #0f172a;
}

.btn.ghost {
    background: transparent;
    color: #1e3a8a;
}

.btn.tiny {
    padding: 6px 10px;
    font-size: 12px;
}

.right {
    text-align: right;
}

.muted {
    color: var(--muted);
}

.pill {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
}

.pill.ok {
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

.pill.bad {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.pill.muted {
    background: #f3f4f6;
    color: #374151;
}

.form {
    max-width: 720px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.form-row.inline {
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.hint {
    font-size: 12px;
    color: var(--muted);
}

.alert {
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #9f1239;
    border-radius: 8px;
    padding: 10px 12px;
    margin: 12px 0;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

.sep {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 14px 0;
}

.kv {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 12px;
}

.text {
    white-space: pre-wrap;
    margin: 0;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 10px;
    font-family: inherit;
}

.note {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 12px;
    border-radius: 10px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.card,
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}

.card h3,
.panel h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--muted);
    font-weight: 600;
}

.card p {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}

.cards.compact {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    margin-bottom: 12px;
}

.cards.compact .card h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

.cards.compact .card p {
    font-size: 22px;
}

.time-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-row .input {
    width: 72px;
}

tr.row-active {
    background: #eff6ff;
}

.note.warning {
    background: #fffbeb;
    border-color: #fcd34d;
}

.grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.mentions {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mentions li {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    line-height: 1.4;
}

.badge {
    margin-left: 8px;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
}

.badge.positive {
    background: #d1fae5;
    color: #065f46;
}

.badge.neutral {
    background: #e5e7eb;
    color: #374151;
}

.badge.negative {
    background: #fee2e2;
    color: #991b1b;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.insight-panel h3 {
    margin-bottom: 12px;
}

.insight-card {
    padding: 16px 18px;
    line-height: 1.55;
}

.insight-prose {
    color: var(--text);
}

.insight-lead {
    margin: 0 0 14px;
    font-size: 15px;
}

.insight-section {
    margin: 14px 0;
}

.insight-section-title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.insight-prose p {
    margin: 0 0 10px;
}

.insight-list {
    margin: 0;
    padding-left: 20px;
}

.insight-list li {
    margin-bottom: 8px;
}

.insight-list li::marker {
    color: var(--primary);
}

.insight-prose--recommendations .insight-section {
    padding: 12px 14px;
    margin-bottom: 10px;
    border-left: 3px solid #16a34a;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 0 8px 8px 0;
}

.insight-prose--recommendations .insight-section-title {
    color: #166534;
}

.account-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
    max-height: 280px;
    overflow: auto;
    padding: 8px 0;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 14px;
    cursor: pointer;
}

.check-row input {
    margin: 0;
}

.generate-report-form .input {
    min-width: 140px;
}

/* Страница входа */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(ellipse 80% 60% at 10% 20%, rgba(31, 75, 216, 0.08), transparent 50%),
        radial-gradient(ellipse 60% 50% at 90% 80%, rgba(15, 23, 42, 0.06), transparent 45%),
        var(--bg);
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(320px, 400px);
    max-width: 920px;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow:
        0 4px 6px -1px rgba(15, 23, 42, 0.06),
        0 20px 40px -12px rgba(15, 23, 42, 0.15);
    border: 1px solid var(--border);
}

.login-brand {
    background: linear-gradient(165deg, #0f172a 0%, #1e3a8a 55%, #1f4bd8 100%);
    color: #e2e8f0;
    padding: 40px 36px;
    display: flex;
    align-items: center;
}

.login-brand-inner {
    width: 100%;
}

.login-badge {
    display: inline-block;
    margin: 0 0 20px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-brand-title {
    margin: 0 0 14px;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
}

.login-brand-text {
    margin: 0 0 24px;
    font-size: 15px;
    line-height: 1.55;
    color: #cbd5e1;
    opacity: 0.95;
}

.login-features {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-features li {
    position: relative;
    padding-left: 22px;
    font-size: 14px;
    color: #e2e8f0;
    line-height: 1.4;
}

.login-features li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.45em;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #86efac;
    box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.25);
}

.login-main {
    background: var(--panel);
    padding: 40px 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 340px;
    border: none;
    box-shadow: none;
    padding: 0;
    background: transparent;
}

.login-card-head {
    margin-bottom: 24px;
}

.login-card-head h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.login-card-head .muted {
    margin: 0;
    font-size: 14px;
}

.login-alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.login-input {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    font-size: 15px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 75, 216, 0.15);
}

.login-submit {
    width: 100%;
    padding: 12px 16px;
    margin-top: 4px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    background: linear-gradient(180deg, #2563eb 0%, #1e3a8a 100%);
    border-color: #1e3a8a;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.login-submit:hover {
    box-shadow: 0 4px 14px rgba(30, 58, 138, 0.35);
}

.login-submit:active {
    transform: translateY(1px);
}

.login-foot {
    margin: 20px 0 0;
    font-size: 13px;
    text-align: center;
    line-height: 1.45;
}

@media (max-width: 768px) {
    .login-shell {
        grid-template-columns: 1fr;
        max-width: 420px;
    }

    .login-brand {
        padding: 32px 28px;
    }

    .login-brand-title {
        font-size: 22px;
    }

    .login-features {
        display: none;
    }

    .login-main {
        padding: 32px 28px 36px;
    }
}

@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .cards {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .kv {
        grid-template-columns: 1fr;
    }
}
