/* ============================================================
   Vuelo — internal creators dashboard
   Static UI kit. Calm blue-tinted light theme.
   ============================================================ */

:root {
  /* ---- palette ---- */
  --bg-page:        #eef2f8;
  --bg-card:        #ffffff;
  --bg-soft:        #f5f8fc;
  --border-soft:    #e6ebf5;
  --text-primary:   #0e1330;
  --text-secondary: #6b7280;
  --brand-primary:  #3b5eff;
  --brand-pink:     #ff6b9d;
  --brand-purple:   #8b7fff;

  /* ---- derived tints ---- */
  --brand-primary-dark: #2f4de0;
  --brand-primary-soft: #e8edff;
  --brand-pink-soft:    #ffeef5;
  --brand-pink-ink:     #b62f61;
  --brand-purple-soft:  #eeecff;
  --brand-purple-ink:   #5f52d6;
  --success:            #0f9d76;
  --success-soft:       #e6f6f0;
  --success-ink:        #0a7a5b;
  --text-muted:         #6b7385;
  --border-strong:      #d7deec;

  /* ---- semantic aliases (used throughout the sheet) ---- */
  --bg:          var(--bg-page);
  --surface:     var(--bg-card);
  --surface-2:   var(--bg-soft);
  --line:        var(--border-soft);
  --line-strong: var(--border-strong);
  --ink:         var(--text-primary);
  --ink-2:       var(--text-secondary);
  --ink-3:       var(--text-muted);
  --accent:      var(--brand-primary);
  --accent-soft: var(--brand-primary-soft);
  --accent-ink:  var(--brand-primary-dark);
  --violet:      var(--brand-purple);
  --violet-soft: var(--brand-purple-soft);
  --mint:        var(--success);
  --mint-soft:   var(--success-soft);
  --amber:       var(--brand-pink);
  --amber-soft:  var(--brand-pink-soft);

  /* ---- shape ---- */
  --r-xs: 12px;   /* badges, chips, small controls */
  --r-sm: 16px;   /* inputs */
  --r-md: 24px;   /* compact cards */
  --r-lg: 28px;   /* cards */
  --r-xl: 32px;   /* large surfaces */

  /* ---- elevation: soft and diffuse, no glow ---- */
  --sh-1: 0 6px 14px -8px rgba(14, 19, 48, .08);
  --sh-2: 0 24px 60px -24px rgba(14, 19, 48, .18), 0 6px 14px -8px rgba(14, 19, 48, .08);
  --sh-3: 0 30px 70px -26px rgba(14, 19, 48, .22), 0 8px 18px -10px rgba(14, 19, 48, .10);
  --sh-btn: 0 14px 36px -10px rgba(59, 94, 255, .45);
  --sh-btn-hover: 0 16px 40px -10px rgba(59, 94, 255, .52);

  /* ---- type ---- */
  --sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
          Roboto, 'Helvetica Neue', Arial, sans-serif;
  --display: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont,
             'Segoe UI', Roboto, Arial, sans-serif;

  --nav-w: 16rem;
}

* { box-sizing: border-box; }

/* атрибут hidden должен побеждать display у компонентов */
[hidden] { display: none !important; }

/* ------------------------------------------------------------
   Global UI scale.
   Every size below is expressed in rem, so this single value
   drives how large the whole interface renders. 16px = 100%.
   ------------------------------------------------------------ */
html { font-size: 18px; }

/* phones keep the original 16px scale — the larger scale is a desktop affordance */
@media (max-width: 700px) {
  html { font-size: 16px; }
}

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "tnum" 0;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
h1 { font-size: 1.875rem; font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: 1.3125rem; }
h3 { font-size: 1.0625rem; }
p  { margin: 0; }
a  { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }

.muted   { color: var(--ink-2); }
.muted-2 { color: var(--ink-3); }
.num     { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 2.75rem; padding: 0 1.25rem;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 0.9062rem; font-weight: 500; letter-spacing: -0.01em;
  cursor: pointer; white-space: nowrap;
  transition: transform .16s cubic-bezier(.2,.8,.3,1), box-shadow .2s, background .2s, border-color .2s, opacity .2s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }

.btn-primary {
  background: var(--brand-primary); color: #fff;
  box-shadow: var(--sh-btn);
}
.btn-primary:hover {
  background: var(--brand-primary-dark);
  box-shadow: var(--sh-btn-hover);
  transform: translateY(-1px);
}

