@import url("/static/fonts/montserrat.css");

@font-face {
  font-family: 'Furore';
  src: url('/static/fonts/Furore.woff') format('woff');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --blue: #0463FD;
  --blue-dark: #0450d0;
  --blue-soft: #E8F0FF;
  --ink: #000000;
  --paper: #FFFFFF;
  --bg: #F1F1EE;
  --line: #E3E3DE;
  --muted: #82827E;
  --green: #1B9C57;
  --green-soft: #E7F5ED;
  --red: #D93B47;
  --red-soft: #FBEAEB;
  --amber: #C98A05;
  --amber-soft: #FDF3DF;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.05);
  --sidebar: 252px;
  --head: 'Furore', 'Montserrat', Arial, sans-serif;
  --text: 'Montserrat', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 14px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--head); font-weight: 600; margin: 0; letter-spacing: .01em; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
[hidden] { display: none !important; }

.mono-num { font-variant-numeric: tabular-nums; font-family: var(--text); white-space: nowrap; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }

/* ------------------------------------------------------------- вход ---- */
.login-screen {
  min-height: 100vh; min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--ink);
  background-image: radial-gradient(circle at 50% 0%, #14213d 0%, #000 60%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--paper);
  border-radius: 20px;
  padding: 38px 34px 30px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  text-align: center;
}
.login-card .logo { width: 84px; height: 84px; margin: 0 auto 18px; }
.login-card .logo svg, .sidebar .brand .brand-mark svg { width: 100%; height: 100%; display: block; }
.login-card h1 { font-size: 19px; line-height: 1.3; text-transform: uppercase; }
.login-card .sub { color: var(--muted); font-size: 12px; margin: 8px 0 26px; letter-spacing: .04em; text-transform: uppercase; }
.login-card .field { text-align: left; }

