/* ============================================================
   Ерошевич CRM — design tokens & base
   One restrained accent (refined indigo) on a neutral ground.
   Light + dark. Modern grotesque (Onest). Balanced density.
   ============================================================ */

:root {
  /* --- neutral ramp (very slightly cool) --- */
  --c-bg:        #f8f9fc;
  --c-surface:   #ffffff;
  --c-surface-2: #f3f5f9;
  --c-surface-3: #eef1f6;
  --c-line:      #e3e7ef;
  --c-line-2:    #d5dbe7;
  --c-text:      #202633;
  --c-text-2:    #5a6373;
  --c-muted:     #7a8292;
  --c-faint:     #9ca3b3;

  /* --- single accent --- */
  --c-accent:      #4169e1;
  --c-accent-hov:  #3157c8;
  --c-accent-press:#2849ad;
  --c-accent-soft: #edf2ff;
  --c-accent-line: #c7d5ff;
  --c-on-accent:   #ffffff;

  /* --- muted status colors (desaturated for a premium feel) --- */
  --c-green:   #238a63;
  --c-green-s: #e9f7ef;
  --c-amber:   #b7791f;
  --c-amber-s: #fff4dc;
  --c-red:     #c74343;
  --c-red-s:   #fdecec;
  --c-sky:     #2f7ebd;
  --c-sky-s:   #eaf5ff;

  /* --- elevation --- */
  --sh-xs: 0 1px 2px rgba(20, 24, 38, 0.05);
  --sh-sm: 0 1px 2px rgba(20, 24, 38, 0.06), 0 1px 3px rgba(20, 24, 38, 0.05);
  --sh-md: 0 4px 12px rgba(20, 24, 38, 0.07), 0 1px 3px rgba(20, 24, 38, 0.05);
  --sh-lg: 0 12px 32px rgba(20, 24, 38, 0.10), 0 4px 12px rgba(20, 24, 38, 0.06);
  --sh-xl: 0 24px 64px rgba(20, 24, 38, 0.16), 0 8px 24px rgba(20, 24, 38, 0.08);
  --ring: 0 0 0 3px rgba(65, 105, 225, 0.18);

  /* --- geometry --- */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  /* --- spacing scale (4px base) --- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;
  --s-9: 48px; --s-10: 64px;

  /* --- layout --- */
  --sidebar-w: 252px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 64px;

  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  color-scheme: light;
}

[data-theme='dark'] {
  --c-bg:        #151821;
  --c-surface:   #1c202b;
  --c-surface-2: #242936;
  --c-surface-3: #2c3240;
  --c-line:      #343b4a;
  --c-line-2:    #434b5c;
  --c-text:      #f2f4f8;
  --c-text-2:    #c9cfda;
  --c-muted:     #9ba3b3;
  --c-faint:     #737c8f;

  --c-accent:      #7d9cff;
  --c-accent-hov:  #91adff;
  --c-accent-press:#a7bdff;
  --c-accent-soft: #29375c;
  --c-accent-line: #40548a;
  --c-on-accent:   #101522;

  --c-green:   #69c191;
  --c-green-s: #1e3a2d;
  --c-amber:   #d6a550;
  --c-amber-s: #3a2f1e;
  --c-red:     #e07a75;
  --c-red-s:   #3d2425;
  --c-sky:     #74b3e6;
  --c-sky-s:   #1f3449;

  --sh-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
  --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.34), 0 1px 3px rgba(0, 0, 0, 0.30);
  --sh-md: 0 4px 12px rgba(0, 0, 0, 0.40), 0 1px 3px rgba(0, 0, 0, 0.30);
  --sh-lg: 0 12px 32px rgba(0, 0, 0, 0.48), 0 4px 12px rgba(0, 0, 0, 0.34);
  --sh-xl: 0 24px 64px rgba(0, 0, 0, 0.56), 0 8px 24px rgba(0, 0, 0, 0.40);
  --ring: 0 0 0 3px rgba(125, 156, 255, 0.26);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv01', 'cv02', 'ss01';
  letter-spacing: 0;
  transition: background 0.3s ease, color 0.3s ease;
}

#root { height: 100%; }

button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: 0; line-height: 1.12; }
p { margin: 0; }

::selection { background: rgba(65, 105, 225, 0.22); }

/* tabular numbers utility */
.tnum { font-feature-settings: 'tnum'; font-variant-numeric: tabular-nums; }

/* scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--c-line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--c-line-2);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--c-muted); background-clip: padding-box; }

/* focus */
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

/* shared motion */
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.97) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-right { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

/* ============================================================
   UI primitives — buttons, badges, fields, avatars, chips, tabs
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--c-surface);
  --fg: var(--c-text);
  --bd: var(--c-line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border: 1px solid var(--bd);
  border-radius: var(--r-sm);
  background: var(--bg); color: var(--fg);
  font-size: 13.5px; font-weight: 600; letter-spacing: 0;
  white-space: nowrap; user-select: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .08s ease;
}
.btn:hover { background: var(--c-surface-2); }
.btn:active { transform: translateY(0.5px); }
.btn svg { width: 17px; height: 17px; flex: 0 0 auto; }

.btn.primary { --bg: var(--c-accent); --fg: var(--c-on-accent); --bd: transparent; box-shadow: var(--sh-xs); }
.btn.primary:hover { background: var(--c-accent-hov); }
.btn.primary:active { background: var(--c-accent-press); }

.btn.ghost { --bd: transparent; --bg: transparent; }
.btn.ghost:hover { background: var(--c-surface-2); }

.btn.soft { --bg: var(--c-accent-soft); --fg: var(--c-accent); --bd: transparent; }
.btn.soft:hover { background: #e5ecff; background: color-mix(in oklch, var(--c-accent-soft) 80%, var(--c-accent) 10%); }

.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: var(--r-xs); }
.btn.sm svg { width: 15px; height: 15px; }
.btn.lg { height: 44px; padding: 0 18px; font-size: 14.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* icon button */
.iconbtn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; flex: 0 0 auto;
  border: 1px solid transparent; border-radius: var(--r-sm);
  color: var(--c-text-2); background: transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.iconbtn:hover { background: var(--c-surface-2); color: var(--c-text); }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn.sm { width: 30px; height: 30px; }
.iconbtn.sm svg { width: 16px; height: 16px; }
.iconbtn.bordered { border-color: var(--c-line-2); background: var(--c-surface); }

/* split button */
.splitbtn { display: inline-flex; }
.splitbtn > .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.splitbtn > .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 0 8px;
  border-left: 1px solid rgba(255,255,255,0.28); border-left: 1px solid color-mix(in oklch, var(--c-on-accent) 28%, transparent); }

/* ---------- Badges / status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 23px; padding: 0 9px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 600; letter-spacing: 0; white-space: nowrap;
  background: var(--c-surface-3); color: var(--c-text-2);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--c-green-s); color: var(--c-green); }
.badge.amber { background: var(--c-amber-s); color: var(--c-amber); }
.badge.red   { background: var(--c-red-s);   color: var(--c-red); }
.badge.sky   { background: var(--c-sky-s);   color: var(--c-sky); }
.badge.accent{ background: var(--c-accent-soft); color: var(--c-accent); }
.badge.plain { background: var(--c-surface-3); color: var(--c-muted); }
.badge.outline { background: transparent; border: 1px solid var(--c-line-2); color: var(--c-text-2); }

/* count pill (nav) */
.pill {
  min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 700;
  background: var(--c-surface-3); color: var(--c-muted);
}
.pill.accent { background: var(--c-accent-soft); color: var(--c-accent); }

/* ---------- Avatars ---------- */
.avatar {
  --sz: 34px;
  width: var(--sz); height: var(--sz); flex: 0 0 auto;
  display: inline-grid; place-items: center; overflow: hidden;
  border-radius: 50%;
  font-size: calc(var(--sz) * 0.38); font-weight: 700; line-height: 1;
  color: #fff; background: var(--av, var(--c-accent));
  letter-spacing: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xs { --sz: 22px; } .avatar.sm { --sz: 28px; }
.avatar.lg { --sz: 44px; } .avatar.xl { --sz: 60px; }
.avatar.ring { box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 3px var(--c-line-2); }

/* logo-ish company glyph */
.glyph {
  --sz: 36px;
  width: var(--sz); height: var(--sz); flex: 0 0 auto;
  display: inline-grid; place-items: center; overflow: hidden;
  border-radius: var(--r-sm);
  font-size: calc(var(--sz) * 0.36); font-weight: 700;
  color: var(--c-text); background: var(--c-surface-3);
  border: 1px solid var(--c-line);
}
.glyph[style*="--cc"] {
  background: var(--c-surface-3);
  background: color-mix(in oklch, var(--cc) 16%, var(--c-surface));
  border-color: var(--c-line);
  border-color: color-mix(in oklch, var(--cc) 32%, transparent);
}
.glyph img { width: 100%; height: 100%; object-fit: cover; }
.glyph.lg { --sz: 52px; border-radius: var(--r-md); }

.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack > * { margin-left: -8px; box-shadow: 0 0 0 2px var(--c-surface); border-radius: 50%; }
.avatar-stack > *:first-child { margin-left: 0; }

/* ---------- Fields ---------- */
.field { display: grid; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--c-text-2); }
.input, .select, .textarea {
  width: 100%; height: 40px;
  padding: 0 12px;
  border: 1px solid var(--c-line-2); border-radius: var(--r-sm);
  background: var(--c-surface); color: var(--c-text);
  font-size: 14px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--c-faint); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--c-accent); box-shadow: var(--ring);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px;
}
.field .hint { font-size: 12px; color: var(--c-muted); }

