/* ============================================================
   Ракета · custom.css
   Линейка стилей из mockup_final_ru.html + новые элементы
   (login, task form, toasts, AI chat, stub-notes).
   CSS-переменные определены в base.html.
   ============================================================ */

/* ===== Reveal on load ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.reveal { animation: fadeUp 520ms var(--ease-out) both; }
.reveal-1 { animation-delay: 60ms; }
.reveal-2 { animation-delay: 120ms; }
.reveal-3 { animation-delay: 180ms; }
.reveal-4 { animation-delay: 240ms; }

/* ===== Shimmer (skeletons) ===== */
@keyframes shimmer {
  0%   { background-position: -220% 0; }
  100% { background-position: 220% 0; }
}
.skel {
  background: linear-gradient(90deg,
    var(--bg-elevated) 0%,
    var(--bg-surface) 35%,
    #25252E 50%,
    var(--bg-surface) 65%,
    var(--bg-elevated) 100%);
  background-size: 220% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: 4px;
  color: transparent !important;
}

/* ===== Pulse dot ===== */
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .55; transform: scale(.8); }
}

/* ============================================================
   APP SHELL — desktop only 1440×900, no responsive in Sprint 1
   ============================================================ */
.app {
  display: grid;
  grid-template-rows: 48px 1fr;
  height: 100vh;
  min-width: 1280px;
  /* Rail widths — single source of truth for both topbar & body columns.
     Collapsing a rail just zeroes its var (see .left-collapsed/.right-collapsed). */
  --col-left: 240px;
  --col-right: 320px;
}
.app.left-collapsed  { --col-left: 0px; }
.app.right-collapsed { --col-right: 0px; }

/* ===== TOPBAR ===== */
.topbar {
  display: grid;
  grid-template-columns: var(--col-left) 1fr var(--col-right);
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  position: relative;
  z-index: 5;
  transition: grid-template-columns var(--t-slow) var(--ease);
}
/* When a side is collapsed, clip its topbar cell + drop the now-floating border. */
.app.left-collapsed  .top-brand { overflow: hidden; border-right-color: transparent; }
.app.right-collapsed .top-trail { overflow: hidden; border-left-color: transparent; }
.top-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  border-right: 1px solid var(--border);
  transition: background var(--t-base) var(--ease);
}
.top-brand:hover { background: var(--bg-surface); }
.brand-logo {
  width: 24px; height: 24px; border-radius: 7px;
  background: linear-gradient(135deg, #FF7E4D, #E04A12);
  display: grid; place-items: center;
  color: #0A0A0B; font-weight: 700; font-size: 12px;
  box-shadow: 0 4px 12px -4px var(--accent-glow);
  transition: transform var(--t-base) var(--ease-out);
}
.brand-logo-lg { width: 40px; height: 40px; font-size: 20px; border-radius: 12px; }
.top-brand:hover .brand-logo { transform: rotate(-6deg) scale(1.06); }
.brand-name { font-size: 13.5px; font-weight: 600; letter-spacing: -.015em; }
.brand-sub {
  font-size: 10px; color: var(--text-muted);
  letter-spacing: .08em; text-transform: uppercase;
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
}

.top-search {
  display: flex; align-items: center;
  padding: 0 14px; gap: 14px;
}
.top-search .input {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 6px 10px; border-radius: 6px;
  color: var(--text-muted); font-size: 12px;
  flex: 1; max-width: 480px;
  transition: border-color var(--t-base) var(--ease), background var(--t-base) var(--ease);
  cursor: text;
}
.top-search .input:hover { border-color: var(--border-strong); background: var(--bg-elevated); }
.top-search .input:focus-within { border-color: var(--accent); background: var(--bg-elevated); }
.top-search svg { width: 13px; height: 13px; }
.top-search input {
  flex: 1; font-size: 12px; color: var(--text-primary);
  background: transparent; border: 0;
}
.top-search input::placeholder { color: var(--text-muted); }
.top-search input:disabled { cursor: text; }
.top-search .kbd {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  background: var(--bg-elevated); padding: 2px 6px; border-radius: 3px;
  border: 1px solid var(--border); color: var(--text-secondary);
}

.ai-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px; border-radius: 14px;
  background: rgba(74, 222, 128, .08);
  border: 1px solid rgba(74, 222, 128, .22);
  font-size: 11.5px; color: var(--success); font-weight: 500;
  white-space: nowrap;
  transition: transform var(--t-base) var(--ease), background var(--t-base) var(--ease);
}
.ai-pill:hover { transform: translateY(-1px); background: rgba(74, 222, 128, .14); }
.ai-pill .pulse-mini {
  width: 6px; height: 6px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulseDot 1.8s ease-in-out infinite;
}

.top-trail {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 14px; gap: 8px;
  border-left: 1px solid var(--border);
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 7px;
  display: grid; place-items: center;
  color: var(--text-muted); position: relative;
  transition: background var(--t-base) var(--ease),
              color var(--t-base) var(--ease),
              transform var(--t-base) var(--ease-out);
}
.icon-btn:hover { background: var(--bg-elevated); color: var(--text-primary); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0); }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn .count {
  position: absolute; top: 2px; right: 2px;
  min-width: 15px; height: 15px; border-radius: 8px; padding: 0 4px;
  background: var(--accent); color: #0A0A0B;
  font-size: 9px; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--bg-primary);
  font-family: 'JetBrains Mono', monospace;
}
.icon-btn .count.danger { background: var(--danger); color: #fff; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 10px 3px 4px; border-radius: 7px;
  border: 1px solid var(--border);
  transition: border-color var(--t-base) var(--ease), background var(--t-base) var(--ease);
  cursor: default;
}
.user-chip:hover { border-color: var(--border-strong); background: var(--bg-elevated); }
.user-chip .av {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, #FF7E4D, #C2410C);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700; color: #0A0A0B;
  box-shadow: inset 0 -2px 6px rgba(0, 0, 0, .25);
}
.user-chip .meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-chip .nm { font-size: 11.5px; font-weight: 500; }
.user-chip .rl {
  font-size: 9.5px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace; letter-spacing: .04em;
}

/* ===== BODY (three rails) ===== */
.body {
  display: grid;
  grid-template-columns: var(--col-left) 1fr var(--col-right);
  min-height: 0;
  transition: grid-template-columns var(--t-slow) var(--ease);
}

/* ============================================================
   LEFT RAIL
   ============================================================ */
.left-rail {
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 0; background: var(--bg-primary);
  /* Scrollable: the nav + team + XP + habit-gate stack can exceed the viewport. */
  overflow-y: auto; overflow-x: hidden;
}
.app.left-collapsed  .left-rail  { overflow: hidden; border-right-color: transparent; }
.app.right-collapsed .right-rail { overflow: hidden; border-left-color: transparent; }
.left-rail::-webkit-scrollbar { width: 8px; }
.left-rail::-webkit-scrollbar-track { background: transparent; }
.left-rail::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 4px; }
.left-rail::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* Rail collapse toggles (live in the center top-search → always visible). */
.rail-toggle {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  display: grid; place-items: center;
  color: var(--text-muted);
  transition: background var(--t-base) var(--ease), color var(--t-base) var(--ease);
}
.rail-toggle:hover { background: var(--bg-elevated); color: var(--text-primary); }
.rail-toggle svg { width: 16px; height: 16px; }
.app.left-collapsed  .rail-toggle.is-left  { color: var(--accent); }
.app.right-collapsed .rail-toggle.is-right { color: var(--accent); }
.rail-section { padding: 14px 14px 6px; }
.rail-h {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px 8px;
}
.rail-h .plus {
  color: var(--text-muted); cursor: pointer;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 4px; font-size: 14px; line-height: 1;
  transition: color var(--t-base) var(--ease), background var(--t-base) var(--ease);
}
.rail-h .plus:hover { color: var(--text-primary); background: var(--bg-elevated); }