.btn-ghost { background: var(--surface); border-color: var(--line); box-shadow: var(--sh-1); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--bg-soft); transform: translateY(-1px); }

.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--bg-soft); color: var(--ink); }

.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-block { width: 100%; }
.btn-lg { height: 3.125rem; padding: 0 1.625rem; font-size: 0.9688rem; }

/* ------------------------------------------------------------
   Inputs
   ------------------------------------------------------------ */
.field { display: block; margin-bottom: 1rem; }
.field > .label {
  display: block; margin-bottom: 0.4375rem;
  font-size: 0.8125rem; font-weight: 500; color: var(--ink-2);
}
.input {
  width: 100%; height: 3.125rem; padding: 0 1rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.9375rem;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.input::placeholder { color: var(--ink-3); }
.input:hover { border-color: var(--line-strong); }
.input:focus {
  outline: none; background: var(--surface);
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(59, 94, 255, .16);
}
.input-lg { height: 3.5rem; font-size: 1rem; border-radius: var(--r-sm); }

/* ------------------------------------------------------------
   Cards & chips
   ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
}
.card-pad { padding: 1.5rem; }

.chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  height: 1.625rem; padding: 0 0.6875rem;
  border-radius: var(--r-xs);
  font-size: 0.7812rem; font-weight: 500;
  background: var(--bg-soft); color: var(--ink-2);
}
.chip-up   { background: var(--success-soft);     color: var(--success-ink); }
.chip-down { background: var(--brand-pink-soft);  color: var(--brand-pink-ink); }
.chip-neutral { background: var(--brand-purple-soft); color: var(--brand-purple-ink); }

.dot { width: 0.4375rem; height: 0.4375rem; border-radius: 50%; background: currentColor; }

/* ============================================================
   AUTH SCREEN
   ============================================================ */
.auth {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 46%;
}
.auth-left {
  display: flex; flex-direction: column; justify-content: center;
  padding: 3rem min(9vw, 6rem);
  min-width: 0;
  background: var(--bg-card);
}
.auth-left .btn { overflow-wrap: break-word; }
.auth-form-wrap { width: 100%; max-width: 24rem; margin: 0 auto; }

.auth-logo { display: inline-flex; align-items: center; gap: 0.625rem; margin-bottom: 3.25rem; transition: gap .22s cubic-bezier(.2,.8,.3,1); }
.logo-mark {
  width: 2.125rem; height: 2.125rem; border-radius: var(--r-xs);
  background: var(--brand-primary);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 8px 18px -8px rgba(59, 94, 255, .5);
  flex: none;
}
.logo-word {
  font-family: var(--display); font-size: 1.125rem; font-weight: 800; letter-spacing: -0.03em;
  max-width: 8rem; opacity: 1; overflow: hidden; white-space: nowrap;
  transition: max-width .26s cubic-bezier(.2,.8,.3,1), opacity .16s ease;
}

.auth-title { margin-bottom: 0.125rem; }
.auth-tagline {
  font-family: var(--display); font-size: 1.875rem; font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.2; color: var(--ink);
  margin-bottom: 2rem;
}

.auth-row { display: flex; align-items: center; justify-content: space-between; margin: 0.25rem 0 1.5rem; }
.check { display: inline-flex; align-items: center; gap: 0.5625rem; font-size: 0.875rem; color: var(--ink-2); cursor: pointer; user-select: none; }
.check input {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}
.check-box {
  flex: none; width: 1.125rem; height: 1.125rem;
  border-radius: 6px; border: 1.5px solid var(--line-strong);
  background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .16s, border-color .16s;
}
.check-box::after {
  content: ''; width: 0.3125rem; height: 0.5625rem;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(40deg) translate(-1px, -1px);
  opacity: 0; transition: opacity .12s;
}
.check input:checked + .check-box { background: var(--brand-primary); border-color: var(--brand-primary); }
.check input:checked + .check-box::after { opacity: 1; }
.check input:focus-visible + .check-box { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.link { color: var(--accent); font-weight: 500; font-size: 0.875rem; }
.link:hover { text-decoration: underline; }

.divider {
  display: flex; align-items: center; gap: 0.875rem;
  margin: 1.625rem 0; color: var(--ink-3); font-size: 0.7812rem;
}
.divider::before, .divider::after { content: ""; height: 0.0625rem; flex: 1; background: var(--line); }

.auth-foot { margin-top: 1.875rem; font-size: 0.875rem; color: var(--ink-2); text-align: center; }

.tagline-word {
  display: inline-block; color: var(--accent); font-weight: 800;
  transition: opacity .22s ease, transform .22s ease;
}
.tagline-word.is-swap { opacity: 0; transform: translateY(0.25rem); }

/* right showcase panel */
.auth-right {
  position: relative; overflow: hidden;
  background: var(--bg-page);
  border-left: 1px solid var(--border-soft);
  padding: 3rem;
  display: flex; flex-direction: column; justify-content: center;
}

.showcase { position: relative; z-index: 1; max-width: 25rem; margin: 0 auto; width: 100%; }
.showcase h2 { font-size: 1.6875rem; line-height: 1.24; margin-bottom: 0.625rem; }
.showcase p { color: var(--ink-2); margin-bottom: 1.75rem; }

.float-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  padding: 1rem 1.125rem;
}
.float-stack { display: grid; gap: 0.875rem; }
.float-stack .float-card:nth-child(2) { margin-left: 2.125rem; }
.float-stack .float-card:nth-child(3) { margin-left: 0.875rem; }
.fc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.375rem; }
.fc-label { font-size: 0.7812rem; color: var(--ink-2); font-weight: 500; }
.fc-value { font-family: var(--display); font-size: 1.5625rem; font-weight: 800; letter-spacing: -0.03em; }

