/* iOS 26 — Liquid Glass, system colors, SF typography */
:root {
  --bg: #000000;
  --bg-grouped: #1c1c1e;
  --bg-secondary: #2c2c2e;
  --bg-tertiary: #3a3a3c;
  --fill-primary: rgba(120, 120, 128, 0.36);
  --fill-secondary: rgba(120, 120, 128, 0.32);
  --fill-tertiary: rgba(118, 118, 128, 0.24);
  --glass: rgba(28, 28, 30, 0.72);
  --glass-strong: rgba(44, 44, 46, 0.82);
  --separator: rgba(84, 84, 88, 0.65);
  --border: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --text-muted: rgba(235, 235, 245, 0.38);
  --blue: #0a84ff;
  --blue-soft: rgba(10, 132, 255, 0.18);
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, 0.16);
  --orange: #ff9f0a;
  --orange-soft: rgba(255, 159, 10, 0.16);
  --red: #ff453a;
  --teal: #64d2ff;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-bubble: 20px;
  --blur: blur(40px) saturate(180%);
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --ring: 0 0 0 3px rgba(10, 132, 255, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

input, textarea, button { font-family: inherit; }

.ico {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}
.ico-sm { width: 18px; height: 18px; }
.ico-lg { width: 22px; height: 22px; }

.mesh-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg);
}

.login[hidden], .app[hidden], .dashboard[hidden], [hidden] { display: none !important; }
body.app-mode .mesh-bg,
body:has(.app:not([hidden])) .mesh-bg {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(10, 132, 255, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(100, 210, 255, 0.08), transparent 50%),
    var(--bg);
}
body.dash-mode .mesh-bg,
body:has(.dashboard:not([hidden])) .mesh-bg {
  background:
    radial-gradient(ellipse 70% 45% at 20% -5%, rgba(10, 132, 255, 0.16), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 30%, rgba(191, 90, 242, 0.08), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 110%, rgba(48, 209, 88, 0.06), transparent 50%),
    var(--bg);
}