/* search box */
.search {
  position: relative; display: flex; align-items: center;
}
.search svg { position: absolute; left: 12px; width: 17px; height: 17px; color: var(--c-faint); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 12px 0 38px;
  border: 1px solid var(--c-line-2); border-radius: var(--r-sm);
  background: var(--c-surface-2); color: var(--c-text); font-size: 14px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.search input::placeholder { color: var(--c-faint); }
.search input:focus { border-color: var(--c-accent); background: var(--c-surface); box-shadow: var(--ring); }
.search .kbd { position: absolute; right: 10px; }

.kbd {
  display: inline-flex; align-items: center; gap: 2px;
  height: 21px; padding: 0 6px;
  border: 1px solid var(--c-line-2); border-radius: var(--r-xs);
  background: var(--c-surface); color: var(--c-muted);
  font-size: 11.5px; font-weight: 600;
}

/* toggle switch */
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--c-line-2); transition: background .18s ease;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: var(--sh-sm); transition: transform .18s ease;
}
.switch input:checked + .track { background: var(--c-accent); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* segmented control */
.segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--c-surface-2); border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
}
.segmented button {
  height: 30px; padding: 0 12px; border-radius: 6px;
  font-size: 13px; font-weight: 600; color: var(--c-text-2);
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.segmented button.active { background: var(--c-surface); color: var(--c-text); box-shadow: var(--sh-xs); }
[data-theme='dark'] .segmented button.active { background: var(--c-surface-3); }
.segmented button:hover:not(.active) { color: var(--c-text); }
.segmented button .pill { margin-left: 6px; }

/* tabs (underline) */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--c-line); }
.tabs button {
  position: relative; height: 42px; padding: 0 14px;
  font-size: 13.5px; font-weight: 600; color: var(--c-muted);
  transition: color .15s ease;
}
.tabs button:hover { color: var(--c-text); }
.tabs button.active { color: var(--c-text); }
.tabs button.active::after {
  content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px;
  background: var(--c-accent); border-radius: 2px;
}
.tabs button .pill { margin-left: 7px; }

/* chip / filter */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--c-line-2); border-radius: var(--r-full);
  font-size: 13px; font-weight: 600; color: var(--c-text-2);
  background: var(--c-surface); transition: all .15s ease;
}
.chip:hover { background: var(--c-surface-2); color: var(--c-text); }
.chip.active { background: var(--c-accent-soft); border-color: var(--c-accent-line); color: var(--c-accent); }

/* card */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
}

/* divider */
.hr { height: 1px; background: var(--c-line); border: 0; margin: 0; }
.vr { width: 1px; align-self: stretch; background: var(--c-line); }

/* tiny meta label */
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--c-faint); }

/* progress */
.progress { height: 6px; border-radius: 999px; background: var(--c-surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--c-accent); }

/* tooltip-ish meta row */
.meta { display: inline-flex; align-items: center; gap: 6px; color: var(--c-muted); font-size: 13px; }
.meta svg { width: 15px; height: 15px; }

/* ---------- Task form controls ---------- */
.form-section { display: grid; gap: 14px; }
.section-label { display: flex; align-items: center; gap: 8px; }
.section-label .eyebrow { margin: 0; }
.section-label .ln { flex: 1; height: 1px; background: var(--c-line); }

/* priority picker */
.prio-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.prio-opt {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 10px;
  border: 1px solid var(--c-line-2); border-radius: var(--r-sm);
  background: var(--c-surface); color: var(--c-text-2);
  font-size: 13px; font-weight: 600; transition: all .14s ease;
}
.prio-opt:hover { background: var(--c-surface-2); }
.prio-opt .pdot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.prio-opt.active { color: var(--c-text); }

/* schedule card (inset, light) */
.sched {
  display: grid; gap: 14px;
  padding: 16px; border: 1px solid var(--c-line); border-radius: var(--r-lg);
  background: var(--c-surface-2);
}
.sched-head { display: flex; align-items: flex-start; gap: 12px; }
.sched-head .si { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--c-accent-soft); color: var(--c-accent); }
.sched-head .si svg { width: 18px; height: 18px; }
.sched-head .st { font-size: 14px; font-weight: 700; }
.sched-head .ss { margin-top: 2px; font-size: 12.5px; color: var(--c-muted); line-height: 1.4; }

/* date / time native inputs */
.input[type='date'], .input[type='time'] { padding-right: 10px; }
.input[type='date']::-webkit-calendar-picker-indicator,
.input[type='time']::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; }
[data-theme='dark'] .input[type='date']::-webkit-calendar-picker-indicator,
[data-theme='dark'] .input[type='time']::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .6; }

/* repeat chips */
.repeat-chips { display: flex; flex-wrap: wrap; gap: 7px; }

/* reveal */
.reveal { display: grid; gap: 14px; animation: reveal-in .2s ease; }
@keyframes reveal-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* interval */
.interval { display: flex; align-items: center; gap: 10px; }
.interval .intv-label { font-size: 13.5px; color: var(--c-text-2); font-weight: 500; }
.interval .intv-num { width: 74px; text-align: center; }
.interval .intv-unit { font-size: 13.5px; color: var(--c-muted); }

/* weekday toggles */
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd {
  height: 40px; border: 1px solid var(--c-line-2); border-radius: var(--r-sm);
  background: var(--c-surface); color: var(--c-text-2);
  font-size: 13px; font-weight: 600; transition: all .14s ease;
}
.wd:hover { background: var(--c-surface-3); color: var(--c-text); }
.wd.active { background: var(--c-accent); border-color: transparent; color: var(--c-on-accent); }

/* repeat backlog note */
.repeat-note { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--c-accent-soft); color: var(--c-accent); font-size: 12.5px; line-height: 1.45; }
.repeat-note svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }

/* client picker tile (read-only header inside form) */
.client-tile { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface-2); }
.client-tile .lmain { min-width: 0; }
.client-tile .lmain strong { display: block; font-size: 13.5px; font-weight: 600; }
.client-tile .lmain span { display: block; font-size: 12px; color: var(--c-muted); }

/* empty state */
.empty { display: grid; place-items: center; gap: 10px; padding: 48px 24px; text-align: center; color: var(--c-muted); }
.empty .ico { width: 46px; height: 46px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--c-surface-2); color: var(--c-faint); }
.empty .ico svg { width: 22px; height: 22px; }

/* ============================================================
   Layout — shell, sidebar, topbar, screens, kanban, modal, login
   ============================================================ */

/* ---------- App shell ---------- */
.shell {
  height: 100%;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  background: var(--c-bg);
  transition: grid-template-columns .22s ease;
}
.shell.collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--c-line);
  background: var(--c-surface);
  min-height: 0;
}
.sidebar-top {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 14px;
  border-bottom: 1px solid var(--c-line);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 9px;
  background: var(--c-accent); color: var(--c-on-accent);
  box-shadow: var(--sh-sm);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-copy { min-width: 0; line-height: 1.15; }
.brand-copy strong { display: block; font-size: 14.5px; font-weight: 700; letter-spacing: 0; white-space: nowrap; }
.brand-copy span { display: block; font-size: 11.5px; color: var(--c-muted); white-space: nowrap; }

.sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 4px; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-group-label { padding: 0 10px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--c-faint); }

.nav-item {
  position: relative;
  display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 11px;
  width: 100%; height: 40px; padding: 0 11px; margin-bottom: 2px;
  border-radius: var(--r-sm);
  color: var(--c-text-2); font-size: 13.5px; font-weight: 600; text-align: left;
  transition: background .14s ease, color .14s ease;
}
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { background: var(--c-surface-2); color: var(--c-text); }
.nav-item.active { background: var(--c-accent-soft); color: var(--c-accent); }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px;
  background: var(--c-accent); border-radius: 0 3px 3px 0;
}
.nav-item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-foot { padding: 10px 12px; border-top: 1px solid var(--c-line); }
.user-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  width: 100%; padding: 7px 8px; border-radius: var(--r-sm);
  transition: background .14s ease;
}
.user-card:hover { background: var(--c-surface-2); }
.user-card .who { min-width: 0; text-align: left; line-height: 1.2; }
.user-card .who strong { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .who span { display: block; font-size: 11.5px; color: var(--c-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .chev { color: var(--c-faint); }

/* collapsed sidebar */
.shell.collapsed .brand-copy,
.shell.collapsed .nav-item .label,
.shell.collapsed .nav-item .pill,
.shell.collapsed .nav-group-label,
.shell.collapsed .user-card .who,
.shell.collapsed .user-card .chev { display: none; }
.shell.collapsed .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 0; }
.shell.collapsed .user-card { grid-template-columns: 1fr; justify-items: center; }
.shell.collapsed .sidebar-top { justify-content: center; padding: 0; }
.shell.collapsed .brand { justify-content: center; }

/* ---------- Workspace ---------- */
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); flex: 0 0 auto;
  padding: 0 18px;
  border-bottom: 1px solid var(--c-line);
  background: rgba(255,255,255,0.8);
  background: color-mix(in oklch, var(--c-surface) 80%, transparent);
  backdrop-filter: blur(10px);
}
.topbar .search { width: min(420px, 38vw); }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar .vr { height: 26px; margin: 0 4px; }
.mobile-only { display: none; }

.view { flex: 1; min-height: 0; overflow-y: auto; }
.view-pad { padding: var(--s-6); }
.view-pad.wide { padding: var(--s-6) var(--s-7); }

/* page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: var(--s-5); flex-wrap: wrap; }
.page-head .titles h1 { font-size: 24px; }
.page-head .titles p { margin-top: 5px; color: var(--c-muted); font-size: 14px; }
.page-head .acts { display: flex; align-items: center; gap: 8px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.stat {
  padding: 16px 18px; border-radius: var(--r-lg);
  border: 1px solid var(--c-line); background: var(--c-surface);
}
.stat .top { display: flex; align-items: center; justify-content: space-between; }
.stat .lbl { font-size: 12.5px; color: var(--c-muted); font-weight: 600; }
.stat .ic { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--c-surface-2); color: var(--c-text-2); }
.stat .ic svg { width: 16px; height: 16px; }
.stat .val { margin-top: 12px; font-size: 28px; font-weight: 700; letter-spacing: 0; line-height: 1; }
.stat .delta { margin-top: 9px; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.stat .delta.up { color: var(--c-green); }
.stat .delta.down { color: var(--c-red); }
.stat .delta svg { width: 14px; height: 14px; }

/* ---------- Clients master/detail ---------- */
.clients-split {
  display: grid; grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  height: 100%; min-height: 0;
}
.master {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--c-line); background: var(--c-surface);
}
.master-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--c-line); display: grid; gap: 12px; }
.master-head .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.master-head h2 { font-size: 17px; }
.master-filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.master-filters::-webkit-scrollbar { display: none; }
.master-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; }

