/* © Егор — демо портфолио. */
/* ═══════════════════════════════════════════════════
   Кейс 14 — ИИ-бухгалтер обжарочной «Кейс 11»
   Тема: «ночная сверка» — глубокий navy, мятный,
   сигнальный красный. Цифры — PT Mono, табличные.
   ═══════════════════════════════════════════════════ */

:root {
  --bg: #0D1320;
  --bg-2: #0F1726;
  --panel: #131C2C;
  --panel-2: #17222F;
  --line: #223049;
  --line-soft: #1B2740;
  --ink: #E9EEF6;
  --ink-2: #97A5BC;
  --ink-3: #5F6E88;
  --mint: #7FD6A9;
  --mint-dim: rgba(127, 214, 169, .12);
  --red: #E0705C;
  --red-dim: rgba(224, 112, 92, .12);
  --gold: #E3BE6A;
  --gold-dim: rgba(227, 190, 106, .12);
  --font-display: "Tenor Sans", serif;
  --font-body: "Geologica", sans-serif;
  --font-mono: "PT Mono", monospace;
  --r: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

html { height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(127, 214, 169, .05), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(64, 96, 160, .09), transparent 55%),
    var(--bg);
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

::selection { background: rgba(127, 214, 169, .25); }

.mono {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  letter-spacing: -.01em;
}

button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; border-radius: 4px; }

/* ─── Верхняя панель ─── */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(13, 19, 32, .85);
  backdrop-filter: blur(6px);
}

.wordmark {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: .14em;
  color: var(--ink);
}

.wordmark__dot { color: var(--mint); }

.wordmark__sub {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 1px;
}

.topbar__status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  margin-left: auto;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px rgba(127, 214, 169, .7);
}

.topbar__balance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
}

.topbar__balance-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-3);
}

.topbar__balance .mono { font-size: 16px; color: var(--mint); }

/* ─── Лента показателей ─── */

.ticker {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 24px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-2);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.ticker::-webkit-scrollbar { display: none; }

.ticker__sep {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--ink-3);
  flex: none;
}

.ticker__item b { color: var(--ink); font-weight: 400; }

.ticker__item--alert {
  color: var(--red);
  padding: 2px 10px;
  background: var(--red-dim);
  border-radius: 4px;
}

/* ─── Сетка ─── */

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr) 470px;
  grid-template-rows: minmax(0, 1fr);
  gap: 20px;
  padding: 20px 24px 22px;
  max-width: 1720px;
  width: 100%;
  margin: 0 auto;
  min-height: 0;
}

/* ─── Левая колонка ─── */

.rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
}

.rail__title, .reg__title {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: .06em;
  color: var(--ink-2);
  padding: 2px 2px 6px;
}

.scen {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .15s, background .15s, transform .12s;
}

.scen:hover {
  border-color: var(--mint);
  background: var(--panel-2);
  transform: translateY(-1px);
}

.scen:disabled { opacity: .45; pointer-events: none; }

.scen.is-active {
  border-color: var(--mint);
  background: var(--mint-dim);
}

.scen__name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
}

.scen__desc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-2);
}

.rail__note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
  padding: 4px 2px;
}

.rail__stand {
  margin-top: auto;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  padding: 12px 15px;
}

.rail__stand-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.rail__stand-list { display: flex; flex-direction: column; gap: 5px; }

.rail__stand-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.rail__stand-list dt { color: var(--ink-3); }
.rail__stand-list dd { color: var(--ink-2); text-align: right; }

/* ─── Чат ─── */

.chat {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  min-height: 0;
  overflow: hidden;
}

.chat__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.chat__avatar {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--mint-dim);
  border: 1px solid rgba(127, 214, 169, .4);
  color: var(--mint);
  font-family: var(--font-display);
  font-size: 17px;
  display: grid;
  place-items: center;
}

.chat__name { font-weight: 600; font-size: 14px; }
.chat__role { font-size: 11.5px; color: var(--ink-3); }