/* ============================================================
   APP SHELL
   ============================================================ */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--nav-w); flex: none;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 1.375rem 1rem;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 60;
  transition: width .28s cubic-bezier(.2,.8,.3,1), padding .28s cubic-bezier(.2,.8,.3,1);
}
.sidebar-head {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0 0.25rem 1.625rem 0.5rem;
}
.sidebar .auth-logo { margin: 0; min-width: 0; }
.nav-toggle {
  flex: none; margin-left: auto;
  width: 2rem; height: 2rem;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-xs);
  background: transparent; color: var(--ink-3);
  cursor: pointer; transition: background .16s, color .16s;
}
.nav-toggle:hover { background: var(--bg-soft); color: var(--ink); }

.nav-label {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 0.75rem; margin-bottom: 0.5rem;
  height: 1.125rem; line-height: 1.125rem; overflow: hidden; text-indent: 0; background: none;
  transition: height .22s cubic-bezier(.2,.8,.3,1), padding .22s cubic-bezier(.2,.8,.3,1),
              margin .22s cubic-bezier(.2,.8,.3,1), background-color .22s ease;
}
.nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.1875rem; }
.nav-item {
  display: flex; align-items: center; gap: 0.6875rem; min-width: 0;
  height: 2.625rem; padding: 0 0.75rem;
  border-radius: var(--r-sm);
  font-size: 0.9062rem; font-weight: 500; color: var(--ink-2);
  transition: background .16s, color .16s, padding .22s cubic-bezier(.2,.8,.3,1), gap .22s cubic-bezier(.2,.8,.3,1);
}
.nav-item svg { flex: none; opacity: .85; }
.nav-item > span:not(.nav-count) {
  flex: 1; min-width: 0; max-width: 12rem; opacity: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: max-width .22s cubic-bezier(.2,.8,.3,1), opacity .14s ease;
}
.nav-item img { flex: none; }
.nav-item:hover { background: var(--bg-soft); color: var(--ink); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-item.is-active svg { opacity: 1; }
.nav-count {
  flex: none; margin-left: auto; font-size: 0.75rem; font-weight: 600;
  min-width: 1.375rem; max-width: 3rem; opacity: 1; text-align: center;
  background: var(--bg-soft); color: var(--ink-2);
  padding: 0.0625rem 0.5rem; border-radius: 8px;
  overflow: hidden;
  transition: max-width .22s cubic-bezier(.2,.8,.3,1), opacity .14s ease, margin .22s ease, padding .22s ease;
}
.nav-item.is-active .nav-count { background: rgba(59, 94, 255, .14); color: var(--brand-primary-dark); }

.sidebar-foot { margin-top: auto; padding-top: 1.125rem; }
.user-card {
  display: flex; align-items: center; gap: 0.6875rem;
  padding: 0.625rem; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line);
  transition: padding .22s cubic-bezier(.2,.8,.3,1), gap .22s cubic-bezier(.2,.8,.3,1);
}
.avatar { width: 2.375rem; height: 2.375rem; border-radius: 50%; object-fit: cover; flex: none; background: var(--bg-soft); transition: width .22s cubic-bezier(.2,.8,.3,1), height .22s cubic-bezier(.2,.8,.3,1); }
.avatar-lg { width: 5.25rem; height: 5.25rem; border-radius: var(--r-md); }
.user-name {
  font-size: 0.875rem; font-weight: 600; line-height: 1.25;
  max-height: 1.25rem; opacity: 1; overflow: hidden;
  transition: max-height .22s cubic-bezier(.2,.8,.3,1), opacity .14s ease, margin .22s ease;
}
.user-mail {
  font-size: 0.75rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-height: 1.125rem; opacity: 1;
  transition: max-height .22s cubic-bezier(.2,.8,.3,1), opacity .14s ease, margin .22s ease;
}