.nav-list { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 6px;
  font-size: 13px; color: var(--text-secondary);
  position: relative; cursor: pointer;
  transition: background var(--t-base) var(--ease),
              color var(--t-base) var(--ease),
              transform var(--t-fast) var(--ease-out);
}
.nav-item:hover { background: var(--bg-surface); color: var(--text-primary); transform: translateX(2px); }
.nav-item.active { background: var(--bg-elevated); color: var(--text-primary); }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 16px; background: var(--accent); border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--accent-glow);
}
.nav-item svg { width: 14px; height: 14px; color: var(--text-muted); transition: color var(--t-base) var(--ease); }
.nav-item:hover svg { color: var(--text-primary); }
.nav-item.active svg { color: var(--accent); }
.nav-item .count {
  margin-left: auto; font-size: 10.5px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.nav-item.active .count { color: var(--text-secondary); }

/* Team list (left rail) */
.rail-section.team .member {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 6px;
  cursor: pointer;
  transition: background var(--t-base) var(--ease), transform var(--t-fast) var(--ease-out);
}
.rail-section.team .member:hover { background: var(--bg-surface); transform: translateX(2px); }

.mini-av {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; color: #0A0A0B;
  flex-shrink: 0; position: relative;
  box-shadow: inset 0 -1px 3px rgba(0, 0, 0, .2);
}
.av-t  { background: linear-gradient(135deg, #FBBF24, #F59E0B); }
.av-v  { background: linear-gradient(135deg, #4ADE80, #22C55E); }
.av-s  { background: linear-gradient(135deg, #60A5FA, #3B82F6); }
.av-sg { background: linear-gradient(135deg, #FF7E4D, #C2410C); }

.mini-av .status {
  position: absolute; bottom: -1px; right: -1px;
  width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid var(--bg-primary);
}
.status.online { background: var(--success); box-shadow: 0 0 6px rgba(74, 222, 128, .6); }
.status.away   { background: var(--warning); }
.status.off    { background: var(--text-muted); }

.member-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.m-name { font-size: 12.5px; font-weight: 500; line-height: 1.2; color: var(--text-primary); }
.m-meta { font-size: 10.5px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

.member .load {
  font-size: 10px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace; font-weight: 500;
}
.member .load.warn { color: var(--warning); }
.member .load.bad  { color: var(--danger); }

.rail-note {
  font-size: 10.5px; color: var(--text-muted);
  padding: 6px 8px 0; font-style: italic;
}

.rail-foot {
  margin-top: auto; padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-surface);
}
.rail-foot .av {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #FF7E4D, #C2410C);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #0A0A0B;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .2);
}
.rail-foot .who { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.rail-foot .who .nm { font-size: 12.5px; font-weight: 500; }
.rail-foot .who .st {
  font-size: 10px; color: var(--success);
  font-family: 'JetBrains Mono', monospace;
  display: flex; align-items: center; gap: 5px;
}
.rail-foot .who .st::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 6px var(--success); animation: pulseDot 2s infinite;
}
.rail-foot .gear {
  width: 26px; height: 26px; border-radius: 5px;
  display: grid; place-items: center;
  color: var(--text-muted);
  transition: background var(--t-base) var(--ease), color var(--t-base) var(--ease);
}
.rail-foot .gear:hover { background: var(--bg-elevated); color: var(--text-primary); }
.rail-foot .gear svg { width: 14px; height: 14px; }

/* ============================================================
   CENTER
   ============================================================ */
.center {
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  background: radial-gradient(ellipse 1100px 600px at 50% -10%, rgba(255, 107, 53, 0.04), transparent 60%);
}

/* KPI row */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}
.kpi {
  padding: 16px 20px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer; position: relative; overflow: hidden;
  transition: background var(--t-base) var(--ease);
}
.kpi::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, var(--accent-soft));
  opacity: 0; transition: opacity var(--t-base) var(--ease); pointer-events: none;
}
.kpi:hover { background: var(--bg-surface); }
.kpi:hover::after { opacity: 1; }
.kpi:last-child { border-right: 0; }
.kpi-l {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600;
}
.kpi-mid { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.kpi-v {
  font-size: 24px; font-weight: 600; letter-spacing: -.02em;
  font-family: 'JetBrains Mono', monospace;
  display: flex; align-items: baseline; gap: 6px; line-height: 1;
}
.kpi-v .unit { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.spark {
  width: 64px; height: 24px; flex-shrink: 0;
  opacity: .85; transition: opacity var(--t-base) var(--ease);
}
.kpi:hover .spark { opacity: 1; }
.kpi-d {
  font-size: 10.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
  font-family: 'JetBrains Mono', monospace;
}
.kpi-d.up   { color: var(--success); }
.kpi-d.down { color: var(--success); } /* −8% CPL = good for advertiser */
.kpi-d.flat { color: var(--text-muted); }
.kpi-d.warn { color: var(--danger); }
.kpi-d .arr { font-size: 9px; }

.stub-note {
  font-size: 10.5px; color: var(--text-muted);
  padding: 8px 24px;
  font-family: 'JetBrains Mono', monospace;
  border-bottom: 1px dashed var(--border);
  background: rgba(255, 107, 53, 0.025);
  font-style: italic;
}
.stub-note.inbox-stub {
  margin: 4px 0 10px;
  padding: 8px 12px; border-radius: 6px;
  border: 1px dashed var(--border-strong);
  background: var(--bg-surface);
}

/* Center scroll */
.center-scroll { flex: 1; overflow-y: auto; min-height: 0; scroll-behavior: smooth; }
.center-scroll::-webkit-scrollbar { width: 10px; }
.center-scroll::-webkit-scrollbar-track { background: transparent; }
.center-scroll::-webkit-scrollbar-thumb {
  background: var(--bg-elevated); border-radius: 5px;
  border: 2px solid var(--bg-primary);
}
.center-scroll::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* Section header */
.sec {
  padding: 18px 24px 8px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted);
}
.sec .sec-l { display: flex; align-items: center; gap: 10px; }
.sec .sec-l b {
  color: var(--text-primary); text-transform: none;
  letter-spacing: -.01em; font-size: 13px; font-weight: 600;
}
.sec .sec-l .meta { color: var(--text-muted); font-size: 11px; letter-spacing: .04em; }
.sec .actions { display: flex; gap: 6px; }

.chip {
  font-size: 11px; color: var(--text-secondary);
  padding: 4px 10px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--bg-surface);
  cursor: pointer;
  text-transform: none; letter-spacing: 0; font-weight: 500;
  transition: all var(--t-base) var(--ease);
}
.chip:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text-primary); transform: translateY(-1px); }
.chip:disabled { opacity: 0.55; cursor: not-allowed; }
.chip.active {
  background: var(--accent-soft); color: var(--accent);
  border-color: transparent;
}
.chip-action {
  background: var(--accent-soft); color: var(--accent);
  border-color: rgba(255, 107, 53, 0.25);
}
.chip-action:hover { background: rgba(255, 107, 53, 0.18); color: var(--accent); }

/* ===== Timeline (календарь команды — stub) ===== */
.timeline {
  margin: 8px 24px 0;
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--bg-surface);
  box-shadow: var(--shadow-lift);
}
.tl-days {
  display: grid; grid-template-columns: 130px repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  height: 38px; background: var(--bg-primary);
}
.tl-days .lab {
  padding: 0 14px; display: flex; align-items: center;
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600;
  border-right: 1px solid var(--border);
}
.tl-days .day {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; font-size: 11px; color: var(--text-muted);
  border-right: 1px solid var(--border); position: relative;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 500;
  transition: background var(--t-base) var(--ease);
}
.tl-days .day:hover { background: var(--bg-surface); }
.tl-days .day:last-child { border-right: 0; }
.tl-days .day .num {
  color: var(--text-secondary); font-weight: 500;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0; font-size: 12px;
}
.tl-days .day.today { background: var(--accent-soft); color: var(--accent); }
.tl-days .day.today .num { color: var(--accent); }
.tl-days .day.weekend { color: #54545E; }

.tl-row {
  display: grid; grid-template-columns: 130px 1fr;
  border-bottom: 1px solid var(--border); min-height: 64px;
}
.tl-row:last-child { border-bottom: 0; }
.tl-pers {
  padding: 0 14px; display: flex; align-items: center; gap: 10px;
  border-right: 1px solid var(--border);
  background: var(--bg-surface);
}
.tl-pers .nm { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.tl-pers .ld { font-size: 10px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.tl-track {
  position: relative;
  background-image: linear-gradient(to right, var(--border) 1px, transparent 1px);
  background-size: calc(100% / 7) 100%;
  padding: 8px 0;
}
.tl-track.tl-empty {
  display: flex; align-items: center; justify-content: center;
}
.tl-placeholder {
  font-size: 11px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  padding: 0 16px; font-style: italic;
}

/* ============================================================
   TASKS — реальные данные через /api/tasks
   ============================================================ */
.task-add-form {
  margin: 0 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-surface);
  padding: 0;
  max-height: 0; overflow: hidden;
  opacity: 0;
  transition: max-height var(--t-slow) var(--ease),
              opacity var(--t-base) var(--ease),
              padding var(--t-base) var(--ease),
              margin-bottom var(--t-base) var(--ease);
}
.task-add-form.open {
  max-height: 220px; opacity: 1;
  padding: 12px; margin-bottom: 8px;
}
.task-add-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.task-add-form input[type="text"],
.task-add-form input[type="date"],
.task-add-form textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 10px; border-radius: 6px;
  font-size: 13px;
  transition: border-color var(--t-base) var(--ease);
}
.task-add-form input[type="text"] { flex: 1; }
.task-add-form input[type="date"] {
  width: 150px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color-scheme: dark;
}
.task-add-form input:focus, .task-add-form textarea:focus { border-color: var(--accent); }
.task-add-form textarea {
  width: 100%; resize: vertical;
  font-family: 'Inter', sans-serif;
}

.tasks-table {
  margin: 8px 24px 16px;
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--bg-surface);
  box-shadow: var(--shadow-lift);
}
.tt-head {
  display: grid; grid-template-columns: 30px 1fr 130px 130px 110px 110px;
  padding: 11px 16px;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  gap: 12px; align-items: center; font-weight: 600;
}
.tt-row {
  display: grid; grid-template-columns: 30px 1fr 130px 130px 110px 110px;
  padding: 10px 16px; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; font-size: 12.5px;
  transition: background var(--t-base) var(--ease),
              transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-base) var(--ease);
}
.tt-row:last-child { border-bottom: 0; }
.tt-row:hover {
  background: var(--bg-elevated);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

.check {
  width: 18px; height: 18px; border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  padding: 0; cursor: pointer;
  background: transparent;
  transition: border-color var(--t-base) var(--ease), background var(--t-base) var(--ease);
}
.check:disabled { cursor: default; }
.check:not(:disabled):hover { border-color: var(--accent); }
.check.done { background: var(--success); border-color: var(--success); }
.check.done::after { content: "✓"; color: #0A0A0B; font-size: 10px; font-weight: 700; }
.tt-row:hover .check:not(:disabled) { border-color: var(--accent); }

/* min-width:0 lets the 1fr title track shrink below its content: without it a
   nowrap source-quote blows the track out to its full text width and pushes the
   КТО/СТАТУС/ДЕДЛАЙН/ИСТОЧНИК columns off-screen (long-quote cards lost controls). */
.tt-title { color: var(--text-primary); line-height: 1.35; min-width: 0; }
.tt-title-row { min-width: 0; }
.tt-desc, .tt-quote { max-width: 100%; }
.tt-desc {
  display: block; margin-top: 3px;
  font-size: 11px; color: var(--text-muted); line-height: 1.4;
}
.tt-row.done .tt-title {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
}

.tt-meta {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--text-secondary);
}
.tt-meta .mini-av { width: 20px; height: 20px; font-size: 9.5px; }

.tt-state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 500;
  padding: 3px 8px; border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
}
.tt-state .d { width: 5px; height: 5px; border-radius: 50%; background: var(--text-secondary); }
.tt-state.active   { color: var(--accent); }
.tt-state.active   .d { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.tt-state.progress { color: var(--warning); }
.tt-state.progress .d { background: var(--warning); }
.tt-state.done     { color: var(--success); }
.tt-state.done     .d { background: var(--success); }
.tt-state.over {
  color: var(--danger);
  border-color: rgba(239, 68, 68, .25);
  background: rgba(239, 68, 68, .06);
}
.tt-state.over .d { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.tt-state.frozen {
  color: #67E8F9;
  border-color: rgba(103, 232, 249, .25);
  background: rgba(103, 232, 249, .06);
}
.tt-state.failed {
  color: var(--danger);
  border-color: rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .08);
  text-decoration: line-through;
}
.tt-state.cancelled {
  color: var(--text-muted);
  opacity: .7;
  text-decoration: line-through;
}

/* ===== Status select (interactive on task card) ===== */
.tt-status-select {
  font: inherit;
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 22px 3px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23808088' stroke-width='2.5'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: border-color var(--t-base) var(--ease), background-color var(--t-base) var(--ease);
}
.tt-status-select:hover { border-color: var(--accent); }
.tt-status-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tt-status-select.active   { color: var(--accent); }
.tt-status-select.progress { color: var(--warning); }
.tt-status-select.done     { color: var(--success); }
.tt-status-select.frozen   { color: #67E8F9; }
.tt-status-select.failed   { color: var(--danger); }
.tt-status-select.cancelled{ color: var(--text-muted); }
.tt-status-select option   { background: var(--bg-elevated); color: var(--text-primary); }

/* ===== Status marker dot (replaces old checkbox) ===== */
.tt-marker {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
  margin: 0 auto;
}
.tt-state-dot.active   { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.tt-state-dot.progress { background: var(--warning); }
.tt-state-dot.done     { background: var(--success); }
.tt-state-dot.frozen   { background: #67E8F9; }
.tt-state-dot.failed   { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.tt-state-dot.cancelled{ background: var(--text-muted); opacity: .5; }
.tt-state-dot.over     { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

/* 1-click complete toggle (replaces the decorative dot on active/done rows). */
.tt-check {
  width: 19px; height: 19px; margin: 0 auto; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 2px solid var(--text-muted); background: transparent;
  font-size: 11px; line-height: 1; color: transparent; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}
.tt-check:hover {
  border-color: var(--success); color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, transparent);
}
.tt-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tt-check.done {            /* completed → filled check, click to reopen */
  border-color: var(--success); background: var(--success); color: #06210f;
}
.tt-check.done:hover { background: color-mix(in srgb, var(--success) 80%, #000); }

/* Clickable task title (opens the detail popup). */
.tt-title-text { cursor: pointer; }
.tt-title-text:hover { text-decoration: underline; text-decoration-color: var(--text-muted); }

/* ===== Task detail popup (Sprint 6) ===== */
.tmodal { position: fixed; inset: 0; z-index: 200; display: none; }
.tmodal.open { display: flex; align-items: center; justify-content: center; }
.tmodal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); }
.tmodal-card {
  position: relative; z-index: 1; width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px); overflow-y: auto;
  background: var(--bg-surface); border: 1px solid var(--border-strong, var(--border));
  border-radius: 14px; padding: 22px 22px 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.tmodal-x {
  position: absolute; top: 12px; right: 12px; width: 28px; height: 28px;
  border-radius: 8px; border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 1;
}
.tmodal-x:hover { color: var(--text-primary); border-color: var(--text-muted); }
.tmodal-title { margin: 0 28px 0 0; font-size: 17px; line-height: 1.3; color: var(--text-primary); }
.tmodal-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 4px; }
.tmodal-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
  color: var(--text-secondary); background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: 7px; padding: 3px 9px;
}
.tmodal-chip .mini-av { width: 16px; height: 16px; font-size: 8.5px; }
.tmodal-section { margin-top: 14px; }
.tmodal-lbl { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 5px; }
.tmodal-text { font-size: 13px; line-height: 1.5; color: var(--text-primary); white-space: pre-wrap; }
.tmodal-quote { font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); font-style: italic; }
.tmodal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.tmodal-btn {
  font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 9px;
  border: 1px solid transparent; cursor: pointer;
}
.tmodal-btn.done { background: var(--success, #28c76f); color: #06210f; }
.tmodal-btn.done:hover { filter: brightness(1.08); }
.tmodal-btn.reopen { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border); }
.tmodal-btn.reopen:hover { border-color: var(--text-muted); }
.tmodal-btn.ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.tmodal-btn.ghost:hover { color: var(--text-primary); border-color: var(--text-muted); }

/* Редактируемая модалка задачи (PATCH-форма) */
.tmodal-edit .tmodal-btn:not(.done):not(.ghost) { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border); }
.tmodal-edit .tmodal-btn:not(.done):not(.ghost):hover { border-color: var(--text-muted); }
.tme-title {
  width: 100%; box-sizing: border-box; font-size: 16px; font-weight: 600; color: var(--text-primary);
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
}
.tme-title:focus { border-color: var(--accent); }
.tme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 12px; margin-top: 14px; }
.tme-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.tme-grid select, .tme-grid input[type=date] {
  font-size: 13px; color: var(--text-primary); background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; text-transform: none; letter-spacing: 0; font-family: inherit;
}
.tme-grid select:focus, .tme-grid input:focus { border-color: var(--accent); }
.tme-desc {
  width: 100%; box-sizing: border-box; font-size: 13px; line-height: 1.5; color: var(--text-primary);
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  resize: vertical; font-family: inherit;
}
.tme-desc:focus { border-color: var(--accent); }
@media (max-width: 560px) { .tme-grid { grid-template-columns: 1fr; } }


/* Muted rows (cancelled/failed) */
.tt-row.muted .tt-title { color: var(--text-muted); text-decoration: line-through; }
.tt-row.muted .tt-desc  { color: var(--text-muted); }

.tt-due {
  font-size: 11px; color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}
.tt-due.bad { color: var(--danger); font-weight: 600; }

.tt-tag {
  font-size: 10px; color: var(--text-muted);
  padding: 3px 7px; border-radius: 4px;
  background: var(--bg-elevated);
  display: inline-flex; align-items: center; gap: 4px;
}
.tt-tag .ic { font-size: 11px; line-height: 1; }

/* Empty state */
.tt-empty {
  padding: 40px 24px; text-align: center;
}
.tt-empty-icon { font-size: 32px; margin-bottom: 8px; opacity: .7; }
.tt-empty-title { color: var(--text-secondary); font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.tt-empty-sub   { color: var(--text-muted); font-size: 11.5px; }

/* ============================================================
   AI CHAT (центр, внизу) — Sprint 2 stub
   ============================================================ */
.ai-chat {
  margin: 8px 24px 24px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-surface);
}
.ai-chat-form { display: flex; gap: 8px; }
.ai-chat-form input {
  flex: 1; background: var(--bg-elevated);
  border: 1px solid var(--border); color: var(--text-primary);
  padding: 10px 12px; border-radius: 6px; font-size: 13px;
  transition: border-color var(--t-base) var(--ease);
}
.ai-chat-form input:focus { border-color: var(--accent); }
.ai-chat-reply {
  margin-top: 10px;
  font-size: 12px; color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  min-height: 0;
}
.ai-chat-reply:empty { display: none; }
.ai-chat-reply .toast { margin: 0; }
.ai-chat-spin {
  display: inline-block; margin-top: 8px;
  font-size: 11px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ===== Habit-gate widget (Sprint 3.5 preflight) ===== */
.habit-gate {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 6px;
}
.habit-gate .hg-summary {
  font-size: 12px; font-weight: 500; line-height: 1.35;
  margin: 6px 0 8px; color: var(--text-primary);
}
.habit-gate .hg-bar {
  height: 4px; border-radius: 2px;
  background: var(--bg-elevated); overflow: hidden;
  margin-bottom: 8px;
}
.habit-gate .hg-bar-fill {
  height: 100%; border-radius: 2px;
  background: var(--accent);
  transition: width var(--t-slow) var(--ease);
}
.habit-gate .hg-stats {
  display: flex; flex-wrap: wrap; gap: 8px 12px;
  font-size: 10.5px; color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 6px;
}
.habit-gate .hg-stat b { color: var(--text-primary); font-weight: 600; }
.habit-gate .hg-stat.muted { color: var(--text-muted); }
.habit-gate .hg-hint {
  font-size: 11px; color: var(--text-muted); line-height: 1.4;
  padding-top: 4px;
}

/* Status colours */
.habit-gate-passed .hg-bar-fill { background: var(--success); }
.habit-gate-passed .hg-summary  { color: var(--success); }
.habit-gate-failing .hg-bar-fill { background: var(--danger); }
.habit-gate-failing .hg-summary  { color: var(--danger); }
.habit-gate-empty .hg-bar-fill   { background: var(--text-muted); }
.habit-gate-empty .hg-summary    { color: var(--text-secondary); }
/* in_progress stays accent (default) */

/* ===== Chat history container (Sprint 2.7) ===== */
.chat-history {
  max-height: 480px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 4px 4px 12px; margin-bottom: 10px;
  scroll-behavior: smooth;
}
.chat-history::-webkit-scrollbar { width: 6px; }
.chat-history::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.chat-history::-webkit-scrollbar-track { background: transparent; }

.chat-empty {
  text-align: center; padding: 28px 16px; color: var(--text-muted);
  font-size: 12.5px; line-height: 1.5;
}
.chat-empty-icon { font-size: 28px; margin-bottom: 6px; opacity: 0.6; }

.chat-turn {
  display: flex; flex-direction: column; gap: 6px;
}

.chat-bubble {
  padding: 9px 12px; border-radius: 10px;
  max-width: 92%; word-wrap: break-word;
  border: 1px solid var(--border);
}
.chat-bubble-meta {
  font-size: 10.5px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 4px; letter-spacing: 0.02em;
}
.chat-bubble-text {
  font-size: 13px; line-height: 1.5; color: var(--text-primary);
  white-space: pre-wrap;
}
.chat-bubble-text.md { white-space: normal; }

.chat-bubble-user {
  align-self: flex-end;
  background: var(--accent-soft);
  border-color: rgba(255, 107, 53, 0.25);
}
.chat-bubble-user .chat-bubble-meta { color: var(--accent); }

.chat-bubble-ai {
  align-self: flex-start;
  background: var(--bg-elevated);
}
.chat-bubble-ai .chat-bubble-meta { color: var(--success); }

.chat-bubble-sources {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.ai-chat-text {
  line-height: 1.55;
  color: var(--text-primary); font-family: 'Inter', sans-serif; font-size: 13px;
}
/* fallback for plain-text replies (no .md class) */
.ai-chat-text:not(.md) { white-space: pre-wrap; }

/* ===== Markdown typography inside AI replies ===== */
.ai-chat-text.md { font-size: 13.5px; }
.ai-chat-text.md > *:first-child { margin-top: 0; }
.ai-chat-text.md > *:last-child { margin-bottom: 0; }

.ai-chat-text.md p { margin: 0 0 10px; }
.ai-chat-text.md h1,
.ai-chat-text.md h2,
.ai-chat-text.md h3,
.ai-chat-text.md h4 {
  font-weight: 600; color: var(--text-primary);
  margin: 18px 0 8px; line-height: 1.3;
  letter-spacing: -0.005em;
}
.ai-chat-text.md h1 { font-size: 18px; }
.ai-chat-text.md h2 { font-size: 16px; }
.ai-chat-text.md h3 { font-size: 14px; color: var(--accent); }
.ai-chat-text.md h4 { font-size: 13px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }

.ai-chat-text.md strong { color: var(--text-primary); font-weight: 600; }
.ai-chat-text.md em { color: var(--text-secondary); font-style: italic; }
.ai-chat-text.md del { color: var(--text-muted); }

.ai-chat-text.md ul,
.ai-chat-text.md ol { margin: 0 0 10px; padding-left: 22px; }
.ai-chat-text.md li { margin: 3px 0; }
.ai-chat-text.md li > ul,
.ai-chat-text.md li > ol { margin: 4px 0 4px; }

.ai-chat-text.md a {
  color: var(--accent); text-decoration: underline;
  text-decoration-color: rgba(255,107,53,.4); text-underline-offset: 2px;
  transition: text-decoration-color var(--t-base) var(--ease);
}
.ai-chat-text.md a:hover { text-decoration-color: var(--accent); }

.ai-chat-text.md code {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 4px; color: var(--text-primary);
  word-break: break-word;
}
.ai-chat-text.md pre {
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 12px; margin: 0 0 12px;
  overflow-x: auto; font-size: 12px; line-height: 1.5;
}
.ai-chat-text.md pre code {
  background: transparent; border: 0; padding: 0; font-size: inherit;
  color: var(--text-primary);
}

.ai-chat-text.md blockquote {
  margin: 0 0 10px; padding: 6px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft); color: var(--text-secondary);
  border-radius: 0 4px 4px 0;
}
.ai-chat-text.md blockquote > *:last-child { margin-bottom: 0; }

.ai-chat-text.md hr {
  border: 0; border-top: 1px solid var(--border);
  margin: 16px 0;
}

.ai-chat-text.md table {
  border-collapse: collapse; width: 100%;
  margin: 0 0 12px; font-size: 12.5px;
  background: var(--bg-elevated); border-radius: 6px; overflow: hidden;
}
.ai-chat-text.md th,
.ai-chat-text.md td {
  padding: 6px 10px; text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.ai-chat-text.md th {
  background: var(--bg-surface); color: var(--text-secondary);
  font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.ai-chat-text.md tr:last-child td { border-bottom: 0; }
.ai-chat-sources {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border);
}
.ai-chat-sources-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.chip-source {
  font-size: 11px; color: var(--accent); font-weight: 600;
  padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-elevated); transition: border-color var(--t-base) var(--ease);
  word-break: break-all;
}
.chip-source:hover { border-color: var(--accent); }

/* ============================================================
   RIGHT RAIL
   ============================================================ */
.right-rail {
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  background: var(--bg-primary);
}
.rr-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg-primary); }
.rr-tab {
  flex: 1; padding: 11px 14px; font-size: 11.5px;
  color: var(--text-muted); font-weight: 500;
  border-right: 1px solid var(--border);
  cursor: pointer; position: relative;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: color var(--t-base) var(--ease), background var(--t-base) var(--ease);
}
.rr-tab:last-child { border-right: 0; }
.rr-tab:hover { color: var(--text-primary); background: var(--bg-surface); }
.rr-tab.active { color: var(--text-primary); background: var(--bg-surface); }
.rr-tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.rr-tab .b {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  background: var(--bg-elevated); padding: 1px 6px; border-radius: 3px;
  border: 1px solid var(--border); font-weight: 600;
}
.rr-tab.active .b {
  background: var(--accent-soft); color: var(--accent); border-color: transparent;
}

.rr-body {
  flex: 1; overflow-y: auto;
  padding: 14px 14px 0;
  scroll-behavior: smooth;
}
.rr-body::-webkit-scrollbar { width: 8px; }
.rr-body::-webkit-scrollbar-track { background: transparent; }
.rr-body::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 4px; }
.rr-body::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* AI Inbox draft cards */
.draft {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 13px; margin-bottom: 10px;
  background: var(--bg-surface); position: relative;
  transition: border-color var(--t-base) var(--ease),
              background var(--t-base) var(--ease),
              transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-base) var(--ease);
}
.draft:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.draft.focus {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(255, 107, 53, .07), transparent 70%);
  box-shadow: var(--shadow-accent);
}
.draft.focus::before {
  content: "↵"; position: absolute; top: 10px; right: 12px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--accent); font-weight: 600;
}
.d-head { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.d-src {
  font-size: 10.5px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; font-weight: 500;
}
.d-src .ico { font-size: 13px; line-height: 1; }
.d-time { margin-left: auto; font-size: 10px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.quote {
  font-size: 11.5px; color: var(--text-secondary);
  padding: 6px 10px; background: var(--bg-elevated);
  border-left: 2px solid var(--border-strong);
  margin-bottom: 10px; line-height: 1.45;
  border-radius: 0 4px 4px 0;
}
.quote .who { color: var(--text-primary); font-weight: 600; }
.d-target {
  font-size: 12px; color: var(--text-primary);
  margin-bottom: 10px; line-height: 1.4;
  display: flex; align-items: flex-start; gap: 8px;
}
.d-target .mi {
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 9.5px; font-weight: 700; color: #0A0A0B;
  display: grid; place-items: center; flex-shrink: 0; margin-top: 1px;
}
.d-target .tx { flex: 1; }
.d-target .tx .who-l {
  display: block; font-size: 10px; color: var(--text-muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px;
}
.d-actions { display: flex; gap: 6px; }

/* Generic buttons */
.btn {
  font-size: 11.5px; font-weight: 500;
  padding: 6px 10px; border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer;
  transition: all var(--t-base) var(--ease);
}
.btn:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text-primary); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary, .btn-primary {
  background: var(--accent); color: #0A0A0B;
  border-color: var(--accent); font-weight: 600;
}
.btn.primary:hover, .btn-primary:hover {
  background: #FF7E4D; color: #0A0A0B;
  box-shadow: 0 6px 16px -6px var(--accent-glow);
}
.btn.danger-ghost { color: var(--text-muted); }
.btn.danger-ghost:hover { color: var(--danger); border-color: rgba(239, 68, 68, .3); }
.btn.btn-ghost, .btn-ghost {
  background: transparent;
}
.btn.btn-block, .btn-block { width: 100%; padding: 10px 14px; font-size: 13px; }
.d-actions .btn { flex: 1; }

.btn .kbd {
  margin-left: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  background: rgba(0, 0, 0, .18); padding: 1px 5px; border-radius: 3px;
  font-weight: 600;
}

/* Alerts tab */
.alert-card {
  padding: 12px 13px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-surface);
  display: grid; grid-template-columns: auto 1fr; gap: 10px;
  cursor: pointer;
  transition: border-color var(--t-base) var(--ease),
              transform var(--t-fast) var(--ease-out),
              background var(--t-base) var(--ease);
}
.alert-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  background: var(--bg-elevated);
}
.alert-card .st { width: 3px; border-radius: 2px; align-self: stretch; }
.alert-card.danger .st { background: var(--danger); box-shadow: 0 0 10px rgba(239, 68, 68, .5); }
.alert-card.warn .st { background: var(--warning); box-shadow: 0 0 10px rgba(251, 191, 36, .4); }
.alert-card .at { font-size: 12px; color: var(--text-primary); line-height: 1.4; font-weight: 500; }
.alert-card .am { font-size: 10.5px; color: var(--text-muted); margin-top: 4px; font-family: 'JetBrains Mono', monospace; }
.alert-card .icn { font-size: 13px; margin-right: 4px; }

