:root {
  /* фон — тёмно-синий */
  --bg: #0a1730;
  --surface: #11224a;
  --surface-2: #162a57;
  --line: rgba(160, 190, 255, 0.12);
  --text: #eaf0fb;
  --muted: #93a6c8;

  /* всплывающие окна и меню — белые */
  --pop: #ffffff;
  --pop-text: #0f1b33;
  --pop-muted: #66748c;
  --pop-line: #e4e9f2;
  --pop-hover: #f2f5fb;

  --accent: #3b82f6;
  --accent-hover: #2f6fe0;
  --mine: #4f9cff;      /* доля компании */
  --mgr: #34d399;       /* доля менеджеров */
  --danger: #ef4c5f;
  --warn: #f5b74b;

  --radius: 14px;
  --shadow-pop: 0 18px 50px rgba(3, 10, 30, 0.45), 0 2px 8px rgba(3, 10, 30, 0.25);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 16px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: rgba(255,255,255,.06); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 13px; font-weight: 400; }

/* ---------- верхняя панель ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 0 28px; height: 64px;
  background: rgba(10, 23, 48, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark path { stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 14px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 550; }
.nav a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav a.active { color: var(--text); background: var(--surface-2); }

.dropdown { position: relative; margin-left: auto; }
.user-btn {
  display: flex; align-items: center; gap: 10px;
  background: none; border: 1px solid transparent; color: var(--text);
  padding: 5px 10px 5px 5px; border-radius: 12px; cursor: pointer; font: inherit;
}
.user-btn:hover, .dropdown.open .user-btn { background: rgba(255,255,255,.05); border-color: var(--line); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #4f9cff, #7c5cff); display: inline-grid; place-items: center; font-weight: 700; color: #fff; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; vertical-align: middle; margin-right: 6px; }
.chev { width: 12px; height: 12px; }
.chev path { stroke: var(--muted); stroke-width: 1.6; fill: none; }

/* белое меню */
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px;
  background: var(--pop); color: var(--pop-text);
  border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px;
  opacity: 0; visibility: hidden; transform: translateY(-4px); pointer-events: none;
  transition: opacity .15s, transform .15s, visibility .15s;
}
.dropdown.open .menu { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--pop-line); margin-bottom: 6px; display: flex; flex-direction: column; gap: 2px; }
.menu-head span { color: var(--pop-muted); font-size: 13px; }
.menu-head .role-pill { align-self: flex-start; margin-top: 6px; font-size: 12px; color: var(--accent); background: #eaf2ff; padding: 2px 8px; border-radius: 99px; }
.menu-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; font: inherit; color: var(--pop-text); cursor: pointer; }
.menu-item:hover { background: var(--pop-hover); }
.menu-item.danger { color: var(--danger); }
.menu form { margin: 0; }

