/* ============================================================
   Ракета · 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;
}

/* ===== TOPBAR ===== */
.topbar {
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  position: relative;
  z-index: 5;
}
.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: 240px 1fr 320px;
  min-height: 0;
}

/* ============================================================
   LEFT RAIL
   ============================================================ */
.left-rail {
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 0; background: var(--bg-primary);
}
.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); }

.tt-title { color: var(--text-primary); line-height: 1.35; }
.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); }

/* 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;
}
.ai-chat-text {
  white-space: pre-wrap; line-height: 1.55;
  color: var(--text-primary); font-family: 'Inter', sans-serif; font-size: 13px;
}
.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; }

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