@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");
/* ============================================================
   Arizona Event CRM — design system
   Принципы: нейтральная палитра, один акцент, плоские поверхности
   с 1px-границами, одна гарнитура (Inter), сетка 4/8px,
   минимум анимации. Тёмная и светлая темы на одних токенах.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #71717a;
  --accent: #0f8a65;
  --accent-hover: #0c7554;
  --accent-fg: #ffffff;
  --accent-soft: rgba(15, 138, 101, .09);
  --danger: #dc2626;
  --chart-grid: rgba(24, 24, 27, .07);
  --shadow-pop: 0 12px 32px -8px rgba(24, 24, 27, .18), 0 2px 6px rgba(24, 24, 27, .06);
  --ring: rgba(15, 138, 101, .28);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* алиасы для старых имён, которые используются в inline-коде страниц */
  --paper: var(--bg); --paper-2: var(--surface); --paper-3: var(--surface-2);
  --ink: var(--text); --ink-2: var(--text-2); --ink-3: var(--text-3);
  --hair: var(--border); --hair-2: var(--border-strong); --glass-b: var(--border);
  --red: var(--accent); --text-faint: var(--text-3); --serif: var(--sans);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #111113;
  --surface-2: #18181b;
  --border: #27272a;
  --border-strong: #3f3f46;
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --accent: #34d399;
  --accent-hover: #6ee7b7;
  --accent-fg: #04201a;
  --accent-soft: rgba(52, 211, 153, .12);
  --danger: #f87171;
  --chart-grid: rgba(255, 255, 255, .06);
  --shadow-pop: 0 16px 40px -8px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);
  --ring: rgba(52, 211, 153, .3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #09090b;
    --surface: #111113;
    --surface-2: #18181b;
    --border: #27272a;
    --border-strong: #3f3f46;
    --text: #f4f4f5;
    --text-2: #a1a1aa;
    --text-3: #71717a;
    --accent: #34d399;
    --accent-hover: #6ee7b7;
    --accent-fg: #04201a;
    --accent-soft: rgba(52, 211, 153, .12);
    --danger: #f87171;
    --chart-grid: rgba(255, 255, 255, .06);
    --shadow-pop: 0 16px 40px -8px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);
    --ring: rgba(52, 211, 153, .3);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss03';
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
.ic { display: inline-block; vertical-align: -2px; flex-shrink: 0; }
.tick, .eyebrow { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Header ---------- */
header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 24px;
  height: 56px; padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
.logo-bg { fill: var(--accent); }
.logo-a { stroke: var(--accent-fg); }
.logo-dot { fill: var(--accent-fg); transform-box: fill-box; transform-origin: center; }
.brand-copy h1 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; white-space: nowrap; }
.subtitle { display: none; }

.nav-tabs-wrap { position: relative; display: flex; align-items: stretch; flex: 1; min-width: 0; height: 100%; margin-left: 8px; }
.nav-tabs { display: flex; align-items: stretch; gap: 2px; }
.nav-tabs-secondary { position: relative; margin-left: 12px; padding-left: 12px; }
.nav-tabs-secondary::before {
  content: ''; position: absolute; left: 0; top: 50%; width: 1px; height: 16px;
  margin-top: -8px; background: var(--border-strong);
}
.nav-tabs a {
  position: relative; display: flex; align-items: center; padding: 0 12px;
  font-size: 14px; font-weight: 500; color: var(--text-2); transition: color .15s;
}
.nav-tabs a:hover { color: var(--text); }
.nav-tabs a.active { color: var(--text); }
.nav-tabs a.active::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--text);
}
.has-ind a.active::after { display: none; }
.nav-ind { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--text); pointer-events: none; }
.nav-tabs-wrap .theme-toggle { position: static; margin: auto 0 auto auto; }

@media (max-width: 760px) {
  header { height: auto; flex-wrap: wrap; gap: 0 16px; padding: 10px 16px 0; }
  .nav-tabs-wrap { order: 3; flex-basis: 100%; height: 44px; margin: 8px 0 0; overflow-x: auto; }
  .nav-tabs a { white-space: nowrap; }
  .nav-ind { bottom: 0; }
  .nav-tabs-wrap .theme-toggle { position: absolute; top: 10px; right: 16px; margin: 0; }
}

/* ---------- Layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 96px; }
@media (max-width: 700px) { main { padding: 24px 16px 64px; } }

.page-head, .section-head, .plan-header { margin-bottom: 24px; }
.page-title, .report-title, .plan-title, .section-head h2 {
  font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; color: var(--text);
}
.page-sub, .report-sub { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.report-sub { margin-bottom: 24px; }

.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.bento > * { min-width: 0; }
.b-3 { grid-column: span 3; } .b-4 { grid-column: span 4; } .b-6 { grid-column: span 6; }
.b-8 { grid-column: span 8; } .b-12 { grid-column: span 12; }
@media (max-width: 980px) { .b-3, .b-4 { grid-column: span 6; } .b-8 { grid-column: span 12; } }
@media (max-width: 640px) { .b-3, .b-4, .b-6 { grid-column: span 12; } }

/* ---------- Surfaces ---------- */
.glass, .panel {
  position: relative; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}