.client-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px;
  width: 100%; padding: 10px 11px; border-radius: var(--r-md); text-align: left;
  transition: background .12s ease;
}
.client-row:hover { background: var(--c-surface-2); }
.client-row.active { background: var(--c-accent-soft); }
.client-row.active .c-name { color: var(--c-accent); }
.client-row .c-main { min-width: 0; }
.client-row .c-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-row .c-sub { font-size: 12px; color: var(--c-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.client-row .c-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }

.master-foot { padding: 10px 14px; border-top: 1px solid var(--c-line); display: flex; align-items: center; justify-content: space-between; color: var(--c-muted); font-size: 12.5px; }
.pager { display: flex; align-items: center; gap: 2px; }
.pager button { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--c-text-2); }
.pager button:hover { background: var(--c-surface-2); }
.pager button.active { background: var(--c-accent); color: var(--c-on-accent); }

/* detail */
.detail { min-width: 0; min-height: 0; overflow-y: auto; }
.detail-hero { padding: 22px 26px 0; }
.detail-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.detail-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.detail-id .who h1 { font-size: 23px; display: flex; align-items: center; gap: 12px; }
.detail-id .who .sub { margin-top: 4px; color: var(--c-muted); font-size: 13.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-acts { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.detail-meta { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0; margin-top: 22px; border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface); overflow: hidden; }
.detail-meta .cell { padding: 14px 18px; border-right: 1px solid var(--c-line); }
.detail-meta .cell:last-child { border-right: 0; }
.detail-meta .cell .k { font-size: 11.5px; color: var(--c-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.detail-meta .cell .v { margin-top: 7px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.detail-meta .cell .v a { color: var(--c-accent); }

.detail-tabs { position: sticky; top: 0; z-index: 5; padding: 18px 26px 0; background: var(--c-bg); }
.detail-body { padding: 20px 26px 32px; }

/* two-column inside overview */
.ov-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(300px, 340px); gap: 18px; align-items: start; }

/* panels */
.panel { border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--c-line); }
.panel-head h3 { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel-head .n { color: var(--c-faint); font-weight: 600; }
.panel-body { padding: 6px; }
.panel-body.pad { padding: 16px; }

/* link rows */
.link-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 10px 11px; border-radius: var(--r-md); transition: background .12s ease; }
.link-row:hover { background: var(--c-surface-2); }
.link-row .lico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--c-surface-2); color: var(--c-text-2); }
.link-row .lico svg { width: 17px; height: 17px; }
.link-row .lmain { min-width: 0; }
.link-row .lmain strong { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-row .lmain span { display: block; font-size: 12px; color: var(--c-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* notes */
.note { padding: 13px 14px; border-radius: var(--r-md); background: var(--c-surface-2); border: 1px solid var(--c-line); }
.note + .note { margin-top: 10px; }
.note p { font-size: 13.5px; line-height: 1.55; color: var(--c-text); }
.note .note-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.note .note-head strong { font-size: 13px; font-weight: 600; }
.note .note-head time { font-size: 12px; color: var(--c-faint); margin-left: auto; }

/* timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 1.5px; background: var(--c-line); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item .tl-dot { position: absolute; left: -22px; top: 3px; width: 11px; height: 11px; border-radius: 50%; background: var(--c-surface); border: 2px solid var(--c-line-2); }
.tl-item.accent .tl-dot { border-color: var(--c-accent); background: var(--c-accent); }
.tl-item .tl-txt { font-size: 13.5px; }
.tl-item .tl-txt b { font-weight: 600; }
.tl-item time { display: block; margin-top: 3px; font-size: 12px; color: var(--c-faint); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(264px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kcol { background: var(--c-surface-2); border: 1px solid var(--c-line); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: 100%; }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 13px 14px 11px; }
.kcol-head .kdot { width: 8px; height: 8px; border-radius: 50%; }
.kcol-head h4 { font-size: 13px; font-weight: 700; }
.kcol-head .pill { margin-left: 2px; }
.kcol-head .add { margin-left: auto; color: var(--c-faint); }
.kcol-body { display: flex; flex-direction: column; gap: 9px; padding: 0 10px 12px; overflow-y: auto; }

.tcard {
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-md);
  padding: 12px 13px; cursor: pointer; box-shadow: var(--sh-xs);
  transition: border-color .14s ease, box-shadow .14s ease, transform .08s ease;
}
.tcard:hover { border-color: var(--c-line-2); box-shadow: var(--sh-sm); }
.tcard:active { transform: scale(0.99); }
.tcard .tt { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.tcard .tmeta { display: flex; align-items: center; gap: 8px; margin-top: 11px; }
.tcard .tmeta .when { font-size: 12px; color: var(--c-muted); display: inline-flex; align-items: center; gap: 5px; margin-right: auto; }
.tcard .tmeta .when svg { width: 13px; height: 13px; }
.tcard .tmeta .when.over { color: var(--c-red); }
.tcard .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }
.tcard .ttag { font-size: 11px; font-weight: 600; color: var(--c-muted); background: var(--c-surface-2); border: 1px solid var(--c-line); border-radius: 5px; padding: 1px 6px; }
.kadd { display: flex; align-items: center; gap: 7px; padding: 9px 11px; border-radius: var(--r-md); border: 1px dashed var(--c-line-2); color: var(--c-muted); font-size: 13px; font-weight: 600; }
.kadd:hover { background: var(--c-surface); color: var(--c-text); }
.kadd svg { width: 15px; height: 15px; }
.prio-bar { width: 3px; align-self: stretch; border-radius: 3px; }

/* ---------- Data table (tasks list / team) ---------- */
.dtable-wrap { border: 1px solid var(--c-line); border-radius: var(--r-lg); overflow: hidden; background: var(--c-surface); }
.dtable { width: 100%; border-collapse: collapse; }
.dtable th { padding: 11px 16px; text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--c-muted); background: var(--c-surface-2); border-bottom: 1px solid var(--c-line); white-space: nowrap; }
.dtable td { padding: 13px 16px; border-bottom: 1px solid var(--c-line); font-size: 13.5px; vertical-align: middle; }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tbody tr { transition: background .12s ease; }
.dtable tbody tr:hover { background: var(--c-surface-2); }
.dtable .t-title { font-weight: 600; }
.cellflex { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* ---------- Reports ---------- */
.report-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); gap: 16px; align-items: start; }
.chart-card { padding: 18px 20px; }
.bars { display: flex; align-items: flex-end; gap: 12px; height: 200px; padding-top: 10px; }
.bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.bars .bar-col .stack { flex: 1; width: 100%; max-width: 38px; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; }
.bars .bar { width: 100%; border-radius: 5px 5px 3px 3px; background: var(--c-accent); transition: height .4s cubic-bezier(.2,.7,.3,1); }
.bars .bar.alt { background: var(--c-accent-soft); }
.bars .bar-col .x { font-size: 11.5px; color: var(--c-muted); }

.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend .li { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--c-text-2); }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

.ring-row { display: flex; align-items: center; gap: 18px; }
.donut { --p: 70; --col: var(--c-accent); width: 120px; height: 120px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(var(--col) calc(var(--p) * 1%), var(--c-surface-3) 0);
  display: grid; place-items: center; }
.donut::after { content: ''; width: 80px; height: 80px; border-radius: 50%; background: var(--c-surface); }
.donut .lab { position: absolute; text-align: center; }

.workload-row { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 14px; padding: 11px 0; }
.workload-row + .workload-row { border-top: 1px solid var(--c-line); }
.workload-row .nm { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 600; }

/* ---------- Modal / drawer ---------- */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(32,38,51,0.36); background: color-mix(in oklch, var(--c-text) 36%, transparent); backdrop-filter: blur(3px); animation: scrim-in .18s ease; display: grid; }
.modal { place-self: center; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); overflow: hidden; display: flex; flex-direction: column;
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-xl); box-shadow: var(--sh-xl); animation: pop-in .22s cubic-bezier(.2,.7,.3,1); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 22px 24px 0; }
.modal-head h2 { font-size: 19px; }
.modal-head p { margin-top: 5px; color: var(--c-muted); font-size: 13.5px; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--c-line); background: var(--c-surface-2); }

.drawer-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(32,38,51,0.3); background: color-mix(in oklch, var(--c-text) 30%, transparent); backdrop-filter: blur(2px); animation: scrim-in .18s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 81; width: min(460px, 100vw); display: flex; flex-direction: column;
  background: var(--c-surface); border-left: 1px solid var(--c-line); box-shadow: var(--sh-xl); animation: slide-right .24s cubic-bezier(.2,.7,.3,1); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px; border-bottom: 1px solid var(--c-line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-foot { display: flex; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--c-line); }

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

/* popover */
.popover { position: absolute; z-index: 60; min-width: 280px; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); box-shadow: var(--sh-lg); animation: pop-in .16s ease; overflow: hidden; }
.popover-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; border-bottom: 1px solid var(--c-line); }
.popover-head strong { font-size: 13.5px; }
.popover-body { max-height: 360px; overflow-y: auto; }
.menu { padding: 6px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border-radius: 7px; font-size: 13.5px; font-weight: 500; color: var(--c-text); text-align: left; }
.menu button:hover { background: var(--c-surface-2); }
.menu button svg { width: 16px; height: 16px; color: var(--c-text-2); }
.menu button.danger { color: var(--c-red); }
.menu button.danger svg { color: var(--c-red); }
.menu .sep { height: 1px; background: var(--c-line); margin: 6px 0; }

