/* ============================================================================
   K&N ELITE · Система контроля агентов
   Design system — tokens, primitives, components, motion, responsive
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces */
  --paper:        #F4EFE3;   /* app background           */
  --paper-2:      #EFE9DA;   /* deeper paper             */
  --surface:      #FFFCF7;   /* cards                    */
  --surface-2:    #FAF6EC;   /* subtle raised / hover    */
  --surface-3:    #F5EED9;   /* gold tint (notes, work)  */

  /* Ink */
  --ink:          #1A1714;   /* primary text / dark UI   */
  --ink-soft:     #4C453B;   /* secondary text           */
  --muted:        #8C8474;   /* tertiary / labels        */
  --faint:        #B3AB99;   /* disabled / placeholders  */

  /* Lines */
  --line:         #E8E0CF;   /* borders / dividers       */
  --line-2:       #DED5C0;   /* stronger border          */

  /* Gold */
  --gold:         #C9A961;
  --gold-2:       #BD9A4E;   /* hover / deep             */
  --gold-deep:    #97793A;   /* gold text on light       */
  --gold-pale:    #F5EED9;
  --gold-line:    #E4D2A6;

  /* Semantic */
  --green:        #4F7E5E;
  --green-deep:   #3A5446;
  --green-pale:   #E4EADF;
  --red:          #BC5E3C;
  --red-deep:     #9A4439;
  --red-pale:     #F4E4E0;
  --slate:        #61708A;
  --slate-pale:   #E3E7EE;
  --tan:          #9A7E4E;
  --tan-pale:     #EFE2C6;

  /* Radii */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Shadows — soft, warm, premium */
  --sh-xs: 0 1px 2px rgba(40,30,12,.04);
  --sh-sm: 0 2px 8px rgba(60,44,16,.05), 0 1px 2px rgba(60,44,16,.04);
  --sh-md: 0 8px 24px rgba(60,44,16,.07), 0 2px 6px rgba(60,44,16,.05);
  --sh-lg: 0 24px 60px rgba(40,28,8,.16), 0 8px 20px rgba(40,28,8,.10);
  --sh-gold: 0 8px 22px rgba(201,169,97,.32);

  /* Motion — soft premium easing */
  --ease:      cubic-bezier(.22,1,.36,1);    /* expo-out, entrances    */
  --ease-soft: cubic-bezier(.16,1,.3,1);     /* gentle settle          */
  --ease-io:   cubic-bezier(.65,0,.35,1);    /* symmetric              */
  --spring:    cubic-bezier(.34,1.4,.5,1);   /* slight overshoot       */
  --t-fast: .16s;
  --t-base: .28s;
  --t-slow: .5s;

  --sidebar-w: 266px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
::selection { background: rgba(201,169,97,.30); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

/* Scrollbars */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #D9CFB8; border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #CBBF9F; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Typography helpers ---------- */
.serif { font-family: 'Cormorant Garamond', Georgia, serif; }
.mono  { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* base icon size (context rules override via higher specificity) */
.ic { width: 18px; height: 18px; flex: none; }

.display { font-family: 'Cormorant Garamond', serif; font-weight: 400; font-size: 34px; line-height: 1.06; letter-spacing: -.5px; }
.display-l { font-family: 'Cormorant Garamond', serif; font-weight: 300; font-size: clamp(38px, 5vw, 50px); line-height: 1.02; letter-spacing: -1.2px; }
.heading { font-family: 'Cormorant Garamond', serif; font-weight: 500; font-size: 22px; line-height: 1.16; letter-spacing: 0; }

.caps {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500; font-size: 11px; line-height: 1;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted);
}
.caps-s { font-size: 10px; letter-spacing: .26em; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.num-xl { font-weight: 600; font-size: 32px; letter-spacing: -1px; line-height: 1.05; }

.t-muted { color: var(--muted); }
.t-soft  { color: var(--ink-soft); }

/* ============================================================================
   PRIMITIVES
   ========================================================================= */

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2);
  box-shadow: var(--sh-xs);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-base) var(--ease),
              background var(--t-base) var(--ease), border-color var(--t-base) var(--ease), color var(--t-base);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { transform: translateY(-1.5px); box-shadow: var(--sh-md); border-color: var(--line-2); }
.btn:active { transform: translateY(0) scale(.985); box-shadow: var(--sh-xs); transition-duration: .08s; }
.btn svg { width: 17px; height: 17px; }

.btn-gold {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #D2B26B 0%, var(--gold) 55%, var(--gold-2) 100%);
  color: #2A2008; border-color: var(--gold-2); font-weight: 600;
  box-shadow: var(--sh-gold);
}
.btn-gold:hover { box-shadow: 0 12px 30px rgba(201,169,97,.42); }
.btn-gold::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.55) 48%, transparent 70%);
  transform: translateX(-130%); transition: transform .75s var(--ease);
}
.btn-gold:hover::after { transform: translateX(130%); }

.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; transform: translateY(0); }

.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: var(--r-xs); }
.btn-icon { width: 42px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }

/* ---- Segmented control (period / filter) ---- */
.seg {
  position: relative; display: inline-flex; gap: 2px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill);
  box-shadow: var(--sh-xs);
}
.seg .seg-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: 0;
  background: var(--ink); border-radius: var(--r-pill); z-index: 0;
  box-shadow: 0 4px 12px rgba(26,23,20,.28);
  transition: transform .42s var(--spring), width .42s var(--spring);
}
.seg button {
  position: relative; z-index: 1; height: 32px; padding: 0 16px;
  border-radius: var(--r-pill); font-size: 13px; font-weight: 500;
  color: var(--ink-soft); white-space: nowrap;
  transition: color var(--t-base) var(--ease);
}
.seg button.active { color: #FBF6EA; }
.seg button:not(.active):hover { color: var(--ink); }

/* ---- Filter pills (multi / chips) ---- */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  height: 36px; padding: 0 16px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line-2);
  font-size: 13px; font-weight: 500; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 7px;
  box-shadow: var(--sh-xs);
  transition: transform var(--t-fast) var(--ease), background var(--t-base) var(--ease),
              color var(--t-base), border-color var(--t-base), box-shadow var(--t-base);
}
.chip:hover { transform: translateY(-1.5px); box-shadow: var(--sh-sm); border-color: var(--line-2); }
.chip:active { transform: translateY(0) scale(.97); }
.chip.active { background: var(--ink); color: #FBF6EA; border-color: var(--ink); box-shadow: 0 6px 16px rgba(26,23,20,.24); }
.chip .chip-c { opacity: .6; font-variant-numeric: tabular-nums; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 11px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-soft); border: 1px solid transparent;
}
.badge svg { width: 13px; height: 13px; opacity: .85; }
.badge.b-office { background: var(--green-pale); color: var(--green-deep); }
.badge.b-kapt   { background: var(--gold-pale); color: var(--gold-deep); }
.badge.b-vyezd  { background: var(--tan-pale); color: var(--tan); }
.badge.b-remote { background: var(--slate-pale); color: var(--slate); }
.badge.b-off    { background: #EAE4D7; color: #756C5E; }
.badge.b-noresp { background: var(--red-pale); color: var(--red-deep); }
.badge.b-show   { background: var(--tan-pale); color: var(--tan); }

/* % goal mini-pills */
.pct {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 50px; height: 26px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: #ECE6D8; color: var(--muted);
}
.pct.is-green { background: var(--green-pale); color: var(--green-deep); }
.pct.is-gold  { background: #EFE0BE; color: var(--gold-deep); }
.pct.is-red   { background: var(--red-pale); color: var(--red-deep); }

/* delta indicators */
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 500; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta svg { width: 13px; height: 13px; }

/* ---- Cards ---- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
}
.card-pad { padding: 22px 24px; }
.card-hover { transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease), border-color var(--t-base); }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--sh-md); border-color: var(--line-2); }

/* ---- Inputs ---- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { padding-left: 2px; }
.input-wrap {
  position: relative; display: flex; align-items: center;
  background: var(--surface); border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm); height: 50px; padding: 0 14px;
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease), background var(--t-base);
}
.input-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201,169,97,.16); background: var(--surface); }
.input-wrap.err { border-color: var(--red); box-shadow: 0 0 0 4px rgba(188,94,60,.12); }
.input-wrap .lead, .input-wrap .trail { display: inline-flex; color: var(--muted); flex: none; }
.input-wrap .lead svg, .input-wrap .trail svg { width: 18px; height: 18px; }
.input-wrap .trail { cursor: pointer; padding: 4px; margin-right: -4px; border-radius: 6px; transition: color var(--t-base), background var(--t-base); }
.input-wrap .trail:hover { color: var(--ink); background: var(--surface-2); }
.input-wrap input {
  flex: 1; min-width: 0; border: none; background: none; outline: none;
  height: 100%; padding: 0 12px; font-size: 15px; color: var(--ink); letter-spacing: .2px;
}
.input-wrap input::placeholder { color: var(--faint); }
.input-wrap.sm { height: 44px; }
.input-wrap.sm input { font-size: 14px; }

/* select */
.sel-wrap { position: relative; }
.sel-wrap select {
  -webkit-appearance: none; appearance: none; width: 100%; height: 46px;
  padding: 0 40px 0 14px; border-radius: var(--r-sm);
  background: var(--surface); border: 1.5px solid var(--line-2); font-size: 14px;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.sel-wrap select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201,169,97,.16); }
.sel-wrap::after {
  content: ""; position: absolute; right: 15px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg); pointer-events: none;
}