.stat-card { padding: 16px 20px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; min-height: 104px; }
.stat-card .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.stat-card .value { font-size: 30px; font-weight: 600; line-height: 1; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.stat-card .value .unit { font-size: 13px; font-weight: 500; letter-spacing: 0; margin-left: 6px; color: var(--text-3); }
.stat-card .value.mono-small { font-size: 14px; font-weight: 500; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.stat-wide { flex-direction: row !important; align-items: center; justify-content: flex-start; gap: 16px !important; min-height: 0 !important; padding: 12px 20px !important; }

.panel { padding: 20px; }
.panel-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 16px; }
.chart-wrap { width: 100%; height: clamp(200px, 22vw, 260px); position: relative; }
.chart-wrap.short { height: clamp(160px, 18vw, 200px); }

/* ---------- Form controls ---------- */
input[type=text], input[type=datetime-local], textarea, select {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-family: var(--sans); font-size: 14px; height: 36px; padding: 0 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2371717a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
}
select option { background: var(--surface); color: var(--text); }
input:hover, textarea:hover, select:hover { border-color: var(--text-3); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[readonly] { background: var(--surface-2); color: var(--text-2); cursor: default; }
input[readonly]:hover { border-color: var(--border-strong); }
input:disabled, textarea:disabled, select:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Buttons ---------- */
button.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; font-size: 14px; font-weight: 500; line-height: 1;
  color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
button.btn:hover { background: var(--surface-2); }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
button.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
button.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
button.btn.big { height: 40px; padding: 0 20px; }
button.btn:active:not(:disabled) { transform: translateY(1px); }
button.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Dashboard table ---------- */
.table-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 32px 0 12px; }
.table-header h3 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
.controls input[type=text] { width: 260px; max-width: 100%; }

.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3);
  padding: 10px 16px; white-space: nowrap; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
tbody td { padding: 12px 16px; font-size: 14px; white-space: nowrap; vertical-align: middle; color: var(--text); }
tr.report-row { border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
tbody tr:last-child { border-bottom: 0; }
tr.report-row:hover, tr.report-row.expanded { background: var(--surface-2); }
tr.report-row td:first-child { box-shadow: inset 2px 0 0 transparent; }
tr.report-row.expanded td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.mono { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.badge-winner { font-weight: 500; }
.players-count { color: var(--text-2); font-variant-numeric: tabular-nums; }
.author-chip {
  display: inline-block; font-size: 13px; padding: 2px 8px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer;
  transition: color .15s, border-color .15s;
}
.author-chip:hover { color: var(--text); border-color: var(--border-strong); }

.detail-row td { padding: 0; white-space: normal; background: var(--bg); border-bottom: 1px solid var(--border); }
.detail-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 20px 24px; }
@media (max-width: 760px) { .detail-inner { grid-template-columns: 1fr; gap: 20px; } }
.detail-col h4 { font-size: 12px; font-weight: 500; color: var(--text-3); margin-bottom: 10px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 2px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); }
.empty-hint { color: var(--text-3); font-size: 13px; }

.pagination { align-items: center; justify-content: center; gap: 12px; margin-top: 20px; }
.page-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius); cursor: pointer; transition: background .15s;
}
.page-btn:hover:not(:disabled) { background: var(--surface-2); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-info { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- Scans / lightbox ---------- */
.scan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.scan-thumb { position: relative; aspect-ratio: 1 / 1; overflow: hidden; cursor: zoom-in; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.scan-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-time { position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-variant-numeric: tabular-nums; background: rgba(0, 0, 0, .72); color: #fff; }
.scan-zoom { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 6px; background: rgba(0, 0, 0, .65); color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.scan-thumb:hover .scan-zoom { opacity: 1; }
.lightbox { position: fixed; inset: 0; z-index: 3000; display: none; align-items: center; justify-content: center; padding: 40px; background: rgba(0, 0, 0, .8); }
.lightbox.open { display: flex; }
.lightbox-frame { position: relative; max-width: min(92vw, 960px); max-height: 88vh; }
.lightbox img { display: block; max-width: min(92vw, 960px); max-height: 88vh; border-radius: var(--radius-lg); }
.lightbox-close { position: absolute; top: -12px; right: -12px; width: 32px; height: 32px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lightbox-close:hover { background: var(--surface-2); }

/* ---------- States ---------- */
.loading { text-align: center; padding: 96px 20px; font-size: 14px; color: var(--text-2); }
.spinner { width: 20px; height: 20px; margin: 0 auto 14px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--text); animation: spin .7s linear infinite; }
#app { display: none; }
.gate-error { max-width: 520px; margin: 48px auto; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--danger); border-radius: var(--radius); font-size: 14px; line-height: 1.6; }
.empty-state, .empty-authors { text-align: center; padding: 48px 20px; color: var(--text-3); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); margin-top: 12px; font-size: 14px; }

/* ---------- Auth ---------- */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: 32px; }
.auth-card .auth-ic { width: 40px; height: 40px; margin-bottom: 20px; }
.auth-card h1 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; margin-bottom: 8px; }
.auth-card p { color: var(--text-2); line-height: 1.6; margin-bottom: 20px; }
.auth-card code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); padding: 1px 6px; border-radius: var(--radius-sm); }
.auth-note { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.auth-note strong { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }

/* ---------- Authors ---------- */
.authors-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
#authorsSearch { width: 280px; max-width: 100%; }
.pill { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.authors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.author-card {
  display: flex; flex-direction: column; gap: 16px; width: 100%; text-align: left; padding: 20px;
  cursor: pointer; color: var(--text); font-family: var(--sans); transition: border-color .15s, background .15s;
}
.author-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.author-card.leader { border-color: var(--accent); }
.top-row { display: flex; align-items: center; gap: 14px; }
.author-name { font-size: 16px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
.author-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.leader-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; color: var(--accent); background: var(--accent-soft); padding: 1px 8px; border-radius: 999px; margin-bottom: 6px; }
.week-strip { display: flex; align-items: flex-end; gap: 4px; height: 32px; margin-top: auto; }
.week-strip .bar { transform-origin: bottom; flex: 1; background: var(--border); min-height: 3px; border-radius: 2px; }
.week-strip .bar.hit { background: var(--accent); }
.week-strip .bar.today { outline: 1px solid var(--text-3); outline-offset: 1px; }
.meta-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.meta-row b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.balance-pos { color: var(--text) !important; }
.balance-neg { color: var(--danger) !important; }
.seal-ring-wrap { position: relative; flex-shrink: 0; }
.seal-ring { transform: rotate(-90deg); }
.seal-ring circle { fill: none; }
.seal-ring .track { stroke: var(--border); }
.seal-ring .prog { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.2, .8, .2, 1); }
.seal-ring-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 600; font-variant-numeric: tabular-nums; }

