/* ============================================================
   iPhone Guardian — оформление кабинета.
   Палитра и шрифт зафиксированы. Только структура, иконки и движение.
   CSP: style-src 'self' — весь CSS здесь, никаких внешних ресурсов и шрифтов.
   ============================================================ */
:root {
  color: #4a4a4a;
  background: #f8f7f1;
  font-family: "Open Sans", Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --surface: #ffffff;
  --line: #dbdbdb;
  --muted: #757575;
  --blue-dark: #192e45;
  --blue: #294d73;
  --blue-link: #366699;
  --success: #44ad4d;
  --success-soft: #e8f5e9;
  --ink: #363636;
  --red: #e34039;
  --red-soft: #fff0ef;
  --yellow: #ffd524;
  --yellow-dark: #ddca00;
  --sand: #f8f7f1;
  --focus: #ffd524;

  /* --- движение (палитра не затрагивается) --- */
  --ease-out: cubic-bezier(.2, .8, .2, 1);      /* штатный ease-out, численно = текущему */
  --ease-emph: cubic-bezier(.16, 1, .3, 1);     /* «эмоциональные» моменты: подключение, разблокировка, тост */
  --ease-press: cubic-bezier(.3, .7, .4, 1);    /* нажатие */

  /* --- кнопки: радиус, фокус-кольцо, тактильные грани --- */
  --btn-radius: 8px;
  --ring: #192e45;              /* фокус-кольцо на светлых поверхностях = --blue-dark */
  --edge-primary: var(--yellow-dark);
  --edge-secondary: var(--blue-dark);
  --edge-danger: rgba(227,64,57,.30);
  --red-ink: #a52820;           /* читаемый красный текст на --red-soft (~6:1) */

  /* --- шкала интервалов / радиусов / теней (производные) --- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --gap: 20px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --tile: #edf3f9;                 /* уже используемый литерал плитки */
  --tile-line: #d7e3ee;            /* уже используемый литерал рамки плитки */
  --shadow-card: 0 1px 2px rgba(25,46,69,.05), 0 10px 28px -20px rgba(25,46,69,.35);
  --shadow-pop: 0 22px 50px -26px rgba(25,46,69,.42);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--sand);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html, body { overflow-x: hidden; }

button, input, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: progress; opacity: .62; }

.hidden { display: none !important; }
[hidden] { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- иконки ---------- */
.ico {
  width: 18px; height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -3px;
}
.ico-sm { width: 15px; height: 15px; stroke-width: 1.85; vertical-align: -2px; }
.ico-lg { width: 34px; height: 34px; stroke-width: 1.5; }
.ico-xl { width: 46px; height: 46px; stroke-width: 1.3; }

/* ============================================================
   Верхняя панель
   ============================================================ */
.topbar {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--blue-dark);
  color: #fff;
  border-bottom: 1px solid #294d73;
}
.brand, .account-tools { display: flex; align-items: center; gap: 10px; }
.brand { font-size: 18px; font-weight: 700; }
.account-tools { color: #fff; font-size: 13px; }
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--yellow);
  color: var(--blue-dark);
}
.brand-mark .ico { width: 19px; height: 19px; }

/* ============================================================
   Раскладка
   ============================================================ */
main { max-width: 1240px; margin: 0 auto; padding: 24px; }
.dashboard { display: grid; gap: var(--gap); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
/* Одинокая панель в grid-2 занимает всю ширину, а не половину (защитно) */
.grid-2 > .panel:only-child { grid-column: 1 / -1; }

/* ============================================================
   Экран входа
   ============================================================ */
.auth-shell { min-height: calc(100vh - 106px); display: grid; place-items: center; }
.auth-panel {
  width: min(100%, 400px);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 5px 0 rgba(25, 46, 69, .18);
}
.auth-lead { text-align: center; margin-bottom: 20px; }
.auth-mark {
  width: 58px; height: 58px;
  display: inline-grid; place-items: center;
  margin-bottom: 10px;
  border-radius: 14px;
  color: var(--blue);
  background: #edf3f9;
  border: 1px solid #d7e3ee;
}
.auth-lead h1 { margin: 0 0 4px; color: var(--blue-dark); font-size: 20px; }
.auth-lead p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.auth-panel form { margin-top: 20px; }

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  padding: 3px;
  border-radius: 7px;
  background: #e6e6e6;
}
.segmented > button {
  min-height: 36px;
  border: 0;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: #555;
  background: transparent;
  font-size: 14px;
  font-weight: 650;
}
.segmented > button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 0 rgba(25, 46, 69, .16);
}
.segmented > button:not(.active):hover { color: var(--ink); }

/* ============================================================
   Формы и поля
   ============================================================ */
form, .compact-form { display: grid; gap: 15px; }
label, legend { color: #4a4a4a; font-size: 13px; font-weight: 650; }

input, textarea {
  width: 100%;
  margin-top: 7px;
  padding: 10px 11px;
  color: #363636;
  background: #fff;
  border: 1px solid #959495;
  border-radius: 8px;
  outline: none;
}
textarea { resize: vertical; min-height: 76px; }
input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(41,77,115,.18); }
label:focus-within { color: var(--blue); }

/* ============================================================
   Кнопки
   ============================================================ */