.notif { display: grid; grid-template-columns: auto 1fr; gap: 11px; padding: 12px 15px; border-bottom: 1px solid var(--c-line); }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: var(--c-accent-soft); }
.notif .nico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--c-surface-2); color: var(--c-text-2); }
.notif .nico svg { width: 16px; height: 16px; }
.notif p { font-size: 13px; line-height: 1.45; }
.notif p b { font-weight: 600; }
.notif time { font-size: 11.5px; color: var(--c-faint); }

/* ---------- Login ---------- */
.login { height: 100%; display: grid; grid-template-columns: 1.05fr 0.95fr; background: var(--c-bg); }
.login-aside { position: relative; overflow: hidden; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; color: var(--c-on-accent);
  background: linear-gradient(155deg, var(--c-accent-press), var(--c-accent));
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklch, var(--c-accent) 86%, white 14%), transparent 60%),
    linear-gradient(155deg, var(--c-accent-press), var(--c-accent)); }
.login-aside .grain { position: absolute; inset: 0; opacity: 0.5;
  background-image: radial-gradient(rgba(255,255,255,0.14) 1px, transparent 1.4px);
  background-image: radial-gradient(color-mix(in oklch, white 14%, transparent) 1px, transparent 1.4px);
  background-size: 22px 22px; mask-image: radial-gradient(120% 120% at 30% 10%, black, transparent 75%); }
.login-aside .lb-top, .login-aside .lb-mid, .login-aside .lb-bot { position: relative; z-index: 1; }
.login-aside .brand-mark { background: rgba(255,255,255,0.16); box-shadow: none; backdrop-filter: blur(4px); }
.login-aside h1 { margin: 0; font-size: 40px; letter-spacing: 0; max-width: 16ch; }
.login-aside .lead { margin-top: 16px; font-size: 16px; line-height: 1.55; max-width: 40ch; opacity: 0.85; }
.login-aside .lb-bot { display: grid; gap: 12px; }
.login-feat { display: flex; align-items: center; gap: 11px; font-size: 14px; opacity: 0.92; }
.login-feat .fi { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,0.14); }
.login-feat .fi svg { width: 16px; height: 16px; }

.login-main { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(400px, 100%); }
.login-card .lc-head { margin-bottom: 24px; }
.login-card h2 { font-size: 25px; }
.login-card .lc-head p { margin-top: 7px; color: var(--c-muted); font-size: 14.5px; }
.login-err { display: flex; align-items: center; gap: 9px; padding: 11px 13px; border-radius: var(--r-sm); background: var(--c-red-s); color: var(--c-red); font-size: 13px; font-weight: 500; }
.login-err svg { width: 17px; height: 17px; flex: 0 0 auto; }
.input-wrap { position: relative; }
.input-wrap .pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .ov-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-meta { grid-template-columns: 1fr; }
  .detail-meta .cell { border-right: 0; border-bottom: 1px solid var(--c-line); }
  .detail-meta .cell:last-child { border-bottom: 0; }
}

/* mobile */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; top: 0; bottom: 0; left: 0; width: 276px; transform: translateX(-100%); transition: transform .24s ease; box-shadow: var(--sh-xl); }
  .shell.nav-open .sidebar { transform: none; }
  .mobile-scrim { position: fixed; inset: 0; z-index: 89; background: rgba(10,12,20,.42); animation: scrim-in .2s ease; }
  .mobile-only { display: inline-grid; }
  .clients-split { grid-template-columns: 1fr; }
  .clients-split .detail { display: none; }
  .clients-split.show-detail .master { display: none; }
  .clients-split.show-detail .detail { display: block; }
  .login { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .topbar .search { display: none; }
  .view-pad, .view-pad.wide { padding: var(--s-4); }
  .detail-hero { padding: 16px 16px 0; }
  .detail-tabs { padding: 14px 16px 0; }
  .detail-body { padding: 16px; }
  .page-head .titles h1 { font-size: 21px; }

  /* задачи: канбан колонками во весь экран со снэпом */
  .kanban { grid-auto-columns: min(86vw, 320px); scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .kanban .kcol { scroll-snap-align: start; }
  .kcol-body { max-height: calc(100dvh - 320px); }
  .page-head { flex-wrap: wrap; gap: 10px; }
  .page-head .acts { width: 100%; display: flex; gap: 8px; }
  .page-head .acts .segmented { flex: 1; display: flex; }
  .page-head .acts .segmented button { flex: 1; }
  .page-head .acts .btn.primary { flex: 1; justify-content: center; }
  .dtable-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dtable { min-width: 640px; }
  .tcard .tt { font-size: 14px; }
  .kadd, .kcol-head .add, .tcard, .chip { touch-action: manipulation; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; }
  .modal { width: min(96vw, 600px) !important; max-height: 92dvh; }
  .drawer { width: min(100vw, 480px); }
}

/* ============================================================
   Плотность интерфейса (data-density on <html>)
   ============================================================ */
/* Просторно */
html[data-density="spacious"] {
  --s-3: 14px; --s-4: 20px; --s-5: 26px; --s-6: 32px; --s-7: 44px;
}
html[data-density="spacious"] .panel-head { padding: 18px 20px; }
html[data-density="spacious"] .panel-body.pad { padding: 22px; }
html[data-density="spacious"] .stat { padding: 22px 22px; }
html[data-density="spacious"] .stat-grid { gap: 18px; }
html[data-density="spacious"] .ov-grid { gap: 24px; }
html[data-density="spacious"] .dtable th { padding: 14px 18px; }
html[data-density="spacious"] .dtable td { padding: 17px 18px; }
html[data-density="spacious"] .link-row { padding: 13px 13px; }
html[data-density="spacious"] .kb-item { padding: 14px 13px; }

/* Компактно */
html[data-density="compact"] {
  --s-3: 8px; --s-4: 11px; --s-5: 14px; --s-6: 16px; --s-7: 22px;
}
html[data-density="compact"] .panel-head { padding: 9px 13px; }
html[data-density="compact"] .panel-body.pad { padding: 11px; }
html[data-density="compact"] .stat { padding: 11px 13px; }
html[data-density="compact"] .stat-grid { gap: 10px; }
html[data-density="compact"] .ov-grid { gap: 12px; }
html[data-density="compact"] .dtable th { padding: 8px 14px; }
html[data-density="compact"] .dtable td { padding: 8px 14px; }
html[data-density="compact"] .link-row { padding: 7px 10px; }
html[data-density="compact"] .stat .val { font-size: 26px; }
html[data-density="compact"] .kb-item { padding: 8px 10px; }
html[data-density="compact"] .kb-article { padding: 18px 22px 28px; }

/* ============================================================
   Calendar — month grid, week view, mobile agenda
   Built on the shared tokens (theme.css). One accent, status tones.
   ============================================================ */

/* ---------- shell ---------- */
.cal { display: flex; flex-direction: column; }

/* navigation strip under the page head */
.cal-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cal-monthnav { display: flex; align-items: center; gap: 4px; }
.cal-monthnav .arr {
  width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto;
  border: 1px solid var(--c-line-2); border-radius: var(--r-sm); background: var(--c-surface); color: var(--c-text-2);
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.cal-monthnav .arr:hover { background: var(--c-surface-2); color: var(--c-text); }
.cal-monthnav .arr svg { width: 18px; height: 18px; }
.cal-title { font-size: 17px; font-weight: 700; letter-spacing: 0; min-width: 168px; text-align: center; }
.cal-title .yr { color: var(--c-muted); font-weight: 600; }

.cal-filters { display: flex; gap: 7px; flex-wrap: wrap; margin-left: 2px; }
.cal-bar .spacer { flex: 1; }

/* legend */
.cal-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cal-legend .li { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--c-text-2); font-weight: 500; }
.cal-legend .sw { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }

/* ---------- Month grid ---------- */
.cal-card {
  border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface);
  overflow: hidden; box-shadow: var(--sh-xs);
  display: flex; flex-direction: column;
}
.cal-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--c-line); background: var(--c-surface-2);
}
.cal-dow .d {
  padding: 10px 12px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--c-muted); text-align: left;
}
.cal-dow .d.we { color: var(--c-faint); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(118px, auto); }
.cal-cell {
  position: relative; border-right: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line);
  padding: 7px 8px 8px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
  background: var(--c-surface); transition: background .12s ease; text-align: left;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-grid > .cal-cell:nth-last-child(-n+7) { border-bottom: 0; }
.cal-cell:hover { background: var(--c-surface-2); }
.cal-cell.out { background: var(--c-bg); }
.cal-cell.out .daynum { color: var(--c-faint); }
.cal-cell.we:not(.out) { background: #f9fafc; background: color-mix(in oklch, var(--c-surface-2) 50%, var(--c-surface)); }

.cal-cell .cell-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.cal-cell .daynum {
  font-size: 13px; font-weight: 600; color: var(--c-text-2); line-height: 1;
  width: 24px; height: 24px; display: grid; place-items: center; border-radius: var(--r-full);
}
.cal-cell.today .daynum { background: var(--c-accent); color: var(--c-on-accent); font-weight: 700; }
.cal-cell .addday {
  width: 20px; height: 20px; display: grid; place-items: center; border-radius: var(--r-xs);
  color: var(--c-faint); opacity: 0; transition: opacity .12s ease, background .12s ease, color .12s ease;
}
.cal-cell:hover .addday { opacity: 1; }
.cal-cell .addday:hover { background: var(--c-accent-soft); color: var(--c-accent); }
.cal-cell .addday svg { width: 14px; height: 14px; }

.cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-chip {
  display: flex; align-items: center; gap: 6px; min-width: 0; text-align: left;
  height: 22px; padding: 0 7px; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 600; line-height: 1; color: var(--cf, var(--c-text-2));
  background: var(--cbg, var(--c-surface-3));
  transition: filter .12s ease, transform .06s ease;
}
.cal-chip:hover { filter: brightness(0.97); }
[data-theme='dark'] .cal-chip:hover { filter: brightness(1.12); }
.cal-chip:active { transform: scale(0.985); }
.cal-chip .cdot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; background: var(--cd, var(--c-faint)); }
.cal-chip .ctitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-chip.is-done .ctitle { text-decoration: line-through; opacity: .7; }
.cal-more {
  align-self: flex-start; padding: 1px 5px; border-radius: var(--r-xs);
  font-size: 11.5px; font-weight: 600; color: var(--c-muted);
}
.cal-more:hover { background: var(--c-surface-3); color: var(--c-text); }