.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; background: transparent; border: 0; color: var(--text-2); cursor: pointer; margin-bottom: 16px; padding: 4px 0; transition: color .15s; }
.back-link:hover { color: var(--text); }
.author-hero { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 24px; margin-bottom: 16px; }
.author-hero h2 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.author-hero .sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.hero-stats { display: flex; gap: 32px; flex-wrap: wrap; margin-left: auto; }
.hero-stat .label { font-size: 12px; font-weight: 500; color: var(--text-3); margin-bottom: 4px; }
.hero-stat .value { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-stat .value.crimson { color: var(--danger); }
@media (max-width: 640px) { .hero-stats { margin-left: 0; gap: 16px 28px; } }

/* ---------- Report form ---------- */
.report-wrap { max-width: 760px; margin: 0 auto; }
.form-card { padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.field label .hint { font-weight: 400; color: var(--text-3); margin-left: 6px; }
.field input[type=text], .field input[type=datetime-local], .field textarea { width: 100%; }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .row-2 { grid-template-columns: 1fr; } .form-card { padding: 20px; } input, textarea, select { font-size: 16px !important; } }
.count-line { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.dropzone { border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 32px 20px; text-align: center; cursor: pointer; color: var(--text-2); background: var(--surface); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon { width: 28px; height: 28px; margin: 0 auto 10px; color: var(--text-3); }
.dz-icon .dz-icon { margin: 0; width: 100%; height: 100%; }
.dz-main { font-weight: 500; font-size: 14px; color: var(--text); }
.dz-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1 / 1; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.t-remove { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .7); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.t-remove:hover { background: #000; }
.t-status { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; font-size: 11px; background: rgba(0, 0, 0, .7); color: #fff; }
.thumb.uploading { border-color: var(--accent); }
.thumb.done .t-status { background: rgba(15, 118, 84, .92); }
.thumb.error { border-color: var(--danger); }
.thumb.error .t-status { background: rgba(185, 28, 28, .92); }
.actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid var(--border); }
.actions .msg { flex: 1; min-width: 200px; font-size: 13px; }
.msg.ok { color: var(--accent); } .msg.err { color: var(--danger); } .msg.info { color: var(--text-2); }

/* ---------- Planner ---------- */
.date-tabs {
  display: flex; gap: 2px; margin-bottom: 20px; padding: 3px; width: fit-content; max-width: 100%;
  overflow-x: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.date-tab { min-width: 76px; padding: 6px 12px; text-align: center; cursor: pointer; user-select: none; border-radius: 9px; border: 1px solid transparent; transition: background .15s; }
.date-tab:hover { background: var(--border); }
.date-tab.active { background: var(--surface); border-color: var(--border); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.date-tab .dow { font-size: 11px; font-weight: 500; color: var(--text-3); }
.date-tab.today .dow { color: var(--accent); }
.date-tab .dnum { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

.plan-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; transition: opacity .2s; }
@media (max-width: 1100px) { .plan-grid { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 900px) { .plan-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 560px) { .plan-grid { grid-template-columns: repeat(2, 1fr); } }
.time-slot {
  position: relative; overflow: hidden; padding: 10px 12px; text-align: left; cursor: pointer; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}
.time-slot:hover { border-color: var(--border-strong); background: var(--surface-2); }
.time-slot.booked { background: var(--ac-bg, var(--accent-soft)); box-shadow: inset 3px 0 0 var(--ac-solid, var(--accent)); }
.time-slot.booked:hover { background: var(--ac-bg-hover, var(--accent-soft)); }
.time-slot.past { opacity: .4; cursor: default; background: var(--surface-2); }
.time-slot.past:hover { border-color: var(--border); background: var(--surface-2); }
.time-slot.booked.past { opacity: .65; cursor: pointer; background: var(--ac-bg, var(--accent-soft)); }
.time-code { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.slot-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.time-slot.booked .slot-label { display: none; }
.slot-owner { margin-top: 4px; display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-owner-title { margin-top: 1px; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.input-modal { display: none; position: fixed; z-index: 2000; width: 340px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: 20px; }
.input-modal.show { display: block; }
.input-modal-header { font-size: 16px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 16px; }
.input-modal input, .input-modal select { width: 100%; margin-bottom: 16px; }
#modalViewInfo { margin-bottom: 16px; font-size: 14px; line-height: 1.7; }
#modalViewInfo .mv-author { font-weight: 600; }
#modalViewInfo div { display: flex; align-items: center; gap: 8px; }
.input-modal-buttons { display: flex; gap: 8px; justify-content: flex-end; }
.input-modal-buttons button { height: 34px; padding: 0 14px; font-size: 13px; font-weight: 500; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; color: var(--text); background: var(--surface); transition: background .15s; }
.input-modal-buttons button:hover { background: var(--surface-2); }
.input-modal-buttons button:disabled { opacity: .5; cursor: not-allowed; }
.btn-save { background: var(--accent) !important; border-color: var(--accent) !important; color: var(--accent-fg) !important; }
.btn-save:hover { background: var(--accent-hover) !important; }
.btn-delete { color: var(--danger) !important; margin-right: auto; }
.btn-delete:hover { background: color-mix(in srgb, var(--danger) 10%, transparent) !important; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed; right: 16px; bottom: 16px; z-index: 2500; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius); cursor: pointer; transition: background .15s, color .15s;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle svg { width: 16px; height: 16px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ============================================================
   Leaders Portal — надстройка над дизайн-системой выше.
   Те же токены, плоские поверхности, 1px-границы, один акцент.
   ============================================================ */
:root {
  --fg: var(--text); --muted: var(--text-3); --line: var(--border); --card: var(--surface); --err: var(--danger);
  --ok: #0f8a65; --warn: #b45309; --bad: var(--danger); --info: #2563eb;
}
:root[data-theme="dark"] { --ok: #34d399; --warn: #fbbf24; --info: #60a5fa; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ok: #34d399; --warn: #fbbf24; --info: #60a5fa; } }
.ok { --t: var(--ok); } .warn { --t: var(--warn); } .bad { --t: var(--bad); } .info { --t: var(--info); }
[hidden] { display: none !important; }
.ic { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
p { color: var(--text-2); } .muted { color: var(--text-3); } .err { color: var(--danger); } .info { white-space: pre-line; }

/* ---------- Шапка (бывшее боковое меню) ---------- */
body.portal { display: block; padding: 0; text-align: left; }
.sidebar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 24px; height: 56px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.ic.brand-ic { width: 28px; height: 28px; padding: 6px; border-radius: 7px; background: var(--accent); color: var(--accent-fg); }
.sidebar nav { display: flex; align-items: stretch; gap: 2px; flex: 1; min-width: 0; height: 100%; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
.sidebar nav a { position: relative; display: flex; align-items: center; padding: 0 12px; font-size: 14px; font-weight: 500; white-space: nowrap; color: var(--text-2); transition: color .15s; }
.sidebar nav a .ic { display: none; }
.sidebar nav a:hover, .sidebar nav a.active { color: var(--text); }
.sidebar nav a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--text); }
.side-card { display: none; }
.me-box { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.me-box img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); background: var(--surface-2); }
.me-box a { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
.me-box button, .theme-toggle { position: static; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; background: transparent; color: var(--text-2); border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; transition: background .15s, color .15s; }
.me-box button:hover, .theme-toggle:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 760px) {
  .sidebar { height: auto; flex-wrap: wrap; gap: 0 16px; padding: 10px 16px 0; }
  .me-box { margin-left: auto; } .sidebar nav { order: 3; flex-basis: 100%; height: 44px; margin: 8px 0 0; }
}

/* ---------- Контент ---------- */
.content { display: block; max-width: 1200px; margin: 0 auto; padding: 32px 24px 96px; }
.content .panel { max-width: none; padding: 0; background: none; border: 0; border-radius: 0; }
.content .panel:has(> .profile-card) { max-width: 720px; margin: 0 auto; }
.content h1 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; margin-bottom: 20px; }
.content h2 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; margin: 28px 0 12px; }
.h-ic { display: flex; align-items: center; gap: 8px; } .h-ic .ic, .box h2 .ic { color: var(--text-3); }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px; font-size: 13px; font-weight: 500; color: var(--text-2); transition: color .15s; } .back:hover { color: var(--text); }
.row a, .editor a { color: var(--accent); }
@media (max-width: 700px) { .content { padding: 24px 16px 64px; } }

/* ---------- Поверхности ---------- */
.box, .hero, .profile-card, .card, .org-card, .user-row, .stat, .group-head, .color-row, .empty { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.org-card, .user-row, .group-head { transition: border-color .15s, background .15s; }
.org-card:hover, .user-row:not(.static):hover, .group-head:hover { border-color: var(--border-strong); background: var(--surface-2); }
.card { width: 100%; max-width: 420px; padding: 32px; text-align: left; box-shadow: var(--shadow-pop); }
body:not(.portal) { display: grid; place-items: center; padding: 24px; }
.card h1 { font-size: 20px; margin-bottom: 8px; } .card p { margin-bottom: 20px; line-height: 1.6; }
.card .input { text-align: left; } .card .avatar { margin: 0 0 14px; }
.avatar, .avatar-lg { display: block; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); background: var(--surface-2); }
.avatar { width: 64px; height: 64px; } .avatar-lg { width: 96px; height: 96px; }

/* ---------- Формы ---------- */
.input { width: 100%; height: 36px; margin-bottom: 14px; padding: 0 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); font: 14px var(--sans); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:hover { border-color: var(--text-3); } .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); } .input::placeholder { color: var(--text-3); }
.input.sel { width: auto; margin: 0; } .input.grow { flex: 1; min-width: 120px; width: auto; margin: 0; }
input[type=color] { height: 32px; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; } .form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-3); }
.msg { min-height: 1.2em; margin-top: 8px; font-size: 13px; }
button.btn, a.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 40px; padding: 0 16px; font: 500 14px/1 var(--sans); color: var(--accent-fg); background: var(--accent); border: 1px solid var(--accent); border-radius: var(--radius); cursor: pointer; transition: background .15s, border-color .15s; }
button.btn:hover, a.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.btn.small, a.btn.small { width: auto; height: 34px; padding: 0 14px; font-size: 13px; margin: 0; }
button.btn.secondary { margin-top: 10px; background: var(--surface); color: var(--text); border-color: var(--border-strong); }
button.btn.secondary:hover { background: var(--surface-2); border-color: var(--border-strong); } button.btn.small.secondary { margin: 0; }
button.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
button.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: var(--danger); }
button.btn.vk { background: #0077ff; border-color: #0077ff; color: #fff; }
button.btn.vk:hover { background: #0066dd; border-color: #0066dd; }
button.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
button.btn.discord:hover { background: #4752c4; border-color: #4752c4; }
button.btn:disabled { opacity: .5; cursor: not-allowed; } button.btn:active:not(:disabled) { transform: translateY(1px); }
.login-row { display: flex; gap: 10px; } .login-row .btn { flex: 1; width: auto; }
.toggle, .fbtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 999px; font: 500 13px var(--sans); cursor: pointer; transition: background .15s, border-color .15s; }
.toggle:hover:not(:disabled):not(.on), .fbtn:hover:not(.on) { background: var(--surface-2); }
.toggle.on:hover, .fbtn.on:hover { filter: brightness(1.07); }
.toggle.on, .fbtn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); } .toggle:disabled { opacity: .4; cursor: not-allowed; }
.fbtn b { padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-weight: 600; } .fbtn.on b { background: rgba(255, 255, 255, .22); color: inherit; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; } .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(128, 128, 128, .5); }
.tabs { display: flex; gap: 2px; margin: 0 0 20px; border-bottom: 1px solid var(--border); }
.tab { display: inline-flex; align-items: center; gap: 7px; margin-bottom: -1px; padding: 10px 12px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-2); font: 500 14px var(--sans); cursor: pointer; transition: color .15s; }
.tab:hover { color: var(--text); } .tab.on { color: var(--text); border-bottom-color: var(--text); }

