:root {
  --navy: #153f63;
  --navy-strong: #0f3150;
  --navy-soft: #eaf2f8;
  --green: #0aa66e;
  --green-soft: #e9f9f2;
  --red: #ef4656;
  --red-soft: #fff0f2;
  --amber: #ee9c19;
  --amber-soft: #fff6e5;
  --blue: #2f6fed;
  --ink: #172235;
  --muted: #718198;
  --line: #e4eaf1;
  --surface: #ffffff;
  --canvas: #f6f8fb;
  --shadow-sm: 0 1px 2px rgba(18, 45, 68, .05), 0 8px 24px rgba(18, 45, 68, .04);
  --shadow-md: 0 18px 48px rgba(18, 45, 68, .10);
  --radius: 20px;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0, rgba(58, 126, 184, .055), transparent 25rem),
    var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }

/* Авторизация */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 15% 20%, rgba(10, 166, 110, .14), transparent 28rem),
    radial-gradient(circle at 85% 80%, rgba(47, 111, 237, .12), transparent 32rem),
    #eef5f8;
}
.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  padding: 38px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 28px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
}
.auth-card h1 { margin: 0; font-size: 31px; letter-spacing: -.03em; }
.auth-card p { margin: 5px 0 0; color: var(--muted); line-height: 1.45; }
.auth-card label { display: grid; gap: 8px; color: #334359; font-size: 13px; font-weight: 750; }
.auth-card input, .search, .date-control input {
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid #dbe3eb;
  border-radius: 13px;
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.auth-card input:focus, .search:focus, .date-control input:focus {
  border-color: #6b9ad0;
  box-shadow: 0 0 0 4px rgba(47,111,237,.10);
}
.password-input { position: relative; display: block; }
.password-input > input { width: 100%; padding-right: 50px; }
.auth-card .password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}
.auth-card .password-toggle:hover { background: var(--navy-soft); color: var(--navy); }
.auth-card .password-toggle:focus-visible { outline: 3px solid rgba(47,111,237,.18); outline-offset: 1px; }
.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.password-eye-closed, .password-toggle[aria-pressed="true"] .password-eye-open { display: none; }
.password-toggle[aria-pressed="true"] .password-eye-closed { display: block; }
.auth-card > button, .primary {
  min-height: 46px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--navy), #18537e);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(21,63,99,.16);
}
.logo-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, #2377b7, #0aae78);
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(19,101,129,.20);
  overflow: hidden;
}
.logo-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: 19px; box-shadow: none; }
.logo-mark.has-image { width: 96px; border-radius: 14px; background: #fff; box-shadow: 0 8px 20px rgba(18,45,68,.12); }
.logo-mark.small.has-image { width: 72px; border-radius: 10px; }
.logo-mark.has-image img { width: 100%; height: 100%; display: block; object-fit: contain; }
.message { min-height: 20px; color: var(--red); font-size: 13px; }

/* Каркас */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 252px;
  display: flex;
  flex-direction: column;
  padding: 24px 15px 18px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  box-shadow: 8px 0 30px rgba(30,54,78,.035);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 27px; }
