/* ─── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: #f7f8fa;
    color: #1f2328;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

.muted { color: #5c6670; }

/* ─── Header ────────────────────────────────────────────────── */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e4e7eb;
    padding: 14px 0;
}
.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}
.brand {
    font-size: 18px;
    font-weight: 600;
    color: #1f2328;
    text-decoration: none;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}
nav a {
    color: #5c6670;
    text-decoration: none;
    margin-left: 20px;
    font-size: 14px;
}
nav a:hover { color: #1f2328; }

.user-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}
.user-name { color: #1f2328; font-weight: 500; }
.logout-form { display: inline; margin: 0; }
.btn-link {
    background: none;
    border: none;
    color: #5c6670;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.btn-link:hover { color: #d73a49; }

/* ─── Main ──────────────────────────────────────────────────── */
main { flex: 1; padding: 32px 0 48px; }

.hero h1 {
    font-size: 32px;
    margin: 0 0 8px;
    font-weight: 700;
}
.lead {
    font-size: 17px;
    color: #5c6670;
    margin: 0 0 32px;
}

.status-card {
    background: #fff;
    border: 1px solid #e4e7eb;
    border-left: 4px solid #4CAF50;
    border-radius: 8px;
    padding: 20px 24px;
    max-width: 560px;
}
.status-card h3 { margin: 0 0 12px; font-size: 16px; }
.status-card ul { margin: 0 0 12px; padding-left: 20px; }
.status-card li { margin-bottom: 6px; font-size: 14px; }
.status-card .hint {
    font-size: 13px;
    color: #5c6670;
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid #eef0f2;
}

code {
    background: #f1f3f5;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.92em;
    font-family: "SF Mono", Menlo, Consolas, monospace;
}

/* ─── Auth / login ──────────────────────────────────────────── */
body.login-page { background: #eef1f5; }
body.login-page main { display: flex; align-items: center; justify-content: center; }

.auth-card {
    background: #fff;
    border: 1px solid #e4e7eb;
    border-radius: 10px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-card .muted { margin: 0 0 20px; font-size: 14px; }

.auth-card form { display: flex; flex-direction: column; gap: 16px; }

.auth-card label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #3e4651;
    font-weight: 500;
}
.auth-card input[type="email"],
.auth-card input[type="password"] {
    font: inherit;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 15px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-card input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-weight: 500;
    font-size: 14px;
    line-height: 1;
    padding: 0 18px;
    height: 40px;
    box-sizing: border-box;
    border: 1px solid #4b5563;
    border-radius: 8px;
    background: #4b5563;
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #374151; border-color: #374151; }
.btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-success {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}
.btn-success:hover { background: #059669; border-color: #059669; }

/* Pencil-icon link used in table action columns instead of text "Изменить". */
.icon-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    color: #2563eb;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s;
}
.icon-edit:hover { background: #eff6ff; }
.icon-edit svg { width: 16px; height: 16px; }
.col-edit { width: 50px; text-align: center; }
.status-line { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}
.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}
.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}
.alert-warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}

/* ─── Solid action buttons (header / inline) ─────────────────
   Используются в шапках страниц рядом с заголовком (как «+ Добавить»,
   «🗑 Удалить выбранные»). Цвет состояния:
     обычное   — насыщенный
     hover     — темнее
     disabled  — бледный, курсор not-allowed                       */
.btn-success-solid,
.btn-primary-solid,
.btn-danger-solid {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 16px; height: 40px;
    border: 0; border-radius: 8px; cursor: pointer;
    font-size: 14px; font-weight: 500;
    color: #fff; text-decoration: none;
    transition: background 0.15s;
}
.btn-success-solid { background: #10b981; }
.btn-success-solid:hover  { background: #059669; }
.btn-success-solid:disabled { background: #a7f3d0; cursor: not-allowed; }

.btn-primary-solid { background: #2563eb; }
.btn-primary-solid:hover  { background: #1d4ed8; }
.btn-primary-solid:disabled { background: #bfdbfe; cursor: not-allowed; }

.btn-danger-solid { background: #ef4444; }
.btn-danger-solid:hover  { background: #dc2626; }
.btn-danger-solid:disabled { background: #fca5a5; cursor: not-allowed; }

/* ─── Footer ────────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid #e4e7eb;
    padding: 16px 0;
    background: #fff;
}
.site-footer small { color: #8b95a3; font-size: 12px; }

/* ─── Applied filters chip panel ─────────────────────────────
   Универсальный блок «активные фильтры» под формой фильтров.
   Используется на /budget, /payments, /items, /bank/transactions,
   /dict/contractors. Скрывается из шаблона, если фильтров нет. */
.applied-filters {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    margin: 0 0 12px;
    padding: 8px 12px;
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px;
    font-size: 13px;
}
.applied-filters .af-label {
    color: #1e40af; font-weight: 600; margin-right: 4px;
}
.applied-filters .af-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px;
    background: #fff; border: 1px solid #bfdbfe; border-radius: 999px;
    color: #1e40af;
}
.applied-filters .af-chip-key { color: #64748b; font-size: 11px; }
.applied-filters .af-reset {
    margin-left: auto;
    color: #dc2626; text-decoration: none; font-size: 12px;
    white-space: nowrap;
}
.applied-filters .af-reset:hover { text-decoration: underline; }