/* ---------- Профиль, префиксы, списки ---------- */
.profile-card { display: grid; grid-template-columns: 96px 1fr; column-gap: 20px; align-items: center; padding: 24px; text-align: left; }
.profile-card > img { grid-row: 1 / 3; grid-column: 1; } .profile-card > :not(img) { grid-column: 2; } .profile-card > .rows, .profile-card > .edit-bar, .profile-card > .social, .profile-card > .since { grid-column: 1 / -1; }
.profile-card h1 { margin-bottom: 6px; font-size: 22px; } .profile-card .rows { margin-top: 20px; }
.badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .profile-card .badges { margin: 0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 12px; }
.role-tag { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.role-tag.sub { font-size: 12px; font-weight: 500; }
.tags { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; } .tags > * { min-width: 0; }
.rows { border-top: 1px solid var(--border); } .row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 4px; border-bottom: 1px solid var(--border); font-size: 14px; } .row span:first-child { color: var(--text-3); }
.edit-bar { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; } .editor h3 { margin: 16px 0 2px; font-size: 14px; font-weight: 600; } .editor .hint { margin: 0 0 8px; font-size: 13px; color: var(--text-3); }
.editor .actions { padding-top: 8px; border-top: 0; justify-content: flex-start; }
.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 8px; } .list-grid > p, .list-grid > .empty { grid-column: 1 / -1; }
.user-row { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 12px 16px; margin-bottom: 8px; } .list-grid .user-row { margin: 0; }
.user-row img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); background: var(--surface-2); }
.user-row .nm { flex: 1 1 90px; min-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; } .user-row .tags { flex: 0 1 auto; min-width: 0; max-width: 58%; } .user-row .uid { flex: none; white-space: nowrap; font-size: 13px; color: var(--text-3); }
.search-wrap { position: relative; flex: 1 1 220px; margin: 0 0 12px; } .toolbar .search-wrap { margin: 0; } .search-wrap > .ic { position: absolute; left: 12px; top: 18px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; } .search-wrap .input { margin: 0; padding-left: 34px; }
.color-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 16px; margin-bottom: 8px; } .color-row .nm { flex: 1; }
.color-row input[type=color] { width: 44px; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: transparent; cursor: pointer; }

