/* ═══ IZI Кабинет 2.0 — дизайн-система ═══
   Чистый, спокойный интерфейс: тёмный сайдбар, светлый контент,
   индиго-акцент, мягкие тени, плавные модалки и тосты. */

:root {
    --bg: #f3f5f9;
    --panel: #ffffff;
    --border: #e6e9ef;
    --border-soft: #f0f2f6;
    --text: #16202e;
    --text-2: #3c4657;
    --muted: #7c8698;
    --faint: #aab2c0;
    --accent: #3b64f4;
    --accent-2: #2749d1;
    --accent-soft: #eaefff;
    --ok: #10b981;   --ok-soft: #e4f8ef;   --ok-deep: #0a7d54;
    --warn: #f59e0b; --warn-soft: #fdf1dc; --warn-deep: #a16207;
    --err: #ef4444;  --err-soft: #feeaea;  --err-deep: #b91c1c;
    --sidebar: #0e1526;
    --r: 12px;
    --r-lg: 16px;
    --shadow-1: 0 1px 2px rgba(18, 30, 55, .05), 0 2px 8px rgba(18, 30, 55, .04);
    --shadow-2: 0 8px 28px rgba(18, 30, 55, .12);
    --shadow-3: 0 24px 70px rgba(12, 22, 44, .28);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: "Segoe UI Variable Text", "Segoe UI", -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px; color: var(--text); background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
::selection { background: #cddafe; }

/* ─── Скроллбары ─── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #ccd3de; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: #b3bccb; }
::-webkit-scrollbar-track { background: transparent; }

/* ═══ Логин ═══ */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(900px 500px at 15% -10%, #24356b 0%, transparent 60%),
                radial-gradient(800px 500px at 110% 110%, #1b2a55 0%, transparent 55%),
                var(--sidebar);
    padding: 24px;
}
.login-card {
    width: 400px; background: var(--panel); border-radius: 20px;
    padding: 40px 38px 34px; box-shadow: var(--shadow-3);
    display: flex; flex-direction: column; gap: 16px;
    animation: rise .35s cubic-bezier(.22,.9,.35,1.2);
}
.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 4px; }
.brand-mark {
    width: 46px; height: 46px; border-radius: 13px; flex: 0 0 46px;
    background: linear-gradient(135deg, var(--accent), #6e8cfb);
    color: #fff; font-weight: 800; font-size: 15px; letter-spacing: -.5px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(59, 100, 244, .35);
}
.login-brand-name { font-size: 20px; font-weight: 800; letter-spacing: -.4px; }
.login-brand-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-2); font-weight: 650; }
.login-card input { height: 44px; font-size: 14px; }
.login-error {
    display: flex; align-items: center; gap: 8px; color: var(--err-deep);
    background: var(--err-soft); border-radius: 10px; padding: 10px 13px; font-size: 13px;
}
.login-btn { height: 46px; font-size: 14.5px; border-radius: 11px; margin-top: 4px; }
.login-foot { text-align: center; font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* ═══ Каркас ═══ */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 232px; flex: 0 0 232px; background: var(--sidebar); color: #b9c2d4;
    display: flex; flex-direction: column; padding: 20px 14px 16px;
    position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 20px; }
.sidebar .brand-mark { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; font-size: 12.5px; }
.brand-name { color: #fff; font-weight: 800; font-size: 16.5px; letter-spacing: -.3px; line-height: 1.15; }
.brand-sub { font-size: 10.5px; color: #6e7b93; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.nav-section { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #566179; padding: 14px 10px 6px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 11px;
    color: #b9c2d4; text-decoration: none; padding: 10px 12px; border-radius: 10px;
    font-weight: 550; font-size: 13.5px; transition: background .13s, color .13s;
}
.sidebar nav a svg { opacity: .8; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar nav a.active {
    background: linear-gradient(135deg, var(--accent), #5379f6); color: #fff;
    box-shadow: 0 4px 14px rgba(59, 100, 244, .35);
}
.sidebar nav a.active svg { opacity: 1; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.user-ava {
    width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
    background: linear-gradient(135deg, #46527a, #2c3654); color: #dbe3f5;
    font-size: 12.5px; font-weight: 750; display: flex; align-items: center; justify-content: center;
}
.user-meta { min-width: 0; flex: 1; }
.user-name { font-size: 13px; font-weight: 650; color: #e8ecf5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: #7d8aa3; }
.logout-btn {
    border: none; background: none; color: #7d8aa3; cursor: pointer; padding: 7px;
    border-radius: 8px; display: flex; transition: all .13s;
}
.logout-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

.content { flex: 1; padding: 28px 36px 48px; max-width: 1560px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -.4px; margin-right: auto; }
.page-title .title-sub { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: 3px; }

/* ═══ Кнопки ═══ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid var(--border); background: var(--panel); color: var(--text-2);
    padding: 9px 16px; border-radius: 10px; font-size: 13px; font-weight: 650; font-family: inherit;
    cursor: pointer; transition: all .14s; white-space: nowrap;
}
.btn:hover { border-color: #cfd6e1; background: #fafbfd; }
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: linear-gradient(135deg, var(--accent), #5177f5); border-color: transparent; color: #fff;
    box-shadow: 0 3px 10px rgba(59, 100, 244, .3);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: 0 5px 16px rgba(59, 100, 244, .4); }
.btn-danger { color: var(--err-deep); }
.btn-danger:hover { border-color: #f3c2c2; background: #fef7f7; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-block { width: 100%; }
.icon-btn { padding: 8px; border-radius: 9px; }

/* ═══ Поля ═══ */
input, select, textarea {
    border: 1.5px solid var(--border); border-radius: 10px; padding: 9px 12px;
    font-size: 13.5px; font-family: inherit; color: var(--text); background: #fff; outline: none;
    transition: border-color .14s, box-shadow .14s;
}
input:hover, select:hover, textarea:hover { border-color: #d3d9e3; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px rgba(59, 100, 244, .13); }
input:disabled { background: #f7f8fa; color: var(--muted); }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-wrap input { padding-left: 38px; width: 280px; }

/* ═══ Панели и таблицы ═══ */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th {
    text-align: left; padding: 11px 16px; background: #f9fafc; color: var(--muted);
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.grid td { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tr.click { cursor: pointer; transition: background .1s; }
table.grid tr.click:hover td { background: #f6f9ff; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.cell-main { font-weight: 650; }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.row-ava {
    width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 750; color: #fff;
}
.name-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }

/* ═══ Статусы ═══ */
.pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
    border-radius: 20px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.draft     { background: #eef0f4; color: #6b7686; }
.pill.filled    { background: var(--accent-soft); color: var(--accent-2); }
.pill.sent_1c   { background: var(--warn-soft); color: var(--warn-deep); }
.pill.submitted { background: var(--ok-soft); color: var(--ok-deep); }
.pill.accepted  { background: linear-gradient(135deg, #10b981, #0d9e6e); color: #fff; }
.pill.archived  { background: #eef0f4; color: var(--faint); }

/* Степпер статусов квартала */
.stepper { display: flex; align-items: center; gap: 0; }
.step { display: flex; align-items: center; }
.step-dot {
    width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: #edeff4; color: var(--faint); border: 2px solid transparent;
}
.step-dot svg { width: 12px; height: 12px; }
.step.done .step-dot { background: var(--ok-soft); color: var(--ok-deep); }
.step.cur .step-dot { background: #fff; border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px rgba(59,100,244,.14); }
.step-line { width: 26px; height: 2px; background: #e4e7ee; }
.step.done + .step .step-line, .step-line.done { background: #9fdcc3; }

/* ═══ Карточки ═══ */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-1); }
.card-title { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 750; margin-bottom: 14px; }
.card-title svg { color: var(--accent); }
.client-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
@media (max-width: 1150px) { .client-grid { grid-template-columns: 1fr; } }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; font-weight: 600; overflow-wrap: anywhere; }

.profile-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.profile-ava {
    width: 52px; height: 52px; border-radius: 15px; flex: 0 0 52px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 800; color: #fff;
}
.profile-name { font-size: 16px; font-weight: 750; line-height: 1.25; }
.profile-inn { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ═══ Кварталы ═══ */
.q-block { margin-bottom: 18px; }
.q-head {
    display: flex; align-items: center; gap: 14px; padding: 14px 18px;
    background: #f9fafc; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.q-title { font-weight: 750; font-size: 14.5px; }
.q-tax { font-size: 13px; color: var(--muted); }
.q-tax b { color: var(--text); font-size: 14px; }
.q-head .spacer { margin-left: auto; }
.q-actions { display: flex; gap: 8px; flex-wrap: wrap; }
table.rev td input { width: 136px; text-align: right; padding: 7px 10px; }
tr.total-row td { background: #f9fafc; font-weight: 700; border-top: 1px solid var(--border); }

/* ═══ KPI ═══ */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
    background: var(--panel); border: 1.5px solid var(--border); border-radius: var(--r-lg);
    padding: 14px 16px; cursor: pointer; transition: all .14s; display: flex; align-items: center; gap: 12px;
    box-shadow: var(--shadow-1);
}
.kpi:hover { border-color: #c6d2f5; transform: translateY(-1px); }
.kpi.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 100, 244, .12); }
.kpi-ico { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: 0 0 38px; }
.kpi .n { font-size: 21px; font-weight: 800; line-height: 1.1; }
.kpi .l { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* ═══ Модалки ═══ */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(10, 18, 38, .5); z-index: 100;
    display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px 16px;
    backdrop-filter: blur(4px); animation: fadeIn .18s ease-out;
    overflow-y: auto;
}
.modal {
    background: #fff; border-radius: 18px; width: 540px; max-width: 100%;
    box-shadow: var(--shadow-3); animation: rise .24s cubic-bezier(.22,.9,.35,1.18);
    display: flex; flex-direction: column; max-height: 86vh;
}
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px 0; }
.modal-ico {
    width: 40px; height: 40px; border-radius: 12px; flex: 0 0 40px;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.modal-ico.danger { background: var(--err-soft); color: var(--err); }
.modal-ico.ok { background: var(--ok-soft); color: var(--ok-deep); }
.modal-ico.warn { background: var(--warn-soft); color: var(--warn-deep); }
.modal-title { font-size: 16.5px; font-weight: 780; letter-spacing: -.2px; }
.modal-x {
    margin-left: auto; border: none; background: #f2f4f8; color: var(--muted); cursor: pointer;
    width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
    transition: all .13s;
}
.modal-x:hover { background: #e8ebf1; color: var(--text); }
.modal-body { padding: 18px 24px 24px; overflow-y: auto; }
.modal.closing { animation: sink .16s ease-in forwards; }
.modal-backdrop.closing { animation: fadeOut .16s ease-in forwards; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label, .modal-body label.fld { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 650; color: var(--text-2); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.form-error {
    display: flex; align-items: center; gap: 8px; color: var(--err-deep); background: var(--err-soft);
    border-radius: 10px; padding: 10px 13px; font-size: 13px; margin-top: 14px;
}
.confirm-text { font-size: 14px; color: var(--text-2); line-height: 1.55; }
.confirm-note {
    margin-top: 12px; padding: 11px 14px; border-radius: 10px; background: #f6f8fb;
    font-size: 12.5px; color: var(--muted); line-height: 1.5;
}

/* ═══ Тосты ═══ */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 300; }
.toast {
    display: flex; align-items: flex-start; gap: 11px; min-width: 280px; max-width: 380px;
    background: #101726; color: #e8ecf5; border-radius: 13px; padding: 13px 15px;
    font-size: 13px; box-shadow: var(--shadow-2); animation: toast-in .25s cubic-bezier(.22,.9,.35,1.2);
}
.toast.leaving { animation: toast-out .2s ease-in forwards; }
.toast-ico { flex: 0 0 20px; margin-top: 1px; }
.toast.ok .toast-ico { color: #34d399; }
.toast.err .toast-ico { color: #f87171; }
.toast.info .toast-ico { color: #7ea2ff; }
.toast-title { font-weight: 700; margin-bottom: 2px; }
.toast-msg { color: #b6bfd1; line-height: 1.4; }
.toast.ok .toast-title { color: #6ee7b7; }
.toast.err .toast-title { color: #fca5a5; }

/* ═══ Пустые состояния и скелетоны ═══ */
.empty-state { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty-ico {
    width: 56px; height: 56px; border-radius: 16px; background: #eef1f6; color: var(--faint);
    display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
}
.empty-title { font-size: 15px; font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.empty-hint { font-size: 13px; margin-bottom: 16px; }
.skel { position: relative; overflow: hidden; background: #edeff4; border-radius: 8px; }
.skel::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
    animation: shimmer 1.3s infinite;
}
.skel-row { display: flex; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }

/* ═══ Сегмент-контрол и период ═══ */
.seg { display: inline-flex; border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button {
    border: none; background: none; padding: 8px 15px; font-size: 13px; font-weight: 650;
    color: var(--muted); cursor: pointer; font-family: inherit; transition: all .13s;
}
.seg button:hover { color: var(--text); background: #f6f8fb; }
.seg button.active { background: var(--accent); color: #fff; }
.period-wrap { display: flex; align-items: center; gap: 10px; }
.period-wrap select { font-weight: 650; }

/* ═══ Вкладки карточки клиента ═══ */
.card-hero { display: flex; align-items: center; gap: 14px; min-width: 0; }
.card-hero .profile-ava { width: 46px; height: 46px; flex-basis: 46px; font-size: 15px; border-radius: 13px; }
.tabs {
    display: flex; gap: 4px; margin-bottom: 20px; background: #e9ecf2;
    padding: 4px; border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto;
}
.tab {
    display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
    background: none; color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 650;
    padding: 9px 16px; border-radius: 9px; transition: all .15s; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(18, 30, 55, .12); }
.tab.active svg { color: var(--accent); }
.rev-toolbar { display: flex; justify-content: flex-end; margin-bottom: 16px; }

/* ═══ Профиль: районы, доступы, контакт ═══ */
.card-head-row {
    display: flex; align-items: center; gap: 12px; padding: 15px 20px;
    background: #f9fafc; border-bottom: 1px solid var(--border);
}
.card-head-row .muted { margin-right: auto; }
.card-head-row .card-title { margin-right: auto; }
.card-head-row .card-title + .muted { margin-right: 0; margin-left: -4px; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; align-items: start; }
@media (max-width: 1100px) { .profile-grid { grid-template-columns: 1fr; } }

.rep-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.rep-chip {
    display: inline-flex; padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 700;
    background: var(--accent-soft); color: var(--accent-2); border: 1px solid #d8e2fd;
}
.rep-chip.off {
    background: #f2f4f8; color: var(--faint); border-color: transparent;
    text-decoration: line-through; font-weight: 600;
}
.soc-badge {
    display: inline-flex; padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 700;
    background: #f3ebff; color: #7c3aed; margin-right: 4px;
}
.soc-badge.off { background: #f2f4f8; color: var(--faint); text-decoration: line-through; font-weight: 600; }

.acc-list { padding: 6px 20px 10px; }
.acc-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; min-height: 38px;
}
.acc-row:last-child { border-bottom: none; }
.acc-row .k { color: var(--muted); flex: 0 0 auto; }
.acc-row .v { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.acc-row .v a { color: var(--accent-2); text-decoration: none; }
.acc-row .v a:hover { text-decoration: underline; }
.acc-row .v.ok { color: var(--ok-deep); }
.acc-row .v.mono { font-family: "SF Mono", Consolas, monospace; font-size: 12.5px; }
.pw-dots { letter-spacing: 2px; color: var(--text-2); }
.faint { color: var(--faint); }
.mini-btn {
    border: none; background: none; color: var(--faint); cursor: pointer; padding: 4px;
    border-radius: 6px; display: inline-flex; transition: all .12s;
}
.mini-btn:hover { background: #eef1f6; color: var(--accent); }

.rep-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.rep-pick {
    display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 6px;
    padding: 6px 12px; border: 1.5px solid var(--border); border-radius: 9px; cursor: pointer;
    font-size: 12.5px !important; font-weight: 700 !important; color: var(--muted); transition: all .13s;
}
.rep-pick input { display: none; }
.rep-pick:hover { border-color: #c6d2f5; }
.rep-pick.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }

/* Тихая строка добавления в конце таблицы */
.add-line {
    display: flex; align-items: center; gap: 7px; width: 100%;
    border: none; background: none; cursor: pointer; font-family: inherit;
    padding: 11px 20px; font-size: 12.5px; font-weight: 650; color: var(--faint);
    border-top: 1px solid var(--border-soft); transition: all .13s;
}
.add-line:hover { color: var(--accent); background: #f8faff; }

/* Карандаш в шапке карточки — появляется при наведении */
.hero-edit { margin-left: 8px; opacity: 0; vertical-align: 2px; }
.card-hero:hover .hero-edit { opacity: 1; }
.hero-edit:hover { color: var(--accent); background: var(--accent-soft); }

/* Вид деятельности */
.kind-badge {
    display: inline-flex; padding: 4px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 700;
}
.kind-badge.trade { background: #fdf0e0; color: #a3610a; }
.kind-badge.serv { background: #e3f2fd; color: #1565c0; }

/* ═══ Обновления ═══ */
.upd-group { margin-bottom: 20px; }
.upd-date {
    display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 750;
    color: var(--text-2); margin-bottom: 10px;
}
.upd-date svg { color: var(--accent); }
.upd-item {
    display: flex; align-items: flex-start; gap: 11px; padding: 10px 0;
    border-bottom: 1px solid var(--border-soft); font-size: 13.5px; line-height: 1.5;
}
.upd-item:last-child { border-bottom: none; }
.upd-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: 0 0 7px; }

/* ═══ Договор и баланс ═══ */
.balance-card { display: flex; flex-direction: column; gap: 6px; }
.balance-num { font-size: 34px; font-weight: 800; letter-spacing: -.8px; color: var(--ok-deep); }
.balance-num span { font-size: 16px; font-weight: 700; color: var(--muted); }
.balance-card.neg .balance-num { color: var(--err-deep); }
.hint-card {
    display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 13px 16px;
    background: #f2f6ff; border: 1px solid #dbe6ff; border-radius: 12px;
    font-size: 12.5px; color: #3d5390; line-height: 1.5;
}
.hint-card svg { flex: 0 0 auto; color: var(--accent); }

/* ═══ Инфраструктура ═══ */
.infra-hero {
    display: flex; align-items: center; gap: 16px; padding: 20px 24px; border-radius: var(--r-lg);
    margin-bottom: 18px; border: 1px solid transparent;
}
.infra-hero.ok { background: #e9f9f1; border-color: #c4ecd8; color: #0a6847; }
.infra-hero.warn { background: #fdf3df; border-color: #f3ddb0; color: #8a5a06; }
.infra-hero.error { background: #fdecec; border-color: #f5c8c8; color: #a11616; }
.infra-hero-ico { display: flex; }
.infra-hero-title { font-size: 17px; font-weight: 800; letter-spacing: -.2px; }
.infra-hero-sub { font-size: 13px; opacity: .85; margin-top: 2px; }
.infra-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-bottom: 18px; }
.infra-card {
    background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--ok);
    border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-1);
    display: flex; flex-direction: column; gap: 10px;
}
.infra-card.st-warn { border-left-color: var(--warn); }
.infra-card.st-error { border-left-color: var(--err); }
.infra-card.st-stale { border-left-color: #9aa3b2; }
.infra-card-top { display: flex; align-items: center; gap: 12px; }
.infra-ico {
    width: 42px; height: 42px; border-radius: 12px; flex: 0 0 42px;
    display: flex; align-items: center; justify-content: center;
    background: var(--ok-soft); color: var(--ok-deep);
}
.infra-ico.st-warn { background: var(--warn-soft); color: var(--warn-deep); }
.infra-ico.st-error { background: var(--err-soft); color: var(--err-deep); }
.infra-ico.st-stale { background: #eef0f4; color: #6b7686; }
.infra-card-titles { min-width: 0; margin-right: auto; }
.infra-card-name { font-size: 14px; font-weight: 750; }
.infra-card-sched { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.infra-pill.st-ok { background: var(--ok-soft); color: var(--ok-deep); }
.infra-pill.st-warn { background: var(--warn-soft); color: var(--warn-deep); }
.infra-pill.st-error { background: var(--err-soft); color: var(--err-deep); }
.infra-pill.st-stale { background: #eef0f4; color: #6b7686; }
.infra-card-msg { font-size: 13px; font-weight: 600; color: var(--text-2); line-height: 1.45; }
.infra-card.st-error .infra-card-msg { color: var(--err-deep); }
.infra-card-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.infra-card-foot { font-size: 11.5px; color: var(--faint); border-top: 1px solid var(--border-soft); padding-top: 10px; }
.infra-events { padding: 8px 20px 14px; }
.infra-event { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.infra-event:last-child { border-bottom: none; }
.infra-event-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 9px; }
.infra-event-body { min-width: 0; flex: 1; }
.infra-event-title { font-size: 13px; font-weight: 600; }
.infra-event-msg { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.infra-event-time { font-size: 11.5px; color: var(--faint); white-space: nowrap; margin-top: 2px; }
.infra-events-empty {
    display: flex; align-items: center; gap: 10px; padding: 18px 20px;
    color: var(--ok-deep); font-size: 13px; font-weight: 600;
}

/* ═══ Анимации ═══ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sink { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(30px); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.fade-in { animation: rise .25s ease-out; }

@media (max-width: 860px) {
    .sidebar { width: 68px; flex-basis: 68px; padding: 16px 10px; }
    .sidebar .brand-name, .sidebar .brand-sub, .sidebar nav a span, .nav-section, .user-meta { display: none; }
    .sidebar nav a { justify-content: center; padding: 11px; }
    .content { padding: 20px 16px 40px; }
    .search-wrap input { width: 100%; }
}