/* ---------- Week view ---------- */
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wcol { border-right: 1px solid var(--c-line); display: flex; flex-direction: column; min-width: 0; }
.cal-wcol:last-child { border-right: 0; }
.cal-whead {
  display: flex; align-items: baseline; gap: 8px; padding: 11px 12px;
  border-bottom: 1px solid var(--c-line); background: var(--c-surface-2);
}
.cal-whead .wd { font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--c-muted); }
.cal-whead .dn { font-size: 16px; font-weight: 700; letter-spacing: 0; }
.cal-whead.today .dn { color: var(--c-accent); }
.cal-whead .n { margin-left: auto; }
.cal-wbody { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 7px; min-height: 120px; }
.cal-wcol.is-we .cal-wbody { background: rgba(243,245,249,0.45); background: color-mix(in oklch, var(--c-surface-2) 45%, transparent); }
.cal-wadd {
  margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px; border-radius: var(--r-sm); border: 1px dashed var(--c-line-2);
  color: var(--c-faint); font-size: 12px; font-weight: 600; opacity: 0; transition: opacity .12s ease;
}
.cal-wcol:hover .cal-wadd { opacity: 1; }
.cal-wadd:hover { background: var(--c-surface); color: var(--c-text); }
.cal-wadd svg { width: 14px; height: 14px; }

/* event card (week + agenda) */
.cal-event {
  position: relative; display: flex; gap: 9px; align-items: flex-start;
  padding: 9px 10px 9px 11px; border-radius: var(--r-md);
  border: 1px solid var(--c-line); background: var(--c-surface); box-shadow: var(--sh-xs);
  text-align: left; transition: border-color .14s ease, box-shadow .14s ease, transform .06s ease;
}
.cal-event::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--cd, var(--c-faint)); }
.cal-event:hover { border-color: var(--c-line-2); box-shadow: var(--sh-sm); }
.cal-event:active { transform: scale(0.995); }
.cal-event .ev-main { flex: 1; min-width: 0; }
.cal-event .ev-title { font-size: 13px; font-weight: 600; line-height: 1.35; }
.cal-event.is-done .ev-title { text-decoration: line-through; color: var(--c-muted); }
.cal-event .ev-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.cal-event .ev-cli { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--c-muted); font-weight: 500; min-width: 0; }
.cal-event .ev-cli .glyph { --sz: 18px; border-radius: 5px; font-size: 10px; }
.cal-event .ev-time { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--c-text-2); }
.cal-event .ev-time svg { width: 12px; height: 12px; }
.cal-event .ev-time.over { color: var(--c-red); }
.cal-event .ev-right { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }

/* ---------- Unscheduled strip ---------- */
.cal-unsched { margin-top: 14px; }
.cal-unsched .panel-head .add { color: var(--c-faint); }
.cal-unsched-body { display: flex; gap: 8px; padding: 12px; overflow-x: auto; }
.cal-unsched-body .cal-event { min-width: 240px; flex: 0 0 auto; }
.cal-unsched-empty { padding: 14px 16px; color: var(--c-muted); font-size: 13px; }

/* ---------- Mobile agenda ---------- */
.cal-mobile { display: none; }

@media (max-width: 760px) {
  /* hide desktop calendar, show mobile agenda */
  .cal-desktop { display: none; }
  .cal-mobile { display: flex; flex-direction: column; }

  .cal-m-head {
    display: flex; align-items: center; gap: 10px; padding: 4px 0 12px;
  }
  .cal-m-head .cal-title { min-width: 0; flex: 1; text-align: left; font-size: 19px; }
  .cal-m-head .today-btn { flex: 0 0 auto; }

  /* week strip */
  .cal-strip {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
    padding: 8px; border: 1px solid var(--c-line); border-radius: var(--r-lg);
    background: var(--c-surface); box-shadow: var(--sh-xs);
  }
  .cal-sday {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 7px 0 8px; border-radius: var(--r-md); min-width: 0;
    transition: background .14s ease;
  }
  .cal-sday:hover { background: var(--c-surface-2); }
  .cal-sday .sd-wd { font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--c-faint); }
  .cal-sday .sd-num {
    width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--r-full);
    font-size: 14px; font-weight: 700; color: var(--c-text);
  }
  .cal-sday.today .sd-num { box-shadow: inset 0 0 0 1.5px var(--c-accent); color: var(--c-accent); }
  .cal-sday.sel .sd-num { background: var(--c-accent); color: var(--c-on-accent); }
  .cal-sday.sel.today .sd-num { box-shadow: none; }
  .cal-sday .sd-dots { display: flex; gap: 3px; height: 5px; align-items: center; }
  .cal-sday .sd-dots i { width: 5px; height: 5px; border-radius: 50%; }
  .cal-sday.sel .sd-wd { color: var(--c-accent); }

  /* selected-day header */
  .cal-m-dayhead { display: flex; align-items: baseline; gap: 9px; padding: 18px 2px 12px; }
  .cal-m-dayhead h3 { font-size: 16px; font-weight: 700; letter-spacing: 0; }
  .cal-m-dayhead h3 .dow { color: var(--c-muted); font-weight: 600; text-transform: capitalize; }
  .cal-m-dayhead .n { margin-left: auto; }

  /* agenda list */
  .cal-agenda { display: flex; flex-direction: column; gap: 9px; padding-bottom: 24px; }
  .cal-agenda .cal-event { padding: 12px 13px; }
  .cal-agenda .cal-event .ev-title { font-size: 14px; }

  .cal-m-empty {
    display: grid; place-items: center; gap: 10px; padding: 40px 20px; text-align: center;
    color: var(--c-muted); border: 1px dashed var(--c-line-2); border-radius: var(--r-lg); margin-top: 4px;
  }
  .cal-m-empty .ico { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--c-surface-2); color: var(--c-faint); }
  .cal-m-empty .ico svg { width: 22px; height: 22px; }
  .cal-m-empty .t { font-weight: 600; color: var(--c-text); font-size: 13.5px; }
}

/* tablet: smaller month cells */
@media (max-width: 1100px) and (min-width: 761px) {
  .cal-grid { grid-auto-rows: minmax(104px, auto); }
}

/* ============================================================
   Метки (labels) — chips, picker, palette
   ============================================================ */
:root {
  --lab-indigo: var(--c-accent);
  --lab-green:  var(--c-green);
  --lab-amber:  var(--c-amber);
  --lab-red:    var(--c-red);
  --lab-sky:    var(--c-sky);
  --lab-purple: #8b5cf6;
  --lab-teal:   #0f9b8e;
  --lab-pink:   #db4d7a;
  --lab-slate:  #687386;
}
[data-theme='dark'] {
  --lab-purple: #b394ff;
  --lab-teal:   #74d3c7;
  --lab-pink:   #f097b3;
  --lab-slate:  #aab3c2;
}

/* chip */
.label-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  height: 25px; padding: 0 9px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
  color: var(--lc, var(--c-text-2));
  background: color-mix(in oklch, var(--lc, var(--c-faint)) 11%, var(--c-surface));
  border: 1px solid color-mix(in oklch, var(--lc, var(--c-line-2)) 26%, transparent);
}
.label-chip .ldot { width: 7px; height: 7px; border-radius: 50%; background: var(--lc, var(--c-faint)); flex: 0 0 auto; }
.label-chip .lt { overflow: hidden; text-overflow: ellipsis; }
.label-chip .lx {
  display: grid; place-items: center; width: 16px; height: 16px; margin-right: -3px; border-radius: 50%;
  color: var(--lc); opacity: 0.65; transition: opacity .12s ease, background .12s ease;
}
.label-chip .lx:hover { opacity: 1; background: color-mix(in oklch, var(--lc) 18%, transparent); }

.label-chip.mini { height: 20px; padding: 0 7px; font-size: 11px; font-weight: 600; gap: 5px; }
.label-chip.mini .ldot { width: 6px; height: 6px; }

/* generic chip row */
.label-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }

/* picker */
.label-picker { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.lp-anchor { position: relative; display: inline-flex; }
.label-add {
  display: inline-flex; align-items: center; gap: 5px; height: 25px; padding: 0 11px 0 8px;
  border-radius: var(--r-full); border: 1px dashed var(--c-line-2); background: transparent;
  color: var(--c-muted); font-size: 12px; font-weight: 600;
  transition: border-color .14s ease, color .14s ease, background .14s ease;
}
.label-add:hover { border-color: var(--c-accent-line); color: var(--c-accent); background: var(--c-accent-soft); border-style: solid; }
.label-add svg { stroke-width: 2.2; }

/* popover */
.popover.label-pop { padding: 0; overflow: hidden; min-width: 0; }
.lp-search { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--c-line); }
.lp-search svg { color: var(--c-faint); flex: 0 0 auto; }
.lp-search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 13.5px; color: var(--c-text); }
.lp-search input::placeholder { color: var(--c-faint); }
.lp-list { max-height: 240px; overflow-y: auto; padding: 6px; }
.lp-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 9px;
  border-radius: 7px; font-size: 13.5px; font-weight: 500; color: var(--c-text); text-align: left;
}
.lp-item:hover { background: var(--c-surface-2); }
.lp-item .ldot { width: 9px; height: 9px; border-radius: 50%; background: var(--lc, var(--c-faint)); flex: 0 0 auto; }
.lp-item .lp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-item.create { color: var(--c-accent); font-weight: 600; }
.lp-item .lp-plus { display: grid; place-items: center; width: 9px; height: 9px; color: var(--c-accent); }
.lp-item.create svg { stroke-width: 2.4; }
.lp-empty { padding: 14px 10px; text-align: center; font-size: 12.5px; color: var(--c-faint); }