/* ---------- Организации ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 20px; }
.group { margin-bottom: 12px; } .group-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px; color: var(--text); font: 600 14px var(--sans); text-align: left; cursor: pointer; }
.group-head .cnt { padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-3); font-size: 12px; font-weight: 500; } .group-head .bdg { margin-left: auto; } .group-head .chev { transition: transform .2s; } .group.closed .chev { transform: rotate(-90deg); }
.collapse { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .25s ease; } .collapse.closed { grid-template-rows: 0fr; } .collapse > div { overflow: hidden; }
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; padding: 8px 1px 1px; }
.org-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-left: 3px solid var(--c, var(--accent)); }
.oc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 500; } .badges-row { display: flex; flex-wrap: wrap; gap: 6px; }
.org-tag { padding: 1px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); font-size: 12px; color: var(--text-3); white-space: nowrap; }
.bdg { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; white-space: nowrap; color: var(--t, var(--text-2)); background: color-mix(in srgb, var(--t, var(--text-3)) 12%, transparent); }

/* ---------- Лидерский профиль ---------- */
.meta { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); }
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; padding: 20px; margin-bottom: 16px; }
.hero-main { display: flex; align-items: center; gap: 16px; flex: 1 1 300px; min-width: 0; } .hero .avatar-lg { width: 72px; height: 72px; } .hero h1 { margin-bottom: 6px; font-size: 22px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; } .hero .stats { flex: 2 1 460px; margin: 0; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; }
.stat .si { display: flex; width: auto; height: auto; color: var(--t, var(--text-3)); } .stat small { font-size: 13px; font-weight: 500; color: var(--text-2); } .stat span { font-size: 12px; color: var(--text-3); }
.stat b { font-size: 26px; font-weight: 600; line-height: 1.1; letter-spacing: -.025em; color: var(--t, var(--text)); font-variant-numeric: tabular-nums; }
.lgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: stretch; margin-bottom: 16px; }
.box { display: flex; flex-direction: column; gap: 12px; padding: 20px; } .box > * { margin: 0 !important; } .box > .pgrid, .box > .section-actions { margin-top: auto !important; } .box > .scroll { flex: 1; }
.box h2 { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pgrid, .dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .pgrid .btn { width: 100%; } .dgrid .input.sel { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .section-actions { display: flex; gap: 8px; flex-wrap: wrap; } .section-actions .btn { justify-content: center; }
.sum { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; font-weight: 500; color: var(--t, var(--text)); background: color-mix(in srgb, var(--t, var(--text-3)) 10%, transparent); }
.scroll { max-height: 280px; overflow: auto; }
.tl { position: relative; padding-left: 22px; } .tl::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px; background: var(--border-strong); }
.tl-item { position: relative; padding: 8px 0; } .tl-item::before { content: ""; position: absolute; left: -21px; top: 14px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--surface); background: var(--t, var(--text-3)); }
.tl-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; } .tl-row small { display: block; font-size: 12px; color: var(--text-3); }
.hist { margin-bottom: 24px; } .hist .scroll { max-height: none; overflow: visible; } .hist .feed { columns: 2 340px; column-gap: 32px; } .hist .feed li { break-inside: avoid; }
.feed { list-style: none; } .feed li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; } .feed li:last-child { border-bottom: 0; }
.feed small { display: block; font-size: 12px; color: var(--text-3); } .reason { font-size: 13px; font-style: italic; color: var(--text-2); }
.fi { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; color: var(--t, var(--text-3)); background: color-mix(in srgb, var(--t, var(--text-3)) 12%, transparent); }
.pill-inactive { display: inline-block; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); font-size: 12px; font-weight: 500; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 32px 16px; border-style: dashed; border-color: var(--border-strong); color: var(--text-3); text-align: center; font-size: 14px; } .empty p { margin: 0; color: inherit; } .box .empty { flex: 1; padding: 16px; }
.empty-ic { display: flex; font-size: 22px; color: var(--text-3); }