button.primary, button.secondary, button.danger {
  min-height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--btn-radius);
  font-size: 14px;
  font-weight: 700;
}
button.primary {
  border: 1px solid var(--yellow-dark);
  background: var(--yellow);
  color: var(--blue-dark);
  box-shadow: 0 2px 0 var(--edge-primary);
}
button.primary:hover { background: #ffe052; }
button.secondary {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 0 var(--edge-secondary);
}
button.secondary:hover { background: var(--blue-link); }
button.small { min-height: 36px; padding: 0 13px; font-size: 13px; border-radius: 7px; }
.full { width: 100%; }

button.danger {
  border: 1px solid var(--red);
  background: var(--red-soft);
  color: var(--red-ink);
  box-shadow: 0 2px 0 var(--edge-danger);
}
button.danger:hover { background: #ffe1de; color: var(--red-ink); }
button.danger:disabled { border-color: var(--line); background: #f4f4f4; color: var(--muted); box-shadow: none; }

.linklike {
  border: 0;
  background: transparent;
  padding: 2px 3px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--blue-link);
  font-size: 13px;
  font-weight: 650;
}
.linklike:hover { color: var(--blue-dark); text-decoration: underline; }

.icon-button {
  width: 38px; height: 38px;
  padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--blue);
  border-radius: 9px;
  color: var(--blue-dark);
  background: #fff;
  box-shadow: 0 1px 2px rgba(25,46,69,.10);
}
.icon-button:hover { background: #f4f8fc; box-shadow: 0 4px 10px -4px rgba(25,46,69,.32); }
.topbar .icon-button { border-color: #588cc3; color: #fff; background: var(--blue); }
.topbar .icon-button:hover { background: var(--blue-link); }
.icon-button.danger-ghost { border-color: var(--line); color: var(--muted); }
.icon-button.danger-ghost:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }

/* keyboard focus only — мышиный клик остаётся чистым */
button:focus, .linklike:focus, summary:focus, [role="tab"]:focus { outline: none; }
button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.linklike:focus-visible { outline-offset: 3px; text-decoration: underline; }
.segmented > button:focus-visible { outline-offset: -2px; }   /* инсет: без наложения на соседа */
.topbar .icon-button:focus-visible { outline-color: var(--yellow); }  /* на #192e45 синее кольцо не видно */
summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 8px; }

/* ============================================================
   Полоса статуса
   ============================================================ */
.status-band {
  position: relative;
  overflow: hidden;
  min-height: 58px;
  padding: var(--sp-3) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  background: linear-gradient(120deg, var(--blue-dark) 0%, var(--blue) 100%);
  color: #fff;
  border: 1px solid var(--blue-dark);
  border-radius: var(--r-lg);
  box-shadow: 0 12px 30px -20px rgba(25,46,69,.6), inset 0 1px 0 rgba(255,255,255,.06);
}
.status-band::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(60% 120% at 88% -10%, rgba(255,213,36,.14), transparent 60%),
    radial-gradient(50% 120% at 0% 120%, rgba(255,255,255,.06), transparent 60%);
}
.status-band > * { position: relative; }   /* держит текст над ::before */
.status-line { display: flex; align-items: center; }
.status-line .ico { margin-right: 9px; opacity: .92; }
.status-line strong { font-size: 15px; font-weight: 700; letter-spacing: .1px; }
.status-dot {
  position: relative;
  width: 9px; height: 9px;
  display: inline-block;
  margin-right: 10px;
  border-radius: 50%;
  background: #939a95;
}
.status-dot.ok { background: var(--success); }
.status-dot.warn { background: var(--yellow); }
.status-dot.bad { background: var(--red); }
.status-meta {
  color: #fff; font-size: 12.5px; text-align: right;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10);
}

/* ============================================================
   Панели
   ============================================================ */