/* ---- Toggle ---- */
.toggle {
  position: relative; width: 46px; height: 27px; border-radius: 99px;
  background: #D8CFBC; transition: background var(--t-base) var(--ease); flex: none;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  background: #fff; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,.22);
  transition: transform .34s var(--spring);
}
.toggle.on { background: var(--green); }
.toggle.on::after { transform: translateX(19px); }

/* ---- Stepper ---- */
.stepper { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); height: 52px; padding: 0 6px; box-shadow: var(--sh-xs); }
.stepper button {
  width: 36px; height: 36px; border-radius: var(--r-xs); flex: none;
  display: grid; place-items: center; color: var(--ink-soft);
  background: var(--surface-2); transition: background var(--t-base), color var(--t-base), transform var(--t-fast);
  font-size: 19px; line-height: 1;
}
.stepper button:hover { background: var(--gold-pale); color: var(--gold-deep); }
.stepper button:active { transform: scale(.9); }
.stepper .val { flex: 1; min-width: 0; width: 100%; text-align: center; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.stepper input.val { border: none; background: transparent; outline: none; -webkit-appearance: none; padding: 4px 2px; border-radius: 7px; color: var(--ink); transition: background var(--t-base); }
.stepper input.val:focus { background: var(--gold-pale); box-shadow: inset 0 0 0 1.5px var(--gold); }

/* small numeric editable cell */
.cell-num {
  width: 52px; height: 38px; border-radius: var(--r-xs); border: 1px solid var(--line-2);
  background: var(--surface); text-align: center; font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--ink);
  transition: border-color var(--t-base), box-shadow var(--t-base), background var(--t-base);
}
.cell-num:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,169,97,.18); }
.cell-num.off { background: var(--surface-2); color: var(--faint); border-color: transparent; }