/* ── Вход: full-bleed hero ───────────────────────────────────────────── */
.login {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(28px + var(--safe-top)) calc(20px + var(--safe-right)) calc(28px + var(--safe-bottom)) calc(20px + var(--safe-left));
  overflow: hidden;
}
.login-hero {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.login-hero picture,
.login-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transform: scale(1.04);
  animation: login-ken 18s ease-in-out infinite alternate;
}
@media (min-width: 769px) {
  .login-hero-img { object-position: center; }
}
@keyframes login-ken {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.1) translate3d(-1.5%, -1%, 0); }
}
.login-hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, rgba(0, 0, 0, 0.42) 40%, rgba(0, 0, 0, 0.78) 100%);
  pointer-events: none;
}
.login-stage {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  animation: login-card-in 0.55s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.login-hero-copy {
  text-align: center;
  padding: 0 8px;
}
.login-hero-title {
  margin: 0;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 11vw, 72px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: #fff;
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}
.login-hero-sub {
  margin: 14px 0 0;
  font-family: var(--font);
  font-size: clamp(16px, 3.6vw, 20px);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.92);
  display: inline-block;
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
  padding-bottom: 2px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.login-card {
  width: 100%;
  background: rgba(18, 18, 20, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  padding: 28px 24px;
  backdrop-filter: blur(36px) saturate(180%);
  -webkit-backdrop-filter: blur(36px) saturate(180%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 28px 80px rgba(0, 0, 0, 0.45);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.login-card[hidden],
.login-hero-copy[hidden] { display: none !important; }

/* Success welcome on same hero screen */
.login-welcome {
  width: 100%;
  text-align: center;
  padding: 12px 8px 8px;
  animation: welcome-in 0.55s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.login-welcome[hidden] { display: none !important; }

/* Сплэш при восстановлении сессии — без мелькающей формы входа */
.login-booting {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 10px 8px 4px;
  animation: welcome-in 0.4s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.login-booting[hidden] { display: none !important; }
.login-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: #fff;
  animation: login-spin 0.8s linear infinite;
}
@keyframes login-spin { to { transform: rotate(360deg); } }
.login-booting-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: -0.01em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* Push onboarding on login hero */
.login-push {
  width: 100%;
  animation: welcome-in 0.5s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.login-push[hidden] { display: none !important; }
.login-push-card {
  width: 100%;
  background: rgba(18, 18, 20, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  padding: 28px 24px;
  backdrop-filter: blur(36px) saturate(180%);
  -webkit-backdrop-filter: blur(36px) saturate(180%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 28px 80px rgba(0, 0, 0, 0.45);
}
.login-push-title {
  margin: 0;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
  text-align: center;
}
.login-push-sub {
  margin: 12px 0 22px;
  text-align: center;
  font-size: 15px;
  line-height: 1.4;
  color: rgba(235, 235, 245, 0.7);
}
.push-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  margin-bottom: 16px;
  user-select: none;
}
.push-toggle-label {
  font-size: 16px;
  font-weight: 560;
  color: #fff;
}
.push-switch {
  position: relative;
  width: 52px;
  height: 32px;
  flex-shrink: 0;
}
.push-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.push-switch-ui {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.36);
  transition: background 0.22s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.push-switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.push-switch input:checked + .push-switch-ui {
  background: var(--green);
}
.push-switch input:checked + .push-switch-ui::after {
  transform: translateX(20px);
}
.login-push-hint {
  margin: 0 0 14px;
  text-align: center;
  font-size: 14px;
  color: rgba(235, 235, 245, 0.65);
  line-height: 1.35;
}
.login-push-hint.is-error { color: #ff6961; }
.login-push .btn-primary:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}
@keyframes welcome-in {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-welcome-check {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(48, 209, 88, 0.14);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 1px rgba(48, 209, 88, 0.25), 0 16px 40px rgba(48, 209, 88, 0.18);
}
.login-welcome-svg {
  width: 52px;
  height: 52px;
}
.login-welcome-circle {
  stroke: #30d158;
  stroke-width: 2.5;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: welcome-circle 0.6s ease-out forwards;
}
.login-welcome-tick {
  stroke: #30d158;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: welcome-tick 0.35s 0.45s ease-out forwards;
}
@keyframes welcome-circle {
  to { stroke-dashoffset: 0; }
}
@keyframes welcome-tick {
  to { stroke-dashoffset: 0; }
}
.login-welcome-label {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(48, 209, 88, 0.95);
}
.login-welcome-name {
  margin: 10px 0 0;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 8vw, 48px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
  animation: welcome-name 0.55s 0.25s both cubic-bezier(0.2, 0.9, 0.2, 1);
}
@keyframes welcome-name {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.login.is-leaving {
  transition: opacity 0.4s ease, transform 0.4s ease;
  opacity: 0;
  transform: scale(1.02);
}
.login.is-leaving .login-hero-img {
  animation: none;
  transform: scale(1.12);
  transition: transform 0.5s ease;
}

@keyframes login-card-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: rgba(235, 235, 245, 0.55);
  margin-bottom: 8px;
}
.field-shell {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 2px 4px 2px 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field-shell:focus-within {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(10, 132, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.22);
}
.field-ico {
  color: rgba(235, 235, 245, 0.45);
  margin-right: 10px;
  flex-shrink: 0;
}
.field-shell input,
.field input {
  width: 100%;
  background: transparent !important;
  border: none !important;
  border-radius: 14px;
  padding: 14px 12px 14px 0;
  color: #fff !important;
  font-size: 17px;
  letter-spacing: -0.01em;
  outline: none;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
  caret-color: var(--blue);
}
.field-shell input { padding-left: 0; }
.field-shell:not(:has(.field-ico)) input { padding-left: 12px; }
.field input::placeholder,
.field-shell input::placeholder { color: rgba(235, 235, 245, 0.35); }
/* Убираем жёлтый autofill Chrome */
.field-shell input:-webkit-autofill,
.field-shell input:-webkit-autofill:hover,
.field-shell input:-webkit-autofill:focus,
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff !important;
  caret-color: var(--blue);
  transition: background-color 99999s ease-in-out 0s;
  box-shadow: 0 0 0 1000px rgba(28, 28, 30, 0.92) inset !important;
  border-radius: 14px;
}
.advanced { margin-bottom: 18px; }
.advanced summary {
  cursor: pointer;
  color: #7ec8ff;
  font-size: 15px;
  padding: 6px 0;
  user-select: none;
}
.btn-primary {
  width: 100%;
  background: linear-gradient(180deg, #1a90ff 0%, #0a84ff 100%);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(10, 132, 255, 0.35);
  transition: transform 0.12s, opacity 0.15s, box-shadow 0.2s;
}
.btn-primary:hover {
  opacity: 0.96;
  box-shadow: 0 14px 34px rgba(10, 132, 255, 0.42);
}
.btn-primary:active { transform: scale(0.98); }
.login-error {
  margin-top: 14px;
  color: #ff6961;
  font-size: 15px;
  text-align: center;
}

@media (max-width: 480px) {
  .login-card {
    padding: 28px 20px;
    border-radius: 24px;
    max-width: 100%;
  }
  .login-title { font-size: 28px; }
}

/* ── Каркас ───────────────────────────────────────────────────────────── */
.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  overflow: hidden;
  animation: app-in 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
}
@keyframes app-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Сайдбар ──────────────────────────────────────────────────────────── */
.side {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-right: 0.5px solid var(--separator);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 1;
}
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) calc(16px + var(--safe-right)) 10px calc(16px + var(--safe-left));
  gap: 10px;
}
.side-head-l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.side-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.side-me {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-actions { display: flex; gap: 8px; flex-shrink: 0; }
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--fill-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}
.icon-btn:hover {
  background: var(--fill-secondary);
  color: var(--text);
}
.icon-btn:active { transform: scale(0.94); }

.side-search { padding: 0 16px 10px; }
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap .ico {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  background: var(--fill-tertiary);
  border: none;
  border-radius: 12px;
  padding: 10px 14px 10px 38px;
  color: var(--text);
  font-size: 17px;
  outline: none;
  transition: box-shadow 0.2s;
}
.search-wrap input::placeholder { color: var(--text-muted); }
.search-wrap input:focus { box-shadow: var(--ring); }

.side-scope {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 16px 12px;
  padding: 4px;
  border-radius: 12px;
  background: var(--fill-tertiary);
}
.scope-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.12s;
}
.scope-btn:active { transform: scale(0.98); }
.scope-btn.is-active {
  background: var(--bg-secondary);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 4px 14px rgba(0, 0, 0, 0.25);
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px calc(12px + var(--safe-bottom));
  overscroll-behavior: contain;
}
.chat-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 10px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background 0.15s;
}
.chat-item:hover { background: var(--fill-tertiary); }
.chat-item.is-active { background: var(--fill-secondary); }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--av-a, #2c2c2e) 0%, var(--av-b, #3a3a3c) 100%);
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}
.avatar-sm { width: 36px; height: 36px; }
.avatar-sm .avatar-text { font-size: 13px; }
.avatar-lg { width: 72px; height: 72px; }
.avatar-lg .avatar-text { font-size: 24px; letter-spacing: -0.03em; }
.avatar-text {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1;
  user-select: none;
}
.avatar .dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--bg-grouped);
}
.dot.manager { background: var(--green); }
.dot.waiting { background: var(--orange); }

.ci-body { min-width: 0; }
.ci-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.022em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ci-last {
  font-size: 15px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.ci-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ci-time { font-size: 15px; color: var(--text-muted); white-space: nowrap; }
.ci-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
}
.ci-tag.manager { background: var(--green-soft); color: var(--green); }
.ci-tag.other { background: var(--fill-tertiary); color: var(--text-secondary); }

.ci-unread {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.18);
  flex-shrink: 0;
}
.chat-item.is-unread .ci-name { font-weight: 700; }
.chat-item.is-unread .ci-last { color: var(--text); }