.panel {
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.panel-heading {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.heading-titles { min-width: 0; }
.panel h1 { margin: 0; color: var(--blue-dark); font-size: 21px; line-height: 1.15; letter-spacing: -.2px; }
.panel h2, .audit-section h2 { margin: 0; color: var(--blue-dark); font-size: 15px; display: inline-flex; align-items: center; gap: 7px; }
.eyebrow {
  margin: 0 0 var(--sp-1);
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--blue-link);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.panel-note { margin: 0 0 var(--sp-4); color: var(--muted); font-size: 13px; line-height: 1.55; }
.subheading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; margin-bottom: 12px; }
.section-divider { height: 1px; margin: 18px 0; background: var(--line); }
.button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted-empty,
.find-list.empty,
.leak-list.empty,
.shortcut-empty {
  padding: 20px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background: rgba(25,46,69,.015);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.badge { padding: 5px 9px; border-radius: 999px; background: #e6e6e6; color: #555; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.ok { background: var(--blue); color: #fff; }

/* ============================================================
   Мастер подключения iCloud
   ============================================================ */
.wizard { position: relative; }
.wiz-track { display: flex; gap: 6px; margin-bottom: 18px; }
.wiz-step { flex: 1; height: 4px; border-radius: 999px; background: #e6e6e6; transform-origin: center; transition: background .3s var(--ease-out), transform .3s var(--ease-out); }
.wiz-step.done { background: var(--blue); }
.wiz-step.current { background: var(--yellow); transform: scaleY(1.5); }

.wiz-stages { position: relative; min-height: 220px; }
.stage { display: none; }
.stage.active { display: block; animation: gd-stage-in .34s var(--ease-emph); }
.stage[data-stage="connected"].active .connected-badge { animation: gd-pop .55s var(--ease-emph) both; }
.stage[data-stage="connected"].active .connected-badge .ico { animation: gd-pop-in .5s var(--ease-emph) .12s backwards; }
.stage.leaving {
  display: block;
  position: absolute;
  top: 0; left: 0; right: 0;
  pointer-events: none;
  animation: gd-stage-out .3s ease forwards;
}
.wiz-hero {
  width: 76px; height: 76px;
  margin: 4px auto 14px;
  display: grid; place-items: center;
  border-radius: 20px;
  color: var(--blue);
  background: #edf3f9;
  border: 1px solid #d7e3ee;
}
.wiz-lead { margin: 0 0 16px; color: var(--ink); font-size: 14px; line-height: 1.55; text-align: center; }
.wiz-account {
  margin: 12px 0 14px;
  padding: 9px 12px;
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 999px;
  background: #edf3f9;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 650;
}
.stage[data-stage="password"] .linklike,
.stage[data-stage="2fa"] .linklike { margin-top: 12px; }
.stage[data-stage="2fa"] #wiz-2fa {
  text-align: center;
  font-size: 22px;
  letter-spacing: 8px;
  font-variant-numeric: tabular-nums;
}

.connected-card { display: grid; gap: 14px; }
.connected-head { display: flex; align-items: center; gap: 10px; color: var(--blue-dark); font-size: 15px; }
.connected-head.warn { color: var(--red); }
.connected-badge {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--success);
}
.connected-head.warn .connected-badge { background: var(--red); }
.connected-facts { margin: 0; display: grid; gap: 10px; }
.connected-facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.connected-facts dt { margin: 0; color: var(--muted); font-size: 12.5px; font-weight: 650; }
.connected-facts dd { margin: 0; color: var(--ink); font-size: 13px; text-align: right; }
.wiz-banner {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px;
  border-left: 4px solid var(--red);
  border-radius: 6px;
  background: var(--red-soft);
  color: #8f241f;
  font-size: 13px;
  line-height: 1.45;
}
.wiz-banner .ico { color: var(--red); margin-top: 1px; }

/* ============================================================
   iPhone под защитой
   ============================================================ */
.devices-gate {
  display: grid; place-items: center; gap: var(--sp-3);
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
}
.devices-gate > .ico {
  width: 30px; height: 30px; padding: 15px; box-sizing: content-box;
  border-radius: 50%; color: var(--blue);
  background: var(--tile); box-shadow: inset 0 0 0 1px var(--tile-line);
}
.devices-gate p { margin: 0; font-size: 13.5px; max-width: 360px; line-height: 1.5; }

/* --- список Локатора --- */
.find-list { display: grid; gap: 8px; }
.find-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  animation: gd-rise .4s cubic-bezier(.2,.8,.2,1) backwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}
.find-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 9px;
  color: var(--blue);
  background: #edf3f9;
}
.find-text { display: grid; min-width: 0; }
.find-title { color: var(--ink); font-weight: 700; }
.find-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.find-add { min-height: 36px; padding: 0 13px; font-size: 13px; border-radius: 7px; }
.find-note { color: var(--muted); font-size: 12px; }

/* --- карточки под защитой --- */
.protected-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.pcard {
  display: grid;
  gap: var(--sp-4);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  animation: gd-rise .5s cubic-bezier(.2,.8,.2,1) backwards;
  animation-delay: calc(var(--i, 0) * 70ms);
  transition: box-shadow .22s ease, transform .22s ease;
}
.pcard:hover { box-shadow: var(--shadow-pop); transform: translateY(-2px); }
.pcard-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pcard-title { display: flex; align-items: center; gap: 11px; min-width: 0; color: var(--blue); }
.pcard-title > .ico {
  width: 18px; height: 18px;
  padding: 8px;
  box-sizing: content-box;
  border-radius: var(--r-md);
  color: var(--blue);
  background: var(--tile);
  box-shadow: inset 0 0 0 1px var(--tile-line);
}
.pcard-title strong { color: var(--ink); font-size: 15px; }
.pcard-banner {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 12px;
  border-left: 4px solid var(--red);
  border-radius: 8px;
  background: var(--red-soft);
  color: #8f241f;
  font-size: 12.5px;
  line-height: 1.45;
}
.pcard-banner .ico { color: var(--red); margin-top: 1px; flex: none; }

.pstep { display: grid; gap: var(--sp-3); }
.pstep-head { display: flex; align-items: center; gap: 9px; }
.pstep-num {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 0 0 3px rgba(41,77,115,.10);
}
.pstep-num.danger { background: var(--red); box-shadow: 0 0 0 3px rgba(227,64,57,.12); }
.pstep-title { color: var(--blue-dark); font-size: 14px; font-weight: 700; margin-right: auto; }
.pstep-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.pstep-hint.subtle { opacity: .82; font-size: 11.5px; }