.brand > span:last-child { min-width: 0; }
.brand.has-brand-image { gap: 10px; }
.brand.has-brand-image small { max-width: 112px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.01em; }
.brand small { max-width: 150px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar nav { display: grid; gap: 7px; }
.nav {
  position: relative;
  min-height: 51px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #66758b;
  text-align: left;
  font-size: 14px;
  font-weight: 750;
  transition: background .16s, color .16s, transform .16s;
}
.nav > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #e2e8ee;
  border-radius: 11px;
  background: #fff;
  color: #334359;
  font-size: 17px;
}
.nav b {
  min-width: 23px;
  padding: 4px 7px;
  border-radius: 99px;
  background: #edf2f6;
  color: #627286;
  font-size: 11px;
  text-align: center;
}
.nav:hover { background: #f1f5f8; color: var(--ink); transform: translateX(2px); }
.nav.active {
  background: linear-gradient(135deg, var(--navy), #1b527d);
  color: #fff;
  box-shadow: 0 12px 25px rgba(21,63,99,.15);
}
.nav.active > span { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.11); color: #fff; }
.nav.active b { background: #b8ff08; color: #17324b; }
.sidebar-footer {
  margin-top: auto;
  padding: 18px 9px 2px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}
.text-button, .link-button { padding: 0; border: 0; background: transparent; color: var(--navy); font-weight: 800; }
.sidebar .text-button { color: var(--red); font-size: 12px; }
main { min-height: 100vh; margin-left: 252px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 23px clamp(22px, 3vw, 46px) 17px;
  border-bottom: 1px solid rgba(228,234,241,.86);
  background: rgba(246,248,251,.88);
  backdrop-filter: blur(16px);
}
.topbar h1 { margin: 0; font-size: clamp(25px, 2vw, 31px); letter-spacing: -.035em; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.online-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.outline {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #34455b;
  font-weight: 750;
  box-shadow: var(--shadow-sm);
}
.menu-button { display: none; border: 0; background: transparent; color: var(--ink); font-size: 25px; }
.view { display: none; width: min(1540px, 100%); margin: 0 auto; padding: 25px clamp(22px, 3vw, 46px) 56px; }
.view.active { display: block; animation: view-in .18s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* Общие компоненты */
.period-row { display: flex; justify-content: space-between; margin: 2px 0 18px; }
.period-row strong, .period-row small { display: block; }
.period-row strong { text-transform: capitalize; }
.period-row small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(190px,1fr)); gap: 15px; margin-bottom: 20px; }
.metric-grid.compact { grid-template-columns: repeat(3,minmax(210px,1fr)); }
.metric {
  position: relative;
  min-height: 142px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.metric::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -28px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--navy-soft);
}
.metric.warning::after { background: var(--amber-soft); }
.metric.success::after { background: var(--green-soft); }
.metric span, .metric small { position: relative; z-index: 1; display: block; color: var(--muted); }
.metric span { font-size: 13px; font-weight: 700; }
.metric strong { position: relative; z-index: 1; display: block; margin: 12px 0 8px; font-size: clamp(25px,2vw,32px); letter-spacing: -.03em; }
.metric small { font-size: 12px; }
.metric[data-overview-detail] { cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.metric[data-overview-detail]:hover { transform: translateY(-3px); border-color: #c8d8e5; box-shadow: 0 14px 30px rgba(18,45,68,.09); }
.metric[data-overview-detail]:focus-visible { outline: 3px solid rgba(47,111,237,.18); outline-offset: 3px; }
.metric-open { position: absolute; z-index: 2; right: 17px; top: 17px; color: #66809a; font-size: 10px; font-style: normal; font-weight: 800; opacity: 0; transform: translateX(-3px); transition: .16s ease; }
.metric[data-overview-detail]:hover .metric-open, .metric[data-overview-detail]:focus-visible .metric-open { opacity: 1; transform: none; }
.two-column, .management-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.panel:not(.table-panel) { padding: 21px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.panel h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.panel p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.stack { display: grid; gap: 9px; }
.row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfd;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.row-card:hover { border-color: #cfdae4; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.row-card strong, .row-card small { display: block; }
.row-card strong { font-size: 14px; }
.row-card small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.trainer-management-row > div:first-child { min-width: 180px; }
.trainer-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.trainer-card-actions .table-action { min-height: 34px; padding: 7px 10px; white-space: nowrap; }
.trainer-card-actions .open { border-color: var(--navy); background: var(--navy); color: #fff; }
.pill { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 99px; background: #eef2f5; color: #607083; font-size: 11px; font-weight: 850; white-space: nowrap; }
.pill.green { background: var(--green-soft); color: #078258; }
.pill.red { background: var(--red-soft); color: #cc3445; }
.pill.amber { background: var(--amber-soft); color: #a86700; }
.section-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.segmented, .status-tabs { display: flex; gap: 4px; overflow-x: auto; }
.segmented { flex: 1; }
.segmented button, .status-tabs button {
  min-height: 38px;
  padding: 9px 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}
.segmented button.active, .status-tabs button.active { background: var(--navy); color: #fff; }
.primary { padding: 10px 17px; white-space: nowrap; }
.primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.public-form-link { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 9px 14px; color: var(--navy); text-decoration: none; white-space: nowrap; }
.lead-origin { display: grid; gap: 5px; margin: 12px 0; padding: 11px 12px; border-radius: 12px; background: #f6f9fb; color: var(--muted); }
.lead-origin span { color: var(--navy); font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.lead-origin small { font-size: 12px; line-height: 1.45; }
.compact-button {
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.funnel {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.funnel div { flex: 1; padding: 16px; border-radius: 14px; background: #f8fafc; }
.funnel span, .funnel strong { display: block; }
.funnel span { color: var(--muted); font-size: 12px; }
.funnel strong { margin-top: 7px; font-size: 26px; }
.funnel i { align-self: center; color: #a8b5c1; font-style: normal; }
.empty-state { padding: 58px 18px; color: var(--muted); text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { margin-bottom: 7px; color: var(--ink); font-size: 19px; }
.date-control { display: flex; align-items: center; gap: 10px; color: #445469; font-size: 13px; font-weight: 750; }
.legend { margin-left: auto; display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend i { width: 10px; height: 10px; border-radius: 50%; }
.legend .green { background: var(--green); }
.legend .red { background: var(--red); }
.legend .gray { background: #d8e0e7; }

/* Таблицы */
.table-panel { overflow: hidden; }
.table-panel .panel-head { padding: 20px 20px 2px; }
.table-wrap { overflow: auto; scrollbar-color: #cdd7e0 transparent; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 14px 16px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 2; background: #f8fafc; color: #728198; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
td { background: #fff; font-size: 13px; }
tbody tr:hover td { background: #f8fbfd; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.action-buttons { display: flex; gap: 6px; }
.action-buttons button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 11px; font-weight: 850; }
.action-buttons .arrive { border-color: #bdebd9; background: var(--green-soft); color: #078258; }
.action-buttons .leave { border-color: #cddbf5; background: #eef4ff; color: #2d61bd; }
.action-buttons .miss { border-color: #ffd1d6; background: var(--red-soft); color: #c93344; }
.search { min-width: 230px; }
.search.wide { flex: 1; }

/* Должники и ученики */
.debt-hero {
  position: relative;
  display: flex;
  gap: 80px;
  margin-bottom: 18px;
  padding: 24px 28px;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(120deg, #153f63, #173e54 65%, #155449);
  color: #fff;
  box-shadow: 0 18px 38px rgba(21,63,99,.16);
}
.debt-hero::after { content: "₸"; position: absolute; right: 34px; top: -21px; color: rgba(255,255,255,.08); font-size: 126px; font-weight: 900; }
.debt-hero span, .debt-hero strong { display: block; }
.debt-hero span { color: #c4d8e4; font-size: 12px; }
.debt-hero strong { margin-top: 7px; font-size: 30px; }
.card-list { display: grid; grid-template-columns: repeat(3,minmax(270px,1fr)); gap: 14px; }
.debtor-card, .student-card {
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.debtor-card { padding: 18px; }
.debtor-card:hover, .student-card:hover { border-color: #cad7e1; transform: translateY(-2px); box-shadow: 0 14px 30px rgba(18,45,68,.08); }
.debtor-card header, .student-card header { display: flex; justify-content: space-between; gap: 12px; }
.debtor-card h3, .student-card h3 { margin: 0; font-size: 15px; }
.debtor-card p, .student-card p { margin: 5px 0; color: var(--muted); font-size: 12px; }
.debtor-card footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.debtor-card footer strong { color: #ca3445; font-size: 16px; }
.whatsapp { padding: 8px 10px; border-radius: 9px; background: var(--green-soft); color: #078258; font-size: 11px; font-weight: 850; text-decoration: none; }
.student-grid { display: grid; grid-template-columns: repeat(2,minmax(320px,1fr)); gap: 12px; }
.student-card { padding: 17px; }
.student-card .details { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.student-card .details > div { min-width: 0; }
.student-card .details span { color: var(--muted); font-size: 10px; }
.student-card .details strong { display: block; margin-top: 4px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.student-card { cursor: pointer; }
.student-card-status { min-width: 0; display: grid; justify-items: end; gap: 8px; }
.student-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.student-card-actions button { min-height: 28px; padding: 5px 8px; border: 1px solid #d5e0e9; border-radius: 8px; background: #fff; color: #516174; font-size: 9px; font-weight: 850; white-space: nowrap; }
.student-card-actions button:hover { border-color: #91b4d8; background: #f3f8ff; color: #265b91; }
.student-card-actions button.open { border-color: #b9d3f3; background: #edf5ff; color: #245d9e; }
.student-card-actions button.student-whatsapp { border-color: #8ddfc2; background: #eafaf4; color: #078258; }
.student-card-actions button.student-whatsapp:hover { border-color: #0aa473; background: #0aa473; color: #fff; }
.student-card-actions button:disabled { opacity: .55; cursor: wait; }
.card-number { display: inline-flex; margin-left: 5px; padding: 3px 7px; border-radius: 7px; background: #eef4ff; color: #315f9e; font-size: 10px; font-weight: 900; vertical-align: middle; letter-spacing: .04em; }
.lead-grid { display: grid; grid-template-columns: repeat(2,minmax(320px,1fr)); gap: 13px; }
.lead-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.lead-card header { display: flex; justify-content: space-between; gap: 12px; }
.lead-card h3 { margin: 0; font-size: 15px; }
.lead-card p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.lead-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.lead-actions button, .table-action {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #405066;
  font-size: 11px;
  font-weight: 800;
}
.lead-actions .positive, .table-action.positive { border-color: #bcebd8; background: var(--green-soft); color: #078258; }
.lead-actions .negative { border-color: #ffd0d6; background: var(--red-soft); color: #c93445; }
.lead-actions .lead-whatsapp { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 7px 11px; border: 1px solid #9ee2ca; border-radius: 9px; background: #0aa473; color: #fff; font-size: 11px; font-weight: 850; text-decoration: none; }
.lead-actions .lead-whatsapp:hover { border-color: #078f64; background: #078f64; }
.lead-actions .lead-whatsapp.disabled { border-color: var(--line); background: #f2f5f7; color: #94a2b2; cursor: not-allowed; }
.lead-actions .primary-action { border-color: var(--navy); background: var(--navy); color: #fff; }

/* Диалоги и рабочие формы */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(14,31,47,.52);
  backdrop-filter: blur(7px);
}
.modal-card {
  width: min(660px,100%);
  max-height: min(88vh,900px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(8,27,43,.25);
}
.modal-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 24px 17px; border-bottom: 1px solid var(--line); }
.modal-card h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.modal-card header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.modal-close { width: 36px; height: 36px; border: 0; border-radius: 11px; background: #f3f6f8; color: #6c7b8d; font-size: 24px; line-height: 1; }
.modal-body { max-height: calc(88vh - 85px); overflow-y: auto; padding: 21px 24px 24px; }
.overview-attendance-filters { position: sticky; z-index: 3; top: -21px; display: grid; gap: 10px; margin: -5px 0 15px; padding: 5px 0 12px; border-bottom: 1px solid var(--line); background: #fff; }
.overview-attendance-filter { min-width: 0; display: grid; grid-template-columns: 62px minmax(0,1fr); align-items: center; gap: 10px; }
.overview-attendance-filter > span { color: #7b8da4; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.overview-attendance-tabs { min-width: 0; display: flex; gap: 7px; overflow-x: auto; padding: 2px 1px 4px; scrollbar-width: thin; }
.overview-attendance-tabs button { flex: 0 0 auto; min-height: 34px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #617187; font-size: 11px; font-weight: 780; white-space: nowrap; }
.overview-attendance-tabs button:hover { border-color: #b9ccdc; color: var(--navy); }
.overview-attendance-tabs button.active { border-color: var(--navy); background: var(--navy); color: #fff; box-shadow: 0 6px 14px rgba(21,63,99,.12); }
.overview-attendance-tabs button b { margin-left: 4px; color: #9aabba; font-size: 9px; }
.overview-attendance-tabs button.active b { color: #b8ff08; }
.overview-detail-context { margin: -2px 0 9px; color: var(--muted); font-size: 10px; }
.overview-detail-loading { min-height: 180px; display: grid; place-content: center; justify-items: center; gap: 7px; color: var(--navy); text-align: center; }
.overview-detail-loading small { color: var(--muted); }
.overview-loading-dot { width: 22px; height: 22px; border: 3px solid #dce8ef; border-top-color: var(--green); border-radius: 50%; animation: overview-spin .75s linear infinite; }
.overview-retry-button { justify-self: center; margin-top: 10px; padding: 8px 12px; border: 0; border-radius: 9px; background: var(--navy); color: #fff; font-weight: 800; }
@keyframes overview-spin { to { transform: rotate(360deg); } }
.overview-detail-summary { display: grid; gap: 4px; margin-bottom: 15px; padding: 16px 18px; border-radius: 15px; background: var(--navy-soft); color: var(--navy); }
.overview-detail-summary.warning { background: var(--amber-soft); color: #996000; }
.overview-detail-summary.success { background: var(--green-soft); color: #087c56; }
.overview-detail-summary span { font-size: 11px; font-weight: 800; }
.overview-detail-summary strong { font-size: 27px; letter-spacing: -.03em; }
.overview-detail-summary small { opacity: .78; font-size: 11px; }
.overview-detail-list { display: grid; gap: 7px; }
.overview-detail-row { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.overview-detail-row > div { min-width: 0; }
.overview-detail-row strong, .overview-detail-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview-detail-row strong { font-size: 12px; }
.overview-detail-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.overview-detail-value { padding: 6px 9px; border-radius: 9px; background: #f1f5f8; color: #526176; font-size: 10px; font-weight: 850; white-space: nowrap; }
.overview-detail-value.green { background: var(--green-soft); color: #078258; }
.overview-detail-value.blue { background: #eef4ff; color: #2861ad; }
.overview-detail-value.amber { background: var(--amber-soft); color: #a86a00; }
.overview-detail-value.red { background: var(--red-soft); color: #c93445; }
.overview-detail-value.gray { background: #f1f5f8; color: #718198; }
.overview-detail-empty { display: grid; gap: 4px; padding: 28px; border: 1px dashed #cbd7e1; border-radius: 14px; text-align: center; }
.overview-detail-empty span { color: var(--muted); font-size: 11px; }
@media (max-width: 620px) {
  .overview-attendance-filter { grid-template-columns: 1fr; gap: 4px; }
  .overview-attendance-filters { top: -21px; }
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: grid; gap: 7px; color: #43536a; font-size: 12px; font-weight: 750; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  min-height: 45px;
  padding: 11px 13px;
  border: 1px solid #dbe3eb;
  border-radius: 12px;
  outline: 0;
  background: #fff;
  color: var(--ink);
}
.form-field textarea { min-height: 88px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: #6b9ad0; box-shadow: 0 0 0 4px rgba(47,111,237,.09); }
.form-hint { color: var(--muted); font-size: 11px; font-weight: 500; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.form-actions button { min-height: 42px; padding: 9px 16px; border-radius: 11px; font-weight: 800; }
.form-actions .cancel { border: 1px solid var(--line); background: #fff; color: #526176; }
.form-actions .save { border: 0; background: var(--navy); color: #fff; }
.form-actions .danger { margin-right: auto; border: 1px solid #ffd0d6; background: var(--red-soft); color: #c93445; }
.weekday-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.weekday-picker label { position: relative; }
.weekday-picker input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-picker span { width: 40px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); font-size: 12px; font-weight: 800; }
.weekday-picker input:checked + span { border-color: var(--navy); background: var(--navy); color: #fff; }
.inline-note { padding: 12px 13px; border-radius: 12px; background: #f4f8fb; color: var(--muted); font-size: 12px; line-height: 1.5; }
.client-card-number { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px 14px; padding: 15px 17px; border: 1px solid #c9dcef; border-radius: 14px; background: linear-gradient(135deg,#f4f8ff,#f2fbf7); }
.client-card-number span { color: var(--muted); font-size: 12px; font-weight: 800; }
.client-card-number strong { grid-row: 1 / span 2; grid-column: 2; color: var(--navy); font-size: 28px; letter-spacing: .12em; }
.client-card-number small { color: var(--muted); font-size: 11px; }

/* Ресепшн и рабочий экран тренера */
.reception-grid { display: grid; grid-template-columns: minmax(440px,1.1fr) minmax(320px,.9fr); grid-template-areas: "scan inside" "recent inside"; align-items: start; gap: 20px; margin-bottom: 20px; }
.scan-card, .reception-side, .recent-scans { padding: 24px; }
.scan-card { grid-area: scan; position: relative; z-index: 3; overflow: visible; }
.scan-card::after { content: ""; position: absolute; width: 190px; height: 190px; right: 0; top: 0; border-radius: 0 var(--radius) 0 100%; background: linear-gradient(145deg,var(--green-soft),var(--navy-soft)); opacity: .8; pointer-events: none; }
.scan-kicker { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; color: #078258; font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.scan-card h2 { position: relative; z-index: 1; margin: 18px 0 7px; font-size: clamp(23px,2.2vw,32px); letter-spacing: -.035em; }
.scan-card > p { position: relative; z-index: 1; max-width: 630px; margin: 0; color: var(--muted); line-height: 1.55; }
.barcode-form { margin-top: 25px; }
.barcode-form label { display: block; margin-bottom: 8px; color: #43536a; font-size: 12px; font-weight: 800; }
.barcode-form > div { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.reception-search-wrap { position: relative; min-width: 0; }
.barcode-form input { min-width: 0; min-height: 58px; padding: 14px 17px; border: 2px solid #bfd2e1; border-radius: 15px; outline: 0; background: #fbfdff; color: var(--ink); font-size: 18px; font-weight: 750; letter-spacing: .03em; }
.reception-search-wrap > input { width: 100%; }
.barcode-form input:focus { border-color: var(--green); box-shadow: 0 0 0 5px rgba(10,166,110,.11); background: #fff; }
.barcode-form button { min-width: 132px; border: 0; border-radius: 15px; background: var(--navy); color: #fff; font-weight: 850; }
.barcode-form #barcodeSubmit.reception-submit-green, .barcode-form #barcodeSubmit.reception-submit-amber { background: #079b69; }
.barcode-form #barcodeSubmit.reception-submit-blue { background: #3977c7; }
.barcode-form #barcodeSubmit.reception-submit-red { background: #c93445; }
.reception-suggestions { position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; width: min(620px,calc(100vw - 96px)); max-height: min(390px,calc(100vh - 190px)); overflow-y: auto; padding: 7px; border: 1px solid #cddce7; border-radius: 17px; background: #fff; box-shadow: 0 20px 45px rgba(19,50,74,.18); }
.barcode-form .reception-suggestion { width: 100%; min-width: 0; display: grid; grid-template-columns: 38px minmax(220px,1fr) 180px; align-items: center; gap: 10px; padding: 10px 11px; border: 1px solid transparent; border-radius: 12px; background: #fff; color: var(--ink); text-align: left; font-weight: 400; }
.barcode-form .reception-suggestion:hover, .barcode-form .reception-suggestion.active { border-color: #c8dbe8; background: #f4f8fb; }
.reception-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--navy-soft); color: var(--navy); font-size: 14px; font-weight: 900; }
.reception-person, .reception-access > span { min-width: 0; display: grid; gap: 3px; }
.reception-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.reception-person small, .reception-access small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.reception-access { display: grid; grid-template-columns: 10px minmax(0,1fr); align-items: center; gap: 7px; }
.reception-access > i { width: 10px; height: 10px; border-radius: 50%; background: #9aabba; box-shadow: 0 0 0 4px #eef3f6; }
.reception-access strong { font-size: 11px; }
.reception-access.green strong { color: #078258; } .reception-access.green > i { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.reception-access.red strong { color: #c93445; } .reception-access.red > i { background: #ef4d5f; box-shadow: 0 0 0 4px var(--red-soft); }
.reception-access.amber strong { color: #b87400; } .reception-access.amber > i { background: #f0a51a; box-shadow: 0 0 0 4px #fff4d9; }
.reception-access.blue strong { color: #2861ad; } .reception-access.blue > i { background: #3977c7; box-shadow: 0 0 0 4px #eaf2ff; }
.reception-no-results { display: grid; gap: 3px; padding: 14px; color: var(--ink); }
.reception-no-results span { color: var(--muted); font-size: 11px; }
.scan-alternatives { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 11px; color: var(--muted); font-size: 11px; }
.camera-panel { position: relative; margin-top: 16px; overflow: hidden; border-radius: 17px; background: #101923; }
.camera-panel video { width: 100%; max-height: 330px; display: block; object-fit: cover; }
.camera-panel::after { content: ""; position: absolute; inset: 22% 12%; border: 2px solid #8cffcf; border-radius: 13px; box-shadow: 0 0 0 999px rgba(4,15,24,.30); pointer-events: none; }
.camera-panel button { position: absolute; z-index: 2; right: 12px; bottom: 12px; padding: 9px 12px; border: 0; border-radius: 10px; background: rgba(255,255,255,.9); color: var(--ink); font-weight: 800; }
.scan-result { display: grid; gap: 4px; margin-top: 18px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 14px; background: #f7fafc; }
.scan-result strong { font-size: 14px; }
.scan-result span { color: var(--muted); font-size: 12px; }
.scan-result.in { border-color: #ade6cf; background: var(--green-soft); color: #087c56; }
.scan-result.out { border-color: #bdd3f8; background: #eef4ff; color: #265ba9; }
.scan-result.error { border-color: #ffd0d6; background: var(--red-soft); color: #ba3040; }
.scan-result.loading { border-color: #d8e3eb; background: #f4f8fb; }
.scan-result.preview.green { border-color: #ade6cf; background: var(--green-soft); color: #087c56; }
.scan-result.preview.red { border-color: #ffd0d6; background: var(--red-soft); color: #ba3040; }
.scan-result.preview.amber { border-color: #f5d58f; background: #fff8e7; color: #966000; }
.scan-result.preview.blue { border-color: #bdd3f8; background: #eef4ff; color: #265ba9; }
.reception-side { grid-area: inside; height: 650px; display: flex; flex-direction: column; }
.inside-groups { flex: 0 0 auto; display: flex; gap: 6px; margin: -3px 0 10px; padding-bottom: 3px; overflow-x: auto; }
.inside-groups button { flex: 0 0 auto; min-height: 32px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 99px; background: #fff; color: var(--muted); font-size: 10px; font-weight: 800; }
.inside-groups button b { margin-left: 3px; color: #93a5b6; font-size: 9px; }
.inside-groups button.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.inside-groups button.active b { color: #b8ff08; }
.inside-list { min-height: 0; flex: 1; display: grid; align-content: start; gap: 5px; overflow-y: auto; padding-right: 3px; }
.inside-row { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.inside-row strong, .inside-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inside-row strong { font-size: 11px; }
.inside-row small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.inside-row button { min-height: 29px; padding: 5px 9px; border: 1px solid #bdd3f8; border-radius: 8px; background: #eef4ff; color: #2861ad; font-size: 9px; font-weight: 850; }
.inside-row button:hover { border-color: #3977c7; background: #3977c7; color: #fff; }
.inside-row button:disabled { opacity: .55; cursor: wait; }
.recent-scans { grid-area: recent; min-width: 0; margin-top: 0; }
.scan-history { display: grid; }
.scan-history-row { display: grid; grid-template-columns: 74px 1fr auto; align-items: center; gap: 13px; padding: 13px 4px; border-top: 1px solid var(--line); }
.scan-history-row:first-child { border-top: 0; }
.scan-history-row strong, .scan-history-row small { display: block; }
.scan-history-row small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.scan-history-row time { color: var(--muted); font-size: 12px; }
.scan-direction { padding: 6px 9px; border-radius: 99px; font-size: 10px; font-weight: 900; text-align: center; text-transform: uppercase; letter-spacing: .05em; }
.scan-direction.in { background: var(--green-soft); color: #078258; }
.scan-direction.out { background: #eef4ff; color: #2c61b8; }
.trainer-day-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 16px; padding: 22px 25px; border-radius: var(--radius); background: linear-gradient(120deg,#153f63,#184e72 68%,#176353); color: #fff; box-shadow: 0 18px 38px rgba(21,63,99,.16); }
.trainer-day-card span { color: #b8ff08; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.trainer-day-card h2 { margin: 7px 0 5px; font-size: 23px; letter-spacing: -.025em; }
.trainer-day-card p { margin: 0; color: #c8d9e5; font-size: 12px; }
.trainer-day-card button { min-width: 150px; min-height: 46px; border: 0; border-radius: 13px; background: #b8ff08; color: #15364d; font-weight: 900; box-shadow: 0 8px 22px rgba(0,0,0,.12); }
.attendance-tools { align-items: flex-start; }
.group-tabs { min-width: 0; display: flex; flex: 1; flex-wrap: wrap; align-content: flex-start; gap: 6px; overflow: visible; padding-bottom: 0; }
.group-tabs button { flex: 0 0 auto; min-height: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #617187; font-size: 12px; font-weight: 750; line-height: 1.2; }
.group-tabs button b { margin-left: 5px; color: #9aabba; font-size: 10px; }
.group-tabs button.active { border-color: var(--navy); background: var(--navy); color: #fff; box-shadow: 0 8px 18px rgba(21,63,99,.14); }
.group-tabs button.active b { color: #b8ff08; }
.attendance-tools .date-control { flex: 0 0 auto; margin-left: auto; }
.attendance-tools .date-control input { min-height: 38px; padding-block: 8px; }
.trainer-mode .student-card { cursor: default; }

/* Управление */
.management-grid { grid-template-columns: 1fr 1fr; }
.brand-settings-panel { grid-column: 1 / -1; }
.brand-upload { display: flex; align-items: center; gap: 18px; padding: 4px 0; }
.brand-logo-preview { width: 140px; height: 82px; flex: 0 0 140px; display: grid; place-items: center; overflow: hidden; border: 1px solid #d8e3ec; border-radius: 16px; background: linear-gradient(145deg, #2377b7, #0aae78); color: #fff; font-size: 34px; font-weight: 900; box-shadow: var(--shadow-sm); }
.brand-logo-preview.has-image { background: #fff; }
.brand-logo-preview img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand-upload-copy { min-width: 0; display: grid; gap: 7px; }
.brand-upload-copy > strong { font-size: 15px; }
.brand-upload-copy > span { color: var(--muted); font-size: 12px; }
.brand-upload-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 3px; }
.brand-upload-actions button { min-height: 36px; }
#management .panel { min-height: 330px; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  max-width: min(380px,calc(100vw - 32px));
  padding: 13px 17px;
  border-radius: 12px;
  background: #14293a;
  color: #fff;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: .2s;
}
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .card-list { grid-template-columns: repeat(2,1fr); }
  .student-grid { grid-template-columns: 1fr; }
  .lead-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { width: 224px; }
  main { margin-left: 224px; }
  .two-column, .management-grid { grid-template-columns: 1fr; }
  .top-actions > span:not(.online-dot) { display: none; }
  .reception-grid { grid-template-columns: 1fr; grid-template-areas: "scan" "inside" "recent"; }
  .reception-side { height: auto; min-height: 0; }
  .inside-list { max-height: 455px; }
  .reception-suggestions { width: 100%; }
  .barcode-form .reception-suggestion { grid-template-columns: 34px minmax(0,1fr); }
  .reception-access { grid-column: 2; }
}
@media (max-width: 760px) {
  .sidebar { width: min(290px,86vw); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 50px rgba(17,39,58,.18); }
  .sidebar.open { transform: none; }
  main { margin-left: 0; }
  .menu-button { display: block; }
  .topbar { min-height: 78px; padding: 13px 16px; }
  .topbar > div:nth-child(2) { flex: 1; }
  .topbar h1 { font-size: 23px; }
  .topbar p, .top-actions > span { display: none; }
  .view { padding: 16px 13px 36px; }
  .metric-grid, .metric-grid.compact { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { min-height: 126px; padding: 16px; }
  .metric strong { font-size: 24px; }
  .section-tools { align-items: stretch; flex-wrap: wrap; }
  .segmented, .status-tabs { width: 100%; }
  .search.wide, .search { min-width: 100%; }
  .legend { width: 100%; margin-left: 0; overflow-x: auto; }
  .trainer-day-card { align-items: flex-start; flex-direction: column; }
  .trainer-day-card button { width: 100%; }
  .attendance-tools .date-control { width: 100%; justify-content: space-between; }
  .group-tabs { width: 100%; flex-basis: 100%; }
  .reception-grid { display: block; }
  .reception-side { margin-top: 14px; }
  .card-list { grid-template-columns: 1fr; }
  .student-card .details { grid-template-columns: 1fr 1fr; }
  .student-card header { align-items: flex-start; }
  .student-card-status { justify-items: end; }
  .student-card-actions { max-width: 210px; }
  .trainer-management-row { align-items: flex-start; flex-direction: column; }
  .trainer-card-actions { width: 100%; justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .funnel { gap: 5px; }
  .funnel div { padding: 12px; }
  .funnel strong { font-size: 22px; }
}
@media (max-width: 480px) {
  .auth-screen { padding: 14px; }
  .auth-card { padding: 25px; border-radius: 23px; }
  .metric-grid, .metric-grid.compact { grid-template-columns: 1fr; }
  .metric { min-height: 116px; }
  .debt-hero { justify-content: space-between; gap: 12px; padding: 20px; }
  .debt-hero strong { font-size: 23px; }
  .action-buttons { flex-wrap: wrap; }
  .student-card .details { grid-template-columns: 1fr 1fr; }
  .student-card header { flex-direction: column; }
  .student-card-status { width: 100%; justify-items: start; }
  .student-card-actions { max-width: none; justify-content: flex-start; }
  .brand-upload { align-items: flex-start; flex-direction: column; }
  .top-actions .outline { padding-inline: 10px; }
  .scan-card, .reception-side, .recent-scans { padding: 18px; }
  .barcode-form > div { grid-template-columns: 1fr; }
  .barcode-form button { min-height: 50px; }
  .reception-suggestions { width: 100%; }
  .barcode-form .reception-suggestion { grid-template-columns: 34px 1fr; }
  .reception-access { grid-column: 2; }
  .scan-alternatives { align-items: flex-start; flex-direction: column; }
  .scan-history-row { grid-template-columns: 64px 1fr; }
  .scan-history-row time { display: none; }
}