/* Кнопка «Обновить»: один оборот стрелки при нажатии */
.icon-btn .ico.is-spinning { animation: refresh-spin 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Чат ──────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  position: relative;
  z-index: 1;
}
.main.is-chat .empty-state { display: none !important; }
.main:not(.is-chat) .conversation { display: none !important; }

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}
.list-empty {
  padding: 24px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 15px;
}
.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--fill-tertiary);
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.empty-text {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 260px;
  line-height: 1.45;
}

.conversation {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}
.conv-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) calc(16px + var(--safe-right)) 10px calc(12px + var(--safe-left));
  border-bottom: 0.5px solid var(--separator);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  flex-shrink: 0;
  z-index: 2;
}
.conv-back { display: none; }
.conv-who {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.conv-avatar-wrap { flex-shrink: 0; }
.conv-who-text { min-width: 0; }
.conv-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.022em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-meta {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.conv-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.control-badge {
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.control-badge.other {
  background: var(--fill-tertiary);
  color: var(--text-secondary);
}
.return-kira-btn {
  color: #64d2ff;
  border: 1px solid rgba(100, 210, 255, 0.3);
  background: rgba(10, 132, 255, 0.16);
  flex-shrink: 0;
}
.return-kira-btn[hidden] { display: none !important; }
.return-kira-btn:hover {
  background: rgba(10, 132, 255, 0.26);
  border-color: rgba(100, 210, 255, 0.5);
}
.btn-ghost {
  border: none;
  background: var(--fill-tertiary);
  color: var(--blue);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn-ghost:hover { background: var(--fill-secondary); }
.btn-ghost:active { opacity: 0.8; }

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overscroll-behavior: contain;
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
}

/* iMessage-style bubbles */
.msg {
  max-width: min(75%, 420px);
  border-radius: var(--radius-bubble);
  font-size: 17px;
  line-height: 1.35;
  flex-shrink: 0;
  letter-spacing: -0.022em;
}
.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px 0;
}
.msg-who {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  opacity: 0.7;
}
.msg-time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
  flex-shrink: 0;
}
.msg-body {
  padding: 8px 14px 10px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.msg--client {
  align-self: flex-start;
  background: var(--bg-secondary);
  border-bottom-left-radius: 6px;
  color: var(--text);
}
.msg--client .msg-who { color: var(--text-secondary); }

.msg--kira {
  align-self: flex-end;
  background: var(--bg-tertiary);
  border-bottom-right-radius: 6px;
  color: var(--text);
}
.msg--kira .msg-who { color: var(--teal); opacity: 1; }

.msg--manager {
  align-self: flex-end;
  background: var(--blue);
  border-bottom-right-radius: 6px;
  color: #fff;
}
.msg--manager .msg-who { color: rgba(255, 255, 255, 0.75); opacity: 1; }
.msg--manager .msg-time { opacity: 0.65; }

.msg-system {
  align-self: center;
  max-width: 92%;
  padding: 8px 0;
}
.msg-system span {
  display: inline-block;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--fill-tertiary);
  border-radius: 999px;
  padding: 6px 14px;
  line-height: 1.35;
}

.msg-event {
  align-self: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
}
.msg-event-card {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  max-width: min(560px, 92%);
  background: rgba(28, 28, 30, 0.82);
  border: 0.5px solid var(--separator);
  border-radius: 16px;
  padding: 10px 12px;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.msg-event-ico {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
  display: grid;
  place-items: center;
}
.msg-event--kira .msg-event-ico {
  background: rgba(100, 210, 255, 0.16);
  color: var(--teal);
}
.msg-event-text { min-width: 0; }
.msg-event-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.msg-event-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-event-time {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.msg-event-note {
  max-width: min(560px, 92%);
  margin: 6px auto 0;
  padding: 0 4px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

.composer {
  border-top: 0.5px solid var(--separator);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  padding: 10px 12px calc(10px + var(--safe-bottom));
  flex-shrink: 0;
  z-index: 2;
}
.manager-hint {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.35;
  padding: 0 4px;
}
.manager-hint[hidden] { display: none !important; }
.readonly-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--fill-tertiary);
  border: 0.5px solid var(--separator);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.35;
}
.readonly-notice[hidden] { display: none !important; }
.readonly-notice .ico { color: var(--text-muted); flex-shrink: 0; }
.composer-row[hidden] { display: none !important; }
.product-picker {
  margin: 0 0 8px;
  padding: 0 2px;
  display: flex;
}
.product-picker[hidden] { display: none !important; }
.product-links-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.05) 55%, rgba(10, 132, 255, 0.14) 100%),
    rgba(28, 28, 30, 0.45);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