/* ---------- Панель, уведомления, «было → станет» ---------- */
.overlay { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .2s; } .overlay.show { opacity: 1; }
.drawer { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); transform: translateY(12px) scale(.98); transition: transform .2s; } .overlay.show .drawer { transform: none; }
.editor .step-in { animation: fade .25s; } .editor .grp-name { display: block; margin: 8px 0 6px; font-size: 12px; color: var(--text-3); }
.dr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; } .dr-head h2 { margin: 0 !important; font-size: 16px; }
.x { display: grid; place-items: center; width: 32px; height: 32px; background: transparent; border: 0; border-radius: var(--radius); color: var(--text-2); cursor: pointer; } .x:hover { background: var(--surface-2); color: var(--text); }
.dr-user { display: flex; align-items: center; gap: 12px; margin: 6px 0 16px; } .dr-av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.diff { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px; margin: 16px 0 6px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.diff-col small { display: block; margin-bottom: 4px; font-size: 12px; color: var(--text-3); } .diff-col .tags { justify-content: flex-start; } .diff-arrow { color: var(--text-3); }
.note > div { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-size: 13px; color: var(--warn); }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 3500; display: flex; flex-direction: column; gap: 8px; }
.toast { --t: var(--ok); display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--t); border-radius: var(--radius); box-shadow: var(--shadow-pop); font-size: 14px; transition: opacity .3s; animation: fade .2s; } .toast .ic { color: var(--t); }
.toast.bad { --t: var(--danger); }

/* ============================================================
   Навигация по центру: [nav-l] [Профиль · Организации] [nav-r]
   app.js рендерит три блока (.nav-l / .nav-c / .nav-r); для обычного
   игрока (меньше двух боковых вкладок) — плоский <nav class="flat">.
   Колонки 1fr auto 1fr держат центральную пару ровно по центру.
   ============================================================ */
.brand-logo { width: 32px; height: 32px; flex-shrink: 0; display: block; }

.sidebar nav {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  width: 840px; height: 100%; margin: 0; flex: none; overflow: visible;
  display: grid; grid-template-columns: 1fr auto 1fr;
}
.sidebar nav .nav-l, .sidebar nav .nav-c, .sidebar nav .nav-r { display: flex; align-items: stretch; }
.sidebar nav .nav-l { justify-content: flex-end; }
.sidebar nav .nav-c { justify-content: center; }
.sidebar nav .nav-r { justify-content: flex-start; }
.sidebar nav a { justify-content: center; padding: 0 12px; }
.sidebar nav .nav-c a { padding: 0 16px; font-weight: 600; }