/* labelled field block (reused in modals) */
.field-labels { display: flex; flex-direction: column; gap: 9px; }

/* ---------- menu extras (status section + dots) ---------- */
.menu-label { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--c-faint); }
.menu .st-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: var(--c-faint); }
.menu .st-dot.green { background: var(--c-green); }
.menu .st-dot.amber { background: var(--c-amber); }
.menu .st-dot.sky   { background: var(--c-sky); }
.menu .st-dot.plain { background: var(--c-faint); }

/* ---------- danger button ---------- */
.btn.danger { background: var(--c-red); color: #fff; border-color: transparent; }
.btn.danger:hover { filter: brightness(0.95); background: var(--c-red); color: #fff; }
.btn.danger svg { color: #fff; }

/* ---------- client detail: метки row ---------- */
.detail-labels { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.detail-labels .dl-label {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--c-faint);
}
.detail-labels .dl-label svg { color: var(--c-faint); }

/* ---------- confirm modal body ---------- */
.confirm-body { display: flex; gap: 14px; align-items: flex-start; }
.confirm-body .confirm-ico {
  flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-md);
  background: var(--c-red-s); color: var(--c-red);
}
.confirm-body p { margin: 4px 0 0; font-size: 14px; line-height: 1.55; color: var(--c-text-2); }

/* ============================================================
   Client tag (выделенная метка проекта на карточках задач)
   ============================================================ */
.client-tag {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  height: 24px; padding: 0 9px 0 5px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 700; line-height: 1; white-space: nowrap;
  color: var(--cc); background: color-mix(in oklch, var(--cc) 14%, var(--c-surface));
  border: 1px solid color-mix(in oklch, var(--cc) 36%, transparent);
}
button.client-tag { cursor: pointer; transition: filter .12s ease; }
button.client-tag:hover { filter: brightness(0.96); }
[data-theme='dark'] button.client-tag:hover { filter: brightness(1.12); }
.client-tag .ct-glyph {
  width: 16px; height: 16px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 50%; background: var(--cc); color: #fff; font-size: 9px; font-weight: 700;
}
.client-tag .ct-name { overflow: hidden; text-overflow: ellipsis; letter-spacing: 0; }
.client-tag.mini { height: 21px; font-size: 11.5px; padding: 0 8px 0 4px; gap: 5px; }
.client-tag.mini .ct-glyph { width: 14px; height: 14px; font-size: 8.5px; }

/* ============================================================
   People picker (исполнители / команда)
   ============================================================ */
.people-picker { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.person-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px 0 3px;
  border-radius: var(--r-full); background: var(--c-surface-2); border: 1px solid var(--c-line);
  font-size: 12.5px; font-weight: 600; color: var(--c-text);
}
.person-chip .pc-name { white-space: nowrap; }
.person-chip .pc-x {
  display: grid; place-items: center; width: 16px; height: 16px; margin-left: 1px; border-radius: 50%;
  color: var(--c-faint); transition: background .12s ease, color .12s ease;
}
.person-chip .pc-x:hover { background: var(--c-red-s); color: var(--c-red); }

.lp-item.person { height: 44px; gap: 11px; }
.lp-item.person .lp-pmain { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.lp-item.person .lp-role { font-size: 11.5px; color: var(--c-muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-item.person.on { background: var(--c-accent-soft); }

/* ============================================================
   База знаний
   ============================================================ */
.kb-screen { display: flex; flex-direction: column; height: 100%; }
.kb-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 326px minmax(0, 1fr); gap: 18px; }

/* ---- list ---- */
.kb-list { min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface); overflow: hidden; box-shadow: var(--sh-xs); }
.kb-list-head { padding: 14px; border-bottom: 1px solid var(--c-line); display: flex; flex-direction: column; gap: 12px; }
.kb-list-head .search { width: 100%; }
.kb-sections { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-sections .chip { height: 28px; padding: 0 11px; font-size: 12.5px; }
.kb-items { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.kb-item { display: flex; gap: 11px; align-items: flex-start; padding: 11px 11px; border-radius: var(--r-md); text-align: left; transition: background .12s ease; }
.kb-item:hover { background: var(--c-surface-2); }
.kb-item.active { background: var(--c-accent-soft); }
.kb-item-ico { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--c-surface-3); color: var(--c-text-2); }
.kb-item.active .kb-item-ico { background: var(--c-surface); color: var(--c-accent); }
.kb-item-main { min-width: 0; flex: 1; }
.kb-item-title { font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--c-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-item.active .kb-item-title { color: var(--c-accent); }
.kb-item-sub { font-size: 12px; color: var(--c-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- detail ---- */
.kb-detail { min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface); overflow: hidden; box-shadow: var(--sh-xs); }
.kb-back { display: none; }
.kb-empty-detail { flex: 1; display: grid; place-items: center; padding: 40px; }

.kb-view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.kb-view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 26px 18px; border-bottom: 1px solid var(--c-line); flex-wrap: wrap; }
.kb-vh-main { min-width: 0; flex: 1 1 260px; }
.kb-vh-badges { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 11px; }
.kb-vh-main h1 { font-size: 24px; font-weight: 700; letter-spacing: 0; line-height: 1.2; }
.kb-vh-meta { display: flex; align-items: center; gap: 8px; margin-top: 11px; font-size: 12.5px; color: var(--c-muted); }
.kb-vh-meta .dot-sep { color: var(--c-line-2); }
.kb-vh-acts { display: flex; gap: 8px; flex: 0 0 auto; }
.kb-view-body { flex: 1; min-height: 0; overflow-y: auto; }

/* article prose */
.kb-article { padding: 26px 30px 40px; max-width: 820px; }
.kb-article h2 { font-size: 20px; font-weight: 700; letter-spacing: 0; margin: 26px 0 12px; }
.kb-article h2:first-child { margin-top: 0; }
.kb-article h3 { font-size: 16px; font-weight: 700; margin: 22px 0 10px; }
.kb-article p { font-size: 14.5px; line-height: 1.7; color: var(--c-text-2); margin: 0 0 13px; }
.kb-article ul, .kb-article ol { margin: 0 0 14px; padding-left: 22px; }
.kb-article li { font-size: 14.5px; line-height: 1.7; color: var(--c-text-2); margin-bottom: 5px; }
.kb-article blockquote { margin: 16px 0; padding: 12px 18px; border-left: 3px solid var(--c-accent); background: var(--c-accent-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--c-text); font-size: 14.5px; line-height: 1.6; }
.kb-article img { max-width: 100%; border-radius: var(--r-md); border: 1px solid var(--c-line); margin: 8px 0; }
.kb-article pre { background: var(--c-surface-3); border: 1px solid var(--c-line); border-radius: var(--r-sm); padding: 14px 16px; overflow-x: auto; margin: 0 0 14px; }
.kb-article code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--c-text); }
.kb-article a { color: var(--c-accent); }

/* page iframe */
.kb-pageframe { height: 100%; }
.kb-pageframe iframe { width: 100%; height: 100%; min-height: 520px; border: 0; background: #fff; display: block; }

/* link card */
.kb-linkcard { display: flex; align-items: center; gap: 16px; margin: 26px 30px; padding: 20px; border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface-2); }
.kb-linkico { flex: 0 0 auto; width: 48px; height: 48px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--c-accent-soft); color: var(--c-accent); }
.kb-linkmain { flex: 1; min-width: 0; }
.kb-linkmain strong { display: block; font-size: 15px; }
.kb-linkmain span { display: block; font-size: 13px; color: var(--c-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- editor ---- */
.kb-editor .kb-edit-meta { padding: 20px 24px; border-bottom: 1px solid var(--c-line); display: flex; flex-direction: column; gap: 14px; }
.kb-meta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.kb-meta-row .segmented { width: 100%; }
.kb-meta-row .segmented button { flex: 1; font-size: 12.5px; padding: 0 8px; }
.kb-edit-link { padding: 22px 24px; }

.kb-split { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; }
.kb-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.kb-pane-edit { border-right: 1px solid var(--c-line); }
.kb-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--c-line); background: var(--c-surface-2); min-height: 44px; }
.kb-tb-title { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--c-muted); }
.kb-tb-btns { display: flex; gap: 3px; }
.kb-tb-btns button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--c-text-2); font-size: 13px; font-weight: 700; transition: background .12s ease, color .12s ease; }
.kb-tb-btns button:hover { background: var(--c-surface); color: var(--c-accent); }
.kb-code { flex: 1; min-height: 0; width: 100%; border: 0; outline: none; resize: none; padding: 16px 18px; background: var(--c-surface); color: var(--c-text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.7; }
.kb-prev-scroll { flex: 1; min-height: 0; overflow-y: auto; background: var(--c-surface); }
.kb-pane-prev .kb-article { padding: 20px 24px 32px; }
.kb-pane-prev .kb-pageframe { height: 100%; }
.kb-pane-prev .kb-pageframe iframe { min-height: 100%; }

.kb-mtabs { display: none; }
.kb-edit-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--c-line); background: var(--c-surface-2); }
.btn.danger.ghost { background: transparent; color: var(--c-red); border-color: var(--c-line-2); }
.btn.danger.ghost:hover { background: var(--c-red-s); border-color: transparent; color: var(--c-red); }
.btn.danger.ghost svg { color: var(--c-red); }

/* ============================================================
   Client links — add form + row actions
   ============================================================ */
.link-add { display: flex; flex-direction: column; gap: 9px; padding: 12px; margin-bottom: 6px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface-2); }
.link-add-row { display: flex; gap: 9px; }
.link-add-row .input, .link-add-row .select { height: 38px; }
.link-row-h { position: relative; }
.link-row .lrow-acts { display: flex; align-items: center; gap: 4px; margin-left: auto; opacity: 0; transition: opacity .12s ease; }
.link-row-h:hover .lrow-acts { opacity: 1; }
.iconbtn.sm.danger { color: var(--c-faint); }
.iconbtn.sm.danger:hover { color: var(--c-red); background: var(--c-red-s); }