/* Knowledge widget */
.knowledge {
  border-top: 1px solid var(--border);
  padding: 14px;
  background: linear-gradient(180deg, var(--bg-surface), var(--bg-primary));
}
.know-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.know-ic {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 16px;
  border: 1px solid rgba(255, 107, 53, .18);
  flex-shrink: 0;
}
.know-t { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.know-t .ttl { font-size: 12.5px; font-weight: 600; color: var(--text-primary); letter-spacing: -.01em; }
.know-t .sub { font-size: 10.5px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.know-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10.5px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  padding: 0 2px 10px;
}
.know-meta .muted { color: var(--text-muted); font-style: italic; }
.ask-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #E04A12);
  color: #0A0A0B; font-weight: 600;
  padding: 9px 14px; border-radius: 7px; border: 0;
  font-size: 12.5px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
  transition: transform var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease);
  box-shadow: 0 4px 14px -4px var(--accent-glow), inset 0 -2px 4px rgba(0, 0, 0, .15);
}
.ask-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px -6px var(--accent-glow), inset 0 -2px 4px rgba(0, 0, 0, .15);
}
.ask-btn:active { transform: translateY(0); }
.ask-btn .ic { font-size: 14px; line-height: 1; }
.ask-btn .kbd {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  background: rgba(0, 0, 0, .18); padding: 2px 6px; border-radius: 3px;
  color: rgba(10, 10, 11, .7); font-weight: 600;
}

/* KB search (Sprint 2) */
.kb-search { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.kb-input {
  flex: 1; min-width: 0;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-primary); border-radius: 7px;
  padding: 8px 11px; font-size: 12.5px;
  transition: border-color var(--t-base) var(--ease);
}
.kb-input::placeholder { color: var(--text-muted); }
.kb-input:focus { border-color: var(--accent); }
.kb-spin {
  font-size: 10px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace; white-space: nowrap;
}
.htmx-indicator { opacity: 0; transition: opacity var(--t-base) var(--ease); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

.kb-results:empty { display: none; }
.kb-hit-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.kb-hit {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; background: var(--bg-surface);
  transition: border-color var(--t-base) var(--ease), transform var(--t-fast) var(--ease-out);
}
.kb-hit:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kb-hit-path {
  display: flex; align-items: baseline; gap: 4px;
  font-size: 11.5px; color: var(--accent); font-weight: 600;
}
.kb-hit-path:hover .kb-hit-file { text-decoration: underline; }
.kb-hit-file { word-break: break-all; }
.kb-hit-loc { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-muted); }
.kb-hit-head {
  font-size: 10.5px; color: var(--text-secondary); font-weight: 500;
  margin-top: 3px; line-height: 1.3;
}
.kb-hit-text {
  font-size: 11px; color: var(--text-muted); line-height: 1.45;
  margin-top: 4px; white-space: pre-wrap;
}
.kb-empty {
  font-size: 11.5px; color: var(--text-muted); font-style: italic;
  padding: 8px 2px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-shell {
  display: grid; place-items: center;
  height: 100vh; padding: 24px;
  background: radial-gradient(ellipse 800px 500px at 50% 0%, rgba(255, 107, 53, 0.06), transparent 70%),
              var(--bg-primary);
  overflow: auto;
}
.login-card {
  width: 100%; max-width: 380px;
  padding: 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
}
.login-brand {
  display: flex; align-items: center; gap: 14px; margin-bottom: 22px;
}
.login-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.login-sub {
  font-size: 11px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.04em;
  margin-top: 2px;
}
.login-help { font-size: 11.5px; color: var(--text-muted); margin-top: 12px; line-height: 1.5; }
.login-help.muted { color: var(--text-muted); opacity: 0.7; }
.login-error {
  margin-bottom: 14px; padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger); border-radius: 6px;
  font-size: 12px;
}
.login-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 14px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted);
}
.login-divider::before, .login-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.login-dev { display: flex; flex-direction: column; gap: 10px; }
.login-field { display: flex; flex-direction: column; gap: 5px; }
.login-field span {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 600;
}
.login-field input {
  background: var(--bg-elevated); border: 1px solid var(--border);
  padding: 9px 11px; border-radius: 6px; color: var(--text-primary);
  font-size: 13px; font-family: 'JetBrains Mono', monospace;
  transition: border-color var(--t-base) var(--ease);
}
.login-field input:focus { border-color: var(--accent); }
.login-dev-result:not(:empty) {
  margin-top: 12px; padding: 10px;
  border-radius: 6px; background: var(--bg-elevated);
  font-size: 12px; font-family: 'JetBrains Mono', monospace;
}

/* ============================================================
   TOAST SYSTEM
   ============================================================ */
.toast-root {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary); font-size: 12.5px;
  box-shadow: var(--shadow-lift);
  animation: fadeUp 220ms var(--ease-out);
  pointer-events: auto;
  max-width: 360px;
}
.toast-icon {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #0A0A0B;
  flex-shrink: 0;
}
.toast-info .toast-icon { background: #60A5FA; }
.toast-ok   .toast-icon { background: var(--success); }
.toast-warn .toast-icon { background: var(--warning); }
.toast-err  .toast-icon { background: var(--danger); color: #fff; }
.toast.fade-out { opacity: 0; transition: opacity 200ms ease; }

/* ============================================================
   Sprint 4 — live week calendar (event pills on the timeline track)
   ============================================================ */
.tl-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-height: 48px;
  height: 100%;
}
.tl-cell {
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-content: flex-start;
  min-width: 0;            /* allow ellipsis inside grid track */
}
.tl-cell.today   { background: var(--accent-soft); }
.tl-cell.weekend { background: rgba(255, 255, 255, .015); }
.tl-ev {
  font-size: 10.5px;
  line-height: 1.2;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border-left: 3px solid var(--text-secondary);
  color: var(--text-primary);
  /* 2 строки вместо обрезки в 1 — влезает больше слов задачи */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  cursor: grab;               /* draggable между днями (см. htmx-helpers.js) */
  text-decoration: none;
  transition: background var(--t-base) var(--ease), border-left-color var(--t-base) var(--ease);
}
.tl-ev.dragging { opacity: .4; }
.tl-cell.drop-target { background: var(--accent-soft); outline: 1px dashed var(--accent); outline-offset: -2px; }
.tl-ev:hover { background: var(--bg-hover, var(--accent-soft)); border-left-color: var(--accent); }
.tl-ev.active   { border-left-color: var(--accent); }
.tl-ev.progress { border-left-color: var(--warning); }
.tl-ev.done     { border-left-color: var(--success); opacity: .65; text-decoration: line-through; }
.tl-ev.frozen   { border-left-color: #67E8F9; }
.tl-ev.failed   { border-left-color: var(--danger); opacity: .7; }
.tl-ev.over     { border-left-color: var(--danger); background: rgba(239, 68, 68, .10); }
.tl-note {
  padding: 14px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-style: italic;
}

/* Honest Pulse placeholders — muted "—" so a stubbed value never reads as data. */
.kpi-stubbed .kpi-v { color: var(--text-muted); }

/* ============================================================
   Sprint 4 — "Сохранить инсайт" (collapsible KB append form)
   ============================================================ */
.insight-saver { margin-top: 10px; }
.insight-toggle { margin-bottom: 0; }
.insight-form {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: max-height var(--t-slow) var(--ease),
              opacity var(--t-base) var(--ease),
              padding var(--t-base) var(--ease),
              margin-top var(--t-base) var(--ease);
}
.insight-form.open {
  max-height: 360px;
  opacity: 1;
  padding: 12px;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-surface);
}
.insight-form input[type="text"],
.insight-form textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--text-primary);
  width: 100%;
  resize: vertical;
}
.insight-form input[type="text"]:focus,
.insight-form textarea:focus { border-color: var(--accent); }
.insight-actions { display: flex; gap: 8px; align-items: center; }