/* Обычный игрок: один ряд по центру */
.sidebar nav.flat { display: flex; justify-content: center; width: auto; }
.sidebar nav.flat a { padding: 0 16px; }

.me-box { margin-left: auto; }

/* Узкие экраны: меню уходит второй строкой, тоже по центру */
@media (max-width: 1320px) {
  .sidebar { height: auto; flex-wrap: wrap; gap: 0 16px; padding: 10px 16px 0; }
  .sidebar nav {
    position: static; transform: none; width: auto; order: 3; flex-basis: 100%;
    height: 44px; margin: 8px 0 0; overflow-x: auto;
    display: flex; justify-content: safe center;
  }
  .sidebar nav .nav-l, .sidebar nav .nav-c, .sidebar nav .nav-r { flex: none; }
  .sidebar nav a { padding: 0 12px; }
}

/* Логотип: подменяем старую иконку-щит на Leaders.svg (путь относительно этого css-файла) */
.ic.brand-ic {
  width: 32px; height: 32px; padding: 0; border-radius: 0; background: none; overflow: visible;
  transition: filter .3s ease;
}

/* Иконки в кнопках префиксов */
.toggle .t-ic { width: 16px; height: 16px; }
.toggle.on .t-ic { filter: drop-shadow(0 0 1px rgba(0, 0, 0, .55)); }

/* ---------- Профиль: шапка, соцсети, «с нами с», история ролей ---------- */
.profile-card { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.p-main { flex: 1 1 260px; min-width: 0; }
.p-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-left: auto; }
.social { display: flex; gap: 8px; }
.soc-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius); color: #fff; transition: background .15s; }
.soc-btn.discord { background: #5865f2; } .soc-btn.discord:hover { background: #4752c4; }
.soc-btn.vk { background: #0077ff; } .soc-btn.vk:hover { background: #0066dd; }
.soc-ic { width: 18px; height: 18px; fill: currentColor; }
.badges .since { margin-left: 6px; font-size: 13px; color: var(--text-3); }
.p-hist { margin-top: 16px; }

/* Теги в строках списков не обрезаем: сжимается ник, а не префикс */
.user-row .tags { flex: none; max-width: none; }


/* ---------- Смена аватарки ---------- */
.av-wrap { position: relative; width: 96px; height: 96px; flex-shrink: 0; }
.av-wrap .avatar-lg { width: 100%; height: 100%; }
/* Кнопка смены аватарки: круглый бейдж-карандаш в углу, текст не нужен */
.av-edit {
  position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0; border: 2px solid var(--surface); border-radius: 50%;
  background: var(--accent); color: var(--accent-fg); cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: background .15s, transform .15s;
}
.av-edit:hover { background: var(--accent-hover); transform: scale(1.08); }
.av-edit .ic { width: 14px; height: 14px; }
.av-editor h3 { margin: 18px 0 8px; font-size: 14px; font-weight: 600; }
.av-editor h3:first-child { margin-top: 0; }
.av-editor { transition: opacity .15s; }
.av-src-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.av-src {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius);
  font: 500 14px var(--sans); cursor: pointer; transition: background .15s, border-color .15s;
}
.av-src img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.av-src .soc-ic { width: 16px; height: 16px; }
.av-src:hover:not(:disabled) { background: var(--surface-2); }
.av-src.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.av-src:disabled { opacity: .45; cursor: not-allowed; }
.av-preview { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.av-preview img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); margin-right: auto; }

/* ---------- Иконка «Обратная связь» в шапке ---------- */
.me-box a.icon-link { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; max-width: none; padding: 0; color: var(--text-2); border-radius: var(--radius); transition: background .15s, color .15s; }
.me-box a.icon-link:hover, .me-box a.icon-link.active { background: var(--surface-2); color: var(--text); }

/* ============================================================
   Тема «торнадо»: фирменный мятный градиент логотипа, свечение,
   вихрь вместо «Загрузка…», фон-вихрь из частиц (vortex.js)
   ============================================================ */