/* main column */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 0.875rem;
  padding: 0.875rem 2rem;
  background: var(--bg-page);
  border-bottom: 1px solid var(--line);
}
.burger {
  display: none; width: 2.5rem; height: 2.5rem; flex: none;
  align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-xs);
  background: var(--surface); cursor: pointer;
}
.topbar-title { font-size: 0.9375rem; font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.625rem; }

.search {
  position: relative; width: 16.25rem;
}
.search svg { position: absolute; left: 0.8125rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search .input { height: 2.5rem; padding-left: 2.375rem; border-radius: var(--r-sm); font-size: 0.875rem; }

.icon-btn {
  width: 2.5rem; height: 2.5rem; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  transition: box-shadow .2s, color .2s;
}
.icon-btn:hover { color: var(--ink); box-shadow: var(--sh-1); }

.page { padding: 1.875rem 2rem 4rem; max-width: 85rem; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1.625rem; }
.page-head .grow { flex: 1; min-width: 15rem; }
.page-head p { color: var(--ink-2); margin-top: 0.375rem; }

.section-head {
  display: flex; align-items: center; gap: 0.875rem; flex-wrap: wrap;
  margin: 2.375rem 0 1rem;
}
.section-head .grow { flex: 1; min-width: 12.5rem; }

/* segmented control */
.segmented {
  display: inline-flex; padding: 0.25rem; gap: 0.125rem;
  background: var(--bg-soft); border-radius: 999px;
}
.seg {
  display: inline-flex; align-items: center; gap: 0.4375rem;
  height: 2.125rem; padding: 0 0.9375rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-2);
  font-size: 0.8438rem; font-weight: 500; cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s;
}
.seg:hover { color: var(--ink); }
.seg.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* ------------------------------------------------------------
   KPI cards
   ------------------------------------------------------------ */
.kpi-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.kpi {
  position: relative; overflow: hidden; min-width: 0;
  padding: 1.25rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-2);
  transition: transform .22s cubic-bezier(.2,.8,.3,1), box-shadow .22s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-3); }
.kpi-top { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 1rem; }
.kpi-ico {
  width: 2.125rem; height: 2.125rem; border-radius: var(--r-xs); flex: none;
  display: grid; place-items: center;
  background: var(--brand-primary-soft); color: var(--brand-primary);
}
.kpi-ico.v { background: var(--brand-purple-soft); color: var(--brand-purple-ink); }
.kpi-ico.m { background: var(--success-soft);      color: var(--success-ink); }
.kpi-ico.a { background: var(--brand-pink-soft);   color: var(--brand-pink-ink); }
.kpi-label { font-size: 0.8438rem; font-weight: 500; color: var(--ink-2); overflow-wrap: break-word; }
.kpi-value { font-family: var(--display); font-size: 2rem; font-weight: 800; letter-spacing: -0.035em; line-height: 1; }
.kpi-foot { display: flex; align-items: center; gap: 0.5625rem; margin-top: 0.75rem; }
.kpi-foot .muted-2 { font-size: 0.7812rem; }
.spark { margin-top: 0.875rem; display: block; width: 100%; height: 2.125rem; }

/* ------------------------------------------------------------
   Chart block
   ------------------------------------------------------------ */
.chart-card { padding: 1.5rem; }
.chart-head { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.375rem; }
.chart-head .grow { flex: 1; min-width: 12.5rem; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; margin: 0.875rem 0 1.125rem; }
.legend-item { display: inline-flex; align-items: center; gap: 0.4375rem; font-size: 0.8125rem; color: var(--ink-2); }
.legend-swatch { width: 0.5625rem; height: 0.5625rem; border-radius: 3px; }