.chat__log {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.msg {
  max-width: 86%;
  padding: 11px 15px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.6;
  animation: msg-in .25s ease both;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.msg--user {
  align-self: flex-end;
  background: var(--mint);
  color: #0D241A;
  border-bottom-right-radius: 3px;
  font-weight: 500;
}

.msg--agent {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 3px;
}

.msg--agent b { color: var(--mint); font-weight: 600; }
.msg--agent em { color: var(--gold); font-style: normal; }
.msg--agent u { color: var(--red); text-decoration: none; }

.msg__time {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
}

/* Печатающий курсор */
.caret::after {
  content: "▍";
  color: var(--mint);
  animation: blink .8s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* Три точки */
.typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  border-bottom-left-radius: 3px;
}

.typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  animation: dot 1.1s ease-in-out infinite;
}

.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

@keyframes dot {
  0%, 60%, 100% { transform: none; opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; background: var(--mint); }
}

/* Плашки-цифры внутри сообщения */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.stats__cell {
  background: rgba(13, 19, 32, .55);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 8px 10px;
}

.stats__label {
  font-size: 10.5px;
  color: var(--ink-3);
  margin-bottom: 2px;
}

.stats__val {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--ink);
  white-space: nowrap;
}

.stats__val--mint { color: var(--mint); }
.stats__val--red { color: var(--red); }
.stats__val--gold { color: var(--gold); }

/* Черновик письма в чате */
.letter {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: rgba(13, 19, 32, .55);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
}

.letter__tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  background: var(--gold-dim);
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 8px;
}

.letter p { margin-bottom: 7px; }
.letter p:last-child { margin-bottom: 0; }
.letter b { color: var(--ink); font-weight: 600; }

/* Быстрые ответы */
.chat__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 20px 12px;
}

.qbtn {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--mint);
  background: var(--mint-dim);
  border: 1px solid rgba(127, 214, 169, .45);
  border-radius: 99px;
  padding: 7px 16px;
  transition: background .15s, transform .12s;
}

.qbtn:hover { background: rgba(127, 214, 169, .22); transform: translateY(-1px); }

.qbtn--ghost {
  color: var(--ink-2);
  background: transparent;
  border-color: var(--line);
}

.qbtn--ghost:hover { background: var(--panel-2); }

/* Поле ввода */
.composer {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.composer__input {
  flex: 1;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
}

.composer__input::placeholder { color: var(--ink-3); }
.composer__input:focus { outline: none; border-color: var(--mint); }

.composer__send {
  width: 42px;
  border: none;
  border-radius: 8px;
  background: var(--mint);
  color: #0D241A;
  display: grid;
  place-items: center;
  transition: transform .12s, filter .15s;
}

.composer__send:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* ─── Регистр (правая колонка) ─── */

.reg {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  min-height: 0;
  overflow: hidden;
}

.reg__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.reg__title { padding: 0; }

.reg__export {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mint);
  background: var(--mint-dim);
  border: 1px solid rgba(127, 214, 169, .4);
  border-radius: 6px;
  padding: 6px 12px;
  transition: background .15s;
}

.reg__export:hover { background: rgba(127, 214, 169, .22); }

.reg__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.reg__empty {
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 40px 24px;
}

.reg__empty-rune {
  font-family: var(--font-display);
  font-size: 42px;
  color: var(--line);
  margin-bottom: 10px;
}

/* Подзаголовки блоков регистра */
.rblock { margin-bottom: 22px; animation: msg-in .3s ease both; }

.rblock__title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  margin-bottom: 9px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.rblock__title .mono { text-transform: none; letter-spacing: 0; color: var(--ink-2); font-weight: 400; }

/* Таблицы регистра */
.rtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.rtable th {
  text-align: left;
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.rtable td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  vertical-align: top;
}

.rtable tr { animation: row-in .3s ease both; }

@keyframes row-in {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}

.rtable .num {
  font-family: var(--font-mono);
  text-align: right;
  white-space: nowrap;
  color: var(--ink);
}

.rtable .acc { font-family: var(--font-mono); color: var(--ink); white-space: nowrap; }

.rtable .who { color: var(--ink); }

.rtable .dim { color: var(--ink-3); font-size: 11px; }

/* Статус-чипы в таблицах */
.chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .05em;
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}

.chip--ok    { color: var(--mint); background: var(--mint-dim); }
.chip--part  { color: var(--gold); background: var(--gold-dim); }
.chip--manual{ color: var(--red);  background: var(--red-dim); }

/* Проводки */
.rtable--postings td { border-bottom: 1px dashed var(--line-soft); }

.rtable--postings tr.is-pending .acc,
.rtable--postings tr.is-pending .num { color: var(--ink-3); }

.rtable--postings tr.is-posted {
  box-shadow: inset 3px 0 0 var(--mint);
}