.pin-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; align-items: start; }
.pin-row input { margin-top: 0; }
.pin-row .primary, .pin-row .danger { min-height: 42px; white-space: nowrap; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f2f3f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.chip.ok {
  border-color: rgba(68,173,77,.42);
  background: var(--success-soft);
  color: var(--success);
}
.chip.ok .ico { animation: gd-pop-in .45s cubic-bezier(.2,.9,.2,1); }
.chip-tail { color: var(--muted); font-weight: 600; opacity: .8; }

.lockbox {
  display: grid; place-items: center; gap: var(--sp-2);
  padding: 22px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  background: #f7f7f4;
  color: var(--muted);
  text-align: center;
}
.lockbox > .ico {
  width: 22px; height: 22px; padding: 11px; box-sizing: content-box;
  border-radius: 50%; color: #8a9099;
  background: #eef0f1; box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.lockbox p { margin: 0; font-size: 13px; }

.duress {
  display: grid; gap: 12px;
  padding: 14px;
  border: 1px solid rgba(227,64,57,.5);
  border-left: 4px solid var(--red);
  border-radius: 12px;
  background: var(--red-soft);
  animation: gd-unlock .5s cubic-bezier(.2,.8,.2,1);
}
.duress-head { display: flex; align-items: center; gap: 8px; color: var(--red); font-size: 14px; }
.duress-head .ico { animation: gd-pop-in .5s var(--ease-emph) .06s backwards; }
.duress-set { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-size: 12.5px; font-weight: 700; }
.danger-note {
  padding: 10px 11px;
  border-left: 4px solid var(--red);
  border-radius: 6px;
  background: #fff;
  color: #8f241f;
  font-size: 12.5px;
  line-height: 1.45;
}

/* ============================================================
   Утечка данных iCloud
   ============================================================ */
.leak-list { display: grid; gap: 8px; }
.leak-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: transform .16s ease, box-shadow .16s ease;
}
.leak-row:hover { transform: translateX(2px); box-shadow: 0 6px 16px -12px rgba(25,46,69,.5); }
.leak-name { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--ink); }
.leak-size { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.leak-risk {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
  background: #eef1f5;
  color: var(--muted);
}
.leak-row.sensitive { border-color: rgba(227,64,57,.4); border-left: 3px solid var(--red); }
.leak-row.sensitive .leak-name { color: var(--red); }
.leak-row.sensitive .leak-risk { background: var(--red-soft); color: var(--red); }

/* ============================================================
   Shortcuts
   ============================================================ */
.shortcut-panel { min-height: 190px; }
.shortcut-result { display: grid; gap: 18px; }
.copy-fields { display: grid; gap: 12px; min-width: 0; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) 38px; gap: 7px; align-items: start; }
.copy-row .icon-button { margin-top: 7px; }
.copy-row textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.qr-wrap { margin: 0; justify-self: center; text-align: center; }
.qr-wrap img { display: block; width: 200px; height: 200px; margin: 0 auto; border: 1px solid var(--line); border-radius: 8px; image-rendering: pixelated; }
.qr-wrap figcaption { margin-top: 7px; color: var(--muted); font-size: 12px; }

.shortcut-help { margin: 4px 0 14px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: rgba(0,0,0,0.015); }
.shortcut-help summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.shortcut-help ol { margin: 10px 0 2px; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; line-height: 1.4; }
.shortcut-help code { padding: 1px 5px; border-radius: 6px; background: rgba(0,0,0,0.06); font-size: 12px; }

/* ---------- иконки в раскрывающихся подсказках ---------- */
.shortcut-help summary { display: flex; align-items: center; gap: 9px; list-style: none; }
.shortcut-help summary::-webkit-details-marker { display: none; }
.shortcut-help summary > span { flex: 1 1 auto; }
.shortcut-help summary > .ico:first-child { color: var(--blue-link); }
.shortcut-help summary .disclosure { color: var(--muted); transition: transform .22s cubic-bezier(.2,.8,.2,1); }
.shortcut-help[open] summary .disclosure { transform: rotate(180deg); }

/* ============================================================
   Аудит
   ============================================================ */
.audit-section { padding: 6px 2px 24px; }
.audit-list { border-top: 1px solid var(--line); }
.audit-row { min-height: 45px; display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.audit-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.audit-event { color: var(--ink); font-weight: 600; }
.audit-result { color: var(--muted); text-align: right; }

/* ============================================================
   Тост
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  max-width: min(90vw, 520px);
  padding: 11px 15px;
  transform: translateX(-50%);
  border-radius: 6px;
  color: #fff;
  background: #1f2529;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow: hidden;
}
.toast.error { background: #8f251f; }

.locked-wrap { display: grid; place-items: center; gap: 12px; padding: 14px 4px; text-align: center; }
.locked-wrap .ico { color: var(--blue); }
.locked-note { margin: 0; font-size: 15px; line-height: 1.6; }

/* ============================================================
   Адаптив
   ============================================================ */
@media (min-width: 1120px) {
  .shortcut-result { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
}
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .topbar { padding: 0 14px; }
  .account-tools span { display: none; }
  main { padding: 14px; }
  .status-band { align-items: flex-start; flex-direction: column; gap: 8px; }
  .status-meta { text-align: left; }
  .status-band { padding: var(--sp-3) var(--sp-4); }
  .audit-row { grid-template-columns: 112px 1fr; padding: 8px 0; }
  .audit-result { grid-column: 2; text-align: left; }
}
@media (max-width: 560px) {
  input, textarea, select, button { font-size: 16px; }   /* без зума на iOS при фокусе */
  main { padding: 12px; }
  .auth-shell { padding: 4px; min-height: calc(100vh - 64px); display: grid; align-content: center; }
  .auth-panel { padding: 18px; width: 100%; }
  .panel { padding: 16px; }
  .protected-list { grid-template-columns: 1fr; }
  .pin-row { grid-template-columns: 1fr; }
  .pin-row .primary, .pin-row .danger { width: 100%; }
  .button-row > button { flex: 1 1 auto; }
  .primary, .secondary, .danger { min-height: 46px; }
  button.danger-ghost:not(.icon-button) { min-height: 46px; }
  .icon-button { min-width: 40px; min-height: 40px; }
  .brand { font-size: 16px; }
  .pcard { padding: 16px; }
  .status-band { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); }
  .dashboard { gap: var(--sp-4); }
}

/* ============================================================
   Движение и микро-взаимодействия (палитра не меняется)
   ============================================================ */
