/* ЛК АЭГИС — единая дизайн-система с aegis-it.ru. Без внешних CDN: шрифты системные. */

:root {
  --bg: #070D1A;
  --ink: #0C1424;
  --text: #E8EDF7;
  --muted: #9AA7BE;
  --line: rgba(255, 255, 255, .12);
  --line-soft: rgba(255, 255, 255, .07);
  --bronze: #C99A4B;
  --bronze-hover: #D8AB5E;
  --blue: #3C6BFF;
  --link: #8FB0FF;
  --coral: #FF5A5F;
  --ok: #3DDC97;
  --focus: #7FA2FF;

  --ok-bg: rgba(61, 220, 151, .16);
  --ok-text: #6FE8B2;
  --ok-line: rgba(61, 220, 151, .32);

  --warn-bg: rgba(201, 154, 75, .18);
  --warn-text: #F4CF8A;
  --warn-line: rgba(201, 154, 75, .36);

  --info-bg: rgba(60, 107, 255, .20);
  --info-text: #A5C0FF;
  --info-line: rgba(60, 107, 255, .38);

  --bad-bg: rgba(255, 90, 95, .18);
  --bad-text: #FF9A9E;
  --bad-line: rgba(255, 90, 95, .36);

  --neutral-bg: rgba(255, 255, 255, .09);
  --neutral-text: #D2DBEC;
  --neutral-line: rgba(255, 255, 255, .14);

  --gutter: clamp(16px, 4vw, 32px);
  --radius: 16px;
  --bevel: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 0 0 1px rgba(255, 255, 255, .06), inset 0 -10px 24px -12px rgba(0, 0, 0, .55);
  --drop: 0 30px 70px -30px rgba(0, 0, 0, .85), 0 14px 28px -16px rgba(0, 0, 0, .65);
  --pressed: inset 0 3px 10px rgba(0, 0, 0, .6), inset 0 -1px 0 rgba(255, 255, 255, .07);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --font-display: Bahnschrift, "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  color-scheme: dark;
  scroll-padding-top: 100px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font: 400 1rem/1.55 var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, a, [role="button"] { touch-action: manipulation; }
button, [role="button"], .nav-links a, .badge {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

@media (pointer: coarse) {
  input, textarea, select { font-size: 16px; }
}

img, svg { max-width: 100%; }
h1, h2, h3, h4, h5 { font-family: var(--font-display); margin: 0 0 .4em; line-height: 1.15; letter-spacing: -.005em; color: #fff; }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration: underline; }
}
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
small, .small { font-size: .875rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.ico { width: 18px; height: 18px; flex: none; }
.ico-sm { width: 16px; height: 16px; flex: none; }

.skip {
  position: absolute; left: 12px; top: -64px; z-index: 90;
  background: var(--bronze); color: var(--ink); padding: 10px 16px;
  border-radius: 8px; font-weight: 700;
}
.skip:focus { top: 12px; text-decoration: none; }

/* ---------- фон (как на aegis-it.ru) ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora::before, .aurora::after { content: ""; position: absolute; width: 64vmax; height: 64vmax; border-radius: 50%; }
.aurora::before {
  left: -25vmax; top: -30vmax;
  background: radial-gradient(closest-side, rgba(60, 107, 255, .24), transparent);
  animation: drift-a 40s ease-in-out infinite alternate;
}
.aurora::after {
  right: -30vmax; bottom: -35vmax;
  background: radial-gradient(closest-side, rgba(201, 154, 75, .15), transparent);
  animation: drift-b 46s ease-in-out infinite alternate;
}
.aurora i {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .032) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, .032) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 20%, #000, transparent 78%);
  mask-image: radial-gradient(ellipse at 50% 20%, #000, transparent 78%);
}
@keyframes drift-a { to { transform: translate(18vmax, 14vmax); } }
@keyframes drift-b { to { transform: translate(-16vmax, -12vmax); } }

/* ---------- шапка: плавающая стеклянная капсула ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 70;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px));
  pointer-events: none;
}
.site-header .bar {
  position: relative; pointer-events: auto;
  display: flex; align-items: center; gap: 16px;
  width: min(1160px, 100%); min-height: 64px; margin-inline: auto;
  padding: 0 12px 0 18px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(38, 52, 96, .66), rgba(12, 20, 42, .80));
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -1px 0 rgba(0, 0, 0, .55), 0 22px 44px -20px rgba(0, 0, 0, .9), 0 4px 12px -4px rgba(0, 0, 0, .5);
  transition: min-height .25s var(--ease), background .25s;
}
.site-header .bar::before {
  content: ""; position: absolute; inset: 0; padding: 1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, .06) 35%, rgba(201, 154, 75, .25) 70%, rgba(201, 154, 75, .58));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
.site-header.scrolled .bar {
  min-height: 58px;
  background: linear-gradient(180deg, rgba(30, 42, 80, .86), rgba(9, 16, 34, .94));
}

.brand {
  display: inline-flex; flex: none; align-items: center; gap: 10px;
  color: #fff; text-decoration: none;
  font: 700 1.15rem/1 var(--font-display); letter-spacing: .04em; white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .25), 0 0 20px rgba(120, 150, 255, .32);
}
@media (hover: hover) and (pointer: fine) {
  .brand:hover { text-decoration: none; color: #fff; }
}
.brand .logo {
  width: 32px; height: 32px; flex: none;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .5)) drop-shadow(0 0 12px rgba(201, 154, 75, .55));
}
.brand .brand-text { display: grid; gap: 2px; }
.brand .sub { font: 400 .72rem/1 var(--font-body); color: #AEB9D8; letter-spacing: .02em; }

.nav { display: flex; flex: 1; align-items: center; gap: 12px; min-width: 0; }
.nav-links {
  display: flex; gap: 2px; margin-inline: auto; padding: 4px;
  border-radius: 15px; background: rgba(0, 0, 0, .3); box-shadow: var(--pressed);
}
.nav-links a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 13px; border-radius: 11px;
  color: #B9C5DC; font: 500 .93rem/1 var(--font-body); text-decoration: none; white-space: nowrap;
  transition: color .18s, background-color .18s, box-shadow .22s;
}
.nav-links a:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) {
  .nav-links a:hover { color: #fff; background: rgba(255, 255, 255, .07); text-decoration: none; }
}
.nav-links a[aria-current="page"] {
  color: #fff; font-weight: 600;
  background: linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32), inset 0 -1px 0 rgba(0, 0, 0, .4), 0 6px 14px -6px rgba(0, 0, 0, .8), 0 0 18px -6px rgba(201, 154, 75, .75);
}

.nav-actions { display: flex; flex: none; align-items: center; gap: 8px; margin-left: auto; }
.nav-actions .nav-link {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 12px; border-radius: 10px;
  color: #D7DEF2; font: 500 .92rem/1 var(--font-body); white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.nav-actions .nav-link[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .11); }
.nav-actions .nav-link-muted { color: var(--muted); }
@media (hover: hover) and (pointer: fine) {
  .nav-actions .nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
}
.nav-actions .nav-link:active { background: rgba(255, 255, 255, .12); }

.menu-btn {
  display: none; flex: none; margin-left: auto;
  width: 46px; height: 46px; padding: 0; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border: 0; border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 -1px 0 rgba(0, 0, 0, .4), 0 8px 16px -8px rgba(0, 0, 0, .8);
  transition: transform 120ms var(--ease-out);
}
.menu-btn:active { transform: scale(.95); }
.menu-btn span { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; transition: transform .25s var(--ease), opacity .2s; }
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 1100px) and (min-width: 961px) {
  .site-header .bar { gap: 10px; padding: 0 10px 0 14px; }
  .nav-links a { padding: 0 10px; font-size: .88rem; }
  .nav-actions .nav-link { padding: 0 9px; font-size: .88rem; }
}

@media (max-width: 960px) {
  .menu-btn { display: flex; }
  .nav {
    display: none; position: absolute; top: calc(100% + 10px); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 12px;
    max-height: calc(100dvh - 104px); overflow-y: auto; overscroll-behavior: contain;
    padding: 14px; border-radius: 22px;
    background: linear-gradient(180deg, #1B2750, #0A1124);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 30px 60px -20px rgba(0, 0, 0, .92);
  }
  .nav.open { display: flex; animation: menu-drop .24s var(--ease); }
  .nav-links { flex-direction: column; gap: 4px; margin: 0; padding: 0; background: none; box-shadow: none; }
  .nav-links a { min-height: 48px; padding: 0 16px; font-size: 1.02rem; }
  .nav-actions { flex-direction: column; align-items: stretch; margin-left: 0; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
  .nav-actions .nav-link { min-height: 46px; padding: 0 16px; font-size: 1rem; }
  .nav-actions .btn { width: 100%; min-height: 48px; }
}
@keyframes menu-drop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }

/* ---------- основной контейнер и сетка ---------- */
main.page-main {
  flex: 1 0 auto;
  position: relative; z-index: 1;
  padding: calc(102px + env(safe-area-inset-top, 0px)) env(safe-area-inset-right, 0px) calc(52px + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px);
}
@media (max-width: 960px) {
  main.page-main { padding-top: calc(92px + env(safe-area-inset-top, 0px)); }
}

.container { width: min(1160px, 100% - 2 * var(--gutter)); margin-inline: auto; }

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 12px 20px; margin-bottom: 22px;
}
.page-head h1, .page-head .h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.05rem); font-weight: 700; }
.page-sub { margin: 6px 0 0; color: var(--muted); font-size: .96rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.row { display: flex; flex-wrap: wrap; margin: 0 -12px; }
.row > [class*="col-"] { padding: 0 12px; min-width: 0; }
.col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-8 { flex: 0 0 66.666%; max-width: 66.666%; }
@media (max-width: 840px) {
  .col-md-4, .col-md-6, .col-md-8 { flex: 0 0 100%; max-width: 100%; }
}

.form-row { display: flex; flex-wrap: wrap; margin: 0 -10px; }
.form-row > [class*="col-"] { padding: 0 10px; min-width: 0; }
@media (max-width: 720px) {
  .form-row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; }
}