.rtable--postings tr.is-posted td { color: var(--ink-2); }

.rtable--postings tr.is-manual {
  box-shadow: inset 3px 0 0 var(--red);
}

/* Строка итога */
.rtable tfoot td {
  border-top: 1px solid var(--line);
  border-bottom: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  padding-top: 9px;
}

/* Aging-бары */
.age { display: flex; flex-direction: column; gap: 10px; }

.age__row { display: grid; grid-template-columns: 132px 1fr 92px; gap: 10px; align-items: center; }

.age__who { font-size: 12px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.age__days { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }

.age__bar {
  height: 10px;
  border-radius: 3px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

.age__fill {
  height: 100%;
  border-radius: 2px;
  width: 0;
  transition: width .9s cubic-bezier(.22, .8, .3, 1);
}

.age__fill--ok   { background: var(--mint); }
.age__fill--warn { background: var(--gold); }
.age__fill--bad  { background: var(--red); }

.age__sum {
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
  color: var(--ink);
}

/* Сравнение налогов */
.taxbar { display: flex; flex-direction: column; gap: 14px; }

.taxbar__row { display: flex; flex-direction: column; gap: 5px; }

.taxbar__meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-2);
}

.taxbar__meta .mono { color: var(--ink); font-size: 13px; }

.taxbar__track {
  height: 14px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

.taxbar__fill {
  height: 100%;
  width: 0;
  transition: width 1s cubic-bezier(.22, .8, .3, 1);
  background: var(--ink-3);
}

.taxbar__fill--win { background: var(--mint); }

/* Инсайт-плашка */
.insight {
  border-left: 3px solid var(--gold);
  background: var(--gold-dim);
  border-radius: 0 6px 6px 0;
  padding: 10px 13px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin-top: 14px;
}

.insight b { color: var(--gold); font-weight: 600; }

.insight--mint {
  border-left-color: var(--mint);
  background: var(--mint-dim);
}

.insight--mint b { color: var(--mint); }

/* График платёжного календаря */
.cal {
  width: 100%;
}

.cal svg { display: block; width: 100%; height: auto; }

.cal__legend {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 8px;
}

.cal__legend i {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: -1px;
}

/* События календаря списком */
.calev { font-size: 12px; }
.calev td .dim { display: block; }

/* Пульс компании */
.reg__pulse {
  border-top: 1px solid var(--line-soft);
  background: var(--panel-2);
  padding: 13px 18px 15px;
}

.reg__pulse-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  margin-bottom: 9px;
}

.pulse {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pulse__cell {
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 8px 10px;
}

.pulse__label { font-size: 10.5px; color: var(--ink-3); margin-bottom: 2px; }

.pulse__val { font-size: 15px; color: var(--mint); }
.pulse__val--gold { color: var(--gold); }
.pulse__val--red { color: var(--red); }

/* Тост */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--mint);
  color: var(--ink);
  font-size: 13px;
  border-radius: 8px;
  padding: 11px 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  z-index: 50;
  animation: toast-in .3s ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ─── Адаптив ─── */

@media (max-width: 1360px) {
  .layout { grid-template-columns: 264px minmax(0, 1fr) 420px; }
}

@media (max-width: 1120px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .reg { display: none; }
}

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .rail { flex-direction: row; flex-wrap: wrap; }
  .scen { flex: 1 1 200px; }
  .rail__stand { display: none; }
  .topbar__balance { display: none; }
}

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

/* ===== оверрайды портфолио: рамки блоков убраны, радиусы и геометрия сохранены =====
   Контурные рамки карточек/панелей/блоков делаем прозрачными (border-color),
   чтобы не менять боксовую геометрию 1:1. Мягкие радиусы, фоны и тени остаются.
   Не трогаем: рамки полей ввода и их focus, кнопки-чипы (.qbtn/.reg__export/
   .letter__tag), треки графиков (.age__bar/.taxbar__track), акцентную полосу
   .insight, иконку-аватар и все разделители (border-bottom/top, таблицы). */
.topbar__status,
.scen,
.scen:hover,
.scen.is-active,
.rail__stand,
.chat,
.msg--agent,
.typing,
.stats__cell,
.letter,
.reg,
.pulse__cell,
.toast { border-color: transparent; }

/* демо-лента */
.demo-ribbon {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 40;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--ink-3);
  background: var(--panel-2);
  padding: 5px 10px;
  border-radius: 6px;
}