/* ---- Progress bar ---- */
.bar { position: relative; height: 9px; border-radius: 99px; background: #EAE3D3; overflow: hidden; }
.bar > i {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 99px; display: block;
  transition: width 1s var(--ease-soft);
}
.bar > i.g { background: linear-gradient(90deg, #5E9070, var(--green)); }
.bar > i.o { background: linear-gradient(90deg, #C9A961, #B68F3E); }
.bar > i.r { background: linear-gradient(90deg, #CE7350, var(--red)); }

/* ---- Avatar ---- */
.av {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-3); color: var(--gold-deep);
  font-weight: 600; font-size: 13px; letter-spacing: .04em;
  border: 1px solid var(--gold-line);
}
.av.lg { width: 76px; height: 76px; font-size: 24px; font-family: 'Cormorant Garamond', serif; font-weight: 600; }
.av.sm { width: 34px; height: 34px; font-size: 12px; }

/* ---- Tabs (underline) ---- */
.tabs { position: relative; display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.tabs button {
  position: relative; padding: 12px 8px; margin: 0 8px; font-size: 14px; font-weight: 500;
  color: var(--muted); transition: color var(--t-base) var(--ease);
}
.tabs button:first-child { margin-left: 0; }
.tabs button.active { color: var(--ink); }
.tabs button:hover { color: var(--ink-soft); }
.tabs .tab-ink { position: absolute; bottom: -1px; height: 2px; background: var(--gold); border-radius: 2px; left: 0; width: 0; transition: transform .4s var(--spring), width .4s var(--spring); }

/* ---- Table ---- */
.tbl { width: 100%; }
.tbl-head, .tbl-row { display: grid; align-items: center; }
.tbl-head {
  padding: 13px 20px; border-bottom: 1px solid var(--line);
}
.tbl-head > * { font-family: 'JetBrains Mono', monospace; font-weight: 500; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.tbl-row {
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  transition: background var(--t-base) var(--ease);
}
.tbl-scroll:last-child .tbl-row:last-child { border-bottom: none; }
.tbl-row.click { cursor: pointer; }
.tbl-row.click:hover { background: var(--surface-2); }
.tbl-num { text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px; }
.tbl-num.dim { color: var(--faint); font-weight: 500; }

/* ============================================================================
   LAYOUT — shell
   ========================================================================= */
#root { min-height: 100vh; }

.shell { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w); flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 40;
}
.sb-logo { padding: 22px 22px 18px; border-bottom: 1px solid var(--line); }
.sb-section { padding: 18px 16px 6px; }
.sb-nav { padding: 4px 14px; flex: 1; overflow-y: auto; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 14px; margin: 3px 0; border-radius: var(--r-sm);
  color: var(--ink-soft); font-size: 14.5px; font-weight: 500;
  transition: background var(--t-base) var(--ease), color var(--t-base);
}
.nav-item .ic { width: 20px; height: 20px; flex: none; color: var(--muted); transition: color var(--t-base), transform var(--t-base) var(--ease); }
.nav-item:hover { background: var(--surface-2); }
.nav-item:hover .ic { transform: translateX(1px); }
.nav-item .bar {
  position: absolute; left: -14px; top: 50%; height: 0; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--gold); transform: translateY(-50%);
  transition: height .4s var(--spring);
}
.nav-item.active {
  background: linear-gradient(90deg, #F1E4BF 0%, #F7EFD8 100%);
  color: var(--ink); font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--gold-line), 0 2px 8px rgba(150,120,40,.10);
}
.nav-item.active .ic { color: var(--gold-deep); transform: scale(1.06); }
.nav-item.active .bar { height: 30px; width: 4px; }
.nav-item.active:hover { background: linear-gradient(90deg, #EFE0B6 0%, #F5ECCF 100%); }
.sb-user {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  border-top: 1px solid var(--line); cursor: pointer;
  transition: background var(--t-base);
}
.sb-user:hover { background: var(--surface-2); }
.sb-user .meta { min-width: 0; }
.sb-user .nm { font-weight: 600; font-size: 14px; }
.sb-user .ro { font-size: 12px; color: var(--muted); }
.sb-user .logout { margin-left: auto; color: var(--faint); transition: color var(--t-base), transform var(--t-base); }
.sb-user:hover .logout { color: var(--red); transform: translateX(2px); }

/* ---- Main ---- */
.main { flex: 1; min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.main-scroll { flex: 1; }
.page { padding: 30px 40px 60px; max-width: 1320px; margin: 0 auto; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* month nav */
.mnav { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-pill); padding: 4px; box-shadow: var(--sh-xs); }
.mnav button { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-soft); transition: background var(--t-base), transform var(--t-fast); }
.mnav button:hover { background: var(--surface-2); }
.mnav button:active { transform: scale(.88); }
.mnav .lbl { padding: 0 8px; font-weight: 600; font-size: 14px; min-width: 96px; text-align: center; }

/* ---- Mobile topbar + drawer ---- */
.topbar { display: none; position: sticky; top: 0; z-index: 45;
  height: 60px; align-items: center; gap: 12px; padding: 0 16px;
  background: rgba(255,252,247,.85); backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.burger { width: 42px; height: 42px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); }
.burger svg { width: 20px; height: 20px; }
.scrim { position: fixed; inset: 0; background: rgba(26,18,8,.34); opacity: 0; pointer-events: none; z-index: 39; transition: opacity var(--t-base) var(--ease); backdrop-filter: blur(2px); }
.scrim.show { opacity: 1; pointer-events: auto; }

/* ============================================================================
   GRID HELPERS
   ========================================================================= */
.grid { display: grid; gap: 16px; }
.kpi-grid { grid-template-columns: repeat(5, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-2 { grid-template-columns: repeat(2, 1fr); }
.row { display: flex; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vcenter { display: flex; align-items: center; gap: 10px; }

/* ---- KPI card ---- */
.kpi { padding: 18px 16px 16px; text-align: center; }
.kpi .lab { display: flex; align-items: center; justify-content: center; gap: 7px; margin-bottom: 12px; }
.kpi .lab svg { width: 15px; height: 15px; color: var(--gold-deep); }
.kpi .big { font-weight: 600; font-size: 30px; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1; margin-bottom: 9px; }
.kpi .delta { justify-content: center; }

/* goal progress rows */
.goal-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; padding: 11px 0; }
.goal-row .gl { display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: 14px; }
.goal-row .gl svg { width: 16px; height: 16px; color: var(--gold-deep); }
.goal-row .gv { font-weight: 600; font-variant-numeric: tabular-nums; }
.goal-row .gp { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
.goal-row .bar { grid-column: 1 / -1; }

/* top list */
.rank { display: flex; align-items: center; gap: 13px; padding: 11px 0; }
.rank .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); flex: none; }
.rank.top .n { background: var(--ink); color: var(--gold); }
.rank.click { cursor: pointer; margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: var(--r-sm); transition: background var(--t-base) var(--ease), transform var(--t-fast) var(--ease); }
.rank.click:hover { background: var(--surface-2); transform: translateX(2px); }

/* calendar */
.cal { }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.cal-dow { text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .12em; color: var(--muted); padding-bottom: 2px; }
.cal-cell {
  min-height: 60px; padding: 7px 2px 6px; border-radius: var(--r-sm); border: 1.5px solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  cursor: pointer; user-select: none; position: relative; text-align: center;
  background: var(--surface-3);
  transition: background .35s var(--ease), color .3s, border-color var(--t-base), transform var(--t-fast) var(--ease), box-shadow var(--t-base);
}
.cal-cell .dnum { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px; line-height: 1; color: var(--ink); }
.cal-cell .sub { font-family: 'JetBrains Mono', monospace; font-size: 8px; letter-spacing: .04em; color: var(--muted); text-transform: lowercase; font-weight: 500; line-height: 1; white-space: nowrap; }
/* day off — clearly disabled-looking + labelled «выходной» */
.cal-cell.off {
  background: #EBE5D7;
  background-image: repeating-linear-gradient(45deg, transparent 0 5px, rgba(120,108,86,.05) 5px 6px);
}
.cal-cell.off .dnum { color: var(--faint); font-weight: 500; }
.cal-cell.off .sub { color: #9A917E; }
.cal-cell.empty { background: transparent; cursor: default; min-height: 0; }
.cal-cell.today { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,169,97,.14); }
.cal-cell:not(.empty):hover { transform: translateY(-2px); box-shadow: var(--sh-sm); }
.cal-cell:not(.empty):active { transform: scale(.94); }
.cal-cell.pop { animation: cellPop .42s var(--spring); }
.cal-cell.link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 0 var(--gold); transition: box-shadow var(--t-base); }
.cal-cell.link:hover::after { box-shadow: inset 0 0 0 1.5px var(--gold-line); }
.cal-legend { display: flex; gap: 16px; align-items: center; }
.cal-legend i { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.cal-legend .sw { width: 14px; height: 14px; border-radius: 5px; background: var(--surface-3); }
.cal-legend .sw-off { background: #EBE5D7; background-image: repeating-linear-gradient(45deg, transparent 0 4px, rgba(120,108,86,.08) 4px 5px); }

/* radio option cards */
.opt {
  display: flex; align-items: center; gap: 14px; padding: 15px 16px;
  border: 1.5px solid var(--line-2); border-radius: var(--r-md); background: var(--surface);
  cursor: pointer; transition: border-color var(--t-base) var(--ease), background var(--t-base), box-shadow var(--t-base), transform var(--t-fast);
}
.opt:hover { border-color: var(--gold-line); background: var(--surface-2); }
.opt:active { transform: scale(.99); }
.opt .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; transition: border-color var(--t-base); }
.opt .radio::after { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--gold); transform: scale(0); transition: transform .3s var(--spring); }
.opt .ot { font-weight: 600; font-size: 14.5px; }
.opt .od { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.opt.sel { border-color: var(--gold); background: var(--gold-pale); box-shadow: 0 0 0 3px rgba(201,169,97,.10); }
.opt.sel .radio { border-color: var(--gold); }
.opt.sel .radio::after { transform: scale(1); }

/* note banner */
.note {
  display: flex; gap: 12px; align-items: flex-start; padding: 15px 18px;
  background: var(--gold-pale); border: 1px solid var(--gold-line); border-radius: var(--r-md);
  font-size: 13.5px; color: var(--gold-deep); line-height: 1.5;
}
.note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.note.plain { background: var(--surface-2); border-color: var(--line); color: var(--ink-soft); }
.note .nt-strong { font-weight: 600; color: var(--ink); display: block; margin-bottom: 2px; }

/* ============================================================================
   LOGIN
   ========================================================================= */
.login { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.login-left {
  position: relative; overflow: hidden; padding: 44px 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(120% 90% at 100% 0%, #2A241B 0%, transparent 60%),
    linear-gradient(150deg, #211C15 0%, #15120E 55%, #0E0C09 100%);
  color: #EDE6D7;
}
.login-left::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 50% at 22% 78%, rgba(201,169,97,.12) 0%, transparent 70%);
}
.login-left .ll-top, .login-left .ll-mid, .login-left .ll-foot { position: relative; z-index: 1; }
.login-left .dash { width: 46px; height: 2px; background: var(--gold); margin-bottom: 26px; border-radius: 2px; }
.login-left .ll-title { font-family: 'Cormorant Garamond', serif; font-weight: 300; font-size: clamp(34px, 4vw, 46px); line-height: 1.04; letter-spacing: -.5px; color: #F3EDDF; }
.login-left .ll-foot { font-size: 12.5px; color: #8A8170; line-height: 1.7; }

.login-right { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--paper); }
.login-card { width: 100%; max-width: 400px; }
.login-card .lc-title { font-family: 'Cormorant Garamond', serif; font-weight: 400; font-size: 40px; letter-spacing: -.5px; line-height: 1.1; }
.login-card .lc-sub { color: var(--muted); margin: 6px 0 26px; }
.login-err {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 18px;
  background: var(--red-pale); border: 1px solid #EBC9BF; border-radius: var(--r-sm);
  color: var(--red-deep); font-size: 13.5px; font-weight: 500;
}
.login-err svg { width: 16px; height: 16px; flex: none; }

/* logo mark */
.logo { display: flex; align-items: center; gap: 12px; }
.logo .mark { width: 42px; height: 42px; flex: none; color: var(--gold-2); }
.logo-full { height: 54px; width: auto; display: block; }
.logo .wm-1 { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 17px; letter-spacing: .12em; line-height: 1; }
.logo .wm-2 { font-family: 'JetBrains Mono', monospace; font-size: 8.5px; letter-spacing: .34em; color: var(--gold-deep); margin-top: 4px; }
.login-left .logo .wm-1 { color: #F3EDDF; }
.login-left .logo .wm-2 { color: var(--gold); }

/* ============================================================================
   MOTION — entrance animations
   ========================================================================= */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes cellPop { 0% { transform: scale(.86); } 55% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes drawer { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes barGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* view enters */
.view-enter { animation: fade .4s var(--ease); }
/* stagger children: set --i on element */
.stagger > * { animation: rise .58s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 55ms); }

.fade-in { animation: fade .4s var(--ease); }

/* ============================================================================
   MODAL
   ========================================================================= */
.modal-scrim {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(26,18,8,.40); backdrop-filter: blur(4px);
  animation: fade .3s var(--ease);
}
.modal-scrim.closing { animation: fade .25s var(--ease) reverse forwards; }
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 48px); overflow-y: auto;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-lg);
  border: 1px solid var(--line);
  animation: scaleIn .42s var(--spring);
}
.modal-scrim.closing .modal { animation: scaleIn .26s var(--ease) reverse forwards; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 24px 26px 4px; }
.modal-head .heading { font-size: 26px; }
.modal-x { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); background: var(--surface-2); transition: background var(--t-base), color var(--t-base), transform var(--t-base); }
.modal-x:hover { background: #ECE5D6; color: var(--ink); transform: rotate(90deg); }
.modal-body { padding: 18px 26px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 26px 24px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* photo upload row */
.photo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.photo-drop { width: 64px; height: 64px; border-radius: var(--r-md); background: var(--surface-2); border: 1.5px dashed var(--line-2); display: grid; place-items: center; color: var(--muted); }
.photo-drop svg { width: 22px; height: 22px; }

/* ============================================================================
   TOAST
   ========================================================================= */
#toast-layer { position: fixed; right: 22px; bottom: 22px; z-index: 80; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; min-width: 240px; max-width: 360px;
  background: var(--ink); color: #F3EDDF; border-radius: var(--r-md);
  box-shadow: var(--sh-lg); font-size: 13.5px; font-weight: 500;
  animation: toastIn .42s var(--spring);
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(201,169,97,.20); color: var(--gold); flex: none; }
.toast .ic svg { width: 16px; height: 16px; }
.toast.ok .ic { background: rgba(102,165,122,.22); color: #8FCB9F; }

/* spinner */
.spin { width: 16px; height: 16px; border: 2px solid rgba(42,32,8,.3); border-top-color: #2A2008; border-radius: 50%; animation: spin .7s linear infinite; }

/* misc */
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.bar-chart { display: flex; align-items: flex-end; justify-content: space-around; gap: 10px; height: 150px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 9px; height: 100%; justify-content: flex-end; }
.bar-col .stem { width: 60%; max-width: 26px; border-radius: 7px 7px 3px 3px; transform-origin: bottom; animation: barGrow .7s var(--ease) backwards; }
.bar-col .bl { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .06em; color: var(--muted); }

/* table wrap + extra components */
.tbl-wrap { width: 100%; }
.stagger-row { animation: rise .55s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 45ms); }

/* location */
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); position: relative; flex: none; box-shadow: 0 0 0 0 rgba(79,126,94,.5); animation: pulse 2.4s var(--ease-io) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(79,126,94,.45); } 70% { box-shadow: 0 0 0 7px rgba(79,126,94,0); } 100% { box-shadow: 0 0 0 0 rgba(79,126,94,0); } }
.loc-lines { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 15px; display: flex; flex-direction: column; gap: 9px; }
.loc-line { gap: 9px; color: var(--ink-soft); font-size: 13px; }
.loc-line .ic { color: var(--muted); }

/* info / bot icon chips */
.cal-ico, .bot-ic { width: 38px; height: 38px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--gold-pale); color: var(--gold-deep); flex: none; }
.bot-time { width: max-content; }
.bot-row { align-items: center; }

/* schedules layout */
.sched-grid { grid-template-columns: minmax(290px, .85fr) 1.3fr; gap: 18px; align-items: start; }

/* charts */
.chart { display: block; overflow: visible; }
.chart-x { font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: .06em; fill: var(--muted); }
.chart-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.15s var(--ease-soft) .15s forwards; }
.chart-area { opacity: 0; animation: fade .9s var(--ease) .5s forwards; }
.chart-dot { opacity: 0; transform-box: fill-box; transform-origin: center; animation: dotPop .4s var(--spring) forwards; transition: transform .18s var(--ease); }
.chart-dot.on { transform: scale(1.7); }
.chart-hit { cursor: pointer; }
.bar-col .stem { cursor: pointer; transition: filter .18s var(--ease), transform .18s var(--ease); transform-origin: bottom; }
.bar-col .stem:hover { filter: brightness(1.08) saturate(1.1); transform: scaleX(1.12); }

/* hover tooltip */
.chart-tip {
  position: fixed; z-index: 90; transform: translate(-50%, calc(-100% - 12px));
  background: var(--ink); color: #F3EDDF; font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums; padding: 7px 11px; border-radius: 8px;
  white-space: nowrap; pointer-events: none; box-shadow: var(--sh-md);
  opacity: 0; transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.chart-tip::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 9px; height: 9px; background: var(--ink); transform: translateX(-50%) rotate(45deg); border-radius: 1px; }
.chart-tip.show { opacity: 1; transform: translate(-50%, calc(-100% - 16px)); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes dotPop { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }

/* micro-bumps + option flash */
.bump { animation: bump .36s var(--spring); display: inline-block; }
@keyframes bump { 0% { transform: scale(1); } 42% { transform: scale(1.16); } 100% { transform: scale(1); } }
.opt.flash { animation: optFlash .6s var(--ease); }
@keyframes optFlash { 0% { box-shadow: 0 0 0 0 rgba(201,169,97,.5); } 100% { box-shadow: 0 0 0 8px rgba(201,169,97,0); } }

/* empty hint text */
.hint { font-size: 12.5px; color: var(--muted); }
.flex1 { flex: 1; } .ml-auto { margin-left: auto; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.nowrap { white-space: nowrap; }

/* ============================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .page { padding: 28px 28px 56px; }
}
@media (max-width: 980px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100dvh; transform: translateX(-100%);
    transition: transform .4s var(--ease); box-shadow: var(--sh-lg);
  }
  .sidebar.open { transform: none; }
  .topbar { display: flex; }
  .main { min-height: calc(100dvh - 60px); }
  .page { padding: 20px 18px 80px; }
  .cards-3, .cards-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .sched-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-left { min-height: 230px; padding: 28px 26px; }
  .login-left .ll-mid { display: none; }
  .login-right { padding: 30px 22px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head { gap: 12px; }
}

/* tables become horizontally scrollable on narrow screens */
@media (max-width: 820px) {
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl-head, .tbl-row { min-width: 660px; }
  .tbl-wrap::-webkit-scrollbar { height: 7px; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .display { font-size: 28px; }
  .cal-grid { gap: 5px; }
  .cal-cell { min-height: 50px; padding: 5px 1px; border-radius: var(--r-xs); }
  .cal-cell .dnum { font-size: 13px; }
  .cal-cell .sub { font-size: 6.5px; letter-spacing: 0; }
  .cal-dow { font-size: 8.5px; letter-spacing: .04em; }
  .seg button { padding: 0 12px; }
  .page { padding: 18px 14px 80px; }
  .card-pad { padding: 18px 16px; }
  .modal-head .heading { font-size: 22px; }
  .login-card .lc-title { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}

/* ============================================================================
   CMS / SITE MODULE — раздел «CMS / Сайт»
   Дописано поверх дизайн-системы; переиспользует токены и компоненты.
   ========================================================================= */

/* ---- Sidebar groups (сворачиваемые разделы) ---- */
.sb-nav { padding: 8px 14px; }
.sb-group + .sb-group { margin-top: 4px; }
.sb-group-h {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin: 4px 0 2px; border-radius: var(--r-sm);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); cursor: pointer; transition: color var(--t-base), background var(--t-base);
}
.sb-group-h:hover { color: var(--gold-deep); background: var(--surface-2); }
.sb-group-h .ic { width: 16px; height: 16px; color: var(--faint); transition: color var(--t-base); }
.sb-group-h:hover .ic { color: var(--gold-deep); }
.sb-group-h .chev { display: inline-flex; transition: transform var(--t-base) var(--ease); }
.sb-group-h .chev svg { width: 15px; height: 15px; }
.sb-group:not(.open) .sb-group-h .chev { transform: rotate(-90deg); }
.sb-group-items {
  overflow: hidden; max-height: 640px;
  transition: max-height .4s var(--ease), opacity .3s var(--ease);
}
.sb-group:not(.open) .sb-group-items { max-height: 0; opacity: 0; }

/* ---- Text utilities ---- */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.truncate2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.faint { color: var(--faint); }
.tick { display: inline-flex; color: var(--green); }
.tick svg { width: 18px; height: 18px; }

/* ---- CMS tags (мелкие пилюли) ---- */
.cms-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.cms-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink-soft);
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.cms-tag svg { width: 13px; height: 13px; opacity: .8; }
.cms-tag.gold { background: var(--gold-pale); border-color: var(--gold-line); color: var(--gold-deep); }
.cms-tag.add { cursor: pointer; border-style: dashed; color: var(--muted); }
.cms-tag.add:hover { color: var(--gold-deep); border-color: var(--gold-line); }

/* ---- Object thumbnails + status dots ---- */
.obj-thumb {
  width: 40px; height: 40px; flex: none; border-radius: var(--r-sm);
  display: grid; place-items: center; background: var(--gold-pale);
  border: 1px solid var(--gold-line); color: var(--gold-deep);
}
.obj-thumb svg { width: 22px; height: 22px; }
.obj-thumb.sm { width: 34px; height: 34px; border-radius: var(--r-xs); }
.obj-thumb.sm svg { width: 18px; height: 18px; }
.star-dot { display: inline-flex; color: var(--gold); }
.star-dot svg { width: 15px; height: 15px; }
.chan-dots { display: inline-flex; gap: 5px; align-items: center; }
.cd { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.cd.ok { background: var(--green); }
.cd.err { background: var(--red); }
.cd.wait { background: var(--gold); }
.cd.off { background: #DCD3C1; }

/* ---- Object cards (grid) ---- */
.obj-card { overflow: hidden; cursor: pointer; }
.obj-cover {
  position: relative; height: 150px; display: grid; place-items: center;
  background: linear-gradient(135deg, #EFE7D3, #E4D9BE); color: var(--gold-deep);
  border-bottom: 1px solid var(--line);
}
.obj-cover > svg { width: 46px; height: 46px; opacity: .55; }
.obj-flag {
  position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: var(--r-pill); background: rgba(26,23,20,.82); color: #F3E9CC;
  font-size: 11px; font-weight: 600; backdrop-filter: blur(4px);
}
.obj-flag svg { width: 13px; height: 13px; }
.obj-photos {
  position: absolute; bottom: 12px; right: 12px; display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill); background: rgba(255,252,247,.92); color: var(--ink-soft);
  font-size: 12px; font-weight: 600;
}
.obj-photos svg { width: 13px; height: 13px; }
.obj-body { padding: 16px 18px 18px; }
.obj-specs { display: flex; gap: 16px; color: var(--ink-soft); font-size: 13.5px; font-weight: 500; }
.obj-specs span { display: inline-flex; align-items: center; gap: 5px; }
.obj-specs svg { width: 16px; height: 16px; color: var(--gold-deep); }

/* ---- Portal icon + CEE letter ---- */
.portal-ic {
  width: 38px; height: 38px; flex: none; border-radius: var(--r-sm);
  display: grid; place-items: center; background: var(--surface-3);
  border: 1px solid var(--gold-line); color: var(--gold-deep);
}
.portal-ic svg { width: 20px; height: 20px; }
.cee-letter {
  width: 38px; height: 38px; flex: none; border-radius: var(--r-xs);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 17px;
  box-shadow: var(--sh-xs);
}

/* ---- Media library ---- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.media-grid.obj { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.media-tile { animation: rise .5s var(--ease) backwards; animation-delay: calc(var(--i,0) * 40ms); }
.media-ph {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-md);
  display: grid; place-items: center; overflow: hidden;
  background: color-mix(in srgb, var(--tint, #C9A961) 20%, var(--surface-2));
  border: 1px solid var(--line); color: color-mix(in srgb, var(--tint, #C9A961) 70%, #6b5f3e);
}
.media-ph svg { width: 34px; height: 34px; opacity: .7; }
.media-ph .play {
  position: absolute; inset: 0; margin: auto; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(26,23,20,.6); color: #fff;
}
.media-ph .play svg { width: 20px; height: 20px; opacity: 1; }
.media-tile.cover .media-ph { outline: 2px solid var(--gold); outline-offset: 2px; }
.media-badge {
  position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--r-pill); background: rgba(26,23,20,.8); color: #F3E9CC; font-size: 11px; font-weight: 600;
}
.media-badge svg { width: 12px; height: 12px; }
.media-cap { margin-top: 8px; font-size: 12.5px; font-weight: 500; display: flex; flex-direction: column; gap: 1px; }
.media-cap .hint { font-size: 11.5px; }
.media-drop {
  width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r-md); border: 1.5px dashed var(--line-2);
  background: var(--surface-2); color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font-size: 12.5px; font-weight: 500; transition: border-color var(--t-base), color var(--t-base), background var(--t-base);
}
.media-drop:hover { border-color: var(--gold); color: var(--gold-deep); background: var(--gold-pale); }
.media-drop svg { width: 26px; height: 26px; }

/* ---- SERP preview (SEO) ---- */
.serp { margin-top: 20px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); max-width: 620px; }
.serp-t { color: #1a4bd8; font-size: 18px; font-weight: 500; line-height: 1.3; margin-bottom: 3px; }
.serp-u { color: #1a7a3c; font-size: 13px; margin-bottom: 5px; }
.serp-d { color: var(--ink-soft); font-size: 13.5px; line-height: 1.45; }

/* ---- Sortable rows (секции, меню, рубрики) ---- */
.sortable-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 14px; margin: 8px 0;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
  animation: rise .5s var(--ease) backwards; animation-delay: calc(var(--i,0) * 45ms);
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
}
.sortable-row:hover { border-color: var(--line-2); box-shadow: var(--sh-xs); transform: translateX(2px); }
.sortable-row .grip { color: var(--faint); cursor: grab; display: inline-flex; }
.sortable-row .grip svg { width: 18px; height: 18px; }
.sec-ord {
  width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-pale); border: 1px solid var(--gold-line); color: var(--gold-deep);
  font-size: 12px; font-weight: 700;
}

/* ---- Folder + lang rows ---- */
.folder-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
  animation: rise .5s var(--ease) backwards; animation-delay: calc(var(--i,0) * 45ms);
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base); cursor: pointer;
}
.folder-row:hover { border-color: var(--gold-line); box-shadow: var(--sh-xs); transform: translateY(-2px); }
.folder-ic { color: var(--gold-deep); display: inline-flex; }
.folder-ic svg { width: 22px; height: 22px; }
.lang-row {
  display: flex; align-items: center; gap: 16px; padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  animation: rise .5s var(--ease) backwards; animation-delay: calc(var(--i,0) * 45ms);
}
.lang-row:last-child { border-bottom: none; }
.lang-code {
  width: 42px; height: 32px; flex: none; border-radius: var(--r-xs); display: grid; place-items: center;
  background: var(--ink); color: var(--gold-pale); font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 500; letter-spacing: .04em;
}
.lang-prog { flex: none; }

@media (max-width: 720px) {
  .lang-row { flex-wrap: wrap; gap: 10px; }
  .lang-prog { width: 100% !important; order: 3; }
  .media-grid, .media-grid.obj { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ============================================================================
   CRM MODULE — раздел CRM (доска, задачи, отчёт собственнику)
   ========================================================================= */

/* ---- Kanban доска сделок ---- */
.kanban-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px 8px; }
.kanban { display: flex; gap: 14px; min-width: min-content; }
.kan-col {
  flex: 0 0 260px; width: 260px; background: var(--paper-2);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px;
  display: flex; flex-direction: column;
}
.kan-head { display: flex; align-items: center; gap: 8px; }
.kan-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tint, var(--gold)); flex: none; }
.kan-t { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 0; }
.kan-c { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 1px 9px; }
.kan-sum { font-size: 12px; color: var(--gold-deep); font-weight: 600; margin: 4px 0 12px; font-variant-numeric: tabular-nums; }
.kan-body { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.kan-empty { color: var(--faint); font-size: 12.5px; text-align: center; padding: 18px 0; border: 1px dashed var(--line-2); border-radius: var(--r-sm); }
.deal-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 13px 14px; cursor: pointer; box-shadow: var(--sh-xs);
  animation: rise .5s var(--ease) backwards; animation-delay: calc(var(--i,0) * 50ms);
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base), border-color var(--t-base);
}
.deal-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--gold-line); }
.deal-obj { display: inline-flex; align-items: center; gap: 6px; font-family: 'JetBrains Mono', monospace; font-size: 11.5px; font-weight: 500; color: var(--ink-soft); }
.deal-obj svg { width: 14px; height: 14px; color: var(--gold-deep); }
.deal-val { font-size: 19px; font-weight: 600; margin-bottom: 6px; letter-spacing: -.4px; }
.deal-contact { font-size: 13px; color: var(--ink-soft); font-weight: 500; margin-bottom: 10px; }
.deal-contact svg { width: 15px; height: 15px; color: var(--muted); }
.deal-next { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; color: var(--gold-deep); background: var(--gold-pale); border-radius: var(--r-xs); padding: 6px 9px; margin-bottom: 10px; }
.deal-next svg { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.deal-foot { align-items: center; }
.deal-foot .hint { font-size: 11.5px; }

/* ---- Task rows ---- */
.task-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 6px;
  border-bottom: 1px solid var(--line);
  animation: rise .5s var(--ease) backwards; animation-delay: calc(var(--i,0) * 45ms);
}
.task-row:last-child { border-bottom: none; }
.task-check {
  width: 24px; height: 24px; flex: none; border-radius: 7px; border: 2px solid var(--line-2);
  display: grid; place-items: center; cursor: pointer; color: #fff; transition: background var(--t-base), border-color var(--t-base);
}
.task-check svg { width: 15px; height: 15px; }
.task-check.on { background: var(--green); border-color: var(--green); }
.task-ic { width: 34px; height: 34px; flex: none; border-radius: var(--r-xs); display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--gold-line); color: var(--gold-deep); }
.task-ic svg { width: 18px; height: 18px; }
.task-due { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; white-space: nowrap; }
.task-due svg { width: 15px; height: 15px; color: var(--muted); }
.task-row.done { opacity: .55; }
.task-row.done .flex1 > span:first-child { text-decoration: line-through; }

/* ---- Calendar with events ---- */
.cal-events .cal-cell.ev { min-height: 92px; align-items: stretch; justify-content: flex-start; padding: 7px; gap: 4px; cursor: default; }
.cal-events .cal-cell.ev:hover { transform: none; box-shadow: var(--sh-xs); }
.cal-ev { font-size: 10.5px; font-weight: 600; line-height: 1.2; padding: 3px 5px; border-radius: 5px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.visita { background: #B68F3E; }
.cal-ev.llamada { background: #61708A; }
.cal-ev.documento { background: #4F7E5E; }
.cal-ev.email { background: #9A7E4E; }

/* ---- Object stats timeline ---- */
.report-cta { background: linear-gradient(100deg, var(--gold-pale), var(--surface)); border-color: var(--gold-line); }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 14px; padding-bottom: 18px; position: relative; animation: rise .5s var(--ease) backwards; animation-delay: calc(var(--i,0) * 55ms); }
.tl-item::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-ic { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--gold-line); color: var(--gold-deep); z-index: 1; }
.tl-ic svg { width: 18px; height: 18px; }
.tl-body { flex: 1; min-width: 0; padding-top: 2px; }
.tl-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.tl-note { font-weight: 500; font-size: 14px; }
.tl-date { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ============================================================================
   ОТЧЁТ СОБСТВЕННИКУ — генерируемый лендинг (standalone)
   ========================================================================= */
.report { min-height: 100vh; background: var(--paper-2); display: flex; flex-direction: column; }
.report-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 24px; background: rgba(26,23,20,.94); backdrop-filter: blur(8px); color: var(--paper);
}
.report-top .btn { height: 40px; }
.report-top .btn-ghost { color: var(--paper); border-color: rgba(255,255,255,.25); background: transparent; }
.report-top .btn-ghost:hover { background: rgba(255,255,255,.1); }
.report-top-t { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: rgba(243,233,204,.7); }
.report-scroll { flex: 1; overflow-y: auto; padding: 30px 20px 60px; }
.report-doc {
  max-width: 860px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-lg); overflow: hidden;
}
.rep-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 32px 40px; background: var(--ink); color: var(--paper); flex-wrap: wrap; }
.rep-brand { display: flex; align-items: center; gap: 14px; }
.rep-brand .mark { width: 46px; height: 46px; color: var(--gold); }
.rep-brand-n { font-family: 'Cormorant Garamond', serif; font-size: 24px; font-weight: 600; letter-spacing: .04em; }
.rep-brand-s { font-size: 12.5px; color: rgba(243,233,204,.72); }
.rep-head-r { text-align: right; }
.rep-ref { font-family: 'JetBrains Mono', monospace; font-size: 15px; color: var(--gold); font-weight: 500; }
.rep-period { font-size: 12px; color: rgba(243,233,204,.7); margin-top: 3px; }
.rep-hero { display: flex; gap: 22px; padding: 30px 40px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rep-hero-img { width: 200px; height: 140px; flex: none; border-radius: var(--r-md); display: grid; place-items: center; background: linear-gradient(135deg, #EFE7D3, #E4D9BE); color: var(--gold-deep); border: 1px solid var(--line); }
.rep-hero-img svg { width: 52px; height: 52px; opacity: .5; }
.rep-hero-body { flex: 1; min-width: 200px; }
.rep-hero-title { font-family: 'Cormorant Garamond', serif; font-size: 27px; font-weight: 500; line-height: 1.15; }
.rep-hero-sub { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; margin: 6px 0 12px; }
.rep-hero-sub svg { width: 16px; height: 16px; }
.rep-hero-price { font-family: 'Cormorant Garamond', serif; font-size: 30px; font-weight: 600; color: var(--gold-deep); }
.rep-hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.rep-tag { padding: 4px 12px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; color: var(--ink-soft); }
.rep-owner { margin: 0 40px; padding: 16px 20px; margin-top: 26px; background: var(--gold-pale); border: 1px solid var(--gold-line); border-radius: var(--r-md); display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; line-height: 1.5; color: var(--ink-soft); }
.rep-owner svg { width: 20px; height: 20px; flex: none; color: var(--gold-deep); margin-top: 1px; }
.rep-section-t { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 600; margin: 32px 40px 16px; padding-bottom: 8px; border-bottom: 2px solid var(--gold-line); }
.rep-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 0 40px; }
.rep-kpi { text-align: center; padding: 16px 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.rep-kpi-ic { display: inline-flex; color: var(--gold-deep); margin-bottom: 8px; }
.rep-kpi-ic svg { width: 22px; height: 22px; }
.rep-kpi-v { font-family: 'Cormorant Garamond', serif; font-size: 28px; font-weight: 600; line-height: 1; }
.rep-kpi-l { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.rep-portals { margin: 0 40px; display: flex; flex-direction: column; gap: 12px; }
.rep-portal { display: flex; align-items: center; gap: 14px; }
.rep-portal-n { width: 110px; flex: none; font-weight: 500; font-size: 13.5px; }
.rep-bar { flex: 1; height: 12px; background: var(--paper-2); border-radius: var(--r-pill); overflow: hidden; }
.rep-bar > i { display: block; height: 100%; width: 0; border-radius: var(--r-pill); background: linear-gradient(90deg, #D9BE77, var(--gold)); transition: width 1s var(--ease); }
.rep-portal-v { width: 60px; text-align: right; font-weight: 600; font-size: 13.5px; color: var(--gold-deep); }
.rep-timeline { margin: 0 40px; display: flex; flex-direction: column; }
.rep-tl { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); align-items: flex-start; }
.rep-tl:last-child { border-bottom: none; }
.rep-tl-d { width: 66px; flex: none; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); padding-top: 8px; }
.rep-tl-ic { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--gold-line); color: var(--gold-deep); }
.rep-tl-ic svg { width: 17px; height: 17px; }
.rep-tl-b { flex: 1; padding-top: 6px; font-size: 14px; line-height: 1.4; }
.rep-next { margin-top: 8px; }
.rep-ul { margin: 0 40px; padding-left: 20px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.7; }
.rep-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 34px 0 0; padding: 26px 40px; background: var(--surface-2); border-top: 1px solid var(--line); flex-wrap: wrap; }

@media (max-width: 720px) {
  .rep-kpis { grid-template-columns: repeat(3, 1fr); }
  .rep-head, .rep-hero, .report-scroll { padding-left: 20px; padding-right: 20px; }
  .rep-section-t, .rep-kpis, .rep-portals, .rep-timeline, .rep-ul { margin-left: 20px; margin-right: 20px; }
  .rep-owner { margin-left: 20px; margin-right: 20px; }
  .report-top { padding: 12px 16px; }
  .report-top-t { display: none; }
}
@media print {
  .report-top { display: none; }
  .report-scroll { padding: 0; }
  .report-doc { box-shadow: none; border: none; max-width: 100%; }
}

/* ---- Kanban drag & drop + deal modal ---- */
.deal-card { cursor: grab; }
.deal-card:active { cursor: grabbing; }
.deal-card.dragging { opacity: .45; transform: rotate(1.5deg) scale(.98); box-shadow: var(--sh-lg); }
.kan-col { transition: background var(--t-base), box-shadow var(--t-base); }
.kan-col.drag-over { background: var(--gold-pale); box-shadow: inset 0 0 0 2px var(--gold); }
.kan-col.drag-over .kan-empty { border-color: var(--gold); color: var(--gold-deep); background: rgba(201,169,97,.08); }
.deal-rows { display: flex; flex-direction: column; gap: 2px; }
.deal-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.deal-row:last-child { border-bottom: none; }
.deal-row-l { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13.5px; }
.deal-row-l svg { width: 16px; height: 16px; color: var(--gold-deep); }
.deal-row-v { font-weight: 600; font-size: 14px; text-align: right; }

/* ============================================================================
   CRM WAVE 2 — левое выравнивание меню, тулбар, богатая карточка сделки, настройки
   ========================================================================= */

/* (2) заголовки групп в меню — по левому краю (кнопка по умолчанию центрирует текст) */
.sb-group-h { text-align: left; }
.sb-group-h .flex1 { text-align: left; }

/* (3) тулбар поиска + фильтров (визуальный) */
.crm-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.crm-search { flex: 1; min-width: 220px; max-width: 420px; }
.tbar-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tbar-ic { display: inline-flex; color: var(--muted); }
.tbar-ic svg { width: 18px; height: 18px; }
.sel-wrap.sm select { height: 38px; padding: 0 34px 0 12px; font-size: 13px; }

/* (5) богатая карточка сделки */
.deal-modal { max-width: 660px; }
.deal-modal .modal-head { align-items: flex-start; }
.stage-track { display: flex; gap: 4px; margin: 4px 0 22px; overflow-x: auto; padding-bottom: 4px; }
.stage-step { flex: 1; min-width: 70px; text-align: center; position: relative; }
.stage-step::before { content: ""; position: absolute; top: 7px; left: -50%; width: 100%; height: 2px; background: var(--line-2); z-index: 0; }
.stage-step:first-child::before { display: none; }
.stage-dot { position: relative; z-index: 1; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); display: block; margin: 0 auto 8px; transition: all var(--t-base); }
.stage-lbl { font-size: 11px; color: var(--muted); line-height: 1.25; display: block; padding: 0 5px; }
.stage-step.done .stage-dot { background: var(--green); border-color: var(--green); }
.stage-step.done::before { background: var(--green); }
.stage-step.cur .stage-dot { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201,169,97,.22); }
.stage-step.cur::before { background: var(--green); }
.stage-step.cur .stage-lbl { color: var(--gold-deep); font-weight: 700; }
.deal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 8px; }
.deal-sec { margin-bottom: 20px; }
.deal-sec-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.deal-sec-h .heading { font-size: 17px; }
.tl-sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; line-height: 1.4; }
.note-item { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 10px; }
.note-item-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 13px; }
.note-item-t { font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
.note-add { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.note-add .input-wrap { flex: 1; }
.note-add .btn { flex: none; white-space: nowrap; }

/* (6) единый раздел настроек — список подразделов */
.set-links { display: flex; flex-direction: column; gap: 8px; }
.set-link { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base); }
.set-link:hover { border-color: var(--gold-line); box-shadow: var(--sh-xs); transform: translateX(2px); }
.set-link > svg { width: 18px; height: 18px; color: var(--faint); }
.set-link-ic { width: 40px; height: 40px; flex: none; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--gold-pale); border: 1px solid var(--gold-line); color: var(--gold-deep); }
.set-link-ic svg { width: 20px; height: 20px; }