/* ---------- утилиты ---------- */
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }
.ml-auto { margin-left: auto; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--muted); }
.opacity-75 { opacity: .82; }
.d-inline { display: inline; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 14px; }
.mb-4 { margin-bottom: 20px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }
.h2 { font: 700 1.65rem/1.2 var(--font-display); }
.h4 { font: 700 1.25rem/1.25 var(--font-display); }
.h5 { font: 700 1.08rem/1.25 var(--font-display); }
.tabular { font-variant-numeric: tabular-nums; }
.narrow-card { max-width: 680px; }

/* ---------- карточки и панели ---------- */
.card, .dashboard-card {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .02));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--drop), inset 0 1px 0 rgba(255, 255, 255, .1);
  overflow: hidden;
}
.card-body { padding: clamp(18px, 3vw, 26px); }
.card-header {
  padding: 15px clamp(18px, 3vw, 26px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .035);
  font-weight: 700;
  color: #fff;
}
.card-title { font: 700 1.15rem/1.25 var(--font-display); margin-bottom: 4px; color: #fff; }
.card-subtitle { color: var(--muted); margin-bottom: 10px; font-weight: 400; }

.dashboard-card { padding: clamp(20px, 3vw, 26px); }
.info-label { font-size: .84rem; color: var(--muted); margin-bottom: 4px; display: block; }
.info-value { font-size: 1.03rem; font-weight: 600; color: #fff; margin: 0 0 14px; overflow-wrap: anywhere; }

.welcome-card {
  background: linear-gradient(135deg, rgba(28, 46, 98, .86), rgba(14, 24, 52, .94) 58%, rgba(12, 20, 36, .98));
  color: #fff;
  border: 1px solid rgba(201, 154, 75, .36);
  border-radius: 20px;
  padding: clamp(20px, 3vw, 28px);
  box-shadow: 0 28px 64px -28px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .15);
}
.welcome-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.welcome-title-wrap { flex: 1 1 180px; min-width: 0; }
.welcome-title-wrap h2 { margin-bottom: 6px; font-size: clamp(1.25rem, 2.4vw, 1.55rem); }
.welcome-title-wrap p { color: #CBD4E6; max-width: 62ch; }
.welcome-status { margin-left: auto; flex: none; }
.welcome-dates {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
  color: #CBD4E6; font-size: .92rem; font-variant-numeric: tabular-nums;
}
.icon-circle {
  width: 48px; height: 48px; flex: none; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(201, 154, 75, .14);
  border: 1px solid rgba(201, 154, 75, .38);
  color: var(--bronze-hover);
  box-shadow: 0 0 24px -6px rgba(201, 154, 75, .45);
}

/* ---------- авторизация и регистрация ---------- */
.auth-wrap {
  min-height: calc(100dvh - 220px);
  display: grid; place-items: center; padding: 8px 0;
}
.auth-card { width: min(460px, 100%); }
.auth-card-wide { width: min(520px, 100%); }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-mark {
  width: 48px; height: 48px; margin: 0 auto 12px;
  display: grid; place-items: center; border-radius: 14px;
  background: rgba(201, 154, 75, .12); border: 1px solid rgba(201, 154, 75, .35);
}
.auth-head h1 { font-size: 1.65rem; margin-bottom: 6px; }
.auth-head p { color: var(--muted); font-size: .95rem; }
.auth-foot { margin-top: 18px; text-align: center; font-size: .92rem; color: var(--muted); display: grid; gap: 6px; }

/* ---------- мини-статистика ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-tile {
  padding: 18px 20px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .02));
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px -26px rgba(0, 0, 0, .85), inset 0 1px 0 rgba(255, 255, 255, .1);
  text-decoration: none; color: var(--text); display: block;
  transition: border-color .18s var(--ease-out), transform .14s var(--ease-out), background-color .18s;
}
a.stat-tile:active { transform: scale(.985); }
@media (hover: hover) and (pointer: fine) {
  a.stat-tile:hover { border-color: rgba(201, 154, 75, .55); transform: translateY(-2px); text-decoration: none; }
}
.stat-tile .num {
  font: 800 1.85rem/1.05 var(--font-display);
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.stat-tile-accent .num { color: var(--bronze-hover); }
.stat-tile .lbl { color: var(--muted); font-size: .9rem; margin-top: 6px; }

@media (max-width: 480px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-tile { padding: 14px 16px; }
  .stat-tile .num { font-size: 1.55rem; }
  .stat-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ---------- формы ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .92rem; color: #C3CDE0; font-weight: 600; margin-bottom: 6px; }
.form-control {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .06); color: #fff;
  font: 400 1rem/1.35 var(--font-body);
  transition: border-color .18s, box-shadow .18s, background-color .18s;
}
.form-control::placeholder { color: rgba(154, 167, 190, .7); }
select.form-control option { color: #101828; background: #fff; }
textarea.form-control { min-height: 104px; resize: vertical; line-height: 1.45; }
.form-control:focus {
  outline: none; border-color: var(--blue);
  background: rgba(255, 255, 255, .09);
  box-shadow: 0 0 0 4px rgba(60, 107, 255, .28);
}

.form-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 20px;
}
@media (max-width: 560px) {
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .btn { width: 100%; }
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px; border-radius: 12px; border: 1px solid transparent;
  font: 600 .96rem/1 var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform 140ms var(--ease-out), box-shadow 180ms var(--ease-out), background-color 140ms, border-color 140ms, color 140ms;
}
.btn:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { text-decoration: none; }
}
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .88rem; border-radius: 10px; }
@media (pointer: coarse) {
  .btn-sm { min-height: 42px; padding: 0 14px; }
}

.btn-primary {
  background: linear-gradient(180deg, #E0B468, var(--bronze));
  color: var(--ink);
  box-shadow: 0 10px 26px -10px rgba(201, 154, 75, .8), inset 0 1px 0 rgba(255, 255, 255, .35);
}
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 32px -10px rgba(201, 154, 75, .9), inset 0 1px 0 rgba(255, 255, 255, .45); color: var(--ink); }
}

.btn-secondary, .btn-ghost, .btn-light, .btn-dark {
  background: rgba(255, 255, 255, .07); color: #fff; border-color: rgba(255, 255, 255, .2);
}
@media (hover: hover) and (pointer: fine) {
  .btn-secondary:hover, .btn-ghost:hover, .btn-light:hover, .btn-dark:hover {
    background: rgba(255, 255, 255, .13); border-color: rgba(255, 255, 255, .42); color: #fff;
  }
}

.btn-success {
  background: linear-gradient(180deg, #E0B468, var(--bronze));
  color: var(--ink);
  box-shadow: 0 10px 26px -10px rgba(201, 154, 75, .8), inset 0 1px 0 rgba(255, 255, 255, .35);
}
@media (hover: hover) and (pointer: fine) {
  .btn-success:hover { transform: translateY(-1px); color: var(--ink); }
}

.btn-outline-primary {
  background: rgba(201, 154, 75, .1);
  border-color: rgba(201, 154, 75, .42);
  color: #F4CF8A;
}
@media (hover: hover) and (pointer: fine) {
  .btn-outline-primary:hover { background: rgba(201, 154, 75, .2); border-color: var(--bronze-hover); color: #fff; }
}

.btn-danger, .btn-outline-danger {
  background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-text);
}
@media (hover: hover) and (pointer: fine) {
  .btn-danger:hover, .btn-outline-danger:hover { background: rgba(255, 90, 95, .28); border-color: rgba(255, 90, 95, .58); color: #fff; }
}

.btn-link-danger {
  background: none; border: 0; padding: 4px 6px; margin: 0;
  color: var(--bad-text); font: 600 .84rem/1 var(--font-body); cursor: pointer; border-radius: 6px;
}
@media (hover: hover) and (pointer: fine) {
  .btn-link-danger:hover { background: var(--bad-bg); text-decoration: underline; }
}

/* ---------- таблицы и адаптивные карточки-строки ---------- */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table thead.thead-light th {
  padding: 13px 18px;
  background: rgba(255, 255, 255, .04);
  color: var(--muted); font-size: .86rem; font-weight: 600; text-align: left;
  white-space: nowrap; border-bottom: 1px solid var(--line);
}
.table td { padding: 14px 18px; border-top: 1px solid var(--line-soft); vertical-align: middle; color: var(--text); }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr[data-href] { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .table-hover tbody tr:hover td { background: rgba(255, 255, 255, .035); }
}
.table td.text-right, .table th.text-right { text-align: right; }
.table .cell-actions { white-space: nowrap; }
.table .cell-desc { max-width: 44ch; white-space: normal; color: var(--muted); }
.table .acts { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.table .acts form { display: inline-flex; margin: 0; }
.row-link { color: #fff; font-weight: 600; text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .row-link:hover { color: var(--bronze-hover); text-decoration: underline; }
}
.row-done { opacity: .58; }
.text-strike { text-decoration: line-through; }

@media (max-width: 760px) {
  .table-responsive { overflow: visible; }
  .table.table-cards, .table.table-cards tbody, .table.table-cards td { display: block; width: 100%; }
  .table.table-cards thead { display: none; }
  .table.table-cards tbody { display: grid; gap: 12px; padding: 12px; }
  .card-body > .table-responsive > .table.table-cards tbody { padding: 0; }
  .table.table-cards tr {
    display: flex; flex-direction: column; width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .03);
    padding: 4px 14px;
  }
  .table.table-cards td {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 10px 0; border-top: 1px solid var(--line-soft);
    text-align: right; white-space: normal;
  }
  .table.table-cards td:first-child { border-top: 0; }
  .table.table-cards tr:has(td.cell-main) td:first-child:not(.cell-main) { border-top: 1px solid var(--line-soft); }
  .table.table-cards td::before {
    content: attr(data-label);
    color: var(--muted); font-size: .83rem; font-weight: 600; text-align: left; flex: 0 0 auto;
  }
  .table.table-cards td.cell-main {
    order: -1; display: block; text-align: left; padding-top: 12px; border-top: 0;
  }
  .table.table-cards td.cell-main::before { display: none; }
  .table.table-cards td.cell-desc { display: block; max-width: none; text-align: left; }
  .table.table-cards td.cell-desc::before { display: block; margin-bottom: 4px; }
  .table.table-cards td.cell-empty {
    display: block; text-align: center; padding: 20px 12px; border-top: 0;
  }
  .table.table-cards td.cell-empty::before { display: none; }
  .table.table-cards td.cell-actions { justify-content: flex-end; }
  .table.table-cards td.cell-actions::before { margin-right: auto; }
}

/* ---------- бейджи / статусы ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  white-space: nowrap; border: 1px solid transparent;
}
.badge-pill { border-radius: 999px; }
.badge-success { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-line); }
.badge-danger { background: var(--bad-bg); color: var(--bad-text); border-color: var(--bad-line); }
.badge-warning { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-line); }
.badge-info { background: var(--info-bg); color: var(--info-text); border-color: var(--info-line); }
.badge-light { background: var(--neutral-bg); color: var(--neutral-text); border-color: var(--neutral-line); }

/* ---------- уведомления ---------- */
.alert {
  position: relative;
  padding: 14px 46px 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  font-size: .95rem;
  border: 1px solid transparent;
}
.alert-success { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-line); }
.alert-danger { background: var(--bad-bg); color: var(--bad-text); border-color: var(--bad-line); }
.alert-warning { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-line); }
.alert-info { background: var(--info-bg); color: var(--info-text); border-color: var(--info-line); }
.alert .close {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 8px;
  font-size: 1.25rem; line-height: 1; color: inherit; opacity: .75; cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .alert .close:hover { opacity: 1; background: rgba(255, 255, 255, .1); }
}