@keyframes gd-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes gd-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gd-drop { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: none; } }
@keyframes gd-pop { 0% { opacity: 0; transform: scale(.82) rotate(-6deg); } 60% { transform: scale(1.05) rotate(2deg); } 100% { opacity: 1; transform: none; } }
@keyframes gd-pop-in { 0% { transform: scale(.82); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes gd-toast { from { opacity: 0; transform: translateX(-50%) translateY(14px) scale(.97); } to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }
@keyframes gd-toast-out { from { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } to { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.98); } }
@keyframes gd-pulse-ok { 0%,100% { box-shadow: 0 0 0 0 rgba(68,173,77,.55); } 70% { box-shadow: 0 0 0 9px rgba(68,173,77,0); } }
@keyframes gd-pulse-bad { 0%,100% { box-shadow: 0 0 0 0 rgba(227,64,57,.5); } 70% { box-shadow: 0 0 0 9px rgba(227,64,57,0); } }
@keyframes gd-pulse-warn { 0%,100% { box-shadow: 0 0 0 0 rgba(221,202,0,.55); } 70% { box-shadow: 0 0 0 9px rgba(221,202,0,0); } }
@keyframes gd-aurora { 0% { transform: translate3d(-4%,-2%,0) rotate(0deg); } 50% { transform: translate3d(4%,3%,0) rotate(8deg); } 100% { transform: translate3d(-4%,-2%,0) rotate(0deg); } }
@keyframes gd-sheen { from { background-position: -160% 0; } to { background-position: 160% 0; } }
@keyframes gd-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes gd-stage-in { from { opacity: 0; transform: translateX(11px) scale(.994); } to { opacity: 1; transform: none; } }
@keyframes gd-stage-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(-9px) scale(.994); } }
@keyframes gd-unlock { 0% { opacity: 0; transform: translateY(-8px) scale(.97); } 60% { transform: translateY(2px) scale(1.005); } 100% { opacity: 1; transform: none; } }
@keyframes gd-chip { 0%,100% { box-shadow: 0 0 0 0 rgba(41,77,115,.16); } 55% { box-shadow: 0 0 0 5px rgba(41,77,115,0); } }
@keyframes gd-bell { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-9deg); } 40% { transform: rotate(7deg); } 60% { transform: rotate(-4deg); } }
@keyframes gd-shimmer { from { background-position: 200% 0; } to { background-position: -60% 0; } }
@keyframes gd-ripple { to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
@keyframes gd-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}
@keyframes gd-radar { 0% { transform: scale(.7); opacity: .7; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes gd-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes gd-slide-down { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

body::before {
  content: ""; position: fixed; inset: -20vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38vmax 38vmax at 18% 12%, rgba(41,77,115,.16), transparent 60%),
    radial-gradient(30vmax 30vmax at 82% 8%, rgba(255,213,36,.14), transparent 60%),
    radial-gradient(36vmax 36vmax at 70% 88%, rgba(68,173,77,.12), transparent 62%);
  filter: blur(6px); animation: gd-aurora 22s ease-in-out infinite;
}

.topbar { animation: gd-drop .5s cubic-bezier(.2,.8,.2,1) both; }
.auth-panel { animation: gd-rise .55s cubic-bezier(.2,.8,.2,1) backwards; }
.status-band { animation: gd-rise .5s var(--ease-out) backwards; animation-delay: .04s; }
.dashboard > .panel,
.dashboard > .grid-2 > .panel,
.dashboard > .audit-section { animation: gd-rise .55s cubic-bezier(.2,.8,.2,1) backwards; }
/* Каскад задаётся позицией (nth-child), не id — переживает перестановку секций.
   Дети .dashboard: 1 status-band (свой .04s выше), 2 iCloud, 3 Telegram, 4 iPhone, 5 Shortcut, 6 утечка, 7 аудит. */
.dashboard > :nth-child(2) { animation-delay: .10s; }
.dashboard > :nth-child(3) { animation-delay: .16s; }
.dashboard > :nth-child(4) { animation-delay: .22s; }
.dashboard > :nth-child(5) { animation-delay: .28s; }
.dashboard > :nth-child(6) { animation-delay: .34s; }
.dashboard > :nth-child(7) { animation-delay: .40s; }

.brand-mark { animation: gd-float 3.4s ease-in-out infinite; transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.08); }
.auth-mark { animation: gd-pop .55s cubic-bezier(.2,.9,.2,1) both; }

.status-dot { transition: background .3s ease; }
.status-dot.ok { animation: gd-pulse-ok 2.2s ease-out infinite; }
.status-dot.bad { animation: gd-pulse-bad 1.8s ease-out infinite; }
.status-dot.warn { animation: gd-pulse-warn 2s ease-out infinite; }
.status-dot.ok::after, .status-dot.bad::after, .status-dot.warn::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid currentColor; opacity: 0; animation: gd-radar 2.4s ease-out infinite;
}
.status-dot.ok::after { color: var(--success); }
.status-dot.bad::after { color: var(--red); }
.status-dot.warn::after { color: var(--yellow-dark); }

.panel { transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease; }
.panel:hover { box-shadow: 0 14px 40px -20px rgba(25,46,69,.3); }

.primary, .secondary, .danger, .icon-button { transition: transform .12s var(--ease-press), box-shadow .18s var(--ease-out), filter .2s ease, background .2s ease, color .2s ease, border-color .2s ease; }
.primary:hover  { transform: translateY(-1px); box-shadow: 0 3px 0 var(--edge-primary); }
.secondary:hover{ transform: translateY(-1px); box-shadow: 0 3px 0 var(--edge-secondary); }
.danger:hover   { transform: translateY(-1px); box-shadow: 0 3px 0 var(--edge-danger); }
.primary:active, .secondary:active, .danger:active { transform: translateY(2px); box-shadow: none; }
.icon-button:active { transform: translateY(1px) scale(.97); }
.primary { position: relative; overflow: hidden; }
.primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.38) 50%, transparent 70%);
  background-size: 220% 100%; background-position: -160% 0; opacity: 0; transition: opacity .2s ease;
}
.primary:hover::after { opacity: 1; animation: gd-sheen 1.1s ease; }