:root { --grad: linear-gradient(135deg, #1fae7e 0%, #0f8a65 55%, #0b6f50 100%); --glow: rgba(15, 138, 101, .45); }
:root[data-theme="dark"] { --grad: linear-gradient(135deg, #6ee7b7 0%, #34d399 50%, #1e9668 100%); --glow: rgba(52, 211, 153, .45); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --grad: linear-gradient(135deg, #6ee7b7 0%, #34d399 50%, #1e9668 100%); --glow: rgba(52, 211, 153, .45); } }

/* Градиент на основных кнопках и активных элементах */
button.btn:not(.secondary):not(.danger):not(.vk):not(.discord), a.btn:not(.secondary):not(.danger):not(.vk):not(.discord) { background-image: var(--grad); border-color: transparent; }
button.btn:not(.secondary):not(.danger):not(.vk):not(.discord):hover:not(:disabled), a.btn:not(.secondary):not(.danger):not(.vk):not(.discord):hover { background-image: var(--grad); filter: brightness(1.07); box-shadow: 0 6px 18px -6px var(--glow); }
.toggle.on, .fbtn.on { background-image: var(--grad); border-color: transparent; }
.sidebar nav a.active::after { background: var(--grad); }

/* Свечение: аватарка в профиле и карточки при наведении */
.profile-card .avatar-lg, .hero .avatar-lg { box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 28px -6px var(--glow); }
.org-card:hover, .user-row:not(.static):hover { box-shadow: 0 8px 24px -14px var(--glow); }

/* Загрузка: качающиеся линии логотипа */
.loader { width: 56px; height: 52px; margin: 40px auto; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='20 35 160 150'%3E%3Cstyle%3Epath{fill:none;stroke-linecap:round;transform-box:fill-box;transform-origin:center;animation:s 1.3s ease-in-out infinite alternate}@keyframes s{from{transform:translateX(-8px)}to{transform:translateX(8px)}}@media (prefers-reduced-motion:reduce){path{animation:none}}%3C/style%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%234CE0A9'/%3E%3Cstop offset='.5' stop-color='%2335C891'/%3E%3Cstop offset='1' stop-color='%231E9668'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cg stroke='url(%23g)'%3E%3Cpath d='M 35 50 C 80 65, 130 35, 165 50' stroke-width='14' style='animation-delay:0s'/%3E%3Cpath d='M 50 80 C 90 95, 135 65, 155 80' stroke-width='12' style='animation-delay:-0.26s'/%3E%3Cpath d='M 60 110 C 90 122, 120 98, 140 110' stroke-width='10' style='animation-delay:-0.52s'/%3E%3Cpath d='M 75 137 C 95 145, 115 129, 125 137' stroke-width='8' style='animation-delay:-0.78s'/%3E%3Cpath d='M 88 160 C 95 166, 105 158, 102 172' stroke-width='6' style='animation-delay:-1.04s'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; }
.list-grid > .loader { grid-column: 1 / -1; }

/* Фон-вихрь из частиц (vortex.js) */
#vortex-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
body.has-vortex .content { position: relative; z-index: 1; }
body.has-vortex .card { z-index: 1; }

/* Логотип в шапке (инлайн-SVG из app.js): при наведении линии воронки по очереди «раскачиваются» сверху вниз,
   как закручивающийся торнадо; плавный разгон и затухание. Пока курсор на логотипе — подсветка. */
.brand:hover .ic.brand-ic, .brand:focus-visible .ic.brand-ic { filter: drop-shadow(0 0 7px var(--glow)) brightness(1.12); }
.brand-ic path, .brand-ic circle { transform-box: fill-box; transform-origin: center; }
.brand-ic.spin path { animation: tw-sway 1.1s ease-in-out both; animation-delay: calc(var(--i) * 70ms); }
.brand-ic.spin circle { animation: tw-drift 1.2s ease-in-out both; animation-delay: calc(var(--i) * 60ms); }
@keyframes tw-sway {
  0% { transform: none; }
  20% { transform: translateX(calc(var(--a) * -1)) scaleX(.92); }
  45% { transform: translateX(calc(var(--a) * 1.1)) scaleX(1.06); }
  68% { transform: translateX(calc(var(--a) * -.7)) scaleX(.96); }
  86% { transform: translateX(calc(var(--a) * .3)) scaleX(1.01); }
  100% { transform: none; }
}
@keyframes tw-drift {
  0% { transform: none; }
  30% { transform: translate(-10px, -5px); }
  60% { transform: translate(8px, 6px); }
  100% { transform: none; }
}

/* Поле цвета: круглая капля + HEX (вместо квадрата системного color-input) */
.color-field { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; height: 36px; padding: 0 12px 0 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); transition: border-color .15s, box-shadow .15s; }
.color-field:hover { border-color: var(--text-3); }
.color-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.color-field.bad { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.cf-swatch { position: relative; width: 24px; height: 24px; flex-shrink: 0; overflow: hidden; border-radius: 50%; border: 1px solid rgba(128, 128, 128, .5); cursor: pointer; transition: transform .15s; }
.cf-swatch:hover { transform: scale(1.1); }
.cf-swatch input { position: absolute; top: -8px; left: -8px; width: 40px; height: 40px; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.color-field input.cf-hex, .color-field input.cf-hex:hover, .color-field input.cf-hex:focus { width: 72px; height: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none; color: var(--text); font: 500 13px var(--mono); letter-spacing: .03em; text-transform: uppercase; }


/* ---------- Экран входа: карточка профиля в одну линию ---------- */
.card.wide { max-width: 760px; }
#profile:not([hidden]) { display: flex; align-items: center; gap: 28px; }
#profile .avatar { width: 128px; height: 128px; margin: 0; flex: none; }
#profile .prof-main { flex: 1; min-width: 0; }
#profile .prof-main h1 { margin-bottom: 8px; }
#profile .prof-main p { margin: 0; }
#profile .prof-actions { display: flex; align-items: center; gap: 10px; flex: none; }
#profile .prof-actions .btn { width: auto; margin: 0; padding: 0 20px; white-space: nowrap; }
@media (max-width: 720px) {
  #profile:not([hidden]) { flex-direction: column; align-items: flex-start; }
  #profile .prof-actions { width: 100%; }
  #profile .prof-actions .btn { flex: 1; }
}

/* ---------- Карандаш смены ника рядом с ником ---------- */
.nick-edit { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: 8px; padding: 0; vertical-align: middle; background: transparent; border: 1px solid transparent; border-radius: var(--radius); color: var(--text-3); cursor: pointer; transition: background .15s, color .15s; }
.nick-edit:hover { background: var(--surface-2); color: var(--text); }
.nick-edit .ic { width: 15px; height: 15px; }
.nick-editor .actions { padding-top: 12px; border-top: 0; justify-content: flex-start; }