.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-x {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  margin-top: 0.625rem; font-size: 0.75rem; color: var(--ink-3); text-align: center;
}
.chart-tip {
  position: absolute; pointer-events: none; opacity: 0;
  transform: translate(-50%, -100%);
  background: var(--text-primary); color: #fff;
  padding: 0.4375rem 0.6875rem; border-radius: var(--r-xs);
  font-size: 0.7812rem; font-weight: 500; white-space: nowrap;
  box-shadow: var(--sh-2); transition: opacity .14s;
  z-index: 5;
}
.chart-tip b { font-weight: 600; }
.chart-tip.is-on { opacity: 1; }

.chart-side { display: grid; gap: 0.875rem; align-content: start; min-width: 0; }
.mini-stat { min-width: 0; padding: 1rem 1.125rem; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.mini-stat .fc-value { font-size: 1.3125rem; }
.bar-line { height: 0.4375rem; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin-top: 0.625rem; }
.bar-line i { display: block; height: 100%; border-radius: 999px; background: var(--brand-primary); }

.grid-chart { display: grid; grid-template-columns: minmax(0,1fr) 16.75rem; gap: 1rem; }
.grid-chart > * { min-width: 0; }

/* ------------------------------------------------------------
   Reels — card feed
   ------------------------------------------------------------ */
.feed {
  display: grid; gap: 1.125rem;
  grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr));
}
.reel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-2);
  overflow: hidden; cursor: pointer;
  transition: transform .24s cubic-bezier(.2,.8,.3,1), box-shadow .24s;
}
.reel:hover { transform: translateY(-3px); box-shadow: var(--sh-3); }
.reel-media { position: relative; aspect-ratio: 4 / 5; background: var(--bg-soft); overflow: hidden; }
.reel-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2,.8,.3,1); }
.reel:hover .reel-media img { transform: scale(1.05); }
.reel-shade {
  position: absolute; inset: auto 0 0 0; height: 60%;
  background: linear-gradient(to top, rgba(20,16,14,.72), rgba(20,16,14,0));
}
.reel-views {
  position: absolute; left: 0.625rem; bottom: 0.625rem;
  display: inline-flex; align-items: center; gap: 0.375rem;
  color: #fff; font-size: 0.8438rem; font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.reel-badge {
  position: absolute; right: 0.625rem; top: 0.625rem;
  background: var(--bg-card);
  color: var(--ink); font-size: 0.7188rem; font-weight: 600;
  padding: 0.25rem 0.5625rem; border-radius: var(--r-xs);
}
.reel-body { padding: 0.8125rem 0.875rem 0.9375rem; }
.reel-title {
  font-size: 0.875rem; font-weight: 600; line-height: 1.35; margin-bottom: 0.5625rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.375rem;
}
.reel-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.7812rem; color: var(--ink-3); }
.reel-meta .avatar { width: 1.375rem; height: 1.375rem; }
.reel-acc { color: var(--ink-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reel-date { margin-left: auto; white-space: nowrap; }

/* ------------------------------------------------------------
   Reels — table
   ------------------------------------------------------------ */
.table-wrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-2); overflow: hidden;
}
.table-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 47.5rem; }
.tbl th {
  text-align: left; font-size: 0.75rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3);
  padding: 0.8125rem 1.125rem; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink-2); }