/* ============================================================
   Sprint 4 — audit log page (/rocket/admin/audit, founder-only)
   ============================================================ */
.audit-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 32px;
  height: 100vh;
  overflow: auto;
}
.audit-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 20px; }
.audit-back { color: var(--accent); font-size: 13px; font-weight: 600; }
.audit-head h1 { font-size: 20px; font-weight: 700; }
.audit-sub { color: var(--text-muted); font-size: 12px; }
.audit-table {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-surface);
}
.audit-row {
  display: grid;
  grid-template-columns: 60px 1.4fr 1.6fr 1fr 1.2fr;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  align-items: center;
}
.audit-row:last-child { border-bottom: 0; }
.audit-hd {
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}
.audit-action { color: var(--accent); font-weight: 600; }
.audit-target, .audit-ts { color: var(--text-secondary); font-size: 11.5px; }
.audit-empty { padding: 40px; text-align: center; color: var(--text-muted); }

/* Success toast (kind:"success" from approve + insight save). */
.toast-success .toast-icon { background: var(--success); }

/* ============================================================
   Sprint 5 — Pulse (живые KPI: касса-герой + плитки + freshness)
   ============================================================ */
.pulse { margin: 0 24px 4px; }
.pulse-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.pulse-fresh {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-right: auto;
}
.fresh-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 6px var(--success); flex-shrink: 0;
}
.fresh-dot.stale { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.fresh-dot.err   { background: var(--danger);  box-shadow: 0 0 6px var(--danger); }
.pulse-spin { font-size: 11px; color: var(--accent); }

.pulse-hero {
  border: 1px solid var(--border); border-radius: 12px;
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-surface));
  padding: 16px 18px; margin-bottom: 10px;
  box-shadow: var(--shadow-lift);
}
.ph-l { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.ph-period { color: var(--text-muted); text-transform: capitalize; }
.ph-mid { display: flex; align-items: flex-end; gap: 16px; margin: 4px 0 2px; }
.ph-v { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
.ph-spark { width: 120px; height: 36px; opacity: .9; }
.ph-d { font-size: 12px; font-weight: 600; }
.ph-d .arr { font-size: 10px; }
.ph-d.up   { color: var(--success); }
.ph-d.down { color: var(--danger); }
/* Sprint 5.5 — bot-lead attribution sub-line (lower bound, under the касса hero). */
.ph-attr { margin-top: 6px; font-size: 12px; color: var(--text-muted); cursor: help; }
.ph-attr b { color: var(--text); font-weight: 700; }
.ph-attr-share { color: var(--success); font-weight: 600; }
.ph-attr-deals { color: var(--text-muted); }
.pt-spark { width: 100%; height: 18px; opacity: .85; margin: 2px 0; display: block; }

.pulse-tiles {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.ptile {
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-surface); padding: 10px 12px;
  transition: border-color var(--t-base) var(--ease);
}
.ptile:hover, .ptile:focus-visible { border-color: var(--border-strong); }
.pt-l { font-size: 11px; color: var(--text-muted); }
.pt-v { font-size: 19px; font-weight: 700; margin: 3px 0; letter-spacing: -0.01em; }
.pt-d { font-size: 10.5px; font-family: 'JetBrains Mono', monospace; }
.pt-d.up   { color: var(--success); }
.pt-d.down { color: var(--danger); }
.pt-d.flat { color: var(--text-muted); }

/* ============================================================
   Sprint 6 — Collapsible blocks (свернуть/развернуть любой блок)
   ============================================================ */
.blk-toggle {
  font-size: 11px; line-height: 1; color: var(--text-muted);
  padding: 3px 6px; border-radius: 5px; flex: 0 0 auto;
  transition: color var(--t-fast), background var(--t-fast);
}
.blk-toggle:hover { color: var(--text-primary); background: var(--bg-elevated); }
.blk-hidden { display: none !important; }

/* Pulse collapse bar — stays outside #pulse so the toggle survives HTMX swaps. */
.pulse-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 24px 4px;
  font-size: 13px; font-weight: 600; color: var(--text-primary);
}

/* ============================================================
   Sprint 6 — Rich task cards (priority · inline deadline · source quote)
   ============================================================ */
.tt-title-row { display: flex; align-items: center; gap: 7px; }
.tt-title-text { flex: 1 1 auto; min-width: 0; }

.tt-prio {
  flex: 0 0 auto; font-size: 11px; line-height: 1; cursor: pointer;
  padding: 2px 4px; border-radius: 5px; color: var(--text-secondary);
  background: var(--bg-elevated); border: 1px solid var(--border);
  -webkit-appearance: none; appearance: none;
}
.tt-prio.prio-high   { color: #FCA5A5; border-color: rgba(239, 68, 68, .35); }
.tt-prio.prio-normal { color: var(--text-muted); }
.tt-prio.prio-low    { color: var(--text-muted); opacity: .8; }
.tt-prio option { background: var(--bg-surface); color: var(--text-primary); }

/* High-priority rows get a left accent stripe. */
.tt-row.prio-row-high { box-shadow: inset 3px 0 0 var(--danger); }

.tt-quote {
  margin-top: 3px; font-size: 11.5px; color: var(--text-muted);
  font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Sprint 6 — "Закрыть?" suggestion: AI thinks this task is done. */
.tt-complete-suggest {
  margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--success, #28c76f) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--success, #28c76f) 35%, transparent);
}
.tt-cs-label { font-size: 11.5px; color: var(--text-secondary); flex: 1 1 auto; min-width: 0; }
.tt-cs-actions { display: inline-flex; gap: 6px; flex: 0 0 auto; }
.tt-cs-yes, .tt-cs-no {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 5px;
  cursor: pointer; border: 1px solid transparent;
}
.tt-cs-yes { background: var(--success, #28c76f); color: #06210f; }
.tt-cs-yes:hover { filter: brightness(1.08); }
.tt-cs-no {
  background: transparent; color: var(--text-muted); border-color: var(--border);
}
.tt-cs-no:hover { color: var(--text-primary); border-color: var(--text-muted); }

.tt-due-input {
  width: 100%; font-size: 12px; color: var(--text-secondary);
  background: transparent; border: 1px solid transparent; border-radius: 5px;
  padding: 2px 4px; cursor: pointer; color-scheme: dark;
}
.tt-due-input:hover { border-color: var(--border); }
.tt-due-input:focus { border-color: var(--accent); color: var(--text-primary); }

/* ============================================================
   R2 — XP progression bar (claim polish · dopamine)
   The R1 template ships .xp-* hooks with NO styles — the reward jar
   was a slot machine that didn't light up. This makes it glow: smooth
   fill (animated in htmx-helpers.js on swap), a breathing claim CTA,
   level-up celebration, and a promoted streak chip. Sound cues also
   live in htmx-helpers.js.
   ============================================================ */
.xp-bar { border-top: 1px solid var(--border); margin-top: 6px; }

/* Rail header trail — mute toggle + streak chip. */
.xp-rail-trail { display: inline-flex; align-items: center; gap: 8px; }

/* Sound mute toggle. */
.xp-mute {
  background: transparent; border: 0; cursor: pointer;
  color: var(--text-muted); font-size: 12px; line-height: 1; padding: 0 1px;
  transition: color var(--t-base) var(--ease), transform var(--t-fast) var(--ease-out);
}
.xp-mute:hover { color: var(--text-primary); transform: scale(1.12); }

/* Streak chip — promoted from the old grey 10px text. */
.xp-streak {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-family: 'JetBrains Mono', monospace; font-weight: 600;
  padding: 1px 7px; border-radius: 10px;
  color: var(--text-muted);
}
.xp-streak.on { color: var(--warning); background: rgba(251, 191, 36, .12); }
.xp-streak.record {                               /* personal best — gold glow */
  color: #FFD24A; background: rgba(255, 200, 61, .16);
  box-shadow: 0 0 8px -2px rgba(255, 200, 61, .55);
}
.xp-streak.zero { color: var(--text-muted); opacity: .55; background: transparent; }

/* Level line: LVL N · Name */
.xp-level { display: flex; align-items: baseline; gap: 8px; padding: 2px 6px 7px; }
.xp-lvl-num { font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--accent); }
.xp-lvl-name { font-size: 13px; font-weight: 600; color: var(--text-primary); letter-spacing: -.01em; }

/* Progress track + animated fill (accent→gold). The width transition fires
   when htmx-helpers.js replays the old→new width after an outerHTML swap. */
.xp-track {
  height: 8px; border-radius: 5px; margin: 0 6px; overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35);
}
.xp-fill {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--accent), #FFC83D);
  box-shadow: 0 0 10px -2px var(--accent-glow);
  transition: width 800ms var(--ease-out);
}
.xp-meta { font-size: 10px; color: var(--text-muted); padding: 6px 6px 0; }

/* Claim CTA — hero of the rail: gold gradient + breathing pulse so a full
   jar visually "asks" to be tapped. */
@keyframes xpBreath {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 200, 61, 0), 0 4px 14px -4px var(--accent-glow); transform: translateY(0); }
  50%      { box-shadow: 0 0 0 4px rgba(255, 200, 61, .12), 0 8px 22px -6px var(--accent-glow); transform: translateY(-1px); }
}
.xp-claim-btn {
  width: 100%; margin-top: 10px;
  padding: 9px 12px; border: 0; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #FFC83D);
  color: #0A0A0B; font-weight: 700; font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  animation: xpBreath 2.4s var(--ease) infinite;
  transition: transform var(--t-base) var(--ease-out), filter var(--t-base) var(--ease);
}
.xp-claim-btn:hover { transform: translateY(-1px); filter: brightness(1.06); animation-play-state: paused; }
.xp-claim-btn:active { transform: translateY(0); }

/* Claimed banner — celebration after banking the jar (auto-fades via JS). */
@keyframes xpGlow {
  0%  { opacity: 0; transform: translateY(6px) scale(.96); }
  18% { opacity: 1; transform: translateY(0) scale(1); }
  100%{ opacity: 1; transform: none; }
}
.xp-claimed {
  margin-top: 10px; padding: 9px 11px; border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 200, 61, .16), var(--accent-soft));
  border: 1px solid rgba(255, 200, 61, .35);
  color: var(--text-primary); font-size: 12px; font-weight: 600;
  text-align: center; line-height: 1.4;
  animation: xpGlow 440ms var(--ease-out) both;
}

/* Level-up — the whole bar pulses gold and the new level name shimmers big. */
@keyframes xpLevelPulse {
  0%  { box-shadow: 0 0 0 0 rgba(255, 200, 61, 0); }
  30% { box-shadow: 0 0 0 2px rgba(255, 200, 61, .5), 0 0 30px -2px rgba(255, 200, 61, .5); }
  100%{ box-shadow: 0 0 0 0 rgba(255, 200, 61, 0); }
}
.xp-levelup { border-radius: 10px; animation: xpLevelPulse 2.4s var(--ease) both; }
.xp-levelup .xp-lvl-name {
  font-size: 15px;
  background: linear-gradient(90deg, var(--accent), #FFE08A, var(--accent));
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 1.6s ease-in-out 2;
}

/* Skills mini-list (secondary). */
.xp-skills { display: flex; flex-wrap: wrap; gap: 5px; padding: 9px 6px 0; }
.xp-skill {
  font-size: 9.5px; color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 7px; border-radius: 10px;
  background: var(--bg-elevated); border: 1px solid var(--border);
}
.xp-skill b { color: var(--accent); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .xp-fill { transition: none; }
  .xp-claim-btn, .xp-claimed, .xp-levelup, .xp-levelup .xp-lvl-name { animation: none; }
}

/* ============================================================
   Misc
   ============================================================ */
[hidden] { display: none !important; }

/* ============================================================
   TEAM MEMBER CARD (modal) — Sprint 4
   ============================================================ */
.tmodal-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tmodal-chip.chip-danger { color: var(--danger); border-color: rgba(239, 68, 68, .35); }

.tm-tasklist { display: flex; flex-direction: column; gap: 4px; }
.tm-task {
  display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  background: var(--bg-surface); border: 1px solid var(--border);
  transition: background var(--t-base) var(--ease), border-color var(--t-base) var(--ease),
              transform var(--t-fast) var(--ease-out);
}
.tm-task:hover { background: var(--bg-elevated); border-color: var(--border-strong); transform: translateX(2px); }
.tm-task.overdue { border-color: rgba(239, 68, 68, .3); }
.tm-task-prio { text-align: center; font-size: 12px; }
.tm-task-title { font-size: 13px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-task-dl {
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--text-muted); white-space: nowrap;
}
.tm-task-dl.over { color: var(--danger); }

/* ============================================================
   Dense Pulse — операционная приборка (поток / журнал / воронка / деньги)
   Заменяет разрежённые .pulse-hero+.pulse-tiles. Плотность через таблицы +
   моно-числа; цвет ТОЛЬКО на дельтах; разделение elevation'ом, не клетками.
   ============================================================ */
.num {
  font-family: 'JetBrains Mono', monospace;
  font-feature-settings: 'tnum' 1;
  text-align: right;
}
/* единый цвет дельт по всей приборке */
.pulse-flow .up, .mini .up, .pm-d.up { color: var(--success); }
.pulse-flow .down, .mini .down, .pm-d.down { color: var(--danger); }
.pulse-flow .flat, .mini .flat, .pm-d.flat { color: var(--text-muted); }
.pulse-flow .arr, .pm-d .arr { font-size: 9px; margin-right: 2px; }

/* (1) Поток поездок */
.pulse-flow {
  border: 1px solid var(--border); border-radius: 12px;
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-surface));
  padding: 8px 14px; margin-bottom: 8px; box-shadow: var(--shadow-lift);
}
.pf-row {
  display: grid;
  grid-template-columns: 78px 54px 54px 84px 1fr 92px;
  align-items: center; column-gap: 8px; height: 30px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.pf-row > span:not(.pf-cat):not(.pf-delta):not(.pf-spark) { text-align: right; }
.pf-head {
  height: 24px; border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-muted);
}
.pf-head > span:not(.pf-cat):not(.pf-delta):not(.pf-sparkh) { text-align: right; }
.pf-head .pf-delta, .pf-head .pf-sparkh { text-align: right; }
.pf-cat { font-size: 11px; text-transform: uppercase; letter-spacing: .02em; color: var(--text-secondary); font-weight: 600; }
.pf-row .num { font-size: 14px; color: var(--text-primary); }
.pf-delta { font-size: 11px; text-align: right; }
.pf-spark { display: block; }
.pf-spark svg { width: 100%; height: 20px; display: block; opacity: .85; }
.pf-unit { color: var(--text-muted); font-size: 10.5px; }
.pf-total { border-bottom: none; border-top: 1px solid rgba(255,255,255,.12); }
.pf-total .pf-cat, .pf-total .num { font-weight: 700; }

