/* ============================================================
   Личный кабинет СМП — дизайн-система (та же «семья», что и сайт СМП).
   Источник токенов: smp-website/DESIGN-SYSTEM.md и site/src/styles/global.css.
   Golos Text 18px, кнопки 52px, контраст AAA, focus-ring, формы.
   Статический CSS (отдаётся nginx, без фронтенд-сборки).
   ============================================================ */

/* ---- Самохостинг шрифта Golos Text (вариативный, кириллица, веса 400–700) ---- */
@font-face{font-family:"Golos Text";font-style:normal;font-weight:400 700;font-display:swap;src:url("/fonts/golos-text.woff2") format("woff2");}

:root{
  --ink:#13233A;
  --navy:#0E2A47;
  --teal:#0E7C6B;
  --teal-deep:#0B6557;
  /* Текстовая бирюза для ссылок/иконок: контраст ≥7:1 на белом (AAA). #0A5246 ≈ 7.6:1 */
  --teal-text:#0A5246;
  --teal-soft:#EAF4F2;
  --cta:#0B6557;
  --cta-warm:#E2562A;
  --white:#FFFFFF;
  --bg-soft:#F5F8F8;
  --line:#DDE6E6;
  /* Приглушённый текст: затемнён до ≥7:1 на белом (AAA). #46586A ≈ 7.0:1 */
  --muted:#46586A;
  --success:#1A9E6B;
  /* Ошибка на белом: #C62828 ≈ 5.9:1 (норм текст AA с запасом). */
  --error:#C62828;
  --warning:#E8A100;
  /* Читаемый текст в disabled-состоянии (≥4.5:1). */
  --disabled-text:#4A5560;
  --r-btn:10px;
  --r-card:16px;
  --shadow-soft:0 4px 18px rgba(14,42,71,.07);
  --shadow-card:0 6px 24px rgba(14,42,71,.08);
  --shadow-cta:0 4px 14px rgba(11,101,87,.25);
  --container:1200px;
  --font-scale:1; /* «Внешний вид» — размер текста (JS из localStorage) */
  /* C2: фон карточек/таблиц и границы — отдельные переменные, чтобы тёмная тема
     могла их переопределить (раньше --surface не была определена → admin-таблицы
     оставались белыми на тёмном фоне). */
  --surface:#FFFFFF;
  --surface-2:#F7F8FA;     /* шапки таблиц, вложенные блоки */
  --surface-hover:#FAFBFC; /* ховер строк таблицы */
  --border:#E4E7EC;
  --th-text:#475467;       /* текст заголовков таблиц/кнопок сортировки */
}

/* Тёмная тема (опция «Внешний вид»). Контраст ссылок/alert'ов/ошибок ≥4.5:1. */
:root[data-theme="dark"]{
  --ink:#E8EEF4;
  --navy:#DCE7F1;
  --bg-soft:#0E1A2A;
  --white:#16273C;
  --line:#28405A;
  /* Приглушённый текст на тёмном #16273C: #AEC2D6 ≈ 7.4:1 (AAA). */
  --muted:#AEC2D6;
  --teal-soft:#143A36;
  /* Светлая бирюза ссылок/иконок на тёмном: #3FB8A6 ≈ 5.4:1 на #16273C (AA с запасом). */
  --teal-text:#3FB8A6;
  --teal:#3FB8A6;
  --teal-deep:#6FD3C4;
  /* Ошибка светлее, чтобы читалась на тёмном: #FF8A8A ≈ 6.0:1. */
  --error:#FF8A8A;
  --disabled-text:#9FB0C2;
  /* C2: поверхности/границы админки на тёмной теме. Контраст текста ≥4.5:1. */
  --surface:#16273C;        /* фон карточек/таблиц */
  --surface-2:#1E3450;      /* шапки таблиц/вложенные блоки */
  --surface-hover:#1B2E47;  /* ховер строк */
  --border:#28405A;
  --th-text:#C2D2E2;        /* текст заголовков таблиц на тёмном (≈9:1) */
}