.tbl th .arrow { opacity: 0; margin-left: 0.3125rem; }
.tbl th.is-sorted { color: var(--accent-ink); }
.tbl th.is-sorted .arrow { opacity: 1; display: inline-block; }
.tbl th.is-sorted.desc .arrow { transform: rotate(180deg); }
.tbl td { padding: 0.75rem 1.125rem; border-bottom: 1px solid var(--line); font-size: 0.875rem; vertical-align: middle; }
.tbl tbody tr { transition: background .14s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.td-reel { display: flex; align-items: center; gap: 0.75rem; min-width: 16.25rem; max-width: 26.25rem; }
.td-reel > div { min-width: 0; }
.td-thumb { width: 2.75rem; height: 3.375rem; border-radius: var(--r-xs); object-fit: cover; flex: none; background: var(--bg-soft); }
.td-name {
  font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.td-sub { font-size: 0.7812rem; color: var(--ink-3); }
.td-num { font-variant-numeric: tabular-nums; font-weight: 600; }

.table-foot {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.8125rem 1.125rem; background: var(--surface-2); border-top: 1px solid var(--line);
  font-size: 0.8125rem; color: var(--ink-2);
}

/* ------------------------------------------------------------
   Add reel screen
   ------------------------------------------------------------ */
.narrow { max-width: 45rem; }
.add-card { padding: 1.875rem; }
.paste-row { display: flex; gap: 0.625rem; align-items: stretch; }
.paste-row .field { flex: 1; margin: 0; }
.hint { font-size: 0.8125rem; color: var(--ink-3); margin-top: 0.5625rem; }

.state-box {
  display: flex; align-items: center; gap: 0.875rem;
  margin-top: 1.125rem; padding: 1rem 1.125rem;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface-2);
}
.state-box.ok   { background: var(--success-soft);    border-color: #c9ebdf; }
.state-box.err  { background: var(--brand-pink-soft); border-color: #ffd4e2; }
.state-title { font-size: 0.9062rem; font-weight: 600; }
.state-sub { font-size: 0.8125rem; color: var(--ink-2); }

.spinner {
  width: 1.375rem; height: 1.375rem; flex: none; border-radius: 50%;
  border: 2.5px solid var(--border-strong); border-top-color: var(--brand-primary);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.state-ico {
  width: 2.125rem; height: 2.125rem; flex: none; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: var(--mint);
}
.state-box.err .state-ico { background: var(--brand-pink); }

.steps { display: grid; gap: 0.75rem; margin-top: 0.5rem; }
.step { display: flex; gap: 0.8125rem; align-items: flex-start; }
.step-n {
  width: 1.625rem; height: 1.625rem; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-soft); color: var(--ink-2);
  font-size: 0.7812rem; font-weight: 600;
}
.step.done .step-n { background: var(--success); color: #fff; }
.step.active .step-n { background: var(--brand-primary); color: #fff; }
.step-t { font-size: 0.875rem; font-weight: 500; }
.step-s { font-size: 0.7812rem; color: var(--ink-3); }

.preview-reel { display: flex; gap: 1rem; align-items: center; }
.preview-reel img { width: 4.875rem; height: 6rem; border-radius: var(--r-sm); object-fit: cover; flex: none; }

/* ------------------------------------------------------------
   Profile
   ------------------------------------------------------------ */
.profile-hero { position: relative; overflow: hidden; padding: 0; }
.hero-cover {
  height: 8rem;
  /* --cover-hue задаётся из профиля, поэтому у каждого аккаунта своя обложка */
  background:
    linear-gradient(120deg,
      hsl(var(--cover-hue, 232) 78% 92%),
      hsl(calc(var(--cover-hue, 232) + 28) 70% 95%) 55%,
      hsl(calc(var(--cover-hue, 232) + 56) 72% 93%));
}
.hero-body { padding: 0.5rem 1.75rem 1.625rem; display: flex; gap: 1.25rem; align-items: flex-end; flex-wrap: wrap; }
.hero-body .avatar-lg { margin-top: -2.625rem; border: 4px solid var(--surface); box-shadow: var(--sh-2); }
.hero-info { flex: 1; min-width: 13.75rem; padding-top: 0.75rem; padding-bottom: 0.25rem; }
.hero-name { font-family: var(--display); font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; }
.hero-nick { color: var(--ink-2); font-size: 0.9062rem; margin-top: 0.125rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.625rem; padding-bottom: 0.25rem; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1rem; }
.stat-cell { padding: 1.125rem 1.25rem; min-width: 0; }
.stat-cell .kpi-value { font-size: 1.625rem; }

.acc-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(17.25rem, 1fr)); }
.acc {
  display: flex; align-items: center; gap: 0.8125rem; padding: 1.0625rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-2);
  transition: transform .2s, box-shadow .2s;
}
.acc:hover { transform: translateY(-2px); box-shadow: var(--sh-3); }
.acc .grow { flex: 1; min-width: 0; }
.acc-name { font-weight: 600; font-size: 0.9062rem; }
.acc-sub { font-size: 0.7812rem; color: var(--ink-3); }

/* ------------------------------------------------------------
   Misc
   ------------------------------------------------------------ */
.empty { text-align: center; padding: 3.75rem 1.25rem; color: var(--ink-2); }
.empty-ico {
  width: 3.875rem; height: 3.875rem; margin: 0 auto 1rem; border-radius: var(--r-md);
  display: grid; place-items: center; background: var(--bg-soft); color: var(--ink-3);
}

.toast {
  position: fixed; left: 50%; bottom: 1.625rem; transform: translate(-50%, 20px);
  display: flex; align-items: center; gap: 0.625rem;
  background: var(--text-primary); color: #fff;
  padding: 0.75rem 1.125rem; border-radius: var(--r-sm);
  font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--sh-3);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .28s cubic-bezier(.2,.8,.3,1);
  z-index: 200;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.scrim {
  position: fixed; inset: 0; background: rgba(14, 19, 48, .32);
  opacity: 0; pointer-events: none; transition: opacity .24s; z-index: 55;
}
.scrim.is-on { opacity: 1; pointer-events: auto; }

.fade-up { animation: fadeUp .45s cubic-bezier(.2,.8,.3,1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 1260px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-chart { grid-template-columns: minmax(0,1fr); }
  .chart-side { grid-template-columns: repeat(auto-fit, minmax(12.5rem,1fr)); }
}

@media (max-width: 1100px) {
  .auth { grid-template-columns: 1fr; }
  .auth-right { display: none; }
  .auth-left { padding: 2.5rem 1.5rem; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.2,.8,.3,1);
    box-shadow: var(--sh-3);
  }
  .sidebar.is-open { transform: none; }
  .burger { display: inline-flex; }
  .topbar { padding: 0.75rem 1rem; }
  .search { display: none; }
  .page { padding: 1.25rem 1rem 3.5rem; }
  .feed { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.8125rem; }
  h1 { font-size: 1.5625rem; }
  .kpi-value { font-size: 1.6875rem; }
}

@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .kpi { padding: 0.9375rem; }
  .kpi-value { font-size: 1.4375rem; }
  .kpi-top { margin-bottom: 0.75rem; }
  .spark { display: none; }
  .stat-row { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .card-pad, .chart-card, .add-card { padding: 1.125rem; }
  .paste-row { flex-direction: column; }
  .paste-row .btn { width: 100%; align-self: stretch; }
  .hero-body { padding: 0 1.125rem 1.25rem; }
  .segmented { width: 100%; }
  /* thin out chart labels so they stay readable on narrow screens */
  .chart-x { font-size: 0.6875rem; }
  .chart-x span:nth-child(even) { visibility: hidden; }
  .seg { flex: 1; justify-content: center; }
  .page-head { align-items: flex-start; }
}

/* ============================================================
   ONBOARDING
   ============================================================ */
.onboard {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 1.5rem;
  background: var(--bg-page);
}
.onboard-card { width: 100%; max-width: 34rem; padding: 2rem; }

.onboard-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.75rem;
}
.onboard-head .auth-logo { margin: 0; }

.onboard-progress { display: flex; gap: 0.375rem; }
.onboard-progress i {
  width: 1.5rem; height: 0.25rem; border-radius: 999px;
  background: var(--border-soft); transition: background .2s;
}
.onboard-progress i.is-on { background: var(--brand-primary); }

.onboard-step h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.onboard-step > .muted { margin-bottom: 1.75rem; }

.avatar-picker {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  padding: 1.25rem; margin-bottom: 1.75rem;
  background: var(--bg-soft); border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}
.avatar-preview {
  width: 5.5rem; height: 5.5rem; flex: none;
  border-radius: var(--r-md); overflow: hidden;
  background: var(--brand-primary-soft);
  display: grid; place-items: center;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials {
  font-family: var(--display); font-weight: 800; font-size: 1.75rem;
  color: var(--brand-primary);
}
.avatar-actions { flex: 1; min-width: 11rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.avatar-actions .hint { width: 100%; margin: 0; }

.onboard-foot { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.5rem; }
.onboard-foot .btn-primary { margin-left: auto; }

@media (max-width: 520px) {
  .onboard-card { padding: 1.5rem 1.25rem; }
  .onboard-foot { flex-direction: column-reverse; align-items: stretch; }
  .onboard-foot .btn-primary { margin-left: 0; }
}

/* ------------------------------------------------------------
   Экран «Добавить рилс»: одна колонка, форма ограничена по ширине
   ------------------------------------------------------------ */
.add-solo { display: block; }
.add-solo .add-card { max-width: 34rem; margin: 0 auto 2rem; }

.acc .icon-btn { flex: none; width: 2rem; height: 2rem; border: 0; background: transparent; }
.acc .icon-btn:hover { background: var(--bg-soft); }

.feed-compact { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }

/* ------------------------------------------------------------
   Кастомный дропдаун выбора аккаунта (замена нативного <select>,
   чтобы не вылезала системная панель выбора)
   ------------------------------------------------------------ */
.dd { position: relative; }
.dd-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  width: 100%; text-align: left; cursor: pointer;
  font-family: inherit; font-size: inherit; color: var(--text-primary);
}
.dd-toggle:disabled { cursor: not-allowed; opacity: .6; }
.dd-toggle span:first-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dd-chevron {
  flex: none; width: 0.625rem; height: 0.625rem;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg); margin-top: -0.25rem; transition: transform .18s;
}
.dd.is-open .dd-chevron { transform: rotate(-135deg); margin-top: 0.125rem; }

.dd-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 0.5rem); z-index: 40;
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); box-shadow: var(--sh-3);
  padding: 0.375rem; max-height: 16rem; overflow-y: auto;
}
.dd-option {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.625rem 0.625rem; border-radius: var(--r-sm);
  font-size: 0.9375rem; cursor: pointer;
}
.dd-option:hover { background: var(--bg-soft); }
.dd-option.is-selected { color: var(--brand-primary); font-weight: 600; }
.dd-option .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------
   Компактный сайдбар: остаются одни иконки
   ------------------------------------------------------------ */