/* ============================================================
   Mobile — knowledge base
   ============================================================ */
@media (max-width: 760px) {
  .kb-layout { grid-template-columns: 1fr; }
  .kb-layout.show-detail .kb-list { display: none; }
  .kb-layout.show-list .kb-detail { display: none; }
  .kb-back { display: inline-flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--c-line); font-size: 13.5px; font-weight: 600; color: var(--c-text-2); }
  .kb-view-head { flex-direction: column; gap: 14px; padding: 16px 18px; }
  .kb-vh-acts { width: 100%; }
  .kb-vh-acts .btn.primary { flex: 1; }
  .kb-article { padding: 18px 18px 32px; }
  .kb-meta-row { grid-template-columns: 1fr; }
  /* editor: single pane with mobile tabs */
  .kb-split { grid-template-columns: 1fr; }
  .kb-pane { display: none; }
  .kb-pane.on { display: flex; }
  .kb-pane-edit { border-right: 0; }
  .kb-mtabs { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--c-line); background: var(--c-surface); }
  .kb-mtabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; border-radius: var(--r-sm); border: 1px solid var(--c-line-2); background: var(--c-surface); color: var(--c-text-2); font-size: 13px; font-weight: 600; }
  .kb-mtabs button.active { background: var(--c-accent-soft); border-color: var(--c-accent-line); color: var(--c-accent); }
  .kb-code { min-height: 240px; }
}

/* ============================================================
   Команда — профиль участника, роли, сообщения
   ============================================================ */
.dtable tr.row-off td { opacity: 0.55; }
.dtable tr.row-off td:first-child { opacity: 1; }

/* member drawer */
.mem-hero { display: flex; gap: 16px; align-items: flex-start; padding-bottom: 18px; border-bottom: 1px solid var(--c-line); }
.mem-id { min-width: 0; flex: 1; }
.mem-name { font-size: 18px; font-weight: 700; letter-spacing: 0; }
.mem-role { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.mem-meta { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; }
.mem-meta span, .mem-meta a { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--c-muted); }
.mem-meta svg { color: var(--c-faint); }

.mem-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 18px 0; border-bottom: 1px solid var(--c-line); }
.mem-stat { padding: 12px 14px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface-2); }
.mem-stat .v { font-size: 19px; font-weight: 700; letter-spacing: 0; }
.mem-stat .l { font-size: 11.5px; color: var(--c-muted); margin-top: 4px; line-height: 1.3; }

.mem-section { padding: 18px 0 4px; }
.mem-sec-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.mem-sec-head h4 { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--c-muted); }
.mem-empty { padding: 14px; text-align: center; font-size: 13px; color: var(--c-faint); border: 1px dashed var(--c-line-2); border-radius: var(--r-md); }

.mem-task { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 10px 11px; border-radius: var(--r-md); transition: background .12s ease; }
.mem-task:hover { background: var(--c-surface-2); }
.mem-task + .mem-task { margin-top: 2px; }
.mem-task .mt-main { flex: 1; min-width: 0; }
.mem-task .mt-main strong { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mem-task .mt-main span { display: block; font-size: 12px; color: var(--c-muted); margin-top: 2px; }

.mem-clients { display: flex; flex-direction: column; gap: 7px; }
.mem-cli { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--c-line); border-radius: var(--r-md); font-size: 13.5px; font-weight: 600; }
.mem-cli .mem-cli-role { margin-left: auto; font-size: 11.5px; font-weight: 500; color: var(--c-muted); }

/* role modal */
.role-list { display: flex; flex-direction: column; gap: 7px; }
.role-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface); transition: border-color .12s ease, background .12s ease; }
.role-opt:hover { background: var(--c-surface-2); }
.role-opt.active { border-color: var(--c-accent-line); background: var(--c-accent-soft); }
.role-opt .role-ic { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--c-surface-3); color: var(--c-text-2); flex: 0 0 auto; }
.role-opt.active .role-ic { background: var(--c-surface); color: var(--c-accent); }

/* message modal */
.msg-to { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface-2); }
.msg-sent { display: flex; gap: 14px; align-items: flex-start; }
.msg-sent .msg-sent-ico { flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--c-green-s); color: var(--c-green); }
.msg-sent p { margin: 6px 0 0; font-size: 14px; line-height: 1.55; color: var(--c-text-2); }

@media (max-width: 760px) {
  .mem-stats { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   Telegram подключение (настройки → уведомления)
   ============================================================ */
.tg-card { border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface); box-shadow: var(--sh-xs); overflow: hidden; }
.tg-card.connected { border-color: color-mix(in oklch, var(--c-green) 32%, var(--c-line)); }
.tg-head { display: flex; align-items: center; gap: 13px; padding: 16px 18px; border-bottom: 1px solid var(--c-line); }
.tg-logo { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: var(--r-md); background: #2aabee; color: #fff; }
.tg-htext { flex: 1; min-width: 0; }
.tg-title { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; letter-spacing: 0; }
.tg-ok { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--c-green); background: var(--c-green-s); padding: 2px 8px; border-radius: var(--r-full); }
.tg-sub { font-size: 13px; color: var(--c-muted); margin-top: 3px; line-height: 1.4; }

.tg-body { padding: 18px; }
.tg-steps { margin: 0 0 16px; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.tg-steps li { font-size: 13.5px; line-height: 1.5; color: var(--c-text-2); }
.tg-steps b { color: var(--c-text); font-weight: 600; }

.tg-code { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px dashed var(--c-line-2); border-radius: var(--r-md); background: var(--c-surface-2); margin-bottom: 16px; flex-wrap: wrap; }
.tg-code-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--c-faint); }
.tg-code code { flex: 1; min-width: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; font-weight: 700; letter-spacing: 0.04em; color: var(--c-accent); }

.tg-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.tg-linking { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tg-spinner { width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%; border: 2.5px solid var(--c-line-2); border-top-color: var(--c-accent); animation: tg-spin 0.8s linear infinite; }
@keyframes tg-spin { to { transform: rotate(360deg); } }

.tg-account { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--c-line); }
.tg-account .tg-ava { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--c-accent); color: var(--c-on-accent); font-size: 13px; font-weight: 700; }
.tg-account strong { display: block; font-size: 14px; }
.tg-account .tg-handle { font-size: 12.5px; color: var(--c-muted); }
.tg-events { padding: 8px 8px 10px; }
.tg-events-h { padding: 12px 14px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--c-faint); }

/* ============================================================
   Созвоны
   ============================================================ */
.calls .calls-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }

/* personal room link */
.room-link-card { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface); box-shadow: var(--sh-xs); }
.room-link-card .rl-ico { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: var(--r-md); background: var(--c-accent-soft); color: var(--c-accent); }
.room-link-card .rl-main { flex: 1; min-width: 0; }
.room-link-card .rl-main strong { display: block; font-size: 14.5px; }
.room-link-card .rl-main span { display: block; font-size: 13px; color: var(--c-muted); margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* upcoming card */
.call-card { display: flex; align-items: center; gap: 14px; padding: 13px 14px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface); transition: border-color .14s ease, box-shadow .14s ease; }
.call-card:hover { border-color: var(--c-line-2); box-shadow: var(--sh-sm); }
.call-card.soon { border-color: var(--c-accent-line); }
.cc-time { flex: 0 0 auto; width: 72px; display: flex; flex-direction: column; gap: 2px; padding-right: 14px; border-right: 1px solid var(--c-line); }
.cc-time .cc-when { font-size: 16px; font-weight: 700; letter-spacing: 0; }
.cc-time .cc-day { font-size: 11.5px; color: var(--c-muted); font-weight: 600; }
.cc-main { flex: 1; min-width: 0; }
.cc-title { font-size: 14px; font-weight: 600; line-height: 1.35; }
.cc-meta { display: flex; align-items: center; gap: 10px; margin-top: 7px; flex-wrap: wrap; }
.cc-dur { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--c-muted); font-weight: 500; }
.cc-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