button { position: relative; overflow: hidden; }
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: currentColor;
  opacity: .28;
  pointer-events: none;
  animation: gd-ripple .55s cubic-bezier(.2,.7,.3,1) forwards;
}
button:disabled {
  background-image: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.55) 50%, transparent 80%);
  background-size: 220% 100%;
  animation: gd-shimmer 1.1s linear infinite;
}

.icon-button.copied {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-soft);
  box-shadow: 0 1px 2px rgba(68,173,77,.18);
  animation: gd-pop-in .45s cubic-bezier(.2,.9,.2,1);
}
@media (prefers-reduced-motion: no-preference) {
  #refresh-find .ico, #refresh-leak .ico, #refresh-protected .ico,
  #wiz-refresh .ico, #wiz-resend .ico { transition: transform .55s cubic-bezier(.2,.8,.2,1); }
  #refresh-find:hover .ico, #refresh-leak:hover .ico, #refresh-protected:hover .ico,
  #wiz-refresh:hover .ico, #wiz-resend:hover .ico { transform: rotate(-180deg); }
}

input, textarea { transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
input:focus, textarea:focus { transform: translateY(-1px); }
.shake { animation: gd-shake .38s cubic-bezier(.36,.07,.19,.97); }

.badge.ok { animation: gd-pop-in .5s cubic-bezier(.2,.9,.2,1); }
.toast:not(.hidden) { animation: gd-toast .34s var(--ease-emph); }
.toast:not(.hidden)::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--yellow); transform-origin: left; animation: gd-drain 4.5s linear forwards;
}
.toast.error:not(.hidden)::after { background: var(--red); }
.toast.leaving:not(.hidden) { animation: gd-toast-out .26s var(--ease-out) forwards; }

.qr-wrap img { transition: transform .25s cubic-bezier(.2,.8,.2,1); animation: gd-pop .55s cubic-bezier(.2,.9,.2,1) both; }
.qr-wrap img:hover { transform: scale(1.04) rotate(-1deg); }
.shortcut-result:not(.hidden) { animation: gd-rise .45s cubic-bezier(.2,.8,.2,1) both; }

.find-row { transition: transform .18s ease, box-shadow .2s ease, border-color .2s ease; }
.find-row:hover { transform: translateX(3px); box-shadow: 0 6px 18px -12px rgba(25,46,69,.5); }

.chip.pending { animation: gd-chip 2.6s ease-in-out infinite; }
.chip.pending .ico { animation: gd-bell 2.6s ease-in-out infinite; transform-origin: 50% 20%; }

.pcard-banner:not(.hidden), .wiz-banner:not(.hidden) { animation: gd-armed 2.4s ease-in-out infinite; }
@keyframes gd-armed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(227,64,57,0); }
  50%      { box-shadow: 0 0 0 4px rgba(227,64,57,.12); }
}

.shortcut-help[open] ol { animation: gd-slide-down .32s ease; }
.shortcut-help summary { transition: color .18s ease; }
.shortcut-help summary:hover { color: var(--blue); }

.audit-row { transition: background .18s ease, padding-left .18s ease; }
.audit-row:hover { background: rgba(41,77,115,.045); padding-left: 6px; }

.linklike { transition: color .18s ease; }

/* ============================================================
   Уважение к prefers-reduced-motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, body::before { animation: none !important; transition: none !important; }
  .stage.leaving { display: none !important; }
}

/* ============================================================
   Недавно добавленные контролы — приведены к общей системе.
   Только CSS (+ один classList.toggle в app.js для .is-sms).
   Палитра, id, функции и потоки не затронуты. reduced-motion
   выше гасит любые transition через !important независимо от порядка.
   ============================================================ */

/* «Выйти из iCloud»: текстовый ghost-danger — тихий деструктив, на ступень
   ниже filled .secondary/.primary в той же .button-row. :not(.icon-button)
   не трогает кнопку-мусорку в карточке устройства. */
button.danger-ghost:not(.icon-button) {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--btn-radius);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  transition: color .2s ease, border-color .2s ease, background .2s ease,
              box-shadow .18s var(--ease-out), transform .12s var(--ease-press);
}
button.danger-ghost:not(.icon-button):hover {
  border-color: var(--red);
  color: var(--red-ink);
  background: var(--red-soft);
}
button.danger-ghost:not(.icon-button):active { transform: translateY(1px); }
button.danger-ghost:not(.icon-button):disabled {
  border-color: var(--line);
  color: var(--muted);
  background: transparent;
}

/* «Пропустить тест Shortcut»: компактная ссылка, а не 36px-кнопка.
   .linklike.small (0,2,0) перебивает button.small (0,1,1). */
.linklike.small {
  min-height: 0;
  padding: 2px 3px;
  font-size: 12px;
  font-weight: 650;
  border-radius: 4px;
  gap: 4px;
  justify-self: start;   /* в grid .pstep не растягиваться на всю колонку */
}
.linklike.small .ico { width: 13px; height: 13px; }

/* Ссылки на шагах «пароль»/«2FA»: каждая на своей строке, ширина по контенту,
   длинная подпись переносится, иконка выровнена по первой строке. */
.stage[data-stage="password"] > .linklike,
.stage[data-stage="2fa"] > .linklike {
  display: flex;
  align-items: flex-start;
  width: fit-content;
  max-width: 100%;
  line-height: 1.45;
  text-align: left;
}
.stage[data-stage="password"] > .linklike > .ico,
.stage[data-stage="2fa"] > .linklike > .ico { margin-top: 2px; }

/* Лид 2FA в режиме SMS: спокойная янтарная заметка (важное предупреждение,
   а не тревога-красный). Геометрия — как у .wiz-banner, цвет — системный жёлтый.
   Обычный лид (доверенное устройство) остаётся центрированным .wiz-lead. */