.shell.is-compact { --nav-w: 4.5rem; }

.is-compact .sidebar { padding-inline: 0.625rem; align-items: stretch; }

.is-compact .sidebar-head { flex-direction: column; align-items: center; gap: 0.5rem; margin: 0 0 1.25rem; }
.is-compact .sidebar-head .auth-logo { gap: 0; }
.is-compact .logo-word { max-width: 0; opacity: 0; }
.is-compact .nav-count { max-width: 0; opacity: 0; margin-left: 0; padding-inline: 0; }
.is-compact .user-card .user-name,
.is-compact .user-card .user-mail { max-height: 0; opacity: 0; margin: 0; }

/* подпись группы превращается в разделитель, иначе иконки сливаются */
.is-compact .nav-label {
  height: 1px; padding: 0; margin: 0.875rem 0.5rem 0.75rem;
  background: var(--border-soft); text-indent: -999em;
}
.is-compact .nav-toggle { margin-left: 0; }

.is-compact .nav-item {
  justify-content: center;
  padding: 0; gap: 0;
}
.is-compact .nav-item > span:not(.nav-count) { max-width: 0; opacity: 0; }

.is-compact .nav { gap: 0.25rem; }
.is-compact .nav + .nav-label { margin-top: 1rem; }

.is-compact .user-card { flex-direction: column; gap: 0.5rem; padding: 0.5rem; }
.is-compact .user-card .avatar { width: 2rem; height: 2rem; }