/* ---------- тред заявки и заметки ---------- */
.msg-thread { display: grid; gap: 12px; }
.msg {
  max-width: 82%; padding: 13px 16px; border-radius: 16px;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.msg-admin {
  margin-left: auto;
  background: rgba(201, 154, 75, .14);
  border-color: rgba(201, 154, 75, .36);
}
.msg-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; font-size: .85rem; margin-bottom: 6px;
}
.msg-author { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.msg-body { white-space: pre-wrap; color: var(--text); }
@media (max-width: 640px) { .msg { max-width: 100%; } }

/* ---------- строки CRM в карточке клиента ---------- */
.cb-line {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 14px; padding: 12px 0; border-top: 1px solid var(--line-soft);
}
.cb-line:first-child { border-top: 0; padding-top: 0; }
.cb-line:last-child { padding-bottom: 0; }
.cb-line-main { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.cb-line-side { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.task-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-soft);
}
.task-item:first-child { border-top: 0; padding-top: 0; }
.task-item:last-child { padding-bottom: 0; }
.task-title { min-width: 0; overflow-wrap: anywhere; }

/* ---------- канбан-доска сделок ---------- */
.deals-board {
  display: flex; gap: 16px; overflow-x: auto; padding-bottom: 10px;
  overscroll-behavior-x: contain;
}
.deals-col {
  flex: 0 0 264px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.deals-col-h { font: 700 .98rem/1.2 var(--font-display); margin-bottom: 12px; padding: 0 4px; color: #fff; }
.deal-card {
  display: block;
  background: linear-gradient(135deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .025));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  color: var(--text); text-decoration: none;
  transition: border-color .18s, transform .14s var(--ease-out);
}
.deal-card:last-child { margin-bottom: 0; }
.deal-card:active { transform: scale(.985); }
@media (hover: hover) and (pointer: fine) {
  .deal-card:hover { border-color: var(--bronze); text-decoration: none; transform: translateY(-1px); }
}
@media (max-width: 760px) {
  .deals-board { scroll-snap-type: x proximity; }
  .deals-col { flex: 0 0 min(84vw, 310px); scroll-snap-align: start; }
}

/* ---------- подвал (как на aegis-it.ru) ---------- */
.site-footer {
  position: relative; z-index: 1;
  background: rgba(0, 0, 0, .35);
  border-top: 1px solid rgba(255, 255, 255, .06);
  color: #8F9CB5;
  padding: 24px env(safe-area-inset-right, 0px) calc(24px + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px);
  font-size: .9rem;
}
.foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
.foot-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.foot-links a { color: #B9C5DC; }

@media (prefers-reduced-motion: reduce) {
  .aurora::before, .aurora::after, .nav.open { animation: none; }
  .btn, .stat-tile, .deal-card, .site-header .bar, .nav-links a { transition: none; }
}