*,*::before,*::after{box-sizing:border-box;}
html{font-size:calc(18px * var(--font-scale)); scroll-behavior:smooth;}
body{
  margin:0;
  font-family:"Golos Text","PT Root UI","Inter",-apple-system,"Segoe UI",Roboto,sans-serif;
  font-size:1rem; line-height:1.6; color:var(--ink); background:var(--bg-soft);
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
img{max-width:100%; display:block;}

h1,h2,h3{color:var(--navy); margin:0 0 16px; letter-spacing:-0.01em;}
h1{font-size:34px; line-height:1.15; font-weight:700;}
h2{font-size:25px; line-height:1.2; font-weight:700;}
h3{font-size:20px; line-height:1.25; font-weight:600;}
p{margin:0 0 16px;}
.lead{font-size:19px; line-height:1.55; color:var(--ink);}
.small{font-size:15px; line-height:1.45; font-weight:500; color:var(--muted);}
a{color:var(--teal-text); text-decoration:underline; text-underline-offset:2px;}
a:hover{color:var(--teal-deep);}
.tnum{font-variant-numeric:tabular-nums;}

a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,
textarea:focus-visible,.btn:focus-visible,[tabindex]:focus-visible{
  outline:3px solid var(--teal); outline-offset:2px; border-radius:6px;
}

/* ===== Кнопки ===== */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:10px;
  height:52px; padding:0 26px; border-radius:var(--r-btn);
  font-family:inherit; font-size:18px; font-weight:600; line-height:1;
  text-decoration:none; cursor:pointer; border:2px solid transparent;
  transition:transform .18s ease-out, background-color .18s ease-out, box-shadow .18s ease-out;
  white-space:nowrap;
}
.btn svg{width:20px; height:20px; flex:none;}
.btn-primary{background:var(--cta); color:#fff; box-shadow:var(--shadow-cta);}
.btn-primary:hover{background:#09584b; transform:translateY(-1px); color:#fff;}
.btn-primary:active{transform:none;}
.btn-secondary{background:transparent; color:var(--teal-text); border-color:var(--teal);}
.btn-secondary:hover{background:var(--teal-soft); transform:translateY(-1px); color:var(--teal-deep);}
.btn-ghost{background:transparent; color:var(--teal-text); height:auto; padding:0; border:none; text-decoration:underline;}
.btn-block{width:100%;}
.btn:disabled{background:#C5D0D0; color:var(--disabled-text); box-shadow:none; cursor:not-allowed; transform:none;}
.btn-sm{height:44px; font-size:16px; padding:0 18px;}

/* ===== Формы ===== */
.field{margin-bottom:18px;}
.field label{display:block; font-size:15px; font-weight:600; color:var(--navy); margin-bottom:8px;}
.field input,.field select,.field textarea{
  width:100%; min-height:52px; border:2px solid var(--line); border-radius:10px;
  padding:12px 14px; font-family:inherit; font-size:17px; color:var(--ink); background:var(--white);
}
.field textarea{resize:vertical; line-height:1.5;}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--teal); outline:none;}
.field .hint{font-size:15px; color:var(--muted); margin-top:6px;}
.field .err-msg{display:block; color:var(--error); font-size:15px; margin-top:6px;}
.field.has-error input,.field.has-error textarea,.field.has-error select{border-color:var(--error);}
.field-readonly{background:var(--bg-soft); border-color:var(--line); color:var(--disabled-text); cursor:not-allowed;}
.consent{display:flex; gap:12px; align-items:flex-start; margin:6px 0 18px;}
.consent input{width:24px; height:24px; flex:none; margin-top:2px; accent-color:var(--teal-deep); cursor:pointer;}
.consent label{font-size:15px; color:var(--muted); line-height:1.5;}
.checkbox-row{display:flex; gap:10px; align-items:center; margin:6px 0 18px; font-size:15px; color:var(--ink);}
.checkbox-row input{width:22px; height:22px; accent-color:var(--teal-deep); cursor:pointer;}
.secure{display:flex; align-items:center; gap:8px; margin-top:14px; font-size:15px; color:var(--muted);}
.secure svg{width:16px; height:16px; color:var(--teal-text); flex:none;}

/* Алерты */
.alert{border-radius:10px; padding:14px 18px; margin-bottom:18px; font-size:15px; display:flex; gap:10px; align-items:flex-start;}
.alert svg{width:20px; height:20px; flex:none; margin-top:1px;}
.alert-success{background:#E7F6EF; color:#0d6b47; border:1px solid #BFE6D4;}
.alert-info{background:var(--teal-soft); color:var(--teal-deep); border:1px solid #C8E5DF;}
.alert-warning{background:#FCF3DA; color:#7a5b00; border:1px solid #F0DCA0;}
.alert-error{background:#FBE7E7; color:#9b2727; border:1px solid #F1C4C4;}
/* Тёмная тема: тёмные подложки + светлый текст, контраст ≥4.5:1. */
:root[data-theme="dark"] .alert-success{background:#0F2E22; color:#7FE3B8; border-color:#1E5740;}
:root[data-theme="dark"] .alert-info{background:#143A36; color:#7FE0D2; border-color:#1F5A52;}
:root[data-theme="dark"] .alert-warning{background:#3A2F12; color:#F2D27A; border-color:#5A4A1F;}
:root[data-theme="dark"] .alert-error{background:#3A1A1A; color:#FF9E9E; border-color:#5E2A2A;}
/* C2: бейджи статусов и блоки админки на тёмной теме (контраст ≥4.5:1). */
:root[data-theme="dark"] .badge-yes{background:#0F2E22; color:#7FE3B8;}
:root[data-theme="dark"] .badge-no{background:#3A1A1A; color:#FF9E9E;}
:root[data-theme="dark"] .badge-req{background:#3A2F12; color:#F2D27A;}
:root[data-theme="dark"] .debt-amount{color:#FF9E9E;}
:root[data-theme="dark"] .creds-box{background:#3A2F12; border-color:#5A4A1F; color:#F2D27A;}
:root[data-theme="dark"] .creds-box code{color:#FFE6A6;}
:root[data-theme="dark"] .email-pill{background:#1E3450; color:#AEC2D6;}
:root[data-theme="dark"] .email-pill button{color:#AEC2D6;}
:root[data-theme="dark"] .source-row.selected{box-shadow:0 0 0 2px rgba(255,138,138,.25);}
.alert .close{margin-left:auto; background:none; border:none; cursor:pointer; color:inherit; font-size:24px; line-height:1; padding:0; min-width:44px; min-height:44px; display:inline-flex; align-items:center; justify-content:center; margin-top:-6px; margin-right:-6px;}

/* Логотип */
.logo{display:inline-flex; align-items:center; gap:10px; text-decoration:none;}
.logo-mark{width:42px; height:42px; border-radius:11px; background:var(--teal-deep); color:#fff; display:grid; place-items:center; font-weight:700; font-size:18px; letter-spacing:.02em; box-shadow:var(--shadow-cta);}
.logo-text{display:flex; flex-direction:column; line-height:1.05;}
.logo-text b{color:var(--navy); font-size:18px; font-weight:700;}
.logo-text span{font-size:12px; color:var(--muted); font-weight:500;}

/* ===== СТРАНИЦА ВХОДА ===== */
.auth{min-height:100vh; display:grid; grid-template-columns:1fr 1fr;}
.auth-brand{
  background:linear-gradient(150deg,var(--navy) 0%,var(--teal-deep) 100%);
  color:#fff; padding:56px 64px; display:flex; flex-direction:column; justify-content:space-between;
}
.auth-brand .logo-text b{color:#fff;}
.auth-brand .logo-text span{color:rgba(255,255,255,.75);}
.auth-brand .logo-mark{background:rgba(255,255,255,.16); box-shadow:none;}
.auth-brand h1{color:#fff; font-size:36px; max-width:14ch; margin-top:48px;}
.auth-brand .brand-lead{color:rgba(255,255,255,.88); font-size:19px; line-height:1.55; max-width:40ch;}
.auth-brand .brand-points{list-style:none; padding:0; margin:24px 0 0; display:flex; flex-direction:column; gap:14px;}
.auth-brand .brand-points li{display:flex; gap:12px; align-items:flex-start; font-size:16px; color:rgba(255,255,255,.92);}
.auth-brand .brand-points .tick{width:26px; height:26px; flex:none; border-radius:50%; background:rgba(255,255,255,.18); display:grid; place-items:center;}
.auth-brand .brand-points .tick svg{width:15px; height:15px; color:#fff;}
.auth-brand .brand-foot{font-size:13px; color:rgba(255,255,255,.6); line-height:1.6;}

.auth-form-wrap{display:flex; align-items:center; justify-content:center; padding:48px 32px; background:var(--white);}
.auth-card{width:100%; max-width:420px;}
.auth-card .auth-title{font-size:26px; margin-bottom:4px;}
.auth-card .auth-sub{font-size:15px; color:var(--muted); margin-bottom:28px;}
.auth-card .auth-links{margin-top:20px; font-size:15px; color:var(--muted); display:flex; flex-direction:column; gap:8px;}
.auth-card .auth-links .row{display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap;}

/* ===== КАБИНЕТ: layout с боковым меню ===== */
.lk{display:grid; grid-template-columns:264px 1fr; min-height:100vh;}
.sidebar{background:var(--navy); color:rgba(255,255,255,.85); display:flex; flex-direction:column; padding:24px 0;}
.sidebar .brand{padding:0 24px 24px; border-bottom:1px solid rgba(255,255,255,.12); margin-bottom:16px;}
.sidebar .brand .logo-text b{color:#fff;}
.sidebar .brand .logo-text span{color:rgba(255,255,255,.7);}
.sidebar .brand .logo-mark{background:rgba(255,255,255,.16); box-shadow:none;}
.sidebar nav{display:flex; flex-direction:column; gap:2px; padding:0 12px; flex:1;}
.sidebar nav a,.sidebar nav button{
  display:flex; align-items:center; gap:12px; padding:12px 14px; border-radius:10px;
  color:rgba(255,255,255,.85); text-decoration:none; font-size:16px; font-weight:500;
  background:none; border:none; cursor:pointer; font-family:inherit; text-align:left; width:100%;
}
.sidebar nav a svg,.sidebar nav button svg{width:22px; height:22px; flex:none; opacity:.9;}
.sidebar nav a:hover,.sidebar nav button:hover{background:rgba(255,255,255,.08); color:#fff;}
.sidebar nav a.active{background:var(--teal-deep); color:#fff;}
.sidebar .nav-foot{padding:12px 24px 0; border-top:1px solid rgba(255,255,255,.12); margin-top:12px;}
.sidebar .nav-foot .small{color:rgba(255,255,255,.6);}

.lk-main{padding:32px 40px; max-width:1100px;}
.lk-topbar{display:flex; align-items:center; gap:16px; margin-bottom:24px;}
.lk-topbar h1{margin:0;}
.lk-topbar .who{margin-left:auto; text-align:right; font-size:14px; color:var(--muted);}
.lk-topbar .who b{display:block; color:var(--navy); font-size:15px;}

.lk-burger{display:none; width:48px; height:48px; border:1px solid var(--line); border-radius:10px; background:var(--white); cursor:pointer; align-items:center; justify-content:center;}
.lk-burger svg{width:24px; height:24px; color:var(--navy);}
.sidebar-backdrop{display:none; position:fixed; inset:0; background:rgba(14,42,71,.4); z-index:85;}
.sidebar-backdrop.open{display:block;}

/* Сводные карточки */
.summary{display:grid; grid-template-columns:repeat(3,1fr); gap:20px; margin-bottom:28px;}
.sum-card{background:var(--white); border:1px solid var(--line); border-radius:var(--r-card); padding:24px; box-shadow:var(--shadow-soft);}
.sum-card .sc-label{font-size:15px; color:var(--muted); font-weight:600; margin-bottom:10px;}
.sum-card .sc-value{font-size:32px; font-weight:700; color:var(--navy); line-height:1.1; font-variant-numeric:tabular-nums;}
.sum-card .sc-sub{font-size:15px; color:var(--muted); margin-top:6px;}
.sum-card.is-debt .sc-value{color:var(--error);}
.sum-card .sc-status{display:inline-flex; align-items:center; gap:6px; margin-top:8px; font-size:14px; font-weight:600; padding:3px 10px; border-radius:999px;}
.sum-card .sc-status-ic{display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; border-radius:50%; font-size:12px; font-weight:700; line-height:1; color:#fff;}
.sc-status-debt{color:var(--error); background:rgba(176,32,32,.08);}
.sc-status-debt .sc-status-ic{background:var(--error);}
.sc-status-ok{color:#1a7a4a; background:rgba(26,122,74,.08);}
.sc-status-ok .sc-status-ic{background:#1a7a4a;}

/* Панели */
.panel{background:var(--white); border:1px solid var(--line); border-radius:var(--r-card); padding:28px; box-shadow:var(--shadow-soft); margin-bottom:24px;}
.panel-head{display:flex; align-items:center; gap:12px; margin-bottom:18px;}
.panel-head h2{margin:0; font-size:21px;}
.panel-head .panel-actions{margin-left:auto; display:flex; gap:10px;}
.panel .grid-2{display:grid; grid-template-columns:1fr 1fr; gap:18px;}

/* Контакт-блок */
.contact-block{border:1px solid var(--line); border-radius:12px; padding:20px; margin-bottom:16px; background:var(--bg-soft);}
.contact-block .cb-head{display:flex; align-items:center; gap:10px; margin-bottom:14px;}
.contact-block .cb-head b{font-size:16px; color:var(--navy);}
.contact-block .cb-head .tag{font-size:12px; font-weight:600; color:var(--teal-deep); background:var(--teal-soft); padding:3px 10px; border-radius:20px;}
.contact-block .cb-head .rm{margin-left:auto;}
.contact-block .note-line{font-size:15px; color:var(--muted); margin:-6px 0 12px;}

/* Модалка */
.modal-overlay{position:fixed; inset:0; background:rgba(14,42,71,.45); z-index:100; display:flex; align-items:center; justify-content:center; padding:24px;}
.modal{background:var(--white); border-radius:var(--r-card); box-shadow:0 20px 60px rgba(14,42,71,.3); width:100%; max-width:460px; padding:28px;}
.modal-head{display:flex; align-items:center; margin-bottom:18px;}
.modal-head h3{margin:0;}
.modal-head .x{margin-left:auto; background:none; border:none; font-size:28px; line-height:1; color:var(--muted); cursor:pointer; padding:0; min-width:44px; min-height:44px; display:inline-flex; align-items:center; justify-content:center; margin:-8px -8px 0 0;}
.modal-head .x:hover{color:var(--navy);}

/* Внешний вид */
.appearance-row{display:flex; gap:12px; flex-wrap:wrap; align-items:center; margin-bottom:16px;}
.appearance-row .seg{display:inline-flex; border:2px solid var(--line); border-radius:10px; overflow:hidden;}
.appearance-row .seg button{background:var(--white); border:none; padding:10px 16px; font-family:inherit; font-size:15px; font-weight:600; color:var(--ink); cursor:pointer;}
.appearance-row .seg button.active{background:var(--teal-soft); color:var(--teal-deep);}
.appearance-row .seg button + button{border-left:2px solid var(--line);}
.appearance-label{font-size:15px; font-weight:600; color:var(--navy); min-width:130px;}

/* Заглушка пустого раздела */
.empty-state{text-align:center; padding:48px 24px; color:var(--muted);}
.empty-state .es-ic{width:72px; height:72px; margin:0 auto 18px; border-radius:18px; background:var(--teal-soft); color:var(--teal-deep); display:grid; place-items:center;}
.empty-state .es-ic svg{width:38px; height:38px;}
.empty-state h2{color:var(--navy);}
.empty-state p{max-width:48ch; margin:0 auto 8px;}

/* Адаптив */
@media (max-width:900px){
  .auth{grid-template-columns:1fr;}
  .auth-brand{display:none;}
  .lk{grid-template-columns:1fr;}
  .sidebar{position:fixed; left:0; top:0; bottom:0; width:264px; z-index:90; transform:translateX(-100%); transition:transform .25s ease-out;}
  .sidebar.open{transform:translateX(0);}
  .lk-burger{display:inline-flex;}
  .lk-main{padding:20px 16px;}
  .summary{grid-template-columns:1fr;}
  .panel .grid-2{grid-template-columns:1fr;}
}
@media (max-width:560px){
  h1{font-size:28px;}
  .auth-form-wrap{padding:32px 18px;}
}

/* ===== Справка «Профиль клиента» ===== */
.help-fields{margin:18px 0 0; display:grid; gap:14px;}
.help-fields dt{font-size:16px; font-weight:700; color:var(--navy);}
.help-fields dd{margin:4px 0 0; font-size:16px; color:var(--ink); line-height:1.55;}

/* ===== Сворачивание сайдбара до иконок (десктоп) ===== */
.sidebar nav .nav-collapse svg{transition:transform .2s ease-out;}
.lk.sidebar-collapsed .sidebar{grid-column:auto;}
@media (min-width:901px){
  .lk.sidebar-collapsed{grid-template-columns:76px 1fr;}
  .lk.sidebar-collapsed .sidebar .brand .logo-text,
  .lk.sidebar-collapsed .sidebar .nav-label,
  .lk.sidebar-collapsed .sidebar .nav-foot .small{display:none;}
  .lk.sidebar-collapsed .sidebar nav a,
  .lk.sidebar-collapsed .sidebar nav button{justify-content:center; padding:12px 0;}
  .lk.sidebar-collapsed .sidebar .brand{padding:0 12px 16px; display:flex; justify-content:center;}
  .lk.sidebar-collapsed .sidebar .nav-foot form button{justify-content:center;}
  .lk.sidebar-collapsed .sidebar .nav-collapse svg{transform:rotate(180deg);}
}

/* ===== Модальное окно «Внешний вид» ===== */
.appearance-modal{position:fixed; inset:0; z-index:120; display:none; align-items:center; justify-content:center; padding:24px; background:rgba(14,42,71,.45);}
.appearance-modal.open{display:flex;}
.appearance-dialog{background:var(--white); color:var(--ink); border-radius:var(--r-card); box-shadow:0 20px 60px rgba(14,42,71,.35); width:100%; max-width:460px; padding:28px;}
.appearance-dialog .modal-head{display:flex; align-items:center; margin-bottom:18px;}
.appearance-dialog .modal-head h3{margin:0;}
.appearance-dialog .appearance-row{margin-bottom:18px;}

/* Размер текста: − [ %] + Сбросить */
.scale-control{display:inline-flex; align-items:center; gap:10px; flex-wrap:wrap;}
.scale-btn{width:44px; height:44px; border:2px solid var(--line); border-radius:10px; background:var(--white); color:var(--navy); font-size:22px; font-weight:700; line-height:1; cursor:pointer; display:inline-flex; align-items:center; justify-content:center;}
.scale-btn:hover{border-color:var(--teal); color:var(--teal-text);}
.scale-field{display:inline-flex; align-items:center; gap:4px; border:2px solid var(--line); border-radius:10px; padding:0 10px; height:44px; background:var(--white);}
.scale-field input{width:56px; border:none; outline:none; background:transparent; font-family:inherit; font-size:16px; font-weight:600; color:var(--ink); text-align:right; -moz-appearance:textfield;}
.scale-field input::-webkit-outer-spin-button,.scale-field input::-webkit-inner-spin-button{-webkit-appearance:none; margin:0;}
.scale-pct{font-size:16px; font-weight:600; color:var(--muted);}
.scale-reset{font-size:15px; margin-left:4px;}

/* Кнопка «Внешний вид» на странице входа (до авторизации) */
.appearance-fab{position:fixed; top:16px; right:16px; z-index:110; display:inline-flex; align-items:center; gap:8px; height:44px; padding:0 16px; border:1px solid var(--line); border-radius:10px; background:var(--white); color:var(--navy); font-family:inherit; font-size:15px; font-weight:600; cursor:pointer; box-shadow:var(--shadow-soft);}
.appearance-fab svg{width:20px; height:20px; color:var(--teal-text);}
.appearance-fab:hover{border-color:var(--teal);}
@media (max-width:480px){ .appearance-fab span{display:none;} .appearance-fab{padding:0; width:44px; justify-content:center;} }

body.modal-open{overflow:hidden;}

/* ===== «Показать пароль» (toggle-глаз) ===== */
.pw-wrap{position:relative;}
.pw-wrap input{padding-right:52px;}
.pw-toggle{position:absolute; top:50%; right:6px; transform:translateY(-50%); width:44px; height:44px; border:none; background:none; color:var(--muted); cursor:pointer; display:inline-flex; align-items:center; justify-content:center; border-radius:8px;}
.pw-toggle svg{width:22px; height:22px;}
.pw-toggle:hover{color:var(--teal-text);}
.pw-toggle .icon-off{display:none;}
.pw-toggle.is-shown .icon-on{display:none;}
.pw-toggle.is-shown .icon-off{display:inline;}

/* ===== Раздел «Документы» (фаза 2) ===== */
.doc-btn-row{display:flex; flex-wrap:wrap; gap:12px; margin-top:4px;}
.doc-dl{text-decoration:none;}
.doc-dl-act{background:var(--error); color:#fff; border-color:var(--error); box-shadow:none;}
.doc-dl-act:hover{background:#a81f1f; color:#fff; transform:translateY(-1px);}
.doc-dl-act svg{color:#fff;}

.doc-filters{display:flex; flex-wrap:wrap; gap:12px; align-items:flex-start; margin-bottom:18px;}
.doc-search{position:relative; flex:1 1 280px; min-width:240px;}
.doc-search input{width:100%; height:48px; padding:0 44px 0 14px; border:2px solid var(--line); border-radius:10px; background:var(--white); color:var(--ink); font-family:inherit; font-size:16px;}
.doc-search input:focus{outline:none; border-color:var(--teal);}
.doc-search-ic{position:absolute; right:12px; top:50%; transform:translateY(-50%); color:var(--muted); pointer-events:none;}
.doc-search-ic svg{width:20px; height:20px;}

.doc-multi{position:relative;}
.doc-multi>summary{list-style:none; cursor:pointer; height:48px; display:inline-flex; align-items:center; gap:8px; padding:0 16px; border:2px solid var(--line); border-radius:10px; background:var(--white); color:var(--navy); font-weight:600; user-select:none;}
.doc-multi>summary::-webkit-details-marker{display:none;}
.doc-multi[open]>summary{border-color:var(--teal); color:var(--teal-text);}
.doc-count{display:inline-flex; min-width:22px; height:22px; padding:0 6px; align-items:center; justify-content:center; background:var(--teal); color:#fff; border-radius:11px; font-size:13px; font-weight:700;}
.doc-multi-list{position:absolute; z-index:20; margin-top:6px; min-width:180px; max-height:260px; overflow:auto; background:var(--white); border:1px solid var(--line); border-radius:10px; box-shadow:var(--shadow-card); padding:8px;}
.doc-multi-list label{display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:8px; cursor:pointer; font-size:15px; color:var(--ink);}
.doc-multi-list label:hover{background:var(--bg-soft);}
.doc-multi-list input{width:18px; height:18px; accent-color:var(--teal);}

/* Скрытие для скринридеров (видимый текст не показывается, но доступен AT). */
.sr-only{position:absolute !important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;}

/* Легенда-расшифровка сокращений над таблицей (B4). */
.doc-legend{font-size:14px; color:var(--ink); background:var(--bg-soft); border:1px solid var(--line); border-radius:10px; padding:10px 14px; margin:0 0 14px; line-height:1.5;}
.doc-legend strong{color:var(--navy);}

.doc-table-wrap{overflow-x:auto;}
.doc-table{width:100%; border-collapse:collapse; font-size:15px;}
.doc-table th,.doc-table td{padding:12px 10px; text-align:left; border-bottom:1px solid var(--line); vertical-align:middle;}
/* Шапки колонок крупнее и контрастнее для читаемости (B4). */
.doc-table thead th{font-size:15px; color:var(--navy); font-weight:700; white-space:nowrap;}
.doc-table thead th abbr{text-decoration:none; border-bottom:1px dotted var(--muted); cursor:help;}
.doc-table .ta-r{text-align:right;}
.doc-table .ta-c{text-align:center;}
.doc-empty{text-align:center; color:var(--muted); padding:24px;}
.doc-dash{color:var(--muted);}

/* Кнопка раскрытия: значок ~20px, но кликабельная зона ≥48px (расширенный padding). */
.doc-expand{box-sizing:border-box; width:48px; height:48px; margin-right:8px; padding:14px; border:1.5px solid var(--line); border-radius:8px; background:var(--white); color:var(--teal-text); font-size:20px; font-weight:700; line-height:1; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; vertical-align:middle;}
.doc-expand:hover{border-color:var(--teal);}

/* Иконка PDF: значок 24px, кликабельная зона ≥48px. */
.pdf-ic{display:inline-flex; align-items:center; justify-content:center; box-sizing:border-box; width:48px; height:48px; padding:12px; border-radius:8px; color:var(--error);}
.pdf-ic svg{width:24px; height:24px;}
.pdf-ic:hover{background:var(--bg-soft);}
/* Зазор ≥8px между кликабельными иконками в соседних ячейках обеспечен padding ячеек. */

.doc-services-box{background:var(--bg-soft); border-radius:10px; padding:14px 16px;}
.doc-services-box>strong{display:block; margin-bottom:8px; font-size:14px; color:var(--muted);}
.doc-subtable{width:100%; border-collapse:collapse; font-size:14px;}
.doc-subtable th,.doc-subtable td{padding:7px 8px; border-bottom:1px solid var(--line); text-align:left;}
.doc-subtable th{color:var(--muted); font-weight:600;}
.doc-subtable .ta-r{text-align:right;}

.doc-pagination{margin-top:16px;}
.doc-pagination nav{display:flex; gap:6px; flex-wrap:wrap; align-items:center;}
.doc-pagination a,.doc-pagination span,.doc-pagination button{display:inline-flex; min-width:40px; height:40px; padding:0 12px; align-items:center; justify-content:center; border:1px solid var(--line); border-radius:8px; background:var(--white); color:var(--navy); text-decoration:none; font-family:inherit; font-size:15px; cursor:pointer;}
.doc-pagination a:hover,.doc-pagination button:hover{border-color:var(--teal); color:var(--teal-text);}
.doc-pagination span[aria-disabled="true"]{color:var(--muted); cursor:default;}

/* Карточный вид реализаций (B3): по умолчанию скрыт, показывается на узких экранах. */
.doc-cards{display:none;}
.doc-card{background:var(--white); border:1px solid var(--line); border-radius:12px; padding:16px; margin-bottom:14px; box-shadow:var(--shadow-soft);}
.doc-card-head{display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 10px;}
.doc-card-title{font-size:17px; font-weight:700; color:var(--navy);}
.doc-card-date{font-size:15px; color:var(--muted);}
.doc-card-sum{font-size:20px; font-weight:700; color:var(--navy); margin:8px 0 14px;}
.doc-card-actions{display:flex; flex-direction:column; gap:10px;}
.doc-card-btn{display:flex; align-items:center; gap:10px; min-height:52px; padding:12px 16px; border:1.5px solid var(--line); border-radius:10px; background:var(--bg-soft); color:var(--navy); text-decoration:none; font-size:16px; font-weight:600;}
.doc-card-btn svg{width:24px; height:24px; color:var(--error); flex:0 0 auto;}
.doc-card-btn:hover{border-color:var(--teal); color:var(--teal-text);}
.doc-card-toggle{display:inline-flex; align-items:center; justify-content:center; min-height:48px; width:100%; margin-top:12px; padding:10px 16px; border:1.5px solid var(--line); border-radius:10px; background:var(--white); color:var(--teal-text); font-family:inherit; font-size:15px; font-weight:600; cursor:pointer;}
.doc-card-toggle:hover{border-color:var(--teal);}
.doc-card-services{list-style:none; margin:12px 0 0; padding:0; border-top:1px solid var(--line);}
.doc-card-services li{display:flex; flex-wrap:wrap; justify-content:space-between; gap:4px 10px; padding:10px 0; border-bottom:1px solid var(--line); font-size:15px;}
.doc-card-services .dcs-name{flex:1 1 100%; color:var(--ink);}
.doc-card-services .dcs-qty{color:var(--muted);}
.doc-card-services .dcs-sum{font-weight:600; color:var(--navy);}

@media (max-width:560px){
  .doc-filters{flex-direction:column;}
  .doc-multi,.doc-multi>summary{width:100%;}
  /* На мобайле — карточки вместо таблицы (B3): иконки скачивания не прячутся за краем. */
  .doc-table-wrap{display:none;}
  .doc-cards{display:block;}
  .doc-legend{font-size:14px;}
}

@media (prefers-reduced-motion: reduce){
  *{transition:none !important; scroll-behavior:auto !important;}
}

/* ============================================================
   Фаза 3 — админ-панель (карточки, таблицы, бейджи статусов)
   ============================================================ */
.card{background:var(--surface,#fff);border:1px solid var(--border,#e4e7ec);border-radius:14px;padding:18px 20px;box-shadow:0 1px 2px rgba(16,24,40,.04)}
.muted{color:var(--muted,#667085)}
.admin-table-wrap{overflow-x:auto;border:1px solid var(--border,#e4e7ec);border-radius:14px;background:var(--surface,#fff)}
.admin-table{width:100%;border-collapse:collapse;font-size:14px}
.admin-table th,.admin-table td{padding:11px 14px;text-align:left;border-bottom:1px solid var(--border,#eef0f3);vertical-align:top}
.admin-table th{background:var(--surface-2,#f7f8fa);font-weight:600;color:var(--th-text,#475467);white-space:nowrap}
.admin-table tbody tr:hover{background:var(--surface-hover,#fafbfc)}
.admin-table .tnum{font-variant-numeric:tabular-nums}
.admin-table td{color:var(--ink)}
.sort-btn{background:none;border:none;cursor:pointer;font:inherit;font-weight:600;color:var(--th-text,#475467);display:inline-flex;gap:4px;align-items:center}
.badge{display:inline-block;padding:2px 10px;border-radius:999px;font-size:12px;font-weight:600;line-height:1.6}
.badge-yes{background:#e7f6ec;color:#067647}
.badge-no{background:#fdecec;color:#b42318}
.badge-req{background:#fef6e7;color:#b54708}
.debt-amount{color:#b42318;font-weight:600}
.admin-filters{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin-bottom:14px}
.admin-filters input[type=text],.admin-filters select{padding:9px 12px;border:1px solid var(--border,#d0d5dd);border-radius:10px;font:inherit;min-width:200px}
.admin-actions a{margin-right:10px;white-space:nowrap}
.source-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;border:1px solid var(--border,#e4e7ec);border-radius:10px;margin-bottom:8px;cursor:pointer}
.source-row.selected{border-color:#c00;box-shadow:0 0 0 2px rgba(204,0,0,.12)}
.source-row .src-name{font-weight:600;color:var(--teal-text,#1d4ed8)}
.creds-box{background:#fff8e6;border:1px solid #f0c36d;border-radius:10px;padding:12px 14px;margin-top:12px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;color:#3a2f12}
.creds-box code{font-weight:700}
.dropzone{border:2px dashed var(--border,#d0d5dd);border-radius:12px;padding:18px;background:var(--surface-hover,#fafbfc)}
.email-pill{display:inline-flex;align-items:center;gap:6px;background:#eef2ff;color:#3538cd;border-radius:999px;padding:4px 10px;margin:3px;font-size:13px}
.email-pill button{background:none;border:none;cursor:pointer;color:#3538cd;font-size:15px;line-height:1}
.toolbar{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:8px 0}

/* C4: skip-link (пропустить навигацию) — виден только при фокусе с клавиатуры. */
.skip-link{position:absolute;left:8px;top:-48px;z-index:1000;background:var(--teal-deep);color:#fff;padding:10px 16px;border-radius:8px;transition:top .15s ease}
.skip-link:focus{top:8px;outline:2px solid #fff;outline-offset:2px}

/* D2: модалка выбора полей выгрузки (native <details>). */
.export-pop{position:relative}
.export-pop>summary{list-style:none;cursor:pointer}
.export-pop>summary::-webkit-details-marker{display:none}
.export-pop .export-fields{position:absolute;right:0;z-index:30;box-shadow:var(--shadow-card)}

/* C2: на тёмной теме первичный текст внутри карточек/панелей — светлый. */
:root[data-theme="dark"] .card, :root[data-theme="dark"] .panel{color:var(--ink)}