/* ---------- страницы ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 32px 28px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }

.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.segmented button { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 7px 16px; border-radius: 9px; cursor: pointer; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--accent); color: #fff; }

.period-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.period-label { font-size: 18px; font-weight: 600; min-width: 180px; text-align: center; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; padding: 0; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn path { stroke: var(--text); stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.light { background: transparent; border-color: transparent; }
.icon-btn.light:hover { background: rgba(255,255,255,.06); }
.link-btn { background: none; border: 0; color: var(--mine); font: inherit; font-weight: 550; cursor: pointer; padding: 4px 6px; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }

.period-nav[hidden] { display: none; }
.range-pick { flex-wrap: wrap; gap: 12px; }
.range-pick label { flex-direction: row; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.range-pick input[type=date] { width: auto; background: var(--surface); padding: 7px 10px; }
.range-pick .period-label { min-width: 0; text-align: left; font-size: 16px; color: var(--muted); font-weight: 500; }
.auth-switch { text-align: center; margin: 18px 0 0; color: var(--pop-muted); font-size: 14px; }
.auth-switch a { color: var(--accent); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.brand-mark.ok { background: #10b981; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #ef4c5f; color: #fff; font-size: 12px; font-weight: 700; line-height: 1; vertical-align: 1px; }
.requests { border-color: rgba(245, 183, 75, .4); }
.small-btn { padding: 7px 12px; font-size: 13px; }
.actions .small-btn + .small-btn { margin-left: 6px; }
#managerPick { width: auto; min-width: 240px; background: var(--surface); }
#mgrCard[hidden] { display: none; }
.table tr.pick { cursor: pointer; }
.table tr.pick td:first-child { color: var(--text); }
.table tr.pick:hover td:first-child { color: var(--mine); }
.notice { background: rgba(245, 183, 75, .1); border: 1px solid rgba(245, 183, 75, .35); color: #ffd99a; border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-height: 118px; }
.kpi .k-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 550; }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; }
.kpi .k-value { font-size: 26px; font-weight: 700; margin: 8px 0 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-sub { font-size: 13px; color: var(--muted); }
.kpi.hero { background: linear-gradient(160deg, #1d4fb8 0%, #163a8a 100%); border-color: rgba(120, 170, 255, .35); }
.kpi.hero .k-label, .kpi.hero .k-sub { color: #c9dcff; }
.delta { font-weight: 600; }
.delta.up { color: #4ade9b; }
.delta.down { color: #ff8a98; }
.kpi.hero .delta.up { color: #a7f3cf; }
.kpi.hero .delta.down { color: #ffc2ca; }

/* ---------- карточки и таблицы ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card > p { margin: 0 0 12px; }

.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.chart { position: relative; height: 280px; }
.chart svg { display: block; width: 100%; height: 100%; }
.chart .bar { cursor: pointer; transition: opacity .15s; }
.chart .grid { stroke: var(--line); }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .sel-bg { fill: rgba(79, 156, 255, .1); }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--pop); color: var(--pop-text); border-radius: 10px; box-shadow: var(--shadow-pop);
  padding: 10px 12px; font-size: 13px; min-width: 190px; opacity: 0; transition: opacity .1s;
}
.chart-tip.show { opacity: 1; }
.chart-tip b { display: block; margin-bottom: 6px; }
.chart-tip .row { display: flex; justify-content: space-between; gap: 14px; color: var(--pop-muted); }
.chart-tip .row strong { color: var(--pop-text); font-variant-numeric: tabular-nums; }
.chart-tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 0 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255,255,255,.02); }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .c-mine { color: var(--mine); font-weight: 600; }
.table .c-mgr { color: var(--mgr); font-weight: 600; }
.table .date { white-space: nowrap; color: var(--muted); }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table-empty { text-align: center; color: var(--muted); padding: 28px 0 !important; }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; }

.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: rgba(255,255,255,.08); color: var(--muted); }
.tag.ok { background: rgba(52, 211, 153, .12); color: #6ee7b7; }
.tag.warn { background: rgba(245, 183, 75, .14); color: #fcd38a; }
.empty { text-align: center; padding: 30px 10px; }
.empty p { margin: 0 0 6px; }

.status { font-size: 13px; color: var(--muted); }
.status.ok { color: #6ee7b7; }
.status.err { color: #ff9aa7; }

/* ---------- кнопки и формы ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; transition: background .15s; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: var(--pop-hover); color: var(--pop-text); }
.btn.ghost:hover { background: #e6ebf5; }
.btn.ghost-dark { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost-dark:hover:not(:disabled) { background: #1d3569; }
.btn.danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.wide { width: 100%; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select {
  font: inherit; font-weight: 400; font-size: 15px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.25); }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.form-error { color: var(--danger); font-size: 13px; margin: 0 0 10px; display: none; }
.form-error.show { display: block; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.form-actions .form-error { margin: 0 auto 0 0; }
.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; }
.copy-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- белые модальные окна ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(4, 10, 26, .6); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s, visibility .15s; }
.modal.open { opacity: 1; visibility: visible; pointer-events: auto; }
.modal-box { background: var(--pop); color: var(--pop-text); border-radius: 16px; box-shadow: var(--shadow-pop); width: 100%; max-width: 440px; padding: 24px; transform: translateY(8px) scale(.98); transition: transform .15s; max-height: calc(100vh - 32px); overflow: auto; }
.modal.open .modal-box { transform: none; }
.modal-box.small { max-width: 380px; }
.modal-box h3 { font-size: 19px; margin-bottom: 18px; }
.modal-box p { margin: 0 0 16px; }
.modal-box .muted { color: var(--pop-muted); }
.modal-box label { color: var(--pop-muted); }
.modal-box input, .modal-box select { background: #fff; color: var(--pop-text); border-color: #d5dce8; color-scheme: light; }
.modal-box .hint { color: var(--pop-muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- уведомление ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--pop); color: var(--pop-text); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-pop); font-weight: 550; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { color: var(--danger); }

/* ---------- вход ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1000px 600px at 50% -10%, rgba(59,130,246,.25), transparent 60%); }
.auth-card { width: 100%; max-width: 400px; background: var(--pop); color: var(--pop-text); border-radius: 18px; box-shadow: var(--shadow-pop); padding: 32px 28px; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand .brand-mark { width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 14px; }
.auth-brand .brand-mark svg { width: 30px; height: 30px; }
.auth-brand h1 { font-size: 22px; }
.auth-brand p { margin: 4px 0 0; color: var(--pop-muted); }
.auth-card label { color: var(--pop-muted); }
.auth-card input { background: #fff; color: var(--pop-text); border-color: #d5dce8; color-scheme: light; }
.auth-card .btn { margin-top: 6px; padding: 12px; }

/* ---------- адаптив ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > .kpi:nth-child(5):last-child { grid-column: span 2; }
}
@media (max-width: 720px) {
  .topbar { padding: 0 16px; gap: 12px; height: auto; min-height: 60px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 10px; }
  .user-name { display: none; }
  .page { padding: 20px 16px 48px; }
  h1 { font-size: 22px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding: 7px 0; }
  .range-pick label { flex: 1; }
  .range-pick input[type=date] { flex: 1; min-width: 0; }
  .range-pick .period-label { width: 100%; }
  .period-nav { justify-content: space-between; }
  .period-label { min-width: 0; font-size: 16px; }
  .kpi { padding: 14px; min-height: 0; }
  .kpi .k-value { font-size: 20px; }
  .chart { height: 220px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .inline-form { flex-direction: column; }
}

/* ---------- сделки: канбан ---------- */
.page.wide { max-width: 1440px; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn .ico { width: 16px; height: 16px; }
.btn .ico path { stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); }
.search svg * { stroke: var(--muted); stroke-width: 1.6; fill: none; stroke-linecap: round; }
.search input { padding-left: 36px; background: var(--surface); }
.toolbar select { width: auto; min-width: 200px; background: var(--surface); }
:where(input[type=search], input[type=tel], input[type=date], textarea) {
  font: inherit; font-weight: 400; font-size: 15px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; min-height: 72px; }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.25); }