/* (1b) Сегментная касса — деньги по категориям (выручка, чек/чел, доля) */
.pulse-seg {
  border: 1px solid var(--border); border-radius: 12px;
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-surface));
  padding: 6px 14px; margin-bottom: 8px; box-shadow: var(--shadow-lift);
}
.ps-row {
  display: grid;
  grid-template-columns: 78px 1fr 1fr 64px;
  align-items: center; column-gap: 8px; height: 28px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.ps-row:last-child { border-bottom: none; }
.ps-row > span:not(.ps-cat) { text-align: right; }
.ps-head {
  height: 22px; border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-muted);
}
.ps-cat { font-size: 11px; text-transform: uppercase; letter-spacing: .02em; color: var(--text-secondary); font-weight: 600; }
.ps-row .num { font-size: 14px; color: var(--text-primary); }
.ps-row .num.muted { color: var(--text-muted); font-size: 12.5px; }
.ps-total { border-top: 1px solid rgba(255,255,255,.12); }
.ps-total .ps-cat, .ps-total .num { font-weight: 700; }
/* автобус: загрузка/рейс со стрелкой тренда + маржа/рейс под долей */
.ps-row .num.up { color: var(--success); }
.ps-row .num.down { color: var(--danger); }
.ps-row .arr { font-size: 9px; margin-right: 2px; }
.ps-share { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.ps-margin { font-size: 10.5px; font-weight: 600; }
.ps-margin.pos { color: var(--success); }
.ps-margin.neg { color: var(--danger); }
.ps-note { font-size: 10.5px; color: var(--text-muted); margin: 6px 2px 0; line-height: 1.4; }
.ps-note b { color: var(--text-secondary); font-weight: 700; }
.ps-note b.pos { color: var(--success); }
.ps-note b.neg { color: var(--danger); }

/* (2) Журнал 14 дней — за кнопкой (details), свёрнут по умолчанию */
.pulse-drawer { margin-bottom: 8px; }
.pulse-drawer > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-surface); font-size: 12px; font-weight: 600; color: var(--text-secondary);
  transition: border-color var(--t-fast), color var(--t-fast);
}
.pulse-drawer > summary::-webkit-details-marker { display: none; }
.pulse-drawer > summary::marker { content: ''; }
.pulse-drawer > summary:hover { border-color: var(--border-strong); color: var(--text-primary); }
.pulse-drawer .pd-ar { font-size: 10px; color: var(--text-muted); transition: transform var(--t-fast); display: inline-block; }
.pulse-drawer[open] .pd-ar { transform: rotate(90deg); }
.pulse-drawer .pd-hint { margin-left: auto; font-size: 10.5px; font-weight: 400; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.pulse-drawer[open] > summary { border-radius: 10px 10px 0 0; border-bottom: none; }
.pulse-journal {
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-elevated); overflow: hidden;
}
.pulse-drawer[open] .pulse-journal { border-radius: 0 0 10px 10px; border-top: none; }
.pulse-journal table { width: 100%; border-collapse: collapse; }
.pulse-journal th {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-muted); font-weight: 600; text-align: right;
  padding: 7px 10px; background: var(--bg-elevated); position: sticky; top: 0;
}
.pulse-journal th.l { text-align: left; }
.pulse-journal td {
  padding: 0 10px; height: 29px; font-size: 13px; color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.pulse-journal td.num { font-family: 'JetBrains Mono', monospace; font-feature-settings: 'tnum' 1; text-align: right; }
.pulse-journal td.dow { color: var(--text-secondary); font-size: 12px; }
.pulse-journal td.dow.we { color: var(--text-muted); }
.pulse-journal .grp { padding-left: 16px; }   /* группировка близостью, без линий */
.pulse-journal td.grp.num { font-weight: 600; }
.pulse-journal .kassa { text-align: right; white-space: nowrap; }
.pulse-journal .kassa .kv { font-family: 'JetBrains Mono', monospace; font-feature-settings: 'tnum' 1; }
.daybar {
  display: inline-block; width: 56px; height: 4px; margin-left: 8px;
  background: var(--accent-soft); border-radius: 2px; vertical-align: middle; overflow: hidden;
}
.daybar > span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.pulse-journal tfoot td {
  border-top: 2px solid var(--border); border-bottom: none;
  font-weight: 700; background: var(--bg-elevated); position: sticky; bottom: 0;
}
.pulse-journal .jempty { text-align: center; color: var(--text-muted); padding: 24px; }

/* (3-4) ряд потеряшки | воронка */
.pulse-row3 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.pulse-card { border: 1px solid var(--border); border-radius: 10px; background: var(--bg-surface); padding: 10px 12px; }
.pc-h { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.mini { width: 100%; border-collapse: collapse; }
.mini td { padding: 4px 0; font-size: 13px; color: var(--text-primary); }
.mini td:first-child { color: var(--text-secondary); font-size: 12px; }
.mini td.num { font-family: 'JetBrains Mono', monospace; font-feature-settings: 'tnum' 1; text-align: right; color: var(--text-primary); }
.mini td.muted { color: var(--text-muted); }
.mini tr.sep td { border-top: 1px solid rgba(255,255,255,.07); padding-top: 7px; }
.mini.funnel td.sp { width: 76px; }
.mini.funnel td.sp svg { width: 100%; height: 14px; display: block; opacity: .8; }
.pc-cap { margin-top: 7px; font-size: 10.5px; color: var(--text-muted); }

/* (5) Деньги — контекст (вторично, подавлено) */
.pulse-money {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1px; background: var(--border); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; margin-bottom: 4px;
}
.pm-cell { background: var(--bg-surface); padding: 8px 11px; }
.pm-l { font-size: 10px; text-transform: uppercase; letter-spacing: .02em; color: var(--text-muted); }
.pm-v { font-size: 17px; font-weight: 700; color: var(--text-primary); margin: 2px 0 1px; letter-spacing: -0.01em; }
.pm-d { font-size: 10.5px; }
.pm-d.flat { color: var(--text-muted); }
.pm-note { font-size: 10.5px; color: var(--text-muted); margin: 5px 2px 0; }

@media (max-width: 1100px) {
  .pulse-money { grid-template-columns: repeat(2, 1fr); }
  .pulse-row3 { grid-template-columns: 1fr; }
}

/* ============================================================
   CRM FUNNEL BOARD (S3) — read-only kanban сделок (/rocket/crm)
   ============================================================ */
.crm-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.crm-head { padding: 16px 22px 12px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.crm-back { color: var(--text-secondary); font-size: 12.5px; }
.crm-back:hover { color: var(--accent); }
.crm-h1 { font-size: 18px; font-weight: 700; margin: 6px 0 3px; }
.crm-sub { color: var(--text-muted); font-size: 12px; }
.crm-viewmode {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary);
  font-size: 11px; font-weight: 500;
}

/* Board — горизонтальный скролл колонок; каждая колонка скроллит карточки вертикально. */
.crm-board { flex: 1 1 auto; display: flex; gap: 12px; padding: 14px 18px 18px; overflow-x: auto; overflow-y: hidden; }
.crm-col {
  flex: 0 0 270px; display: flex; flex-direction: column; max-height: 100%;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.crm-col--terminal { opacity: .82; }                 /* won/lost — слегка приглушены (вне активной воронки) */
.crm-col-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--stage-color, var(--border-strong));
  flex: 0 0 auto; background: var(--bg-elevated);
}
.crm-col-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.crm-col-stat { font-size: 11px; font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.crm-col-cards { flex: 1 1 auto; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.crm-col-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 14px 0; }

/* Стеки свежести внутри колонки (анти-«каша»): шапка-разделитель, клик = свернуть/развернуть.
   Шапка и карточки — сиблинги (SortableJS видит .crm-card прямыми детьми → драг цел). */
.crm-stack-head {
  display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em; color: var(--text-muted);
  text-transform: uppercase; padding: 5px 4px 3px; margin-top: 2px;
  border-top: 1px solid var(--border);
}
.crm-stack-head:first-child { border-top: none; margin-top: 0; }
.crm-stack-caret { font-size: 10px; transition: transform var(--t-fast); color: var(--text-secondary); }
.crm-stack-head.is-collapsed .crm-stack-caret { transform: rotate(-90deg); }
.crm-stack-label { flex: 1 1 auto; }
.crm-stack-n {
  flex: 0 0 auto; font-weight: 700; color: var(--text-secondary);
  background: rgba(0,0,0,.22); border-radius: 5px; padding: 0 6px; font-variant-numeric: tabular-nums;
}
.crm-stack-head:hover { color: var(--text-secondary); }

/* Deal card — кликабельна (drill-down), но НЕ перетаскивается (drag = S5; «режим просмотра»). */
.crm-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 11px; cursor: pointer; min-height: 54px; transition: border-color var(--t-fast), transform var(--t-fast);
}
.crm-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.crm-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.crm-card--stale { border-left: 3px solid var(--danger); }   /* rotting: дней без активности > порога */
/* S4 редизайн карточки: строка1 имя↔сумма+давность, строка2 стикеры */
.crm-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.crm-card-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
.crm-card-right { flex: 0 0 auto; display: inline-flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.crm-card-val { font-size: 13px; font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums; }
.crm-card-age { font-size: 10.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.crm-card-age.bad { color: var(--danger); font-weight: 600; }
.crm-card-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 7px; }
.crm-tag {
  font-size: 10.5px; font-weight: 600; color: var(--text-secondary);
  background: rgba(0,0,0,.18); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 6px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.crm-tag-tx { font-weight: 400; font-size: 12px; }
.crm-tag-visa45 { color: #14b8a6; border-color: rgba(20,184,166,.35); background: rgba(20,184,166,.1); }
.crm-tag-visa90 { color: #8b5cf6; border-color: rgba(139,92,246,.35); background: rgba(139,92,246,.1); }
.crm-more {
  margin-top: 4px; padding: 7px; border-radius: 8px; border: 1px dashed var(--border-strong);
  background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 500; cursor: pointer;
}
.crm-more:hover { color: var(--text-primary); border-color: var(--text-muted); }

/* Drill-down модалка контакта (тело #crm-modal-body; обёртка .tmodal общая). */
.crm-cd-aifields { display: flex; flex-direction: column; gap: 5px; }
.crm-cd-aif { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.crm-cd-aif-badge { font-size: 11px; opacity: .85; }
.crm-cd-aif-badge.pinned { opacity: 1; }
.crm-cd-aif-key { color: var(--text-muted); min-width: 92px; }
.crm-cd-aif-val { color: var(--text-primary); font-weight: 500; }
.crm-cd-aif-conf { color: var(--text-muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.crm-cd-deals { display: flex; flex-direction: column; gap: 6px; }
.crm-cd-deal { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.crm-cd-deal-stage {
  flex: 0 0 auto; font-size: 10.5px; padding: 1px 7px; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary);
}
.crm-cd-deal-title { flex: 1 1 auto; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-cd-deal-amt { flex: 0 0 auto; color: var(--success); font-weight: 600; }
.crm-cd-acts { display: flex; flex-direction: column; gap: 7px; max-height: 280px; overflow-y: auto; }
.crm-cd-act { display: flex; flex-direction: column; gap: 1px; padding: 6px 9px; border-radius: 9px; max-width: 88%; }
.crm-cd-act.in { align-self: flex-start; background: var(--bg-elevated); border: 1px solid var(--border); }
.crm-cd-act.out { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-glow); }
.crm-cd-act-body { font-size: 12.5px; line-height: 1.4; color: var(--text-primary); white-space: pre-wrap; word-break: break-word; }
.crm-cd-act-ts { font-size: 10px; color: var(--text-muted); }
/* Старые сообщения под катом (Таня-3): свой flex-контейнер, чтобы пузыри in/out
   сохраняли лево/право-выравнивание внутри <details>. */
.crm-cd-older { display: flex; flex-direction: column; gap: 7px; }
.crm-cd-older-sum { align-self: center; font-size: 11px; color: var(--text-muted); cursor: pointer; padding: 4px 0; user-select: none; }
.crm-cd-older-sum:hover { color: var(--text-primary); }
.crm-cd-empty { color: var(--text-muted); font-size: 13px; padding: 8px 0; }

/* ===== CRM S5 — рабочая доска (drag · inline-edit · pin · lost · offer) ===== */
.crm-col-cards { min-height: 48px; }                 /* пустая колонка принимает drop */
.crm-card { cursor: grab; }
.crm-card:active { cursor: grabbing; }
.crm-card--ghost { opacity: .4; background: var(--accent-soft); border: 1px dashed var(--accent); }

/* inline-edit: пунктир-аффорданс + поле ввода */
.crm-edit { cursor: text; border-bottom: 1px dashed transparent; transition: border-color var(--t-fast) var(--ease); }
.crm-edit:hover { border-bottom-color: var(--border-strong); }
.crm-edit-notes { display: block; min-height: 18px; }
.crm-edit-input {
  font: inherit; color: var(--text-primary); background: var(--bg-primary);
  border: 1px solid var(--accent); border-radius: 6px; padding: 2px 6px; width: 100%;
  min-width: 80px; outline: none;
}
textarea.crm-edit-input { min-height: 64px; resize: vertical; line-height: 1.4; }

/* pin AI-поля */
.crm-cd-hint { color: var(--text-muted); font-weight: 400; font-size: 10.5px; }
.crm-cd-aif-pin {
  margin-left: auto; font-size: 12px; line-height: 1; padding: 2px 6px; border-radius: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary);
  transition: all var(--t-fast) var(--ease);
}
.crm-cd-aif-pin:hover { border-color: var(--accent); color: var(--accent); }

/* причина потери на сделке */
.crm-cd-deal-lost { font-size: 11px; color: var(--danger); white-space: nowrap; }

/* ── S5.2 карточка-редизайн: шапка + qual-светофор ── */
.crm-cd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-right: 28px; }
.crm-cd-head .tmodal-title { margin: 0; flex: 1 1 auto; }
.crm-qual-badge {
  flex: 0 0 auto; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border-radius: 7px; padding: 3px 10px; border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}
.crm-qual-hot  { color: var(--danger);  background: rgba(239, 68, 68, .12);  border-color: rgba(239, 68, 68, .35); }
.crm-qual-warm { color: var(--warning); background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .35); }
.crm-qual-cold { color: var(--text-muted); background: var(--bg-elevated); border-color: var(--border); }

/* ── ссылка на человека (tg) ── */
.crm-tg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 2px; font-size: 12px; }
.crm-tg-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.crm-tg-link:hover { text-decoration: underline; }
.crm-tg-id { color: var(--text-muted); cursor: pointer; font-variant-numeric: tabular-nums; border-bottom: 1px dashed transparent; }
.crm-tg-id:hover { border-bottom-color: var(--border-strong); color: var(--text-secondary); }

/* ── плашка стикеров: ФАКТЫ (транспорт/e-visa/дата/канал) ── */
.crm-stickers { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.crm-sticker {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600;
  border-radius: 7px; padding: 3px 9px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-secondary); white-space: nowrap;
}
.crm-st-air  { color: var(--accent);  background: var(--accent-soft);      border-color: var(--accent-glow); }
.crm-st-auto { color: var(--warning); background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .35); }
.crm-st-bus  { color: var(--success); background: rgba(34, 197, 94, .12);  border-color: rgba(34, 197, 94, .35); }
.crm-st-evisa{ color: var(--success); background: rgba(34, 197, 94, .12);  border-color: rgba(34, 197, 94, .35); }
.crm-st-date { color: var(--text-primary); cursor: text; }
.crm-st-chan { font-weight: 500; }
.crm-chan-bot    { color: #8b5cf6; background: rgba(139, 92, 246, .12); border-color: rgba(139, 92, 246, .35); }
.crm-chan-lichka { color: #14b8a6; background: rgba(20, 184, 166, .12); border-color: rgba(20, 184, 166, .35); }
.crm-st-add { color: var(--text-muted); border-style: dashed; font-weight: 400; cursor: default; }
.crm-st-visa45 { color: #14b8a6; background: rgba(20, 184, 166, .12); border-color: rgba(20, 184, 166, .35); }
.crm-st-visa90 { color: #8b5cf6; background: rgba(139, 92, 246, .12); border-color: rgba(139, 92, 246, .35); }

/* ── платежи (реальные из OCR) ── */
.crm-pays { display: flex; flex-direction: column; gap: 5px; }
.crm-pay { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; font-size: 12px; }
.crm-pay-date { color: var(--text-muted); }
.crm-pay-amt { color: var(--success); font-weight: 600; }
.crm-pay-orig { color: var(--text-muted); font-weight: 400; }
.crm-pay-method { color: var(--text-secondary); font-size: 11px; }
.crm-pay-ok { color: var(--success); }

/* ── S4 Аналитика воронки (дашборд) ── */
.crm-an-link { margin-left: 8px; }
.crm-an-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-top: 16px; align-items: start; }
@media (max-width: 760px) { .crm-an-grid { grid-template-columns: 1fr; } }
.crm-an-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.crm-an-lbl { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.crm-fbar-row { display: grid; grid-template-columns: 130px 1fr 48px; align-items: center; gap: 10px; margin-bottom: 7px; }
.crm-fbar-name { font-size: 12px; color: var(--text-secondary); text-align: right; }
.crm-fbar-track { position: relative; height: 22px; background: var(--bg-base, rgba(0,0,0,.2)); border-radius: 6px; overflow: hidden; }
.crm-fbar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-soft), var(--accent)); border-radius: 6px; min-width: 2px; transition: width var(--t-med, .3s) var(--ease); }
.crm-fbar-n { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11.5px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.crm-fbar-conv { font-size: 11.5px; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.crm-fbar-row.is-leak .crm-fbar-conv { color: var(--danger); font-weight: 700; }
.crm-an-leak { margin-top: 12px; font-size: 12px; color: var(--text-secondary); padding: 8px 10px; background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.25); border-radius: 8px; }
.crm-an-big { font-size: 26px; font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums; }
.crm-an-sub2 { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
.crm-an-attn { margin-top: 14px; }
.crm-attn-list { display: flex; flex-direction: column; gap: 4px; }
.crm-attn-row { display: grid; grid-template-columns: 42px 1fr 130px 90px; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.crm-attn-row:hover { background: var(--bg-elevated); border-color: var(--border-strong); }

/* ── S5 Рейсы (операционный вид) ── */
.crm-trips-empty { margin-top: 24px; padding: 22px; text-align: center; color: var(--text-muted);
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px; font-size: 13.5px; }
.crm-trips-day { margin-top: 18px; }
.crm-trips-date { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 0 0 10px;
  letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.crm-trips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.crm-trip-card { display: flex; flex-direction: column; gap: 8px; padding: 14px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px;
  text-decoration: none; color: inherit; transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.crm-trip-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.crm-trip-card-st-cancelled { opacity: .55; }
.crm-trip-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.crm-trip-card-vh { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.crm-trip-card-time { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.crm-trip-card-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.crm-trip-card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.crm-trip-card-seats { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.crm-trip-card-seats.is-full { color: var(--danger, #EF4444); }
.crm-trip-card-status { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--bg-surface); border: 1px solid var(--border); }
/* статус рейса (общие — также для блока рейса в карточке контакта, S4) */
.crm-trip-st-planned { color: var(--text-muted); }
.crm-trip-st-confirmed { color: var(--success, #34D399); }
.crm-trip-st-departed { color: var(--accent, #60A5FA); }
.crm-trip-st-cancelled { color: var(--danger, #EF4444); }

/* ── S5 Детали рейса (пассажиры) ── */
.crm-trip-d-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 8px;
  font-size: 13px; color: var(--text-secondary); }
.crm-trip-d-seats { font-weight: 600; font-variant-numeric: tabular-nums; }
.crm-trip-d-seats.is-full { color: var(--danger, #EF4444); }
.crm-pax-row { cursor: pointer; }
.crm-pax-name { font-weight: 500; color: var(--text-primary); }
.crm-pax-stage { font-size: 12px; padding: 2px 8px; border-radius: 20px; background: var(--bg-surface);
  border: 1px solid var(--border); color: var(--text-secondary); }
.crm-attn-qual { font-weight: 700; color: var(--danger); font-variant-numeric: tabular-nums; }
.crm-attn-name { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-attn-stage { font-size: 11.5px; color: var(--text-secondary); }
.crm-attn-ts { font-size: 11px; color: var(--text-muted); }

/* ── переключатель воронок Бот/Личка (channel-split) ── */
.crm-chan-switch { display: inline-flex; gap: 4px; margin-top: 8px; }
.crm-chan-tab {
  font-size: 12px; text-decoration: none; color: var(--text-secondary);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 7px; padding: 4px 11px; transition: all var(--t-fast) var(--ease);
}
.crm-chan-tab:hover { border-color: var(--border-strong); color: var(--text-primary); }
.crm-chan-tab.is-active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-glow); font-weight: 600; }

/* бот-сделка в обзорном виде «Все» — цвет-маркировка (воронки видно раздельно) */
.crm-card--bot { border-left: 3px solid #8b5cf6; }
.crm-card-bot { color: #8b5cf6; margin-right: 4px; }

/* ── повторные поездки (кружок + история из ops-Excel) ── */
.crm-repeat { margin: 8px 0; font-size: 12px; }
.crm-repeat > summary { cursor: pointer; color: var(--text-secondary); list-style: none; user-select: none; display: inline-flex; align-items: center; gap: 7px; }
.crm-repeat > summary::-webkit-details-marker { display: none; }
.crm-repeat-circle {
  display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px;
  padding: 0 7px; border-radius: 12px; font-weight: 700; font-size: 12px;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-glow);
}
.crm-repeat-list { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 4px; padding-left: 4px; }
.crm-repeat-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-secondary); }
.crm-repeat-date { color: var(--text-muted); }
.crm-repeat-amt { color: var(--success); font-weight: 600; }
.crm-repeat-svc { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* ── строка источника ── */
.crm-cd-srcrow { font-size: 12.5px; color: var(--text-secondary); margin: 8px 0 4px; }

/* ── AI-профиль свёрнут (<details>) ── */
.crm-cd-ai { margin-top: 14px; border: 1px solid var(--border); border-radius: 9px; padding: 4px 10px; background: var(--bg-elevated); }
.crm-cd-ai > summary { cursor: pointer; font-size: 12px; color: var(--text-secondary); padding: 5px 0; list-style: none; user-select: none; }
.crm-cd-ai > summary::-webkit-details-marker { display: none; }
.crm-cd-ai > summary::before { content: '▸ '; color: var(--text-muted); }
.crm-cd-ai[open] > summary::before { content: '▾ '; }
.crm-cd-ai[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.crm-cd-ai .crm-cd-aifields { padding-bottom: 6px; }

/* ── editable-измерения сделки ── */
.crm-cd-deal2 { display: flex; flex-direction: column; gap: 5px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.crm-cd-deal2:last-child { border-bottom: none; }
.crm-cd-deal2-top { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.crm-cd-deal2-dims { display: flex; flex-wrap: wrap; gap: 6px; }
/* Селектор стадии + «🏁 Завершить» (смена стадии прямо из карточки — Таня-1/Таня-6). */
.crm-cd-stagebox { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
.crm-cd-stage-select {
  font-size: 11px; padding: 2px 6px; border-radius: 999px; cursor: pointer; max-width: 170px;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary);
}
.crm-cd-stage-select:hover { border-color: var(--border-strong); color: var(--text-primary); }
.crm-cd-deal-won {
  font-size: 11px; padding: 2px 9px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  background: var(--bg-elevated); border: 1px solid var(--success); color: var(--success); font-weight: 600;
}
.crm-cd-deal-won:hover { background: var(--success); color: #fff; }
/* E2: галочка «🚐 Едет» (is_going) — лид из воронки переезжает на лист /rocket/crm/sheet. */
.crm-cd-deal-going {
  font-size: 11px; padding: 2px 9px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary); font-weight: 600;
}
.crm-cd-deal-going:hover { border-color: #38BDF8; color: #38BDF8; }
.crm-cd-deal-going.is-on { border-color: #38BDF8; color: #38BDF8; background: rgba(56, 189, 248, .12); }
/* Внесено (paid_amount_vnd) — отдельная строка факта оплаты под ценой (S2b, Таня-4). */
.crm-cd-deal-paidrow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 11.5px; color: var(--text-secondary); }
.crm-cd-deal-paid { color: var(--text-primary); font-weight: 600; cursor: pointer; }
.crm-cd-deal-paid:hover { color: var(--success); }
.crm-cd-deal-paidof { color: var(--text-muted); }
.crm-dim {
  display: inline-flex; align-items: center; font-size: 11px; color: var(--text-secondary);
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 8px; cursor: pointer;
}
.crm-dim:hover { border-color: var(--border-strong); color: var(--text-primary); }
.crm-edit-select { min-width: 130px; }

/* ── Карточка-табы (#99, вариант C): шапка-чипы → 💼/💬/🤖, панели toggle через .on ── */
.crm-cd-tripsn {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border);
}
.crm-cd-sum { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 0 2px; }
.crm-cd-sum-main {
  font-size: 11.5px; font-weight: 800; padding: 4px 11px; border-radius: 999px; white-space: nowrap;
  background: var(--accent-soft); border: 1px solid var(--accent-glow); color: var(--accent);
}
.crm-cd-sum-chip {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary);
  white-space: nowrap;
}
.crm-cd-sum-chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.crm-cd-sum-chip.is-payok { color: var(--success); border-color: rgba(74, 222, 128, .35); }
.crm-cd-sum-chip.is-paypart { color: var(--warning); border-color: rgba(251, 191, 36, .35); }
.crm-cd-sum-chip.is-payno { color: var(--danger, #F87171); border-color: rgba(248, 113, 113, .35); }
.crm-cd-tabs {
  display: flex; margin: 12px -22px 0; padding: 0 10px;
  border-bottom: 1px solid var(--border);
}
.crm-cd-tab {
  flex: 1; text-align: center; padding: 9px 4px; font-size: 12.5px; font-weight: 700;
  color: var(--text-muted); cursor: pointer; background: transparent; border: none;
  border-bottom: 3px solid transparent;
}
.crm-cd-tab:hover { color: var(--text-secondary); }
.crm-cd-tab.on { color: var(--text-primary); border-bottom-color: var(--accent); }
.crm-cd-pane { display: none; padding-top: 12px; }
.crm-cd-pane.on { display: block; }
/* Плита сделки */
.crm-cd-deal3 {
  display: flex; flex-direction: column; gap: 7px; padding: 11px 13px; margin-bottom: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: inset 3px 0 0 var(--accent);
}
.crm-cd-deal3-head { display: flex; align-items: center; gap: 10px; }
.crm-cd-deal3-what { font-size: 14px; font-weight: 800; color: var(--text-primary); }
.crm-cd-deal3-head .crm-cd-deal-amt { margin-left: auto; font-size: 13.5px; font-weight: 800; cursor: pointer; }
.crm-cd-deal3-titlerow { font-size: 12px; }
.crm-cd-deal3-titlerow .crm-cd-deal-title { cursor: pointer; color: var(--text-secondary); border-bottom: 1px dashed var(--border-strong); }
.crm-cd-deal3-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* Свёрнутая (не-активная) сделка — строка, клик разворачивает полную плиту */
.crm-cd-past { margin-bottom: 6px; }
.crm-cd-past > summary {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer;
  list-style: none; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-surface); font-size: 12px; color: var(--text-secondary); opacity: .8;
}
.crm-cd-past > summary::-webkit-details-marker { display: none; }
.crm-cd-past > summary:hover { opacity: 1; border-color: var(--border-strong); }
.crm-cd-past[open] > summary { margin-bottom: 6px; opacity: 1; }
.crm-cd-past-st { font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.crm-cd-past-amt { margin-left: auto; font-weight: 700; }
/* Кнопка рейса внутри карточки (была дефолтной browser-button — на плите бросалась в глаза) */
.crm-cd-deal-trip .crm-trip-assign-btn {
  font-size: 11px; padding: 2px 9px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  background: var(--bg-surface); border: 1px solid var(--border-strong); color: var(--text-secondary);
}
.crm-cd-deal-trip .crm-trip-assign-btn:hover { border-color: var(--accent); color: var(--accent); }
/* Досье: key-value строки */
.crm-cd-kv { display: flex; gap: 10px; padding: 3px 0; font-size: 12.5px; }
.crm-cd-kv-k { color: var(--text-muted); min-width: 120px; flex: 0 0 auto; }
.crm-cd-kv-v { color: var(--text-secondary); }
.crm-cd-kv-v.crm-edit { cursor: pointer; border-bottom: 1px dashed var(--border-strong); }
.crm-cd-kv-v.crm-edit:hover { color: var(--text-primary); }
/* Метка источника фолбэка (📋 лист / 🤖 N%) — уходит после ручной фиксации поля */
.crm-cd-kv-src {
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 8px; margin-left: 4px;
  background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border);
}
/* Дата в заголовке плиты — кликается (пунктир как у всех editable) */
.crm-cd-deal3-date { cursor: pointer; border-bottom: 1px dashed var(--border-strong); }
.crm-cd-deal3-date:hover { color: #38BDF8; border-bottom-color: #38BDF8; }
/* Диалог во всю высоту таба */
.crm-cd-acts--tab { max-height: 46vh; }

/* ── файлы (паспорта/скрины) ── */
.crm-files { display: flex; flex-wrap: wrap; gap: 7px; }
.crm-file {
  display: inline-flex; align-items: center; gap: 6px; max-width: 200px; text-decoration: none;
  font-size: 11.5px; color: var(--text-secondary); background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: 7px; padding: 4px 9px;
}
.crm-file:hover { border-color: var(--accent); color: var(--text-primary); }
.crm-file-ic { flex: 0 0 auto; }
.crm-file-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Доки клиента (паспорт/штамп/селфи + PDF) — подсвечены; наши материалы — свёрнуты в details. */
.crm-file--doc { border-color: rgba(20,184,166,.4); background: rgba(20,184,166,.08); color: var(--text-primary); }
.crm-file--doc:hover { border-color: #14b8a6; }
.crm-files-mats > summary { cursor: pointer; list-style: revert; }
.crm-files-mats > summary:hover { color: var(--text-primary); }
.crm-files-mats[open] > summary { margin-bottom: 7px; }

/* lost-reason overlay */
.crm-reason-ov {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); backdrop-filter: blur(2px);
}
.crm-reason-card {
  background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: 14px;
  padding: 18px; width: min(420px, 92vw); box-shadow: var(--shadow-lift);
}
.crm-reason-h { font-weight: 600; font-size: 15px; margin-bottom: 12px; }
.crm-reason-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.crm-reason-pick {
  padding: 6px 12px; border-radius: 999px; background: var(--bg-elevated);
  border: 1px solid var(--border); color: var(--text-secondary); font-size: 12.5px;
  transition: all var(--t-fast) var(--ease);
}
.crm-reason-pick:hover { border-color: var(--danger); color: var(--danger); }
.crm-reason-ta {
  width: 100%; min-height: 56px; resize: vertical; font: inherit; line-height: 1.4;
  background: var(--bg-primary); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; color: var(--text-primary); outline: none;
}
.crm-reason-ta:focus { border-color: var(--accent); }
.crm-reason-bar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.crm-reason-ok, .crm-reason-cancel { padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; }
.crm-reason-ok { background: var(--danger); color: #fff; }
.crm-reason-cancel { background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary); }

/* AI-оффер */
.crm-offer-btn {
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: var(--accent-soft); border: 1px solid var(--accent-glow); color: var(--accent);
  transition: all var(--t-fast) var(--ease);
}
.crm-offer-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.crm-offer-btn:disabled { opacity: .6; cursor: default; }
.crm-offer-result { margin-top: 10px; }
.crm-offer-ta {
  width: 100%; resize: vertical; font: inherit; line-height: 1.5; background: var(--bg-primary);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text-primary);
}
.crm-offer-copy {
  margin-top: 8px; padding: 6px 12px; border-radius: 8px; font-size: 12.5px;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary);
}
.crm-offer-copy:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   CRM-1 · Excel-грид всей базы (/rocket/crm/table)
   ============================================================ */
.crm-table-page { overflow: hidden; }
.crm-flt {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px 22px; border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.crm-flt-q {
  flex: 1 1 220px; min-width: 160px; padding: 7px 12px; font: inherit; font-size: 13px;
  background: var(--bg-primary); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-primary); outline: none;
}
.crm-flt-q:focus { border-color: var(--accent); }
.crm-flt-sel, .crm-flt-date input {
  padding: 7px 10px; font: inherit; font-size: 12.5px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text-secondary); outline: none;
}
.crm-flt-sel:focus, .crm-flt-date input:focus { border-color: var(--accent); color: var(--text-primary); }
.crm-flt-date { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted); }

.crm-table-wrap { flex: 1 1 auto; overflow: auto; }
.crm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.crm-table thead th {
  position: sticky; top: 0; z-index: 2; text-align: left; font-weight: 600;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-muted); background: var(--bg-surface);
  padding: 10px 14px; border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
.crm-tr { cursor: pointer; transition: background var(--t-fast) var(--ease); }
.crm-tr:hover { background: var(--bg-elevated); }
.crm-tr td { padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.crm-td-name { font-weight: 500; color: var(--text-primary); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.crm-td-nick { color: var(--text-secondary); font-size: 12.5px; }
.crm-td-date, .crm-td-sum { font-variant-numeric: tabular-nums; }
.crm-td-sum { font-weight: 500; }
.crm-td-chan { font-size: 12px; color: var(--text-muted); }
.crm-td-dash { color: var(--text-muted); }
.crm-tr--bot { box-shadow: inset 3px 0 0 var(--warning, #FBBF24); }
.crm-tr--ops { box-shadow: inset 3px 0 0 var(--success, #34D399); }
.crm-tr-empty td { padding: 28px 14px; text-align: center; color: var(--text-muted); }
.crm-tr-more td { padding: 10px 14px; text-align: center; border-bottom: none; }

/* ============================================================
   S6 · Доска развоза (dispatch board) — /rocket/crm/trips
   Спрос (лиды с travel_date) ↔ борта: машины-ростеры (водитель/время) + автобусы-блоки.
   3-цветная ротация бортов внутри дня (Сергей: фиолет/зелёный/жёлтый чередуются).
   ============================================================ */
.crm-disp-nav { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.crm-disp-navbtn {
  font-size: 12px; padding: 5px 12px; border-radius: 8px; color: var(--text-secondary);
  background: var(--bg-elevated); border: 1px solid var(--border); transition: all var(--t-fast) var(--ease);
}
.crm-disp-navbtn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.crm-disp-today { color: var(--accent); border-color: var(--accent-glow); background: var(--accent-soft); }
.crm-disp-range { font-size: 12.5px; color: var(--text-muted); padding: 0 4px; }

/* Пульт мест — компактная сводка свободных мест по дням (поверх dispatch_view).
   Горизонтальная лента чипов; клик по чипу скроллит к секции дня (#day-ISO). */
.crm-pulse { display: flex; align-items: center; gap: 10px; margin-top: 12px;
  padding: 8px 10px; border-radius: 10px; background: var(--bg-surface); border: 1px solid var(--border); }
.crm-pulse-lbl { font-size: 12px; font-weight: 600; color: var(--text-secondary); flex-shrink: 0; }
.crm-pulse-track { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.crm-pulse-chip { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 4px 9px; border-radius: 8px; background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-secondary); transition: all var(--t-fast) var(--ease); }
.crm-pulse-chip:hover { border-color: var(--border-strong); color: var(--text-primary); transform: translateY(-1px); }
.crm-pulse-d { font-weight: 700; color: var(--text-primary); }
.crm-pulse-wd { font-size: 11px; color: var(--text-muted); }
.crm-pulse-free { font-variant-numeric: tabular-nums; }
.crm-pulse-none { color: var(--text-muted); opacity: .6; }
.crm-pulse-wait { color: var(--warning, #FBBF24); font-variant-numeric: tabular-nums; }
.crm-pulse-chip.has-free { border-color: rgba(52, 211, 153, .35); }
.crm-pulse-chip.has-free .crm-pulse-free { color: var(--success, #34D399); }
.crm-pulse-chip.is-full { border-color: rgba(251, 191, 36, .35); }
.crm-pulse-chip.is-full .crm-pulse-free { color: var(--warning, #FBBF24); }
.crm-pulse-chip.is-over { border-color: rgba(239, 68, 68, .4); }
.crm-pulse-chip.is-over .crm-pulse-free { color: var(--danger, #EF4444); }
.crm-pulse-chip.is-today { box-shadow: inset 0 0 0 1px var(--accent-soft); }
.crm-pulse-chip.is-past { opacity: .5; }

.crm-disp-day { margin-top: 16px; padding: 12px 14px; border-radius: 12px;
  background: var(--bg-surface); border: 1px solid var(--border); }
.crm-disp-day.is-empty { opacity: .55; padding: 8px 14px; }
.crm-disp-day.is-today { border-color: var(--accent-glow); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.crm-disp-day.is-past { opacity: .6; }
.crm-disp-dayhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.crm-disp-date { font-size: 13.5px; font-weight: 700; color: var(--text-primary); letter-spacing: .02em; }
.crm-disp-wd { font-size: 12px; color: var(--text-muted); }
.crm-disp-daysum { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px;
  color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.crm-disp-vcount { padding: 1px 7px; border-radius: 20px; background: var(--bg-elevated);
  border: 1px solid var(--border); font-weight: 600; }
.crm-disp-addtrip { margin-left: auto; font-size: 12px; padding: 4px 12px; border-radius: 8px;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-glow); font-weight: 600; }
.crm-disp-addtrip:hover { background: var(--accent); color: #fff; }
.crm-disp-emptyline { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.crm-disp-vehicles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px; margin-top: 12px; }
.crm-disp-veh { position: relative; border-radius: 11px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-left: 3px solid var(--disp-c, var(--border-strong));
  transition: transform var(--t-fast) var(--ease); }
.crm-disp-veh:hover { transform: translateY(-1px); }
.crm-disp-veh--0 { --disp-c: #8b5cf6; }
.crm-disp-veh--1 { --disp-c: #34D399; }
.crm-disp-veh--2 { --disp-c: #FBBF24; }
.crm-disp-veh--3 { --disp-c: #3b82f6; }
.crm-disp-veh--4 { --disp-c: #ec4899; }
.crm-disp-veh--5 { --disp-c: #14b8a6; }
.crm-disp-veh.crm-trip-card-st-cancelled { opacity: .5; }
.crm-disp-veh.is-full { box-shadow: inset 0 0 0 1px var(--warning, #FBBF24); }
.crm-disp-veh.is-over { box-shadow: inset 0 0 0 1px var(--danger, #EF4444); }
/* борт: шапка (ссылка-в-детали + занятость + ✎) / мета / тело-дроп со строками */
.crm-disp-veh-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px 6px 13px; }
.crm-disp-veh-headlink { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 0; }
.crm-disp-veh-vh { font-weight: 600; font-size: 13.5px; color: var(--text-primary); }
.crm-disp-veh-time { font-size: 12px; color: var(--text-secondary); }
.crm-disp-veh-seats { font-weight: 700; font-size: 12.5px; color: var(--text-secondary); white-space: nowrap;
  font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: 7px; background: var(--bg-surface); }
.crm-disp-veh-seats.is-full { color: var(--warning, #FBBF24); }
.crm-disp-veh-seats.is-over { color: var(--danger, #EF4444); }
.crm-disp-veh-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px;
  color: var(--text-muted); padding: 0 12px 7px 13px; }
.crm-disp-veh-driver { color: var(--text-secondary); font-weight: 500; }
.crm-disp-edit { font-size: 12px; padding: 2px 7px; border-radius: 7px; color: var(--text-muted);
  background: var(--bg-surface); border: 1px solid var(--border); flex-shrink: 0; }
.crm-disp-edit:hover { color: var(--text-primary); border-color: var(--border-strong); }

/* тело борта = drop-зона (строки-пассажиры); пустое показывает приглашение */
.crm-disp-veh-pax { display: flex; flex-direction: column; gap: 4px; padding: 2px 8px 9px; min-height: 30px; }
.crm-disp-veh-pax:empty::after { content: 'перетащи заявки сюда'; display: block; text-align: center;
  font-size: 11px; color: var(--text-muted); opacity: .55; padding: 6px 0; }
.crm-disp-drop { transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.crm-disp-drop--hot { background: color-mix(in srgb, var(--disp-c, var(--accent)) 16%, transparent);
  box-shadow: inset 0 0 0 1px var(--disp-c, var(--accent-glow)); border-radius: 8px; }

/* строка-заявка / пассажир (Excel-вид) */
.crm-disp-req { display: flex; align-items: center; gap: 7px; font-size: 12px; padding: 5px 9px;
  border-radius: 7px; background: var(--bg-surface); border: 1px solid var(--border);
  transition: border-color var(--t-fast) var(--ease); }
.crm-disp-req:hover { border-color: var(--border-strong); }
.crm-disp-req.crm-trip-assign-btn { cursor: pointer; }
.crm-disp-grip { color: var(--text-muted); font-size: 13px; cursor: grab; letter-spacing: -2px;
  flex-shrink: 0; line-height: 1; }
.crm-disp-grip:active { cursor: grabbing; }
.crm-disp-req-ic { flex-shrink: 0; }
.crm-disp-req-nm { font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.crm-disp-req-pax { color: var(--text-secondary); flex-shrink: 0; }
.crm-disp-req-svc { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; flex: 1; min-width: 0; }
.crm-disp-req-seat { color: var(--text-secondary); flex-shrink: 0; }
.crm-disp-req-pickup { flex-shrink: 0; cursor: help; }  /* 📍 адрес развоза (полный — в title/деталях) */
.crm-pax-pickup { color: var(--text-secondary); max-width: 260px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.crm-disp-req-stg { font-size: 10.5px; padding: 1px 7px; border-radius: 20px; flex-shrink: 0;
  color: var(--text-secondary); background: var(--bg-elevated); border: 1px solid var(--border); }
.crm-disp-req.crm-stg-paid .crm-disp-req-stg,
.crm-disp-req.crm-stg-won .crm-disp-req-stg {
  color: #6ee7b7; background: rgba(52, 211, 153, .14); border-color: rgba(52, 211, 153, .3); }
.crm-disp-req--ghost { opacity: .4; }
.crm-disp-req--chosen { box-shadow: 0 4px 16px rgba(0, 0, 0, .4); border-color: var(--accent-glow); }

.crm-disp-unassigned { margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: rgba(251, 191, 36, 0.06); border: 1px dashed var(--warning, #FBBF24); }
.crm-disp-unassigned-h { font-size: 12px; font-weight: 600; color: var(--warning, #FBBF24); margin-bottom: 4px; }
.crm-disp-unassigned-hint { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.crm-disp-pool { display: flex; flex-direction: column; gap: 5px; min-height: 30px; }
.crm-disp-pool:empty::after { content: 'все заявки распределены ✓'; display: block; text-align: center;
  font-size: 11.5px; color: var(--ok, #34D399); opacity: .7; padding: 6px 0; }
.crm-disp-pool.crm-disp-drop--hot { background: rgba(251, 191, 36, .09);
  box-shadow: inset 0 0 0 1px var(--warning); border-radius: 8px; }

/* +рейс / правка борта — оверлей-форма (реюз шелла .crm-reason-ov/.crm-reason-card из пикера) */
.crm-disp-form { display: flex; flex-direction: column; gap: 10px; min-width: 300px; }
.crm-disp-form label { font-size: 12px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 4px; }
.crm-disp-form select, .crm-disp-form input {
  font-size: 13px; padding: 7px 9px; border-radius: 8px; color: var(--text-primary);
  background: var(--bg-elevated); border: 1px solid var(--border);
}
.crm-disp-form select:focus, .crm-disp-form input:focus { border-color: var(--accent-glow); }
.crm-disp-form-row { display: flex; gap: 8px; }
.crm-disp-form-row > label { flex: 1; }

/* ============================================================
   E1 · «Умный Эксель» — READ-ONLY лист едущих (/rocket/crm/sheet)
   Анти-каша: collapse групп по дате (сегодня+завтра развёрнуты) + sticky
   заголовки даты/вкладок + плотные строки ≤44px. Кант виза(М90)/штамп(М45).
   ============================================================ */
.crm-sheet-page { overflow: hidden; }
/* Липкая полоса: сектор + вкладки (вне скролл-обёртки → всегда видны). */
.crm-sheet-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 22px; border-bottom: 1px solid var(--border); background: var(--bg-surface);
}
.crm-sheet-sector { display: flex; gap: 6px; }
.crm-sheet-sect {
  font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 8px;
  color: var(--text-secondary); background: var(--bg-elevated); border: 1px solid var(--border);
}
.crm-sheet-sect.is-on { background: var(--accent-soft); border-color: var(--accent-glow); color: var(--accent); }
.crm-sheet-sect.is-off { opacity: .45; cursor: not-allowed; }
.crm-sheet-tabs { display: flex; gap: 2px; margin-left: auto; }
.crm-sheet-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 13.5px;
  font-weight: 700; color: var(--text-muted); border-bottom: 3px solid transparent;
  transition: color var(--t-fast) var(--ease);
}
.crm-sheet-tab:hover { color: var(--text-secondary); }
.crm-sheet-tab.is-on { color: var(--text-primary); border-bottom-color: var(--accent); }
.crm-sheet-tab-cnt {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px;
  background: var(--bg-elevated); color: var(--text-secondary);
}
.crm-sheet-tab.is-on .crm-sheet-tab-cnt { background: var(--accent-soft); color: var(--accent); }
/* E4-lite: кнопка дожима на баре листа → очередь возврата виз /rocket/lichka. */
.crm-sheet-lichka {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; white-space: nowrap;
  font-size: 12.5px; font-weight: 700; border-radius: 8px;
  color: var(--danger, #F87171); background: rgba(248, 113, 113, .08);
  border: 1px solid rgba(248, 113, 113, .30);
}
.crm-sheet-lichka:hover { background: rgba(248, 113, 113, .16); }
.crm-sheet-lichka-cnt {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 9px;
  background: rgba(248, 113, 113, .22); color: #ffd9dc;
}

/* Скролл-обёртка листа. */
.crm-sheet-wrap { flex: 1 1 auto; overflow-y: auto; padding: 12px 22px 60px; }
.crm-sheet-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.crm-sheet-hint b { color: var(--text-secondary); }
.crm-sheet-summary {
  font-size: 12.5px; color: var(--text-secondary); margin-bottom: 12px; padding: 8px 12px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px;
}
.crm-sheet-summary b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.crm-sheet-pastdiv {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin: 20px 0 8px; padding-top: 12px;
  border-top: 1px dashed var(--border-strong);
}
.crm-sheet-sw {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  vertical-align: -1px; margin: 0 3px 0 10px;
}
.crm-sheet-sw--visa { background: #38BDF8; }
.crm-sheet-sw--stamp { background: var(--warning, #FBBF24); }
.crm-sheet-empty {
  padding: 40px 18px; text-align: center; color: var(--text-muted); font-size: 13px; line-height: 1.7;
  background: var(--bg-surface); border: 1px dashed var(--border); border-radius: 12px;
}
.crm-sheet-empty code { font-family: 'JetBrains Mono', monospace; color: var(--accent); }

.crm-sheet-group { margin-bottom: 8px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
/* Липкий заголовок даты — верх скролл-обёртки. */
.crm-sheet-ghead {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; background: var(--bg-elevated); border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none; transition: background var(--t-fast) var(--ease);
}
.crm-sheet-ghead:hover { background: var(--bg-surface); }
.crm-sheet-ghead.is-today { box-shadow: inset 3px 0 0 var(--accent); }
.crm-sheet-ghead.is-past { opacity: .55; }
.crm-sheet-ghead.is-past:hover { opacity: .85; }
.crm-sheet-caret { font-size: 11px; color: var(--text-muted); width: 12px; transition: transform var(--t-fast) var(--ease); }
.crm-sheet-ghead.is-collapsed .crm-sheet-caret { transform: rotate(-90deg); }
.crm-sheet-gdate { font-size: 14px; font-weight: 800; color: var(--text-primary); }
.crm-sheet-gwd { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.crm-sheet-gsum { margin-left: auto; font-size: 12px; color: var(--text-secondary); }
.crm-sheet-gsum b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.crm-sheet-gbody.is-collapsed { display: none; }

.crm-sheet-table { width: 100%; border-collapse: collapse; }
.crm-sheet-table thead th {
  position: sticky; top: 40px; z-index: 10; text-align: left; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted);
  background: var(--bg-surface); padding: 6px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.crm-sheet-table td {
  padding: 6px 10px; font-size: 12.5px; height: 40px; border-bottom: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px;
  color: var(--text-secondary);
}
.crm-sheet-row { cursor: pointer; transition: background var(--t-fast) var(--ease); }
.crm-sheet-row:hover td { background: var(--bg-elevated); }
.crm-sheet-row td:first-child { border-left: 3px solid transparent; }
.crm-sheet-row--visa td:first-child { border-left-color: #38BDF8; }
.crm-sheet-row--stamp td:first-child { border-left-color: var(--warning, #FBBF24); }
.crm-sheet-nm { font-weight: 600; color: var(--text-primary) !important; }
.crm-sheet-muted { color: var(--text-muted); opacity: .7; }
.crm-sheet-tg { color: #38BDF8; font-size: 11.5px; }
.crm-sheet-tg:hover { text-decoration: underline; }
/* @-ник: ссылка занимает ВСЮ ячейку (клик мимо текста ника всё равно открывает Telegram,
   а не карточку контакта — фидбэк Сергея 07-01 «при клике на ник не открывается тг»). */
.crm-sheet-at { padding: 0; }
.crm-sheet-at > a, .crm-sheet-at > span { display: block; padding: 6px 10px; }
.crm-sheet-mash { color: var(--text-primary); font-weight: 600; }
.crm-sheet-amt { color: var(--text-primary); font-weight: 500; }
.crm-sheet-ph { color: var(--text-secondary); font-size: 11.5px; }
.crm-sheet-addr { color: var(--text-secondary); font-size: 11.5px; }

.crm-sheet-svc, .crm-sheet-pay, .crm-sheet-st {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 9px; white-space: nowrap;
}
.crm-sheet-svc--visa { background: rgba(56, 189, 248, .14); color: #38BDF8; }
.crm-sheet-svc--stamp { background: rgba(251, 191, 36, .14); color: var(--warning, #FBBF24); }
.crm-sheet-pay--ok { background: rgba(74, 222, 128, .14); color: var(--success, #4ADE80); }
.crm-sheet-pay--part { background: rgba(251, 191, 36, .14); color: var(--warning, #FBBF24); }
.crm-sheet-st--work { background: rgba(56, 189, 248, .12); color: #38BDF8; }
.crm-sheet-st--done { background: var(--bg-elevated); color: var(--text-muted); }

/* E2: сырой текст Тани из Google-листа — оплата (pay_raw) и статус (status_raw) как в Экселе. */
.crm-sheet-pr { font-size: 11px; white-space: nowrap; color: var(--text-secondary); }
.crm-sheet-pr--ok { color: var(--success, #4ADE80); }
.crm-sheet-pr--no { color: var(--danger, #F87171); font-weight: 700; }
.crm-sheet-sr { font-size: 11px; color: var(--text-secondary); }
/* E2: инлайн-правка ряда (только строки-сделки; у поездок листа мастер = Google-лист Тани). */
.crm-sheet-seat {
  cursor: pointer; border-bottom: 1px dashed var(--border); padding-bottom: 1px;
  color: var(--text-primary);
}
.crm-sheet-seat:hover { color: #38BDF8; border-bottom-color: #38BDF8; }

/* E3: редактируемые ячейки листа — тап открывает плашку (write-back в Google-лист). */
.crm-sheet-ed { cursor: pointer; }
span.crm-sheet-ed { border-bottom: 1px dashed var(--border); padding-bottom: 1px; }
.crm-sheet-ed:hover, .crm-sheet-ed:hover > * { color: #38BDF8 !important; border-bottom-color: #38BDF8; }
td.crm-sheet-ed:hover { background: var(--bg-elevated); }

/* E3: плашка-редактор у ячейки — «вываливается и легко тыкается» (кнопки ≥ 44px). */
.crm-sheet-pop {
  position: fixed; z-index: 1100; min-width: 200px; max-width: 300px;
  background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 10px; box-shadow: var(--shadow-lift);
}
.crm-sheet-pop.is-busy { opacity: .6; pointer-events: none; }
.crm-sheet-pop-h { font-size: 12px; font-weight: 700; color: var(--text-secondary); margin: 2px 2px 8px; }
.crm-sheet-pop-opts { display: flex; flex-direction: column; gap: 6px; }
.crm-sheet-pop-opt {
  min-height: 44px; padding: 8px 14px; border-radius: 10px; font-size: 14px; text-align: left;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-primary);
  cursor: pointer; width: 100%;
}
.crm-sheet-pop-opt:hover { border-color: var(--accent); color: var(--accent); }
.crm-sheet-pop-opt.is-danger { color: var(--danger, #F87171); }
.crm-sheet-pop-opt.is-danger:hover { border-color: var(--danger, #F87171); }
.crm-sheet-pop-ok { margin-top: 8px; text-align: center; font-weight: 600; }
.crm-sheet-pop-confirm {
  margin-top: 10px; padding: 10px; border: 1px solid var(--danger, #F87171); border-radius: 10px;
  font-size: 12.5px; color: var(--text-primary); display: flex; flex-direction: column; gap: 8px;
}
.crm-sheet-pop-step { display: flex; align-items: center; gap: 10px; justify-content: center; }
.crm-sheet-pop-stbtn {
  width: 52px; height: 48px; border-radius: 10px; font-size: 22px; font-weight: 700;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-primary);
  cursor: pointer;
}
.crm-sheet-pop-stbtn:hover { border-color: var(--accent); color: var(--accent); }
.crm-sheet-pop-stval {
  min-width: 44px; text-align: center; font-size: 22px; font-weight: 800;
  font-variant-numeric: tabular-nums; color: var(--text-primary);
}
.crm-sheet-pop-free { display: flex; gap: 6px; margin-top: 8px; }
.crm-sheet-pop-free .crm-sheet-pop-ok { margin-top: 0; width: auto; }
.crm-sheet-pop-input {
  flex: 1; min-height: 44px; padding: 8px 10px; border-radius: 10px; font-size: 14px;
  background: var(--bg-primary); border: 1px solid var(--border); color: var(--text-primary);
}

/* E3: маршрутные листы (кнопка на группе даты + модалка со скриптами). */
.crm-sheet-route-btn {
  margin-left: 10px; padding: 3px 10px; border-radius: 8px; font-size: 11.5px;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary);
  cursor: pointer; white-space: nowrap;
}
.crm-sheet-route-btn:hover { border-color: var(--accent); color: var(--accent); }
.crm-sheet-route-card { width: min(560px, 94vw); max-height: 86vh; overflow-y: auto; }
.crm-sheet-route-card .crm-reason-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crm-sheet-route-card .crm-reason-h .crm-offer-copy { margin-top: 0; margin-left: auto; }
.crm-sheet-route-grp { margin-bottom: 14px; }
.crm-sheet-route-trip { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.crm-sheet-route-row { font-size: 12px; color: var(--text-secondary); margin: 2px 0 2px 6px; }
.crm-sheet-route-blk { margin-top: 8px; }
.crm-sheet-route-blkh {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; color: var(--text-secondary); margin-bottom: 4px;
}
.crm-sheet-route-blkh .crm-offer-copy { margin-top: 0; }
.crm-sheet-route-blk .crm-offer-ta { font-size: 12px; font-family: 'JetBrains Mono', monospace; }
.crm-sheet-route-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ============ SEO Dashboard (/rocket/seo) — 2026-07-03 ============ */
.seo-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.seo-kpi { padding: 14px 16px; }
.seo-kpi-mid { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.seo-kpi-v { font-size: 26px; font-weight: 650; font-family: 'JetBrains Mono', monospace; letter-spacing: -.02em; }
.seo-delta { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.seo-delta.up { color: #4ADE80; background: rgba(74, 222, 128, .12); }
.seo-delta.down { color: #F87171; background: rgba(248, 113, 113, .12); }
.seo-delta.flat { color: var(--text-muted); background: rgba(148, 163, 184, .10); }
.seo-chart-card { margin-bottom: 14px; }
.seo-legend { float: right; font-size: 10.5px; color: var(--text-muted); display: flex; gap: 14px; align-items: center; text-transform: none; letter-spacing: 0; font-weight: 500; }
.seo-legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.dot-visits { background: #4ADE80; } .dot-clicks { background: #60A5FA; } .dot-pub { background: #F59E0B; }
.seo-chart { width: 100%; height: 210px; display: block; margin-top: 10px; }
.seo-line-visits { fill: none; stroke: #4ADE80; stroke-width: 2; }
.seo-line-clicks { fill: none; stroke: #60A5FA; stroke-width: 1.6; opacity: .9; }
.seo-dot { opacity: .45; }
.seo-dot:hover { opacity: 1; }
.seo-dot-visits { fill: #4ADE80; } .seo-dot-clicks { fill: #60A5FA; }
.seo-publine { stroke: #F59E0B; stroke-width: 1.2; opacity: .55; stroke-dasharray: 2 4; }
.seo-grid { margin-top: 0; }
.seo-col-right { display: flex; flex-direction: column; gap: 12px; }
.seo-table-wrap { overflow-x: auto; }
.seo-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.seo-table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.seo-table th.seo-num { text-align: right; }
.seo-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.seo-table tr:last-child td { border-bottom: 0; }
.seo-num { font-family: 'JetBrains Mono', monospace; text-align: right; white-space: nowrap; }
.seo-title-link { color: var(--text); text-decoration: none; }
.seo-title-link:hover { color: #4ADE80; }
.seo-site-tag { font-size: 10.5px; color: var(--text-muted); display: block; margin-top: 2px; }
.seo-site-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.seo-site-row:last-of-type { border-bottom: 0; }
.seo-site-name { flex: 1; font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.seo-spark { width: 72px; height: 22px; flex-shrink: 0; opacity: .85; }
.seo-site-v { font-size: 14px; font-weight: 600; min-width: 42px; }
.seo-site-cta { font-size: 10.5px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; min-width: 52px; text-align: right; }
.seo-pipe-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.seo-pipe-row:last-of-type { border-bottom: 0; }
.seo-ev-lbl { margin-top: 14px; }
.seo-ev-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 11.5px; }
.seo-ev-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--text-muted); }
.seo-ev-dot.ok { background: #4ADE80; }
.seo-ev-dot.needs_sergei { background: #F59E0B; }
.seo-ev-dot.failed { background: #F87171; }
.seo-ev-kind { font-weight: 600; }
.seo-ev-ts { color: var(--text-muted); font-size: 10.5px; }
.seo-ev-status { margin-left: auto; color: var(--text-muted); font-size: 10.5px; }
@media (max-width: 900px) {
  .seo-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .seo-grid { grid-template-columns: 1fr; }
}

/* SEO page: обычная длинная страница со скроллом окна-контейнера —
   переопределяем kanban-режим .crm-page (height:100vh + overflow:hidden). */
.crm-page.seo-page { display: block; overflow-y: auto; }
.seo-page .seo-body { padding: 14px 22px 46px; max-width: 1500px; }