#wiz-2fa-lead.is-sms {
  margin: 4px 0 16px;
  padding: 11px 13px;
  text-align: left;
  border-left: 4px solid var(--yellow-dark);
  border-radius: 6px;
  background: rgba(255, 213, 36, .12);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* disabled/busy для текстовых контролов: гасим глобальный shimmer (на прозрачном
   фоне он мигает по пустоте) — приглушённого «…» достаточно. */
.linklike:disabled,
button.danger-ghost:not(.icon-button):disabled {
  background-image: none;
  animation: none;
  opacity: .55;
}

/* ============================================================
   Мастер-панель оператора (CRM)
   ============================================================ */
.crm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.crm-title { margin: 0; color: var(--blue-dark); font-size: 22px; line-height: 1.15; letter-spacing: -.3px; }
.crm-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* --- статистика --- */
.crm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
.stat-tile {
  display: flex; flex-direction: column; gap: 3px;
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}
.stat-tile.ok   { border-left-color: var(--success); }
.stat-tile.warn { border-left-color: var(--yellow-dark); }
.stat-num { font-size: 26px; font-weight: 800; color: var(--blue-dark); line-height: 1; letter-spacing: -.5px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 650; }

/* --- тулбар: поиск + фильтры --- */
.crm-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.crm-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.crm-search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: var(--muted); pointer-events: none; }
.crm-search input { margin: 0; height: 42px; padding-left: 36px; }
.filter-chips { display: flex; gap: 6px; }
.filter-chip {
  min-height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: color .18s var(--ease-out), background .18s var(--ease-out), border-color .18s var(--ease-out);
}
.filter-chip:hover { color: var(--blue-dark); border-color: var(--blue); }
.filter-chip.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* --- список карточек владельцев --- */
.owner-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-4); }
.owner-card {
  display: flex; flex-direction: column; gap: var(--sp-3);
  min-width: 0;
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  transition: transform .2s var(--ease-out), box-shadow .2s ease;
}
.owner-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }

.owner-card__top { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.owner-badge { max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
.owner-avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 17px; font-weight: 800; color: #fff;
  background: var(--blue);
}
.owner-avatar.ok { background: var(--success); }
.owner-avatar.warn { background: var(--yellow-dark); color: var(--blue-dark); }
.owner-avatar.bad { background: var(--red); }
.owner-avatar.neutral { background: #9aa4ae; }

.owner-id { min-width: 0; flex: 1; }
.owner-name { font-weight: 700; color: var(--ink); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner-sub { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.owner-badge {
  flex: none; padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: #eceff2; color: #55606b;
}
.owner-badge.ok { background: var(--success-soft); color: #2e7d33; }
.owner-badge.warn { background: #fff7d6; color: #8a7400; }
.owner-badge.bad { background: var(--red-soft); color: var(--red-ink); }
.owner-badge.neutral { background: #eceff2; color: #55606b; }

.owner-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 8px;
  background: var(--tile); border: 1px solid var(--tile-line);
  font-size: 12px; color: var(--blue-dark);
}
.meta-chip svg { width: 14px; height: 14px; fill: var(--blue); }
.meta-chip b { font-weight: 800; }

.owner-actions { display: flex; gap: 8px; margin-top: auto; }
.owner-actions button { flex: 1; }

.wipe-form { display: grid; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.wipe-form input { margin: 0; }

.owner-empty {
  grid-column: 1 / -1;
  padding: var(--sp-6);
  text-align: center; color: var(--muted); font-size: 14px;
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-md);
}

/* карточки въезжают лесенкой */
.owner-card { animation: gd-rise .45s var(--ease-out) backwards; }
.owner-card:nth-child(1) { animation-delay: .02s; }
.owner-card:nth-child(2) { animation-delay: .06s; }
.owner-card:nth-child(3) { animation-delay: .10s; }
.owner-card:nth-child(4) { animation-delay: .14s; }
.owner-card:nth-child(n+5) { animation-delay: .18s; }

@media (prefers-reduced-motion: reduce) {
  .owner-card { animation: none; }
}

@media (max-width: 640px) {
  .crm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .owner-list { grid-template-columns: minmax(0, 1fr); }
  .crm-toolbar { flex-direction: column; align-items: stretch; }
  /* в колоночном тулбаре flex-grow растянул бы поиск по высоте — фиксируем */
  .crm-search { flex: 0 0 auto; max-width: none; width: 100%; }
  .filter-chips { justify-content: space-between; }
  .filter-chip { flex: 1; }
}

/* ============================================================
   Мастер-консоль оператора — тёмная тема (Mullvad-navy).
   Scoped на body.console (только /master). Клиентский index.html
   без этого класса — его светлый вид не затрагивается.
   ============================================================ */
body.console {
  --cbg: #14273e;
  --ccard: #1e3a5a;
  --cline: rgba(255, 255, 255, .08);
  --cline2: rgba(255, 255, 255, .14);
  --ctext: #e9f1f9;
  --cmuted: #9ab0c6;
  --cblue: #3f6f9f;
  /* фирменная «глубина» Mullvad — свечение в шапке */
  background:
    radial-gradient(130% 340px at 50% 0, rgba(41, 77, 115, .5), transparent 70%),
    var(--cbg);
  background-repeat: no-repeat;
  color: var(--ctext);
  min-height: 100vh;
}
body.console .topbar { background: #0f2036; border-bottom: 1px solid var(--cline); }

body.console .crm-title { color: #f4f8fc; }
body.console .crm-subtitle { color: var(--cmuted); }

/* статы */
body.console .stat-tile {
  background: linear-gradient(180deg, rgba(33, 64, 99, .55), var(--ccard));
  border-color: var(--cline);
  border-left-color: var(--cblue);
  box-shadow: 0 14px 34px -22px rgba(0, 0, 0, .8);
}
body.console .stat-tile.ok { border-left-color: #4fc95a; }
body.console .stat-tile.warn { border-left-color: var(--yellow); }
body.console .stat-num { color: #f4f8fc; }
body.console .stat-label { color: var(--cmuted); }

/* тулбар */
body.console .crm-search input { background: #11223a; border-color: var(--cline2); color: var(--ctext); }
body.console .crm-search input::placeholder { color: #7d92a8; }
body.console .crm-search input:focus { border-color: var(--cblue); box-shadow: 0 0 0 3px rgba(63, 111, 159, .25); }
body.console .crm-search-ico { fill: #7d92a8; }
body.console .filter-chip { background: #1c3757; border-color: var(--cline); color: var(--cmuted); }
body.console .filter-chip:hover { color: #fff; border-color: var(--cblue); }
body.console .filter-chip.is-active { background: var(--blue); border-color: #4d80b0; color: #fff; }

/* карточки */
body.console .owner-card {
  background: linear-gradient(180deg, rgba(33, 64, 99, .40), var(--ccard));
  border-color: var(--cline);
  box-shadow: 0 16px 40px -24px rgba(0, 0, 0, .85);
}
body.console .owner-card:hover { box-shadow: 0 24px 52px -22px rgba(0, 0, 0, .9); border-color: rgba(120, 170, 220, .35); }
body.console .owner-name { color: #f4f8fc; }
body.console .owner-sub { color: #8ea4bb; }
body.console .owner-avatar { box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .7); }

body.console .owner-badge { background: #294763; color: #b9c9db; }
body.console .owner-badge.ok { background: rgba(79, 201, 90, .16); color: #82e08c; }
body.console .owner-badge.warn { background: rgba(255, 213, 36, .15); color: #ffe270; }
body.console .owner-badge.bad { background: rgba(242, 99, 92, .16); color: #ff9d97; }
body.console .owner-badge.neutral { background: #294763; color: #a9bccf; }

body.console .meta-chip { background: #16293f; border-color: var(--cline); color: #cfdcec; }
body.console .meta-chip svg { fill: #74a6d8; }
body.console .meta-chip b { color: #fff; }

/* кнопки на тёмном */
body.console button.secondary { background: var(--blue); border-color: #4d80b0; box-shadow: 0 2px 0 #14304b; }
body.console button.secondary:hover { background: var(--blue-link); }
body.console button.danger { background: rgba(242, 99, 92, .12); border-color: rgba(242, 99, 92, .5); color: #ff9d97; box-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
body.console button.danger:hover { background: rgba(242, 99, 92, .2); color: #ffb4ae; }
body.console button.danger:disabled { background: rgba(255, 255, 255, .04); border-color: var(--cline); color: #62778d; box-shadow: none; }

/* wipe + пусто */
body.console .wipe-form { border-top-color: var(--cline2); }
body.console .wipe-form input { background: #11223a; border-color: var(--cline2); color: var(--ctext); }
body.console .owner-empty { background: #1c3757; border-color: var(--cline2); color: var(--cmuted); }

/* экран входа */
body.console .auth-panel { background: var(--ccard); border-color: var(--cline); box-shadow: 0 20px 50px -28px rgba(0, 0, 0, .85); }
body.console .segmented { background: #16293f; }
body.console .segmented > button { color: var(--cmuted); }
body.console .segmented > button.active { background: var(--blue); color: #fff; box-shadow: none; }
body.console label { color: var(--cmuted); }
body.console input { background: #11223a; border-color: var(--cline2); color: var(--ctext); }
body.console input::placeholder { color: #7d92a8; }
body.console .master-note { color: var(--cmuted); }

/* ============================================================
   Иконки и микро-анимации мастер-консоли
   ============================================================ */
.icon-button svg { width: 18px; height: 18px; fill: currentColor; }
.icon-button.spinning svg { animation: gd-spin .6s linear infinite; }

/* иконка-водяной знак в стат-плитке */
.stat-tile { position: relative; overflow: hidden; }
.stat-ico { position: absolute; top: 13px; right: 13px; width: 22px; height: 22px; opacity: .26; fill: var(--blue); }
.stat-tile.ok .stat-ico { fill: var(--success); }
.stat-tile.warn .stat-ico { fill: var(--yellow-dark); }

/* иконки в кнопках карточек */
.owner-actions button svg { width: 15px; height: 15px; fill: currentColor; flex: none; }

/* статус-точка в бейдже */
.owner-badge { display: inline-flex; align-items: center; }
.badge-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; margin-right: 6px; flex: none;
}
.owner-badge.ok .badge-dot { animation: gd-pulse-dot 1.9s ease-in-out infinite; }
.owner-badge.warn .badge-dot,
.owner-badge.bad .badge-dot { animation: gd-pulse-dot 1.15s ease-in-out infinite; }

/* спиннер загрузки внутри кнопки (заменяет «…») */
.btn-spin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  display: inline-block; opacity: .85;
  animation: gd-spin .6s linear infinite;
}

@keyframes gd-spin { to { transform: rotate(360deg); } }
@keyframes gd-pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; opacity: .95; }
  50% { box-shadow: 0 0 0 4px transparent; opacity: .55; }
}

/* --- тёмная консоль: подсветка иконок/точек под navy --- */
body.console .stat-ico { fill: #6ea3d8; opacity: .30; }
body.console .stat-tile.ok .stat-ico { fill: #4fc95a; }
body.console .stat-tile.warn .stat-ico { fill: var(--yellow); }

@media (prefers-reduced-motion: reduce) {
  .icon-button.spinning svg,
  .badge-dot,
  .btn-spin { animation: none !important; }
}