/* past call */
.past-call { display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-bottom: 1px solid var(--c-line); }
.past-call:last-child { border-bottom: 0; }
.past-call .pc-ico { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--c-surface-3); color: var(--c-muted); }
.past-call .pc-main { flex: 1; min-width: 0; }
.past-call .pc-top { display: flex; align-items: center; gap: 9px; }
.past-call .pc-top strong { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.past-call .pc-sub { font-size: 12px; color: var(--c-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
.past-call .pc-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.past-call .pc-norec { font-size: 12px; color: var(--c-faint); }

/* ============================================================
   Call room
   ============================================================ */
.call-room { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: #0e1016; color: #e8eaf0; }
[data-theme='dark'] .call-room { background: #08090d; }
.room-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); flex: 0 0 auto; }
.rt-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.iconbtn.ghost-light { color: #c8ccd8; }
.iconbtn.ghost-light:hover { background: rgba(255,255,255,0.1); color: #fff; }
.rt-title { font-size: 15px; font-weight: 700; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.rt-sub { font-size: 12.5px; color: #9aa0b0; margin-top: 2px; }
.rt-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.rec-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #ff6b6b; }
.rec-badge i { width: 8px; height: 8px; border-radius: 50%; background: #ff5252; animation: rec-pulse 1.4s ease-in-out infinite; }
@keyframes rec-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.room-timer { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #c8ccd8; font-variant-numeric: tabular-nums; }

.room-body { flex: 1; min-height: 0; display: flex; gap: 0; }
.room-stage { flex: 1; min-width: 0; padding: 18px; display: flex; align-items: center; justify-content: center; }

/* participant grid */
.vgrid { display: grid; gap: 12px; width: 100%; height: 100%; }
.vgrid.n1 { grid-template-columns: 1fr; max-width: 900px; margin: 0 auto; }
.vgrid.n2 { grid-template-columns: 1fr 1fr; }
.vgrid.n3, .vgrid.n4 { grid-template-columns: 1fr 1fr; }
.vgrid.n5, .vgrid.n6 { grid-template-columns: repeat(3, 1fr); }

.vtile { position: relative; border-radius: var(--r-lg); overflow: hidden; background: #1a1d27; min-height: 150px; display: flex; align-items: center; justify-content: center; border: 2px solid transparent; }
.vtile.speaking { border-color: #4ade80; }
.vtile-off { width: 100%; height: 100%; display: grid; place-items: center; }
.vtile .vt-ava { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; font-weight: 700; color: #fff; background: var(--av, #5b5bd6); }
.vtile-cam { width: 100%; height: 100%; display: grid; place-items: center; gap: 10px; background: radial-gradient(circle at 50% 40%, #2d2b42, #14161e); background: radial-gradient(circle at 50% 40%, color-mix(in oklch, var(--av, #5b5bd6) 45%, #1a1d27), #14161e); }
.vtile-cam .cam-note { font-size: 11.5px; color: rgba(255,255,255,0.6); }
.vtile-bar { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vt-name { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: #fff; background: rgba(0,0,0,0.45); padding: 4px 9px; border-radius: var(--r-full); backdrop-filter: blur(4px); }
.vt-host { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: #ffd47e; }
.vt-mic { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,0.45); color: #fff; backdrop-filter: blur(4px); }
.vt-mic.off { background: #d64545; }

/* screen share */
.share-wrap { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 12px; }
.share-screen { position: relative; flex: 1; border-radius: var(--r-lg); overflow: hidden; background: #fff; }
.share-tag { position: absolute; top: 12px; left: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #fff; background: rgba(20,22,30,0.7); padding: 5px 10px; border-radius: var(--r-full); backdrop-filter: blur(4px); }
.share-mock { height: 100%; padding: 48px 40px; background: linear-gradient(160deg, #f4f6fb, #e9edf6); }
.share-mock .sm-bar { width: 180px; height: 22px; border-radius: 6px; background: #5b5bd6; margin-bottom: 22px; }
.share-mock .sm-row { height: 12px; border-radius: 4px; background: #cdd4e4; margin-bottom: 12px; }
.share-mock .sm-row.short { width: 60%; }
.share-mock .sm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 28px; }
.share-mock .sm-card { height: 80px; border-radius: 10px; background: #fff; border: 1px solid #dde3ef; box-shadow: 0 1px 3px rgba(20,24,38,0.06); }
.share-strip { flex: 0 0 auto; display: flex; gap: 10px; height: 92px; }
.share-strip .vtile { min-height: 0; width: 130px; flex: 0 0 auto; }
.share-strip .vtile .vt-ava { width: 42px; height: 42px; font-size: 15px; }
.share-strip .vtile-bar { left: 6px; right: 6px; bottom: 6px; }
.share-strip .vt-name { font-size: 10.5px; padding: 2px 6px; }
.share-strip .vt-mic { width: 20px; height: 20px; }

/* side panel */
.room-panel { width: 320px; flex: 0 0 auto; display: flex; flex-direction: column; background: #14161e; border-left: 1px solid rgba(255,255,255,0.08); }
.rp-tabs { display: flex; align-items: center; gap: 4px; padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.rp-tabs button { height: 32px; padding: 0 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; color: #9aa0b0; }
.rp-tabs button:hover { background: rgba(255,255,255,0.06); color: #e8eaf0; }
.rp-tabs button.active { background: rgba(91,91,214,0.22); color: #b9b9f5; }
.rp-tabs button .pill { background: rgba(255,255,255,0.14); color: #e8eaf0; }
.rp-tabs .rp-close { margin-left: auto; color: #9aa0b0; }
.rp-close:hover { color: #fff; }

.rp-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rp-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.cmsg { display: flex; gap: 8px; }
.cmsg.me { flex-direction: row-reverse; }
.cmsg-b { max-width: 80%; }
.cmsg-h { display: flex; align-items: baseline; gap: 7px; margin-bottom: 3px; }
.cmsg.me .cmsg-h { flex-direction: row-reverse; }
.cmsg-h strong { font-size: 12.5px; color: #e8eaf0; }
.cmsg-h time { font-size: 10.5px; color: #6e7488; }
.cmsg-t { font-size: 13px; line-height: 1.45; color: #c8ccd8; background: #20232e; padding: 8px 11px; border-radius: 12px; }
.cmsg.me .cmsg-t { background: #4a4ad1; color: #fff; }
.rp-input { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,0.08); }
.rp-input input { flex: 1; height: 38px; border-radius: var(--r-full); border: 1px solid rgba(255,255,255,0.12); background: #1c1f29; color: #e8eaf0; padding: 0 14px; font-size: 13.5px; outline: none; }
.rp-input input::placeholder { color: #6e7488; }
.rp-input .iconbtn { color: #b9b9f5; }

.rp-people { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; }
.rp-person { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); }
.rp-person:hover { background: rgba(255,255,255,0.05); }
.rp-pmain { flex: 1; min-width: 0; }
.rp-pmain strong { display: block; font-size: 13px; color: #e8eaf0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-pmain span { font-size: 11px; color: #ffd47e; }
.rp-mic { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,0.08); color: #c8ccd8; }
.rp-mic.off { background: rgba(214,69,69,0.2); color: #ff8a8a; }

/* controls */
.room-controls { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-top: 1px solid rgba(255,255,255,0.08); flex-wrap: wrap; }
.ctrl { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 70px; padding: 8px 12px; border-radius: var(--r-md); color: #e8eaf0; background: rgba(255,255,255,0.07); transition: background .14s ease, color .14s ease; }
.ctrl:hover { background: rgba(255,255,255,0.14); }
.ctrl span { font-size: 11px; font-weight: 600; }
.ctrl.off { background: rgba(214,69,69,0.22); color: #ff9a9a; }
.ctrl.on { background: rgba(91,91,214,0.3); color: #c3c3fb; }
.ctrl.leave { background: #d64545; color: #fff; }
.ctrl.leave:hover { background: #c23a3a; }

/* mobile */
@media (max-width: 760px) {
  .calls .calls-grid { grid-template-columns: 1fr; }
  .call-card { flex-wrap: wrap; }
  .cc-right { width: 100%; justify-content: space-between; border-top: 1px solid var(--c-line); padding-top: 11px; margin-top: 3px; }
  .past-call .pc-sub { max-width: 200px; }

  .room-body { flex-direction: column; }
  .room-stage { padding: 12px; }
  .vgrid { grid-auto-rows: minmax(120px, 1fr); }
  .vgrid.n2, .vgrid.n3, .vgrid.n4 { grid-template-columns: 1fr 1fr; }
  .vgrid.n1 { grid-template-columns: 1fr; }
  .room-panel { position: absolute; inset: 56px 0 92px 0; width: auto; z-index: 5; border-left: 0; }
  .room-controls { gap: 6px; padding: 10px 8px; }
  .ctrl { min-width: 56px; padding: 7px 8px; }
  .ctrl span { font-size: 10px; }
  .rt-title { max-width: 60vw; }
  .share-strip { height: 72px; }
}

/* ---------- lobby (экран входа в созвон) ---------- */
.call-room.lobby { align-items: center; justify-content: center; padding: 20px; }
.lobby-card { width: min(560px, 100%); background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 22px; padding: 26px; display: grid; gap: 14px; }
.lobby-title { font-size: 20px; font-weight: 700; }
.lobby-sub { color: rgba(232,234,240,.65); font-size: 13.5px; }
.lobby-preview { position: relative; aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden; background: #000; display: grid; place-items: center; }
.lobby-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.lobby-novideo { display: grid; gap: 10px; place-items: center; }
.lobby-novideo .vt-ava { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; font-weight: 700; background: var(--av, #4f6df5); color: #fff; }
.lobby-novideo-note { color: rgba(232,234,240,.6); font-size: 13px; }
.lobby-error { background: rgba(224,67,107,.14); border: 1px solid rgba(224,67,107,.35); color: #ff9db4; border-radius: 12px; padding: 10px 14px; font-size: 13px; }
.lobby-toggles { display: flex; gap: 10px; justify-content: center; }
.lobby-actions { display: flex; gap: 10px; }
.lobby-actions .btn { flex: 1; justify-content: center; padding: 13px 16px; font-size: 15px; }
.share-wait { height: 100%; display: grid; place-items: center; color: rgba(232,234,240,.6); font-size: 14px; background: #000; border-radius: 14px; }
@media (max-width: 760px) {
  .lobby-card { padding: 18px; }
  .lobby-preview { aspect-ratio: 4 / 5; }
}

/* ---------- свёрнутый звонок ---------- */
.call-room-hidden { display: none; }
.call-mini { position: fixed; right: 16px; bottom: 16px; z-index: 95; display: flex; align-items: center; gap: 12px;
  background: #11131a; color: #e8eaf0; border: 1px solid rgba(255,255,255,.14); border-radius: 16px; padding: 10px 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.call-mini-pulse { width: 10px; height: 10px; border-radius: 50%; background: #34d399; flex: 0 0 auto; animation: callpulse 1.6s ease infinite; }
@keyframes callpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(52,211,153,.5); } 50% { box-shadow: 0 0 0 7px rgba(52,211,153,0); } }
.call-mini-info { display: grid; line-height: 1.3; min-width: 0; }
.call-mini-info strong { font-size: 13px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-mini-info span { font-size: 12px; color: rgba(232,234,240,.65); }
.call-mini-leave { background: #e0436b; color: #fff; border-radius: 10px; width: 34px; height: 34px; }
.call-mini-leave:hover { background: #c73357; }
@media (max-width: 760px) {
  .call-mini { left: 12px; right: 12px; bottom: 12px; justify-content: space-between; }
}

/* зелёная подсветка говорящего в списке участников */
.rp-ava { display: inline-flex; border-radius: 50%; border: 2px solid transparent; transition: border-color .12s ease; }
.rp-ava.speaking { border-color: #4ade80; box-shadow: 0 0 0 2px rgba(74,222,128,.25); }