.product-links-btn:active { transform: scale(0.97); }
.product-links-btn:hover { border-color: rgba(10, 132, 255, 0.45); color: var(--text); }
.product-links-btn .ico { width: 15px; height: 15px; color: #64d2ff; }

.product-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.product-sheet[hidden] { display: none !important; }
.product-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.product-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 22px 22px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(44, 44, 46, 0.96) 0%, rgba(22, 22, 24, 0.98) 100%);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  padding: 10px 14px calc(16px + var(--safe-bottom));
  animation: productSheetIn 0.28s ease;
}
@keyframes productSheetIn {
  from { transform: translateY(18px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}
.product-grab {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  margin: 2px auto 12px;
}
.product-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 0 2px;
}
.product-sheet-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.product-sheet-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.35;
}
.product-sheet-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.product-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  align-items: center;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.04) 55%),
    rgba(28, 28, 30, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.product-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.product-row-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.product-row-meta {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.product-row-url {
  grid-column: 1 / -1;
  font-size: 12px;
  color: #64d2ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
}
.product-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 92px;
  height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 132, 255, 0.22);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.product-copy-btn:active { transform: scale(0.97); }
.product-copy-btn.is-copied {
  background: rgba(48, 209, 88, 0.28);
  border-color: rgba(48, 209, 88, 0.45);
}
.product-copy-btn .ico {
  width: 15px;
  height: 15px;
}
.product-sheet-empty {
  padding: 24px 8px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}
@media (min-width: 768px) {
  .product-sheet { align-items: center; padding: 24px; }
  .product-panel {
    border-radius: 22px;
    max-height: min(78vh, 680px);
  }
  .product-grab { display: none; }
}
.composer-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--fill-tertiary);
  border-radius: 22px;
  padding: 6px 6px 6px 14px;
}
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  min-height: 36px;
  background: transparent;
  border: none;
  padding: 8px 0;
  color: var(--text);
  font-size: 17px;
  outline: none;
  line-height: 1.35;
}
.composer textarea::placeholder { color: var(--text-muted); }
.composer textarea:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.btn-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: transform 0.12s, opacity 0.15s;
}
.btn-send:hover { opacity: 0.9; }
.btn-send:active { transform: scale(0.92); }
.btn-send:disabled { opacity: 0.35; cursor: default; }