.spin { animation: spin 12s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ каркас ---- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar);
  background: var(--ink); color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: calc(22px + env(safe-area-inset-top)) 20px 20px;
  color: inherit; text-decoration: none; transition: opacity .15s;
}
.sidebar .brand:hover { opacity: .82; }
.sidebar .brand img, .sidebar .brand .brand-mark { width: 42px; height: 42px; flex: 0 0 42px; }
.sidebar .brand b { font-family: var(--head); font-size: 13px; line-height: 1.25; text-transform: uppercase; font-weight: 600; }
.sidebar .brand span { display: block; font-family: var(--text); font-size: 10px; color: #8b8b8b; letter-spacing: .08em; margin-top: 3px; }

.nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: #C9C9C9; font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav a:hover { background: #191919; color: #fff; }
.nav a.active { background: var(--blue); color: #fff; }

.sidebar .foot { margin-top: auto; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
.sidebar .who {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  background: #151515; border: 1px solid #232323; border-radius: 12px;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.sidebar .who:hover { background: #1c1c1c; border-color: #333; }
.ico-btn {
  width: 28px; height: 28px; flex: 0 0 28px; border: 0; border-radius: 8px;
  background: transparent; color: #8b8b8b; cursor: pointer; display: grid; place-items: center;
}
.ico-btn:hover { background: #232323; color: #fff; }
.ico-btn svg { width: 16px; height: 16px; }
.ico-btn.spin svg { animation: spin 1s linear infinite; }
.ico-btn:disabled { cursor: default; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: grid; place-items: center; overflow: hidden;
  font-family: var(--head); font-size: 12px; flex: 0 0 34px;
  background-size: cover; background-position: center;
}
.avatar.dark { background-color: var(--ink); }
.who .nm { font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-note { font-size: 10px; color: #7a7a7a; margin-top: 2px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  min-height: 68px; flex: 0 0 auto;
  background: var(--paper); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: env(safe-area-inset-top) 26px 0;
  padding-right: max(26px, env(safe-area-inset-right));
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 17px; text-transform: uppercase; }
.topbar .today { color: var(--muted); font-size: 12px; }
.content { padding: 26px; max-width: 1560px; width: 100%; }

.burger { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--ink); }
.burger svg { width: 22px; height: 22px; display: block; }

/* ------------------------------------------------------- компоненты ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: #FAFAF8; border-color: #d3d3cd; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #1c1c1c; border-color: #1c1c1c; }
.btn-danger { color: var(--red); border-color: #f0c9cb; background: #fff; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #EDEDE9; border-color: transparent; }

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }

.grid { display: grid; gap: 18px; }
/* Без этого элементы сетки не сжимаются и растягивают страницу вбок */
.grid > *, .stat-carousel, .card { min-width: 0; }
.line { min-width: 0; }
.line > .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.cols-2 { grid-template-columns: 1.55fr 1fr; align-items: start; }
.cols-half { grid-template-columns: 1fr 1fr; align-items: start; }

/* Компактная полоса показателей вместо крупных плиток */
.stat-carousel { position: relative; min-width: 0; max-width: 100%; }
.stat-strip {
  display: flex; overflow-x: auto; scroll-behavior: smooth; min-width: 0;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity; scrollbar-width: none; -ms-overflow-style: none;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
.stat-strip::-webkit-scrollbar { display: none; }
.stat {
  flex: 1 0 200px; min-width: 200px; scroll-snap-align: start;
  padding: 14px 18px; border-left: 1px solid var(--line);
}
.stat-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.stat-nav svg { width: 16px; height: 16px; }
.stat-nav:hover { border-color: var(--blue); color: var(--blue); }
.stat-nav.prev { left: -10px; }
.stat-nav.next { right: -10px; }

.stat-dots { display: none; justify-content: center; gap: 6px; margin-top: 8px; }
.stat-dots i {
  width: 5px; height: 5px; border-radius: 50%; background: #d3d3cd; transition: background .2s, width .2s;
}
.stat-dots i.on { background: var(--blue); width: 16px; border-radius: 3px; }
.stat-carousel.scrollable .stat-dots { display: flex; }
.stat:first-child { border-left: 0; }
.stat .lb {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 600;
}
.stat .vl {
  font-family: var(--text); font-weight: 700; font-size: 24px; line-height: 1.1;
  margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.stat .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.kpi .lb { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.kpi .vl {
  font-family: var(--text); font-weight: 700; letter-spacing: -.02em;
  font-size: 26px; margin-top: 10px; line-height: 1.1;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.num { font-family: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .hint { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.kpi.accent { background: var(--ink); border-color: var(--ink); color: #fff; }
.kpi.accent .lb { color: #9a9a9a; }
.kpi.accent .hint { color: #9a9a9a; }
.kpi.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.kpi.blue .lb, .kpi.blue .hint { color: rgba(255,255,255,.75); }
.pos { color: var(--green); }
.neg { color: var(--red); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: #EFEFEB; color: #55554F;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 600; padding: 0 12px 10px; border-bottom: 1px solid var(--line);
}
.tbl td { padding: 12px; border-bottom: 1px solid #F0F0EC; font-size: 13px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #FAFAF7; }
.tbl .acts { opacity: 0; transition: opacity .15s; white-space: nowrap; }
.tbl tr:hover .acts { opacity: 1; }
.tbl-wrap { overflow-x: auto; margin: 0 -20px -20px; padding: 0 20px 4px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.input, .field input, .field select, .field textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(4,99,253,.12);
}
.field .hint { font-size: 11px; color: var(--muted); margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row > * { min-width: 0; }               /* ячейка сетки не раздувается под содержимое */
/* iPhone: у полей даты и времени своя ширина по содержимому, width: 100% они не слушают
   и вылезают за сетку. Сбрасываем нативное оформление — поле становится обычным. */
.field input[type=date], .field input[type=datetime-local], .field input[type=time], .field input[type=month],
input.input[type=date], input.input[type=datetime-local], input.input[type=time], input.input[type=month] {
  -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left;
}
.field input::-webkit-date-and-time-value, .input::-webkit-date-and-time-value { text-align: left; margin: 0; }
/* без нативного оформления текст даты липнет к верху — центрируем высотой строки (поле 40px, на телефоне 44px) */
.field input[type=date], .field input[type=datetime-local], .field input[type=time], .field input[type=month],
input.input[type=date], input.input[type=datetime-local], input.input[type=time], input.input[type=month] { line-height: 38px; }
.field input::-webkit-datetime-edit, .input::-webkit-datetime-edit { padding: 0; line-height: inherit; }
@media (max-width: 860px) {
  .field input[type=date], .field input[type=datetime-local], .field input[type=time], .field input[type=month],
  input.input[type=date], input.input[type=datetime-local], input.input[type=time], input.input[type=month] { line-height: 42px; }
}
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; }
.check input { width: 17px; height: 17px; accent-color: var(--blue); cursor: pointer; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters .input, .filters select { width: auto; min-width: 150px; height: 38px; }
/* Таблицы плана доходов и расходов: без фиксированной раскладки колонка «Статья»
   забирает всю ширину и суммы уезжают за край карточки.
   (Класс .budget-tbl занят таблицей смет — у неё своя минимальная ширина.) */
.plan-tbl { table-layout: fixed; width: 100%; }
.plan-tbl td:first-child { word-break: break-word; }
.plan-tbl th.right, .plan-tbl td.right { width: 112px; }
/* Подсказка на графике: сумма прямо под курсором, без ожидания системного tooltip */
.chart-box { position: relative; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--ink); color: #fff; border-radius: 10px; padding: 8px 10px;
  font-size: 12px; line-height: 1.45; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
}
.chart-tip b { display: block; font-weight: 600; font-size: 10.5px; color: rgba(255,255,255,.65);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.chart-tip span { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.chart-tip i { width: 7px; height: 7px; border-radius: 2px; flex: 0 0 7px; }

/* Группы «Доходы» и «Расходы» внутри общей таблицы плана */
.plan-tbl .plan-group td {
  background: #F6F6F2; font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
  padding-top: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--line);
}
.plan-tbl .plan-group td.mono-num { font-size: 12.5px; letter-spacing: 0; }
.plan-tbl tbody tr.plan-group:hover td { background: #EFEFEA; }
.plan-tbl tr.plan-group { cursor: pointer; }
.plan-caret {
  display: inline-flex; width: 14px; height: 14px; margin-right: 6px;
  vertical-align: -2px; color: var(--muted); transition: transform .15s;
}
.plan-caret svg { width: 14px; height: 14px; }
.plan-caret.open { transform: rotate(90deg); }
.plan-tbl .plan-total td {
  border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 700;
  padding-top: 12px; font-size: 13px;
}
.plan-tbl .plan-total td:last-child { color: var(--muted); font-weight: 600; font-size: 12px; }

/* Панель месяца в бюджете: стрелки и название всегда в одной строке */
.month-bar { gap: 8px; }
.month-nav { gap: 4px; flex: 0 0 auto; }
.month-name {
  font-family: var(--head); font-size: 15px; text-transform: uppercase;
  min-width: 168px; text-align: center; white-space: nowrap;
}

/* Остатки на счетах */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.acc {
  border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px;
  background: var(--paper); min-width: 0; transition: border-color .15s;
  /* колонка: название сверху, сумма посередине, держатель всегда прижат к низу —
     тогда плашки с длинными названиями не сбивают общую линию */
  display: flex; flex-direction: column;
}
.acc:hover { border-color: #d6d6d0; }
.acc.debt { background: #FFFBF2; border-color: #F0E4CC; }
.acc.total { background: var(--ink); border-color: var(--ink); color: #fff; }
.acc-lb {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em; line-height: 1.35;
  color: var(--muted); font-weight: 600; min-height: 27px;   /* две строки названия */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.acc.total .acc-lb, .acc.total .acc-hint { color: rgba(255,255,255,.6); }
.acc-vl { font-family: var(--text); font-weight: 700; font-size: 20px; margin-top: 6px;
  letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acc-vl.amber { color: var(--amber); }
.acc-vl.neg { color: var(--red); }
.acc-hint { font-size: 11px; color: var(--muted); margin-top: auto; padding-top: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Слой на время ожидания ответа: перехватывает повторные тапы */
.busy-veil {
  position: fixed; inset: 0; z-index: 200; background: rgba(20,20,18,.18);
  display: grid; place-items: center; cursor: progress;
  animation: veil-in .18s ease-out;
}
.busy-veil i {
  width: 46px; height: 46px; border-radius: 14px; background: var(--paper);
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
  display: block; position: relative;
}
.busy-veil i::after {
  content: ""; position: absolute; inset: 12px; border-radius: 50%;
  border: 2.5px solid rgba(0,0,0,.12); border-top-color: var(--blue);
  animation: spin .7s linear infinite;
}
@keyframes veil-in { from { opacity: 0 } to { opacity: 1 } }

/* Поле пароля с кнопкой «показать» */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  border-radius: 8px; padding: 0;
}
.pw-eye svg { width: 18px; height: 18px; }
.pw-eye:hover { color: var(--ink); background: #EDEDE9; }

.search { position: relative; }
.search input { padding-left: 36px; min-width: 230px; }
/* поиск занимает всю свободную ширину строки фильтров */
.filters .search.grow { flex: 1 0 100%; }   /* поиск — на всю ширину строки фильтров */
.filters .search.grow input { width: 100%; min-width: 0; }
.search svg { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--muted); }

.segmented {
  display: inline-flex; background: #EDEDE9; border-radius: 10px; padding: 3px; gap: 2px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500; cursor: pointer; color: #55554F;
}
.segmented button.on { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ------------------------------------------------------- изображения ---- */
.img-field { display: flex; gap: 14px; align-items: flex-start; }
.img-prev {
  width: 108px; flex: 0 0 108px; border-radius: 11px;
  border: 1px dashed var(--line); background: #FAFAF8;
  background-size: cover; background-position: center;
  display: grid; place-items: center; overflow: hidden;
}
.img-prev span { font-size: 11px; color: var(--muted); }
.img-acts { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.poster-wide {
  width: 100%; max-height: 420px; border-radius: 12px; border: 1px solid var(--line);
  background: #F5F5F1 center / contain no-repeat; aspect-ratio: 16 / 10; margin-bottom: 16px;
}

.copy-row { display: flex; align-items: center; gap: 8px; }
.copy-btn {
  border: 1px solid var(--line); background: var(--paper); border-radius: 8px;
  width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer; color: var(--muted);
  flex: 0 0 28px;
}
.copy-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
a.copy-btn { text-decoration: none; }
a.copy-btn.tg { color: #229ED9; border-color: #cfe9f7; }
a.copy-btn.tg:hover { background: #e8f5fd; border-color: #229ED9; }
.copy-btn svg { width: 14px; height: 14px; }

.page-head {
  display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h2 { font-size: 20px; text-transform: uppercase; }
.page-actions { display: flex; gap: 10px; }
.budget-tbl td { padding: 8px 6px; }
.budget-tbl .input { height: 36px; }
.budget-tbl thead th { padding-bottom: 8px; }

.date-tile {
  flex: 0 0 46px; width: 46px; text-align: center; border-radius: 9px; padding: 6px 0;
  background: var(--blue-soft); color: var(--blue);
}
.date-tile .d { font-family: var(--text); font-weight: 700; font-size: 16px; line-height: 1; }
.date-tile .m { font-size: 9px; text-transform: uppercase; margin-top: 2px; letter-spacing: .04em; }
.date-tile.amber { background: var(--amber-soft); color: var(--amber); }
.date-tile.grey { background: #EFEFEB; color: #6f6f69; }

.list-scroll { max-height: 340px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.line { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #F0F0EC; }
.line:last-child { border-bottom: 0; }
.line.clickable { cursor: pointer; border-radius: 8px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
.line.clickable:hover { background: #FAFAF7; }

/* --------------------------------------------------------- сканер ------ */
/* Заявки с сайта */
.tab-count {
  display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 4px;
  border-radius: 999px; background: var(--blue); color: #fff;
  font-size: 11px; font-weight: 700; vertical-align: 1px;
}
.lead-list { display: flex; flex-direction: column; gap: 8px; }
.lead {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--paper);
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.lead:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.lead.fresh { border-left: 3px solid var(--blue); }
.lead-main { flex: 1; min-width: 0; }
.lead-text {
  font-size: 12.5px; color: #55554F; line-height: 1.5; margin-top: 6px;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.lead-side { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.lead-go { color: var(--muted); display: grid; place-items: center; }
.lead-go svg { width: 18px; height: 18px; }
.lead-raw {
  background: #FAFAF8; border-radius: 10px; padding: 10px 12px;
  font-size: 12px; line-height: 1.6; max-height: 200px; overflow: auto;
}
.lead-raw div { display: flex; gap: 8px; }
.lead-raw span { color: var(--muted); flex: 0 0 38%; word-break: break-word; }

.guide { margin: 0; padding-left: 20px; font-size: 12.5px; line-height: 1.65; color: #3a3a36; }
.guide li { margin-bottom: 9px; }
.guide li b { color: var(--ink); }

/* Канбан по заявкам */
.board {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px;
  scrollbar-width: thin; align-items: flex-start;
}
.board-col {
  flex: 0 0 260px; width: 260px; background: #F5F5F1;
  border-radius: 12px; padding: 10px; min-height: 120px;
}
.board-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; padding: 2px 4px 10px;
}
.board-count {
  background: var(--paper); border-radius: 999px; padding: 1px 8px;
  font-size: 11px; color: var(--ink);
}
.board-body { display: flex; flex-direction: column; gap: 8px; min-height: 60px; border-radius: 10px; }
.board-body.over { background: var(--blue-soft); outline: 2px dashed var(--blue); outline-offset: 2px; }
.board-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.board-card:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.board-card.dragging { opacity: .45; }
.board-name { font-weight: 600; font-size: 13px; }
.board-text {
  font-size: 11.5px; color: #55554F; line-height: 1.45; margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.board-foot {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 8px; font-size: 11px; color: var(--muted); min-width: 0;
}
.board-phone { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.board-foot .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-reason {
  margin-top: 6px; padding: 4px 8px; border-radius: 7px;
  background: var(--red-soft); color: var(--red);
  font-size: 10.5px; font-weight: 600; line-height: 1.35;
}
.board-empty { font-size: 11.5px; color: #a8a8a2; padding: 10px 4px; }

/* Выбор мероприятия — первый шаг регистрации */
.pick-list { display: flex; flex-direction: column; gap: 10px; }
.pick-event {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 10px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--paper); cursor: pointer; font-family: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
@media (hover: hover) and (pointer: fine) {
  .pick-event:hover { border-color: var(--blue); box-shadow: var(--shadow); transform: translateY(-1px); }
}
.pick-poster {
  width: 56px; height: 56px; flex: 0 0 56px; border-radius: 10px;
  background: #EFEFEB center/cover;
}
.pick-body { flex: 1; min-width: 0; }
.pick-date {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600;
}
.pick-title {
  font-weight: 600; font-size: 14px; line-height: 1.3; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.pick-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-go { color: var(--muted); flex: 0 0 20px; }
.pick-go svg { width: 20px; height: 20px; }

.checkin-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}

.scanner {
  position: relative; border-radius: 14px; overflow: hidden;
  background: #111; min-height: 240px; display: grid; place-items: center;
}
.scanner video { width: 100%; max-height: 380px; object-fit: cover; display: block; }
.scanner-idle { padding: 28px 20px; text-align: center; color: #fff; }
.scanner-icon { color: #fff; opacity: .5; margin-bottom: 12px; }
.scanner-icon svg { width: 40px; height: 40px; }
.note-line { background: var(--amber-soft); border-radius: 12px; padding: 10px 12px; font-size: 12.5px;
  line-height: 1.55; color: #7A5600; margin-bottom: 14px; }

/* Меню «Ещё» в панели раздела */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; padding: 6px;
  max-width: calc(100vw - 24px);
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.menu button {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 0; border-radius: 9px;
  background: none; font: 600 13px var(--text); color: var(--ink); text-align: left; cursor: pointer;
}
.menu button:hover { background: #F4F4F0; }
.menu svg { width: 16px; height: 16px; flex: 0 0 16px; }

/* Выбор категорий резидента: чипы, до трёх */
.cat-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-pick label { position: relative; cursor: pointer; }
.cat-pick input { position: absolute; opacity: 0; pointer-events: none; }
.cat-pick span { text-transform: none; letter-spacing: normal; display: inline-block; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper); font-size: 12.5px; font-weight: 600; transition: background .15s, border-color .15s; }
.cat-pick input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.cat-pick input:disabled + span { opacity: .4; cursor: default; }
.cat-pick input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Оплаты мероприятия, не разнесённые по статьям сметы */
.est-loose {
  margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: var(--amber-soft);
  color: #7A5600; font-size: 12px; line-height: 1.5;
}

/* Резидент подключил автосписание взноса */
.autopay {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 2px 7px;
  border-radius: 999px; background: var(--green-soft); color: var(--green);
  font-size: 10.5px; font-weight: 700;
}
.autopay svg { width: 11px; height: 11px; }

/* Тестеры онлайн-оплаты: выбранные резиденты тегами */
.tester-chip {
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
  font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.tester-chip:hover { border-color: var(--red); color: var(--red); }

/* Плашка «раздел в разработке» */
.dev-alert {
  margin-bottom: 14px; padding: 11px 14px; border-radius: 12px; border: 1px solid #F5D98A;
  background: var(--amber-soft); color: #7A5600; font-size: 13px; line-height: 1.5;
}

/* Статистика: панель периода, ровная сетка, сворачиваемые блоки */
.period-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 18px; }
.period-bar .input[type=date] { width: auto; height: 36px; }
/* равные отступы между виджетами: расстояние задаёт поток, у карточек своих отступов нет */
.stats-flow { display: flex; flex-direction: column; gap: 18px; }
.stats-flow > .card, .stats-flow > .stat-carousel, .stats-flow > .grid { margin: 0; }
.stats-flow .card + .card { margin-top: 0; }
.stats-grid { grid-template-columns: 1fr 1fr; align-items: stretch; }
.stat-period { width: 132px; flex: 0 0 132px; height: 32px; font-size: 12.5px; padding: 0 8px; }
/* шапка виджета: заголовок слева, дальше пометка и легенда, селект периода всегда справа.
   Не хватило ширины — строка переносится, заголовок не обрезается. */
.stats-flow .card-head { flex-wrap: wrap; gap: 8px 10px; }
.stats-flow .card-head h3 { flex: 1 1 220px; }
.stats-flow .card-head .stat-note { font-size: 12px; }
.stats-flow .card-head .chart-legend { margin: 0 0 0 auto; }
.stats-flow .card-head .stat-period { margin-left: auto; }   /* селект всегда у правого края, даже на своей строке */
.line-btn { width: 100%; background: none; border: 0; border-bottom: 1px solid #F0F0EC; text-align: left;
  font: inherit; color: inherit; cursor: pointer; }
.line-btn:hover { background: #FAFAF7; }
.line-btn svg { width: 15px; height: 15px; color: var(--muted); flex: 0 0 15px; }
@media (max-width: 720px) {
  .stats-flow .card-head h3 { flex: 1 1 100%; }
  .stats-flow .card-head .stat-note { order: 2; }
  .stats-flow .card-head .chart-legend { margin-left: 0; width: 100%; order: 3; }
  .stat-period { width: 100%; flex: 1 1 100%; height: 36px; order: 4; }
}
.stats-grid > .card { margin-top: 0; display: flex; flex-direction: column; }
.stats-grid > .card > .tbl-wrap, .stats-grid > .card > .bars { flex: 1; }
.fold-more { margin-top: 12px; width: 100%; justify-content: center; }
.fold-group + .fold-group { margin-top: 10px; }
.fold-head {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; cursor: pointer; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper);
  font: 600 13px var(--text); color: var(--ink);
}
.fold-head b { font-variant-numeric: tabular-nums; }
.fold-head svg { width: 16px; height: 16px; transition: transform .15s; }
.fold-group.open .fold-head svg { transform: rotate(90deg); }
.fold-group.open .fold-head { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.fold-body { display: none; padding: 14px 12px 4px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; }
.fold-group.open .fold-body { display: block; }
@media (max-width: 860px) { .stats-grid { grid-template-columns: 1fr; } }

/* Статистика: графики по месяцам с подсказкой у курсора */
.stat-chart { position: relative; }
.stat-chart [data-i] { cursor: default; }
.stat-chart [data-i].hover { fill: rgba(4, 99, 253, .05); }
.chart-legend { display: flex; gap: 16px; margin: -4px 0 8px; font-size: 12px; color: #55554F; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i, .stat-tip i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.stat-tip {
  position: absolute; z-index: 3; pointer-events: none; min-width: 170px; padding: 9px 11px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  font-size: 12px; line-height: 1.5; color: var(--ink);
}
.stat-tip b { display: block; margin-bottom: 3px; color: var(--ink); font-size: 12px; }
.stat-tip div { display: flex; align-items: center; gap: 6px; }
.stat-tip div span { margin-left: auto; padding-left: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-tip small { display: block; color: var(--muted); margin-top: 3px; }
.people-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); column-gap: 18px; }

/* Смета мероприятия: итоги, полоса оплаты, статьи строками */
.est-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.est-totals > div { background: #FAFAF7; border: 1px solid #EFEFEA; border-radius: 12px; padding: 11px 13px; }
.est-totals small { display: block; font-size: 11px; color: var(--muted); }
.est-totals b { display: block; font-size: 16px; margin-top: 3px; }
.est-bar { height: 6px; border-radius: 3px; background: #EDEDE9; overflow: hidden; margin: 12px 0 6px; }
.est-bar i { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.est-list { display: flex; flex-direction: column; }
.est-item { display: flex; align-items: flex-start; gap: 14px; padding: 12px 0; border-bottom: 1px solid #F0F0EC; }
.est-item:last-child { border-bottom: 0; }
.est-name { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.est-note { font-size: 11.5px; margin-top: 3px; }
.est-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: 0 0 auto; text-align: right; }
.est-sum { font-weight: 700; font-size: 14px; }
@media (max-width: 520px) {
  .est-totals { grid-template-columns: 1fr 1fr; }
  .est-totals > div:last-child { grid-column: 1 / -1; }
}

/* Затраты на участника мероприятия */
.cost-sum { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.cost-sum > div { display: flex; flex-direction: column; }
.cost-sum b { font: 700 26px/1.1 var(--text); font-variant-numeric: tabular-nums; }
.cost-sum small { color: var(--muted); font-size: 11.5px; margin-top: 4px; }

/* Оценка мероприятия: средний балл и распределение 5→1 */
.rate-sum { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.rate-avg { display: flex; flex-direction: column; min-width: 120px; }
.rate-avg b { font: 700 34px/1 var(--text); }
.rate-stars { color: #F2B31B; font-size: 17px; letter-spacing: 2px; margin-top: 4px; }
.rate-avg small { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.rate-dist { flex: 1; min-width: 200px; display: grid; gap: 5px; }
.rate-row { display: grid; grid-template-columns: 14px 1fr 26px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.rate-row i { height: 8px; border-radius: 4px; background: #EFEFEB; overflow: hidden; }
.rate-row em { display: block; height: 100%; background: #F2B31B; border-radius: 4px; }
.rate-row span:last-child { text-align: right; }

/* Совет на регистрации: отметка одним касанием по имени */
.council-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.council-chip {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px 8px 9px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper);
  font: 600 13px/1.25 var(--text); color: var(--ink); text-align: left; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.council-chip span { flex: 1; min-width: 0; }
.council-chip small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); margin-top: 1px; }
.council-chip.on small { color: inherit; opacity: .75; }
.council-chip svg { width: 18px; height: 18px; flex: 0 0 18px; }
.council-chip:hover:not(.on):not(:disabled) { border-color: var(--blue); }
.council-chip.on { background: var(--green-soft); border-color: transparent; color: var(--green); cursor: default; }
.council-chip:disabled { cursor: default; opacity: .6; }
@media (max-width: 520px) { .council-grid { grid-template-columns: 1fr 1fr; } .council-chip { font-size: 12px; } }

.scan-result {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 4;
  padding: 12px 14px; border-radius: 12px; background: var(--paper);
  box-shadow: 0 8px 26px rgba(0,0,0,.3);
}
.scan-result.ok { border-left: 4px solid var(--green); }
.scan-result.warn { border-left: 4px solid var(--amber); }
.scan-result.err { border-left: 4px solid var(--red); color: var(--red); }

/* --------------------------------------------------------- модалка ---- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 28px 20px; z-index: 100;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--paper); border-radius: 18px; width: 100%; max-width: 560px;
  max-height: calc(100vh - 56px);
  display: flex; flex-direction: column;
  box-shadow: 0 30px 90px rgba(0,0,0,.35); animation: pop .16s ease-out;
}
.modal.wide { max-width: 820px; }
/* форма внутри окна тоже колонка — иначе тело не прокручивается, а кнопки уезжают */
.modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-head { flex: 0 0 auto; }
.modal-foot { flex: 0 0 auto; }
@keyframes pop { from { transform: translateY(-8px); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15px; text-transform: uppercase; }
.modal-body { padding: 22px 24px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  padding: 16px 24px; border-top: 1px solid var(--line); background: #FBFBF9;
  border-radius: 0 0 18px 18px;
}

.toast-wrap { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink); color: #fff; padding: 13px 18px; border-radius: 11px;
  font-size: 13px; box-shadow: 0 12px 34px rgba(0,0,0,.28); max-width: 380px;
  animation: pop .16s ease-out;
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

.err-msg { background: var(--red-soft); color: var(--red); padding: 11px 14px; border-radius: 10px; font-size: 12.5px; margin-bottom: 16px; }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); font-size: 13px; }
.empty b { display: block; font-family: var(--head); color: var(--ink); font-size: 14px; margin-bottom: 8px; text-transform: uppercase; }

/* --------------------------------------------------------- графики ---- */
.chart { width: 100%; overflow-x: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 12px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; }
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 1fr 96px; gap: 12px; align-items: center; font-size: 12.5px; }
.bar-track { height: 8px; background: #EDEDE9; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--blue); }

/* ------------------------------------------------------- резиденты ---- */
/* Тач: отключаем ожидание двойного тапа (иначе первый тап «пропадает»)
   и синюю подсветку при касании. */
.person, .pick-event, .line.clickable, .clickable, [data-open], [data-lead],
.btn, .tab, .segmented button, .tabs button, .pw-eye, .copy-btn {
  touch-action: manipulation; -webkit-tap-highlight-color: rgba(0,0,0,.06);
}

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }
.person {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s;
}
/* На тач-экранах :hover «залипает»: первый тап уходит на наведение, карточка
   сдвигается под пальцем и клик не доходит до обработчика. Только для мыши. */
@media (hover: hover) and (pointer: fine) {
  .person:hover { border-color: var(--blue); box-shadow: var(--shadow); transform: translateY(-2px); }
}
.person .top { display: flex; gap: 12px; align-items: center; margin-bottom: 13px; }
.person .ava {
  width: 46px; height: 46px; border-radius: 50%; flex: 0 0 46px;
  background: var(--ink); color: #fff; display: grid; place-items: center;
  font-family: var(--head); font-size: 15px; background-size: cover; background-position: center;
}
.person .nm { font-weight: 600; font-size: 14px; line-height: 1.25; }
.person .co { font-size: 12px; color: var(--muted); margin-top: 3px; }
.person .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.person .deed { font-size: 12.5px; line-height: 1.5; color: #55554F;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* -------------------------------------------------------- календарь ---- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cal .dow { background: #FBFBF9; padding: 9px; text-align: center; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.cal .day { background: var(--paper); min-height: 108px; padding: 8px; }
.cal .day.out { background: #FAFAF8; }
.cal .day .n { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.cal .day.today .n { background: var(--blue); color: #fff; width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; }
.ev {
  background: var(--blue-soft); color: var(--blue); border-left: 3px solid var(--blue);
  padding: 4px 6px; border-radius: 5px; font-size: 11px; margin-bottom: 4px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500;
}
.ev:hover { background: #d9e6ff; }
.ev.done { background: #EFEFEB; color: #55554F; border-left-color: #9a9a94; }
.ev.cancelled { background: var(--red-soft); color: var(--red); border-left-color: var(--red); text-decoration: line-through; }

.perm-grid { display: flex; flex-direction: column; gap: 8px; }
.perm-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 11px 14px; border: 1px solid var(--line); border-radius: 11px; }
.perm-row.on { border-color: var(--blue); background: #F7FAFF; }

.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button {
  border: 0; background: none; padding: 0 0 12px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.on { color: var(--ink); border-bottom-color: var(--blue); font-weight: 600; }

.skeleton { background: linear-gradient(90deg, #EDEDE9 25%, #F5F5F1 50%, #EDEDE9 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (max-width: 1280px) {
  :root { --sidebar: 218px; }
  .content { padding: 20px; }
}
@media (max-width: 1100px) {
  .cols-2, .cols-half, .cols-tickets { grid-template-columns: 1fr; }
  /* карточка резидента на телефоне: короткие поля в два столбца, пустые прячем */
  .modal .cols-half { grid-template-columns: 1fr 1fr; }
  .modal .cols-half .kv-empty { display: none; }
  .modal .cols-half > div { overflow-wrap: anywhere; }   /* длинный ник или почта переносятся */
  /* меню «Ещё» не должно уезжать за край экрана */
  .filters { position: relative; }
  .filters .menu-wrap { position: static; }
  .filters .menu { left: 0; right: 0; width: auto; min-width: 0; top: calc(100% + 6px); }

  .kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
}
@media (max-width: 900px) {
  .hide-md { display: none !important; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .22s;
    box-shadow: 0 0 60px rgba(0,0,0,.4);
  }
  .sidebar.open { transform: none; }
  .burger { display: inline-flex; }
  .content { padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .field-row { grid-template-columns: 1fr; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; }

  /* Safari на iPhone зумит страницу при фокусе в поле мельче 16px
     и обратно масштаб уже не возвращает — держим ровно 16px. */
  .input, .field input:not([type=checkbox]):not([type=radio]),
  .field select, .field textarea, .search input, .login-card input {
    font-size: 16px;
  }
  .input:not(textarea), .field input:not([type=checkbox]):not([type=radio]),
  .field select, .search input, .login-card input { height: 44px; }
  .field textarea { height: auto; }

  .topbar { min-height: 58px; padding-left: 16px; padding-right: max(16px, env(safe-area-inset-right)); }
  .topbar h2 { font-size: 14px; }
  .topbar .today { display: none; }
  .card { padding: 16px; border-radius: 12px; }
  .tbl-wrap { margin: 0 -16px -16px; padding: 0 16px 4px; }
  .kpi .vl { font-size: 23px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 12px 14px; min-width: 160px; flex: 0 0 160px; }
  .stat .vl { font-size: 20px; }
  .stat-nav { display: none; }
  .grid { gap: 12px; }

  /* фильтры и кнопки — в полную ширину, удобные для пальца */
  .filters { gap: 8px; }
  .filters .input, .filters select, .search input { min-width: 0; width: 100%; }
  .search { width: 100%; }
  .filters .segmented { width: 100%; }
  .filters .segmented button { flex: 1 0 auto; white-space: nowrap; }
  .filters .btn {
    flex: 1 1 46%; min-width: 0; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis;
  }

  .btn { height: 40px; }
  .btn-icon { width: 36px; height: 36px; }

  .tbl .acts { opacity: 1; }
  .people { grid-template-columns: 1fr 1fr; gap: 12px; }
  .board-col { flex: 0 0 220px; width: 220px; }
  .person { padding: 14px; }

  /* модалки — во весь экран снизу */
  .overlay { padding: 0; align-items: flex-end; }
  .modal, .modal.wide {
    max-width: 100%; border-radius: 16px 16px 0 0;
    max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-foot { border-radius: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  /* на телефоне кнопки ложатся по две в ряд — иначе текст сжимается до нечитаемого */
  .modal-foot .btn { flex: 1 1 calc(50% - 5px); min-width: 0; padding: 0 10px; }
  .modal-foot .btn:only-child { flex-basis: 100%; }

  /* календарь-сетка на телефоне превращается в компактную ленту дней */
  .page-head {
    position: sticky; top: 58px; z-index: 15;
    background: var(--bg); padding: 10px 0; margin: -10px 0 12px;
    flex-direction: column; align-items: stretch; gap: 10px;
  }
  .page-head h2 { font-size: 16px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .budget-tbl { min-width: 560px; }
  .cal .day { min-height: 74px; padding: 5px; }
  .cal .dow { font-size: 9px; padding: 6px 2px; }
  .cal .day .n { font-size: 11px; }
  .ev { font-size: 9.5px; padding: 3px 4px; }
  .img-field { align-items: center; }
  .img-prev { width: 76px; flex: 0 0 76px; }
  .img-acts .hint { margin-top: 0; }
}

@media (max-width: 520px) {
  /* показатели по два в ряд: четыре карточки в столбик занимали весь экран */
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi .vl { font-size: 19px; }
  .kpi .lb { font-size: 9.5px; letter-spacing: .06em; }
  .kpi .hint { font-size: 10.5px; margin-top: 6px; }
  .month-name { min-width: 130px; font-size: 13px; }
  /* в бюджете ужимаем шрифт и разрешаем суммам переноситься,
     иначе колонки не сжимаются и таблица уезжает за экран */
  .plan-tbl th, .plan-tbl td { font-size: 11.5px; padding-left: 4px; padding-right: 4px; }
  .plan-tbl td:first-child, .plan-tbl th:first-child { padding-left: 0; }
  .plan-tbl th.right, .plan-tbl td.right { width: 98px; }
  .people { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
  .content { padding: 12px; }
  .tbl-wrap { margin: 0 -16px -16px; padding: 0 16px 4px; }
}

/* Соцсети в форме резидента: три поля в ряд, на телефоне — друг под другом */
.social-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
@media (max-width: 860px) { .social-row { grid-template-columns: 1fr; } }

/* Открытые мероприятия: шапка карточки и полоса выполнения плана */
.sales-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.sales-title {
  font-family: var(--head); font-size: 17px; line-height: 1.35; text-transform: uppercase;
  letter-spacing: .02em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.sales-head .muted { margin-top: 8px; line-height: 1.5; }
.sales-bar { height: 4px; border-radius: 3px; background: #E6E6E1; margin-top: 10px; overflow: hidden; }
.sales-bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.kpi.accent .sales-bar { background: rgba(255, 255, 255, .22); }
.kpi.accent .sales-bar i { background: #fff; }

/* Регистрация и билеты: камера уже, таблица вкладок шире */
.cols-tickets { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 14px; }
@media (max-width: 1100px) { .cols-tickets { grid-template-columns: minmax(0, 1fr); } }
.cols-tickets > .card { margin-top: 0; }
.cols-tickets > .card .tbl-wrap { margin-bottom: -20px; }
.cols-tickets .tbl { width: 100%; }
/* Карточка открытого мероприятия: равномерный воздух между блоками */
.sales-stack { display: grid; gap: 30px; }
.sales-stack > *, .sales-stack .card { min-width: 0; margin-top: 0; }
/* Статус отправки билета — компактный селект в таблице */
.status-sel { font: inherit; font-size: 12px; font-weight: 600; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; }
.status-sel.ok { color: var(--blue); border-color: #BBD4FF; }
.status-sel.wait { color: var(--amber); border-color: #F0DCA6; }