@media (max-width: 640px) {
  .deal-grid { grid-template-columns: 1fr; }
  .crm-search { max-width: none; }
}

/* ============================================================================
   ПОРТАЛ ОЦЕНКИ + CRM-ИНТЕГРАЦИЯ (заявки, лиды оценки, сообщения, отчёт)
   ========================================================================= */

/* ссылка на кабинет собственника на экране логина */
.owner-link { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 13px 16px; border: 1px solid var(--gold-line); border-radius: var(--r-sm); background: var(--gold-pale); color: var(--gold-deep); font-size: 13.5px; font-weight: 500; transition: background var(--t-base), transform var(--t-base); }
.owner-link:hover { background: #F1E4BF; transform: translateY(-1px); }
.owner-link svg { width: 17px; height: 17px; flex: none; }
.owner-link span { flex: 1; }

/* лиды с сервиса оценки — золотая подсветка */
.val-src { color: var(--gold-deep); font-weight: 600; }
.val-src svg { width: 15px; height: 15px; }
.tbl-row.val-lead { background: linear-gradient(90deg, var(--gold-pale), transparent 70%); box-shadow: inset 3px 0 0 var(--gold); }
.tbl-row.val-lead:hover { background: linear-gradient(90deg, #F1E4BF, transparent 70%); }
.val-mark { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #fff; }
.val-mark svg { width: 18px; height: 18px; }

/* карточки «Объекты на оценку» */
.val-card { overflow: hidden; cursor: pointer; padding: 0; }
.val-cover { position: relative; height: 172px; background: linear-gradient(135deg, #EFE7D3, #E4D9BE); overflow: hidden; }
.val-cover img { width: 100%; height: 100%; object-fit: cover; }
.val-ribbon { position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--r-pill); background: rgba(26,23,20,.82); color: #F3E9CC; font-size: 11px; font-weight: 600; backdrop-filter: blur(4px); }
.val-ribbon svg { width: 13px; height: 13px; }
.val-status { position: absolute; top: 12px; right: 12px; }
.val-body { padding: 16px 18px 18px; }
.val-addr { font-family: 'Cormorant Garamond', serif; font-size: 22px; font-weight: 500; line-height: 1.15; }
.val-range-sm { font-family: 'Cormorant Garamond', serif; font-size: 22px; font-weight: 600; color: var(--gold-deep); }

/* блок предв.оценки в модалке */
.val-range { font-family: 'Cormorant Garamond', serif; font-size: 30px; font-weight: 600; color: var(--gold-deep); margin-bottom: 12px; line-height: 1; }
.deal-modal.from-val .modal-head { background: linear-gradient(100deg, var(--gold-pale), transparent); border-radius: var(--r-xl) var(--r-xl) 0 0; }

/* аналоги (comps) */
.comps-tbl { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.comps-h, .comps-r { display: grid; grid-template-columns: 2fr .7fr 1.1fr .7fr; gap: 8px; padding: 9px 12px; align-items: center; }
.comps-h { background: var(--surface-2); font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.comps-r { border-top: 1px solid var(--line); font-size: 13px; }
.comps-r .serif { font-family: 'Cormorant Garamond', serif; font-size: 15px; }

/* активность по сделке (editable) */
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.act-field { display: flex; flex-direction: column; gap: 6px; }
.act-field label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.act-field label svg { width: 14px; height: 14px; color: var(--gold-deep); }
.act-input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); font-size: 18px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; transition: border-color var(--t-base), box-shadow var(--t-base); }
.act-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201,169,97,.16); }

/* тред сообщений собственнику */
.msg-thread { display: flex; flex-direction: column; gap: 10px; max-height: 260px; overflow-y: auto; padding: 4px 2px 8px; }
.msg { max-width: 82%; }
.msg.out { align-self: flex-end; }
.msg.in { align-self: flex-start; }
.msg-b { padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.msg.out .msg-b { background: var(--gold); color: #2a2109; border-bottom-right-radius: 4px; }
.msg.in .msg-b { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg-m { font-size: 11px; color: var(--muted); margin-top: 4px; padding: 0 4px; }
.msg.out .msg-m { text-align: right; }

/* отчёт по сделке — доп. элементы (в стиле карточки оценки) */
.rep-photo { position: relative; margin: 0; aspect-ratio: 21/9; overflow: hidden; }
.rep-photo img { width: 100%; height: 100%; object-fit: cover; }
.rep-photo-tag { position: absolute; bottom: 14px; left: 18px; padding: 5px 12px; background: rgba(26,23,20,.72); color: #F3E9CC; font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: .08em; backdrop-filter: blur(4px); }
.eyebrow-g { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep); }
.rep-progress { margin: 0 40px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.rep-prog { padding: 20px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); text-align: center; }
.rep-prog-v { font-family: 'Cormorant Garamond', serif; font-size: 34px; font-weight: 600; color: var(--gold-deep); line-height: 1; }
.rep-prog-l { font-size: 12px; color: var(--muted); margin-top: 8px; }
.rep-portal-n.serif { font-family: 'Cormorant Garamond', serif; font-size: 16px; }

@media (max-width: 720px) {
  .rep-progress { grid-template-columns: repeat(2, 1fr); margin-left: 20px; margin-right: 20px; }
  .rep-photo-tag { left: 12px; }
}

/* ============================================================================
   CRM WAVE 6 — карточки-заявки на доске, панели клиент/сделка, заметки в ленте
   ========================================================================= */

/* карточки на доске из сервиса оценки — визуально отличаются */
.deal-card.from-val { border-color: var(--gold-line); background: linear-gradient(180deg, var(--gold-pale) 0%, var(--surface) 40%); box-shadow: var(--sh-xs), inset 0 2px 0 var(--gold); }
.deal-card.from-val:hover { border-color: var(--gold); box-shadow: var(--sh-md), inset 0 2px 0 var(--gold); }
.deal-val-ribbon { display: flex; align-items: center; gap: 6px; margin: -13px -14px 10px; padding: 6px 12px; background: var(--gold); color: #2a2109; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.deal-val-ribbon svg { width: 13px; height: 13px; }
.deal-src-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; box-shadow: 0 0 0 3px var(--gold-pale); }
.deal-card.from-val .deal-obj { font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; }
.deal-val-sub { font-size: 12px; font-weight: 400; color: var(--muted); }

/* панели клиент/сделка — чёткое разделение */
.deal-panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; }
.deal-panel-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.deal-panel-h .heading { font-size: 16px; }
.deal-panel .deal-row { border-bottom-color: var(--line-2); }
.deal-panel .deal-row:last-child { border-bottom: none; }

/* заметки внутри ленты истории */
.tl-item.is-note .tl-ic { background: #EFE0BE; border-color: var(--gold); color: var(--gold-deep); }
.tl-item.is-note .tl-body { background: var(--gold-pale); border: 1px solid var(--gold-line); border-radius: var(--r-sm); padding: 8px 12px; margin-top: -2px; }
.tl-tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: var(--r-pill); background: var(--gold); color: #2a2109; font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; vertical-align: middle; }

/* standalone-страница отчёта (новая вкладка) */
.report-standalone { margin: 0; }
.report-standalone .report-top { position: sticky; }

/* ============================================================================
   ФОТО ВМЕСТО ЗАГЛУШЕК — объекты, галерея, медиатека, отчёты
   ========================================================================= */
.obj-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.obj-thumb.ph { padding: 0; overflow: hidden; background: var(--surface-2); }
.obj-thumb.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-ph.has-img, .media-grid.obj .media-ph { padding: 0; overflow: hidden; }
.media-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rep-hero-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* фото-обложка в шапке карточки объекта */
.obj-hero { position: relative; height: 300px; border-radius: var(--r-lg); overflow: hidden; margin-bottom: 20px; border: 1px solid var(--line); background: var(--surface-2); }
.obj-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.obj-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(26,23,20,.28)); pointer-events: none; }
.obj-hero-count { position: absolute; bottom: 14px; right: 14px; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill); background: rgba(255,252,247,.92); color: var(--ink-soft); font-size: 12.5px; font-weight: 600; box-shadow: var(--sh-xs); }
.obj-hero-count svg { width: 14px; height: 14px; }
.obj-hero .obj-flag { top: 14px; left: 14px; }
@media (max-width: 720px) { .obj-hero { height: 200px; } }

/* ============================================================================
   МЕНЮ — правильная иерархия: разделы крупные/контрастные, подразделы мельче
   ========================================================================= */
.sb-nav { padding: 10px 12px; }

/* верхний уровень (заголовки-группы и листовые пункты) — крупно и контрастно */
.sb-group-h.sb-top {
  font-family: inherit; font-size: 14.5px; font-weight: 600; letter-spacing: 0; text-transform: none;
  color: var(--ink); padding: 12px 12px; margin: 4px 0 2px; gap: 12px;
}
.sb-group-h.sb-top .ic { width: 20px; height: 20px; color: var(--gold-deep); }
.sb-group-h.sb-top:hover { color: var(--ink); background: var(--surface-2); }
.sb-group-h.sb-top:hover .ic { color: var(--gold-deep); }
.sb-group-h.sb-top .chev { color: var(--faint); }
.sb-group-h.sb-top .chev svg { width: 16px; height: 16px; }

/* листовой пункт верхнего уровня — как заголовок, но кликабельный/активируемый */
a.sb-top { height: auto; padding: 12px 12px; margin: 4px 0 2px; font-size: 14.5px; font-weight: 600; color: var(--ink); gap: 12px; }
a.sb-top .ic { width: 20px; height: 20px; color: var(--gold-deep); }
a.sb-top:hover { background: var(--surface-2); }
a.sb-top.active { background: linear-gradient(90deg, #F1E4BF 0%, #F7EFD8 100%); color: var(--ink); box-shadow: inset 0 0 0 1px var(--gold-line), 0 2px 8px rgba(150,120,40,.10); }
a.sb-top.active .ic { color: var(--gold-deep); }

/* подразделы — мельче, светлее, с отступом под заголовком */
.sb-group-items .nav-item {
  height: 34px; padding: 0 12px 0 44px; margin: 1px 0; font-size: 13px; font-weight: 500; color: var(--muted);
}
.sb-group-items .nav-item .ic { width: 16px; height: 16px; color: var(--faint); }
.sb-group-items .nav-item:hover { background: var(--surface-2); color: var(--ink-soft); }
.sb-group-items .nav-item:hover .ic { color: var(--muted); }
.sb-group-items .nav-item .bar { display: none; }
.sb-group-items .nav-item.active {
  background: var(--gold-pale); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--gold-line);
}
.sb-group-items .nav-item.active .ic { color: var(--gold-deep); }
.sb-group-items { padding-left: 6px; }