/* на мобильном панель и так выезжает целиком — компактный режим не нужен */
@media (max-width: 960px) {
  .shell.is-compact { --nav-w: 16rem; }
  .is-compact .sidebar { padding-inline: 1rem; }
  .is-compact .sidebar-head { flex-direction: row; gap: 0.5rem; margin: 0 0.25rem 1.625rem 0.5rem; }
  .is-compact .sidebar-head .auth-logo { gap: 0.625rem; }
  .is-compact .logo-word { max-width: 8rem; opacity: 1; }
  .is-compact .nav-count { max-width: 3rem; opacity: 1; margin-left: auto; padding-inline: 0.5rem; }
  .is-compact .user-card .user-name,
  .is-compact .user-card .user-mail { max-height: 1.25rem; opacity: 1; }
  /* на мобильном подписи групп остаются текстом, а не разделителями */
  .is-compact .nav-label {
    height: 1.125rem; padding: 0 0.75rem; margin: 0 0 0.5rem;
    background: none; text-indent: 0;
  }
  .is-compact .nav-item { justify-content: flex-start; padding: 0 0.75rem; gap: 0.6875rem; }
  .is-compact .nav-item > span:not(.nav-count) { max-width: 12rem; opacity: 1; }
  .is-compact .user-card { flex-direction: row; padding: 0.625rem; }
  .is-compact .user-card .avatar { width: 2.375rem; height: 2.375rem; }
  .is-compact .nav-toggle { display: none; }
}