/* ── Профиль (sheet + Apple Watch ring) ──────────────────────────────── */
body.profile-open { overflow: hidden; }
body.product-open { overflow: hidden; }
.profile-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.profile-sheet[hidden] { display: none !important; }
.profile-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}
.profile-panel {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  max-height: min(88dvh, 720px);
  overflow-y: auto;
  background: var(--glass-strong);
  border: 0.5px solid var(--separator);
  border-radius: 28px 28px 0 0;
  padding: 10px 20px calc(24px + var(--safe-bottom));
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.45);
  animation: profile-up 0.32s cubic-bezier(0.2, 0.9, 0.2, 1);
}
@keyframes profile-up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.profile-grab {
  width: 36px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  margin: 4px auto 12px;
}
.profile-close {
  position: absolute;
  top: 14px;
  right: 14px;
}
.profile-ring-wrap {
  position: relative;
  width: 148px;
  height: 148px;
  margin: 8px auto 18px;
  display: grid;
  place-items: center;
}
.profile-ring {
  position: absolute;
  inset: 0;
  width: 148px;
  height: 148px;
  transform: rotate(-90deg);
}
.profile-ring-track {
  fill: none;
  stroke: rgba(120, 120, 128, 0.28);
  stroke-width: 8;
}
.profile-ring-arc {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dasharray 0.45s ease, stroke-dashoffset 0.45s ease;
}
.profile-ring-mine { stroke: var(--green); }
.profile-ring-wait { stroke: var(--orange); }
.profile-avatar {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
}
.profile-hi {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.profile-role {
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
  margin-top: 6px;
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 22px 0 14px;
}
.profile-stat {
  background: var(--fill-tertiary);
  border-radius: 16px;
  padding: 14px 8px;
  text-align: center;
}
.profile-stat-n {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.profile-stat-l {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}
.profile-note {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
  text-align: center;
  padding: 0 8px;
}
.profile-push {
  width: 100%;
  margin: 4px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-push[hidden] { display: none !important; }
.profile-push-btn {
  width: 100%;
}
.profile-push-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  color: var(--text-secondary);
}
.profile-push-hint.is-error { color: #ff6961; }
.profile-push-hint[hidden] { display: none !important; }

@media (min-width: 769px) {
  .profile-sheet { align-items: center; padding: 24px; }
  .profile-panel {
    border-radius: 24px;
    max-height: min(80dvh, 640px);
    animation: profile-fade 0.25s ease;
  }
  @keyframes profile-fade {
    from { transform: scale(0.97); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }
}

/* ── Мобильная вёрстка ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .side { width: 100%; }
  .app.viewing .side { display: none; }
  .app:not(.viewing) .main { display: none; }
  .conv-back { display: grid; }
  .side-title { font-size: 28px; }
  .conv-ctrl { flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
  .control-badge { font-size: 12px; padding: 5px 8px; max-width: 84px; }
  .btn-ghost { font-size: 13px; padding: 6px 12px; }
  .icon-btn { width: 34px; height: 34px; }
  .conv-head { gap: 8px; }
  .msg { max-width: 88%; font-size: 16px; }
  .login-card { padding: 28px 22px; }
  .side-head { padding-top: calc(10px + var(--safe-top)); }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .side-actions { gap: 6px; }
  .composer { padding-bottom: calc(12px + var(--safe-bottom)); }
  .chat-item { min-height: 64px; }
  .ci-tag {
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .avatar { width: 40px; height: 40px; }
  .avatar-text { font-size: 14px; }
  .chat-item { grid-template-columns: 40px 1fr auto; gap: 10px; }
}

@media (min-width: 769px) {
  .conv-back { display: none !important; }
}

.chat-list::-webkit-scrollbar,
.scroll::-webkit-scrollbar { width: 0; height: 0; }

@media (display-mode: standalone) {
  .side-head { padding-top: calc(16px + var(--safe-top)); }
  .conv-head { padding-top: calc(14px + var(--safe-top)); }
  .dash-head { padding-top: calc(16px + var(--safe-top)); }
}

/* ── Дашборд (marketing / head) ───────────────────────────────────────── */
.dashboard {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: app-in 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + var(--safe-top)) calc(20px + var(--safe-right)) 8px calc(20px + var(--safe-left));
}
.dash-brand {
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
}
.dash-me {
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-secondary);
}
.dash-actions { display: flex; gap: 8px; }

.dash-tabs {
  display: flex;
  gap: 4px;
  margin: 4px 16px 0;
  padding: 4px;
  border-radius: 14px;
  background: var(--fill-tertiary);
}
.dash-tabs[hidden] { display: none !important; }
.dash-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.12s;
}
.dash-tab:active { transform: scale(0.98); }
.dash-tab.is-active {
  background: var(--bg-secondary);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 4px 14px rgba(0, 0, 0, 0.25);
}

.dash-periods {
  display: flex;
  gap: 6px;
  padding: 8px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.dash-periods::-webkit-scrollbar { display: none; }
.dash-period {
  flex-shrink: 0;
  border: none;
  background: var(--fill-tertiary);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 560;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.dash-period.is-active {
  background: #fff;
  color: #000;
  font-weight: 700;
}

.dash-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 16px calc(28px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 22px;
  overscroll-behavior: contain;
}
.dash-scroll.dash-head-layout #dashManagersSection { order: -1; }
.dash-scroll.dash-marketing-layout #dashSourcesSection { order: 0; }
.dash-scroll.dash-marketing-layout #dashRingsSection { order: -1; }

.dash-section {
  background: rgba(28, 28, 30, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  padding: 18px 16px 16px;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}
.dash-section.is-emphasized {
  border-color: rgba(10, 132, 255, 0.28);
  box-shadow: 0 0 0 1px rgba(10, 132, 255, 0.08), 0 20px 50px rgba(0, 0, 0, 0.28);
}
.dash-section-title {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dash-rings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 10px;
}
@media (min-width: 720px) {
  .dash-rings { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dashboard { max-width: 1120px; margin: 0 auto; width: 100%; }
}
@media (min-width: 900px) {
  .dash-scroll {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-content: start;
    gap: 20px;
  }
  #dashRingsSection { grid-column: 1 / -1; }
  .dash-scroll.dash-head-layout #dashManagersSection { grid-column: 1 / -1; order: -1; }
}

.metric-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}
.metric-ring-svg {
  width: 108px;
  height: 108px;
  transform: rotate(-90deg);
}
.metric-ring-track {
  stroke: rgba(120, 120, 128, 0.28);
  stroke-width: 8;
}
.metric-ring-arc {
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.05s cubic-bezier(0.2, 0.85, 0.2, 1);
}
.metric-ring {
  position: relative;
}
.metric-ring-core {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 108px;
  height: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.metric-ring-n {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.metric-ring-pct {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}
.metric-ring-label {
  font-size: 13px;
  font-weight: 560;
  color: var(--text-secondary);
  max-width: 120px;
  line-height: 1.25;
}

.dash-sources { display: flex; flex-direction: column; gap: 12px; }
.source-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  animation: dash-row-in 0.45s both cubic-bezier(0.2, 0.9, 0.2, 1);
  animation-delay: calc(var(--i, 0) * 40ms);
}
@keyframes dash-row-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.source-rank {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--fill-tertiary);
  color: var(--text-secondary);
}
.source-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.source-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.source-meta {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.source-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.22);
  overflow: hidden;
}
.source-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a84ff, #64d2ff);
  box-shadow: 0 0 12px rgba(10, 132, 255, 0.35);
  transform-origin: left center;
  animation: bar-grow 0.7s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
@keyframes bar-grow {
  from { transform: scaleX(0.08); opacity: 0.4; }
  to { transform: scaleX(1); opacity: 1; }
}

.mgr-table { display: flex; flex-direction: column; gap: 2px; }
.mgr-row {
  display: grid;
  grid-template-columns: 28px 1fr 72px 72px;
  gap: 8px;
  align-items: center;
  padding: 10px 8px;
  border-radius: 12px;
  animation: dash-row-in 0.45s both cubic-bezier(0.2, 0.9, 0.2, 1);
  animation-delay: calc(var(--i, 0) * 35ms);
}
.mgr-row:not(.mgr-head):nth-child(even) { background: rgba(255, 255, 255, 0.03); }
.mgr-head {
  padding-top: 0;
  padding-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  animation: none;
}
.mgr-rank {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--fill-tertiary);
  color: var(--text-secondary);
}
.mgr-row:nth-child(2) .mgr-rank {
  background: rgba(10, 132, 255, 0.2);
  color: #7ec8ff;
}
.mgr-name {
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.mgr-mini {
  display: block;
  margin-top: 6px;
  height: 4px;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.22);
  overflow: hidden;
}
.mgr-mini i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #30d158, #64d2ff);
}
.mgr-n {
  text-align: right;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.mgr-n.muted { color: var(--text-secondary); font-weight: 600; }
.dash-empty {
  padding: 18px 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
}

@media (max-width: 420px) {
  .mgr-row { grid-template-columns: 28px 1fr 56px 56px; }
  .metric-ring-svg,
  .metric-ring-core { width: 96px; height: 96px; }
  .metric-ring-n { font-size: 22px; }
}