/* стадии: цвета как акценты колонок */
.stage-work { --stage: #5aa9ff; }
.stage-paid { --stage: #f5b74b; }
.stage-won { --stage: #34d399; }
.stage-lost { --stage: #ef4c5f; }

.board { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 14px; align-items: start; padding-bottom: 90px; }
.board[hidden] { display: none; }
.column { background: rgba(17, 34, 74, .55); border: 1px solid var(--line); border-radius: var(--radius); min-height: 240px; transition: border-color .15s, background .15s; }
.column.drag-over { border-color: var(--accent); background: rgba(59, 130, 246, .08); }
.col-head { padding: 14px 16px 12px; border-top: 3px solid var(--stage); border-radius: var(--radius) var(--radius) 0 0; }
.col-title { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.col-count { font-size: 12px; font-weight: 600; color: var(--muted); background: rgba(255,255,255,.07); padding: 1px 8px; border-radius: 99px; }
.col-sum { color: var(--muted); font-size: 13px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.col-body { padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.col-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 8px; border: 1px dashed var(--line); border-radius: 10px; }

.deal-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: border-color .15s, transform .15s, opacity .15s; }
.deal-card:hover { border-color: rgba(120, 170, 255, .4); }
.deal-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.deal-card.dragging { opacity: .35; }
.dc-title { font-weight: 600; line-height: 1.3; word-break: break-word; }
.dc-client { color: var(--muted); font-size: 13px; margin-top: 3px; }
.dc-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 10px; }
.dc-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.dc-meta { color: var(--muted); font-size: 12px; text-align: right; }

/* зоны закрытия при перетаскивании */
.drop-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 14px 28px 20px; background: linear-gradient(to top, rgba(10,23,48,.95) 60%, transparent); transform: translateY(110%); transition: transform .18s; }
.drop-bar.show { transform: none; }
.drop-zone { height: 64px; display: grid; place-items: center; border-radius: 14px; font-weight: 700; border: 2px dashed var(--stage); color: var(--stage); background: rgba(10, 23, 48, .9); transition: background .15s; }
.drop-zone.won { --stage: #34d399; }
.drop-zone.lost { --stage: #ef4c5f; }
.drop-zone.drag-over { background: var(--stage); color: #0a1730; border-style: solid; }

/* карточка сделки (белое окно) */
.deal-box { max-width: 620px; }
.deal-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.deal-head h3 { margin: 0; word-break: break-word; }
.stage-bar { display: flex; gap: 3px; margin-bottom: 18px; }
.stage-bar button { flex: 1; border: 0; padding: 9px 4px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; background: #eef1f6; color: var(--pop-muted); transition: background .15s, color .15s; clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 8px 50%); }
.stage-bar button:first-child { border-radius: 8px 0 0 8px; clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%); }
.stage-bar button:last-child { border-radius: 0 8px 8px 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 8px 50%); }
.stage-bar button:hover:not(:disabled) { background: #e2e7f0; }
.stage-bar button.on { background: var(--stage); color: #fff; }
.stage-bar button.stage-paid.on { color: #3b2a05; }
.stage-bar button.current { box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.stage-bar button:disabled { cursor: default; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.modal-box textarea { background: #fff; color: var(--pop-text); border-color: #d5dce8; color-scheme: light; }
.modal-box input:disabled, .modal-box select:disabled, .modal-box textarea:disabled { background: #f4f6fa; color: var(--pop-muted); }
.split-note { font-size: 13px; color: var(--pop-muted); margin: -4px 0 14px !important; min-height: 1em; }
.split-note b { color: var(--pop-text); }
.lock-note { background: #ecfdf5; color: #065f46; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.modal-actions .spacer { flex: 1; }
.danger-link { color: var(--danger); padding-left: 0; }
.modal-actions [hidden] { display: none; }

.tag.bad { background: rgba(239, 76, 95, .14); color: #ff9aa7; }
.table.clickable tbody tr { cursor: pointer; }
.table tr.inactive td { opacity: .55; }
.icon-btn circle { stroke: var(--text); stroke-width: 1.7; fill: none; }
.form-actions.align-end { align-self: end; margin-bottom: 14px; justify-content: flex-start; }

@media (max-width: 960px) {
  .board { grid-template-columns: repeat(2, minmax(250px, 82vw)); overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -28px; padding: 0 28px 90px; }
  .column { scroll-snap-align: start; }
}
@media (max-width: 720px) {
  .board { margin: 0 -16px; padding: 0 16px 24px; }
  .head-actions { width: 100%; }
  .head-actions .segmented { flex: 1; width: auto; }
  .search { max-width: none; }
  .toolbar select { width: 100%; }
  .row-2 { grid-template-columns: 1fr; }
  .stage-bar { flex-wrap: wrap; }
  .stage-bar button, .stage-bar button:first-child, .stage-bar button:last-child { flex: 1 1 30%; clip-path: none; border-radius: 8px; }
  .drop-bar { padding: 12px 16px 16px; }
}

/* ---------- карточка сделки: просмотр ---------- */
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.modal-box input[type=date] { min-height: 43px; }
.deal-view { margin-top: 4px; }
.sec-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--pop-line); }
.sec-head span { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pop-text); }
.sec-head .link-btn { color: var(--pop-muted); font-weight: 500; }
.sec-head .link-btn:hover { color: var(--accent); }
.dv-field { padding: 10px 0; }
.dv-label { font-size: 13px; color: #8a97ab; margin-bottom: 3px; }
.dv-value { font-size: 17px; color: var(--pop-text); word-break: break-word; }
.dv-value.pre { font-size: 15px; }
.dv-empty { color: #8a97ab; }
.dv-sum { font-size: 40px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; color: var(--pop-text); font-variant-numeric: tabular-nums; }
.dv-sum span { font-size: 26px; color: var(--pop-muted); }
.calc-box { margin: 0 0 14px; }
.calc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.calc-tile { border: 1px solid var(--pop-line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.calc-tile span { font-size: 12px; color: var(--pop-muted); }
.calc-tile b { font-size: 17px; font-weight: 650; color: var(--pop-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-tile.mgr { background: #ecfdf5; border-color: #c6f1dd; }
.calc-tile.mgr b { color: #047857; }
.calc-tile.mine { background: #eef5ff; border-color: #cfe0ff; }
.calc-tile.mine b { color: #1d4ed8; }
.calc-empty { font-size: 13px; color: var(--pop-muted); background: #f4f6fa; border-radius: 10px; padding: 10px 12px; margin-top: 6px; }
.modal-box input.computed { background: #f4f6fa; color: var(--pop-text); cursor: default; }

.contact-card, .person-card { border: 1px solid var(--pop-line); border-radius: 14px; background: #fff; box-shadow: 0 1px 2px rgba(15, 27, 51, .04); }
.contact-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; margin-top: 6px; }
.cc-label { font-size: 12px; color: #8a97ab; }
.cc-name { font-size: 18px; color: var(--pop-text); margin: 2px 0 4px; word-break: break-word; }
.cc-sub { color: var(--pop-muted); font-size: 15px; }
.cc-actions { display: flex; gap: 6px; flex: none; }
.cc-btn { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; transition: background .15s; }
.cc-btn:hover { background: var(--pop-hover); }
.cc-btn svg { width: 24px; height: 24px; }
.cc-btn.call svg path { fill: #3b82f6; }
.cc-btn.mail svg *, .cc-btn.chat svg * { fill: none; stroke: #8a97ab; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.cc-btn.chat svg path:first-child { fill: none; }
.cc-btn.off { opacity: .35; cursor: default; }
.cc-btn.off:hover { background: none; }
.cc-btn.off.call svg path { fill: #8a97ab; }
.person-card { display: flex; align-items: center; gap: 14px; padding: 12px 18px; margin-top: 6px; font-size: 18px; color: var(--accent); }
.person-card .avatar { width: 44px; height: 44px; font-size: 18px; background: #3d4a5c; }

@media (max-width: 720px) {
  .row-3 { grid-template-columns: 1fr 1fr; }
  .dv-sum { font-size: 32px; }
  .calc-grid { grid-template-columns: 1fr; }
  .contact-card { flex-direction: column; align-items: flex-start; }
}

/* ---------- элементы, которые есть только на телефоне ---------- */
.tabbar, .fab, .stage-tabs { display: none; }
.modal-box { position: relative; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--pop-hover); display: grid; place-items: center; cursor: pointer; z-index: 3; }
.modal-x:hover { background: #e6ebf5; }
.modal-x svg { width: 14px; height: 14px; }
.modal-x path { stroke: var(--pop-muted); stroke-width: 2; stroke-linecap: round; }
.modal-box h3, .deal-head { padding-right: 44px; }

/* ---------- телефон ---------- */
@media (max-width: 720px) {
  /* без зума iOS при фокусе на поле: шрифт полей не меньше 16px */
  input, select, textarea, input[type=search], input[type=tel], input[type=date] { font-size: 16px !important; }
  body { -webkit-tap-highlight-color: transparent; }

  /* верхняя панель: логотип и профиль; разделы — в нижнем меню */
  .topbar { flex-wrap: nowrap; min-height: 56px; padding: env(safe-area-inset-top) 16px 0; }
  .topbar .nav { display: none; }
  .brand { font-size: 16px; }
  .brand-mark { width: 30px; height: 30px; }

  body.has-tabbar { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(13, 28, 58, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 4px env(safe-area-inset-bottom);
  }
  .tabbar a { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 8px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; border-radius: 12px; }
  .tabbar svg { width: 24px; height: 24px; }
  .tabbar svg * { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.active { color: #fff; }
  .tabbar a.active svg * { stroke: var(--mine); }
  .tabbar .badge { position: absolute; top: 2px; left: calc(50% + 6px); font-style: normal; min-width: 18px; height: 18px; font-size: 11px; }

  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .page { padding: 16px 16px 24px; }
  .page-head { margin-bottom: 14px; }
  h1 { font-size: 24px; }

  /* круглая кнопка «+» над нижним меню */
  .fab {
    display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 35;
    width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); cursor: pointer;
    box-shadow: 0 10px 24px rgba(59, 130, 246, .45), 0 2px 6px rgba(0, 0, 0, .3);
  }
  .fab:active { transform: scale(.95); }
  .fab svg { width: 26px; height: 26px; }
  .fab path { stroke: #fff; stroke-width: 2.4; stroke-linecap: round; }

  /* сделки: одна колонка на всю ширину, стадии — вкладками */
  #newDeal { display: none; }
  .head-actions .segmented { flex: 1; }
  .toolbar { gap: 8px; margin-bottom: 12px; }
  .search { min-width: 0; }
  .stage-tabs { display: flex; width: 100%; margin-bottom: 12px; }
  .stage-tabs[hidden] { display: none; }
  .stage-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 0; }
  .stage-tabs .st-count { font-size: 12px; background: rgba(255,255,255,.1); padding: 0 7px; border-radius: 99px; line-height: 18px; }
  .stage-tabs button.active { background: var(--stage); color: #0a1730; }
  .stage-tabs button.active .st-count { background: rgba(10, 23, 48, .18); }
  .board { display: block; margin: 0; padding: 0 0 84px; overflow: visible; }
  .board .column:not(.m-show) { display: none; }
  .column { background: none; border: 0; min-height: 0; }
  .col-head { border: 0; padding: 0 2px 10px; }
  .col-title { display: none; }
  .col-sum::before { content: "Сумма: "; }
  .col-body { padding: 0; gap: 10px; }
  .deal-card { padding: 14px 16px; border-radius: 14px; }
  .deal-card:active { background: #1d3569; }
  .dc-title { font-size: 16px; }
  .drop-bar { display: none; }

  /* окна выезжают снизу; кнопки внизу окна всегда видны */
  .modal { place-items: end center; padding: 0; }
  .modal-box, .modal-box.small, .deal-box {
    max-width: none; width: 100%; border-radius: 20px 20px 0 0;
    max-height: calc(100dvh - 20px); padding: 22px 16px 0;
    transform: translateY(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
  }
  .modal.open .modal-box { transform: none; }
  .modal-box::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: #d5dce8; }
  .modal-x { top: 16px; right: 12px; }
  .modal-actions {
    position: sticky; bottom: 0; z-index: 2; background: var(--pop);
    margin: 10px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--pop-line);
  }
  .modal-actions .btn { flex: 1; padding: 13px 10px; }
  .modal-actions .spacer { display: none; }
  .modal-actions .danger-link { flex: 0 0 auto; }
  .modal-actions:has(#copyDeal:not([hidden])) { flex-wrap: wrap; }
  .modal-actions #copyDeal:not([hidden]) { order: -1; flex: 1 1 100%; }
  .stage-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; flex-wrap: nowrap; }
  .stage-bar button, .stage-bar button:first-child, .stage-bar button:last-child { clip-path: none; border-radius: 8px; padding: 10px 2px; font-size: 12px; }
  .dv-value { font-size: 16px; }
  .cc-actions { width: 100%; justify-content: space-between; }
  .cc-btn { flex: 1; height: 44px; background: var(--pop-hover); }
  .row-3 { grid-template-columns: 1fr 1fr; }

  /* таблицы превращаются в карточки */
  .card:has(> .table-wrap .table.stack) { background: none; border: 0; padding: 0; }
  .card:has(> .table-wrap .table.stack) > .card-head { padding: 0 2px; }
  .table-wrap:has(.table.stack) { margin: 0; padding: 0; overflow: visible; }
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody { display: block; }
  .table.stack tr { position: relative; display: flex; flex-wrap: wrap; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
  .table.stack tr.total { border-color: rgba(120, 170, 255, .4); background: var(--surface-2); }
  .table.stack tbody tr:hover td { background: none; }
  .table.stack td, .table.stack td:first-child, .table.stack td:last-child { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; padding: 4px 0; border: 0; text-align: right; }
  .table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 500; text-align: left; flex: none; }
  .table.stack td:not([data-label])::before { content: none; }
  .table.stack td.st-title { order: -2; flex: 1 1 0; width: auto; justify-content: flex-start; align-items: center; text-align: left; font-weight: 650; font-size: 15px; padding-bottom: 8px; }
  .table.stack td.st-tag { order: -1; width: auto; padding-bottom: 8px; }
  .table.stack td.st-corner { position: absolute; top: 6px; right: 6px; width: auto; padding: 0; }
  .table.stack tr:has(.st-corner) td.st-title { padding-right: 76px; }
  .table.stack td.st-actions { justify-content: stretch; padding-top: 10px; }
  .table.stack td.st-actions .btn { flex: 1; padding: 11px; }
  .table.stack td.table-empty { display: block; text-align: center; }
  .table.stack tr:has(.table-empty) { justify-content: center; }
  .table.stack .avatar.sm { flex: none; }
  .requests { border: 0 !important; }

  /* аналитика */
  .segmented#periodTabs button { font-size: 14px; }
  .kpis { gap: 10px; margin-bottom: 12px; }
  .kpi .k-label { font-size: 12px; }
  .chart { height: 200px; }
  #addManager { width: 100%; }
  #managerPick { width: 100%; }
}

/* ---------- шторка подсказок под полем ---------- */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; right: 0; top: calc(100% - 8px); z-index: 10;
  width: max(100%, 380px); max-width: calc(100vw - 32px);
  background: var(--pop); border: 1px solid var(--pop-line); border-radius: 12px;
  box-shadow: 0 14px 34px rgba(15, 27, 51, .18); padding: 4px; max-height: 280px; overflow-y: auto;
  animation: ac-in .14s ease-out; transform-origin: top;
}
.ac-list[hidden] { display: none; }
@keyframes ac-in { from { opacity: 0; transform: translateY(-4px) scaleY(.96); } to { opacity: 1; transform: none; } }
.ac-head { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #8a97ab; padding: 8px 10px 4px; }
.ac-item { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.ac-item:hover, .ac-item.active { background: var(--pop-hover); }
.ac-phone { font-weight: 600; color: var(--pop-text); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ac-name { color: var(--pop-muted); font-size: 13px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-date { color: #8a97ab; font-size: 12px; font-weight: 400; }
@media (max-width: 720px) {
  .ac-item { padding: 12px 10px; grid-template-columns: 1fr auto; }
  .ac-item .ac-name { grid-column: 1 / -1; grid-row: 2; }
  .ac-item .ac-date { grid-column: 2; grid-row: 1; }
}

/* ---------- итоги месяца ---------- */
.rating-card {
  position: relative; margin-bottom: 16px; padding: 18px 20px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(245, 183, 75, .16), rgba(245, 183, 75, .04) 60%), var(--surface);
  border: 1px solid rgba(245, 183, 75, .45);
}
.rating-card[hidden] { display: none; }
.rating-x { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; }
.rating-x:hover { background: rgba(255,255,255,.08); }
.rating-x svg { width: 14px; height: 14px; }
.rating-x path { stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.rating-kicker { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #f5c46b; margin-bottom: 12px; padding-right: 36px; }
.rating-top { display: flex; align-items: center; gap: 14px; }
.rating-cup { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(160deg, #f8cf72, #e0a12e); box-shadow: 0 8px 22px rgba(245, 183, 75, .35); }
.rating-cup svg { width: 30px; height: 30px; }
.rating-cup path { fill: none; stroke: #4a2f00; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.rating-title { font-size: 13px; font-weight: 600; color: #f5c46b; }
.rating-name { font-size: 20px; font-weight: 700; line-height: 1.3; }
.rating-you { display: inline-block; font-size: 11px; font-weight: 700; color: #0a1730; background: #f5c46b; padding: 1px 7px; border-radius: 99px; vertical-align: 3px; }
.rating-list { list-style: none; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 22px; }
.rating-list li { display: flex; align-items: center; gap: 8px; color: var(--text); }
.rating-list li.me { font-weight: 700; }
.rating-place { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
@media (max-width: 720px) {
  .rating-card { padding: 16px; }
  .rating-name { font-size: 18px; }
  .rating-list { flex-direction: column; gap: 8px; }
}

/* ---------- рейтинг менеджеров в аналитике ---------- */
#rankCard[hidden] { display: none; }
.rank-list { display: flex; flex-direction: column; gap: 4px; }
.rank-row { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 14px; padding: 10px 8px; border-radius: 10px; cursor: pointer; }
.rank-row:hover { background: rgba(255,255,255,.04); }
.rank-place { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--surface-2); color: var(--muted); }
.rank-place.p1 { background: linear-gradient(160deg, #f8cf72, #e0a12e); color: #4a2f00; }
.rank-place.p2 { background: linear-gradient(160deg, #e4e9f2, #aab4c4); color: #283447; }
.rank-place.p3 { background: linear-gradient(160deg, #e7b48a, #b9784a); color: #3d1f08; }
.rank-name { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rank-bar { height: 6px; border-radius: 4px; background: rgba(255,255,255,.06); margin-top: 7px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #4f9cff, #34d399); min-width: 2px; }
.rank-val { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.rank-val b { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }
.rank-val span { display: block; font-size: 12px; }
.rank-tag { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.rank-tag.lead { background: rgba(245, 183, 75, .18); color: #f5c46b; }
.rank-tag.lag { background: rgba(239, 76, 95, .16); color: #ff9aa7; }
@media (max-width: 720px) {
  #rankCard { padding: 14px; }
  .rank-row { gap: 10px; padding: 10px 4px; }
  .rank-val b { font-size: 15px; }
}

/* ---------- раздел «Рейтинг» ---------- */
.live-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 6px 12px; border-radius: 99px; }
.live-badge i { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: live-pulse 2s infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); } 70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }
.my-place { display: flex; align-items: center; gap: 16px; padding: 18px 20px; margin-bottom: 16px; border-radius: var(--radius); background: linear-gradient(160deg, #1d4fb8, #163a8a); border: 1px solid rgba(120,170,255,.35); }
.my-place[hidden] { display: none; }
.my-place .rank-place { width: 52px; height: 52px; font-size: 22px; }
.my-place-label { font-size: 13px; color: #c9dcff; font-weight: 600; }
.my-place-value { font-size: 22px; font-weight: 700; }
.rating-table { display: flex; flex-direction: column; }
.rating-row { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 14px; padding: 12px 8px; border-bottom: 1px solid var(--line); }
.rating-row:last-child { border-bottom: 0; }
.rating-row.me { background: rgba(79, 156, 255, .1); border-radius: 10px; border-bottom-color: transparent; }
.rating-row .rank-place { width: 34px; height: 34px; }
.rating-row-name { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rating-row-deals { color: var(--muted); font-size: 14px; white-space: nowrap; }
.rating-row-deals b { color: var(--text); font-size: 17px; font-variant-numeric: tabular-nums; }
.rating-note { margin: 14px 0 0 !important; }
@media (max-width: 720px) {
  .page-head .live-badge { font-size: 12px; }
  .my-place { padding: 14px 16px; }
  .my-place-value { font-size: 19px; }
  .rating-row { gap: 10px; padding: 12px 4px; }
}

/* ---------- рейтинг: пьедестал и аватары ---------- */
.rating-stage { position: relative; overflow: hidden; }
.rating-stage::before { content: ""; position: absolute; left: 50%; top: -120px; width: 520px; height: 320px; margin-left: -260px; background: radial-gradient(closest-side, rgba(245, 183, 75, .18), transparent); pointer-events: none; }
.podium { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 12px; max-width: 560px; margin: 8px auto 6px; }
.pod { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.pod-person { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-bottom: 10px; text-align: center; min-width: 0; width: 100%; }
.pod-name { font-weight: 650; font-size: 14px; line-height: 1.25; word-break: break-word; }
.pod-step { width: 100%; border-radius: 12px 12px 4px 4px; display: grid; place-items: start center; padding-top: 10px; font-size: 26px; font-weight: 800; color: rgba(10, 23, 48, .72); box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.pod-first .pod-step { height: 130px; background: linear-gradient(180deg, #f8cf72, #c98a1c); }
.pod-second .pod-step { height: 96px; background: linear-gradient(180deg, #e4e9f2, #8f9bb0); }
.pod-third .pod-step { height: 72px; background: linear-gradient(180deg, #e7b48a, #9c5f33); }
.pod.me .pod-step { box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 0 0 3px var(--mine); }
.pod.empty .pod-step { height: 40px; background: var(--surface-2); }
.crown { width: 34px; height: 24px; margin-bottom: -2px; filter: drop-shadow(0 3px 6px rgba(245, 183, 75, .5)); }
.crown path, .crown circle { fill: #f5c046; }

.r-avatar { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; flex: none; border: 3px solid rgba(255,255,255,.18); }
.r-avatar.p1 { width: 66px; height: 66px; font-size: 22px; background: linear-gradient(160deg, #f8cf72, #d8951f); color: #4a2f00; border-color: #fde7ad; box-shadow: 0 8px 26px rgba(245, 183, 75, .45); }
.r-avatar.p2 { background: linear-gradient(160deg, #eef1f6, #9aa6ba); color: #283447; border-color: #f4f6fa; }
.r-avatar.p3 { background: linear-gradient(160deg, #eabf98, #a86a3c); color: #3d1f08; border-color: #f3d3b7; }
.r-avatar.p4 { background: linear-gradient(160deg, hsl(var(--h) 70% 62%), hsl(calc(var(--h) + 40) 65% 45%)); }
.r-avatar.sm { width: 38px; height: 38px; font-size: 14px; border-width: 2px; }

.rating-stage .rating-table { margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.rating-table[hidden] { display: none; }
.rating-stage .rating-row { grid-template-columns: 28px 38px 1fr; }
.rating-stage .rating-row .rank-place { width: 28px; height: 28px; font-size: 13px; }

.my-medal { position: relative; flex: none; width: 56px; height: 56px; display: grid; place-items: center; }
.my-medal svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.my-medal path { fill: #4f9cff; opacity: .7; }
.my-medal circle { fill: var(--surface-2); stroke: rgba(255,255,255,.4); stroke-width: 1.2; }
.my-medal.p1 circle { fill: #f2b93d; stroke: #fde7ad; }
.my-medal.p2 circle { fill: #b8c2d2; stroke: #f4f6fa; }
.my-medal.p3 circle { fill: #c98a5a; stroke: #f3d3b7; }
.my-medal b { position: relative; top: 7px; font-size: 18px; font-weight: 800; color: #0a1730; }
.my-medal.p4 b { color: var(--text); }

/* появление: один раз при открытии страницы */
.r-animate .pod-step { animation: pod-grow .7s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--d) * .15s); transform-origin: bottom; }
.r-animate .pod-person { animation: pod-pop .5s ease-out both; animation-delay: calc(var(--d) * .15s + .45s); }
.r-animate .rating-row { animation: row-in .4s ease-out both; animation-delay: calc(var(--d) * .06s + .8s); }
@keyframes pod-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pod-pop { from { opacity: 0; transform: translateY(14px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes row-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.pod-first .r-avatar.p1 { animation: glow 3s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 8px 34px rgba(245, 183, 75, .75); } }
@media (prefers-reduced-motion: reduce) {
  .r-animate .pod-step, .r-animate .pod-person, .r-animate .rating-row, .pod-first .r-avatar.p1 { animation: none; }
}
@media (max-width: 720px) {
  .podium { gap: 8px; }
  .pod-name { font-size: 13px; }
  .r-avatar { width: 46px; height: 46px; font-size: 16px; }
  .r-avatar.p1 { width: 56px; height: 56px; font-size: 19px; }
  .pod-first .pod-step { height: 110px; }
  .pod-second .pod-step { height: 80px; }
  .pod-third .pod-step { height: 60px; }
}
