/* ============= IGX FINANCE — Big Tech Black ============= */
/* Inspired by Vercel · Linear · Stripe */

:root {
  /* Surfaces — pure black to elevated greys */
  --bg: #000000;
  --surface: #0a0a0a;
  --surface-2: #111111;
  --surface-3: #161616;
  --surface-hover: #1a1a1a;

  /* Borders — subtle whites */
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --border-focus: rgba(255, 255, 255, 0.28);

  /* Text */
  --text: #ededed;
  --text-2: #c5c5c5;
  --text-muted: #8a8a8a;
  --text-dim: #555555;

  /* Single accent — clean white-on-black */
  --white: #ffffff;
  --black: #000000;

  /* Status (used sparingly) */
  --success: #3ddc84;
  --success-bg: rgba(61, 220, 132, 0.10);
  --success-border: rgba(61, 220, 132, 0.22);
  --warning: #f5a623;
  --warning-bg: rgba(245, 166, 35, 0.10);
  --warning-border: rgba(245, 166, 35, 0.22);
  --danger: #e5484d;
  --danger-bg: rgba(229, 72, 77, 0.10);
  --danger-border: rgba(229, 72, 77, 0.22);

  --radius: 12px;
  --radius-sm: 9px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);

  --sidebar-w: 220px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; max-width: 100vw; overflow-x: hidden; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============ Layout ============ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

.sidebar__brand {
  padding: 8px 10px 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.logo--lock {
  flex-direction: column;
  gap: 14px;
}
.logo__img {
  width: 32px; height: 32px;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .4));
}
.logo__img--lg {
  width: 60px; height: 60px;
  filter: drop-shadow(0 6px 24px rgba(255, 255, 255, .12));
}
.logo__text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.logo__mark {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.4px;
  color: var(--white);
}
.logo__sub {
  margin-top: 4px;
  font-size: 9.5px;
  letter-spacing: 3.2px;
  color: var(--text-dim);
  font-weight: 600;
}
.logo--lock .logo__mark {
  font-size: 22px;
  letter-spacing: -.5px;
}
.logo--lock .logo__sub {
  font-size: 11px;
  letter-spacing: 4px;
  margin-top: 5px;
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  transition: background .12s ease, color .12s ease;
}
.nav__item svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav__item:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav__item.active {
  color: var(--text);
  background: var(--surface-3);
}
.nav__item.active svg { opacity: 1; }

.sidebar__footer { border-top: 1px solid var(--border); padding-top: 16px; }
.period-pill {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.period-pill__label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
}
.period-pill__value {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  margin-top: 3px;
}

/* ============ Main / Topbar ============ */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  background: rgba(0, 0, 0, 0.7);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.topbar__title {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  letter-spacing: -0.3px;
}
.topbar__right { display: flex; gap: 8px; align-items: center; }
#sidebarToggle { display: none; }

.period-selector {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.period-input {
  background: transparent;
  border: none;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  padding: 5px 10px;
  outline: none;
  color-scheme: dark;
  min-width: 140px;
}

/* Custom period trigger button (заменяет input type=month) */
.period-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  min-width: 156px;
  white-space: nowrap;
}
.period-trigger:hover { background: rgba(255, 255, 255, .05); }
.period-trigger:focus-visible { outline: 1px solid var(--border-focus); outline-offset: 1px; }
.period-trigger > svg { width: 14px; height: 14px; opacity: .55; flex-shrink: 0; }
.period-trigger > span {
  flex: 1;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.period-trigger__chev {
  width: 12px !important; height: 12px !important;
  opacity: .45;
  transition: transform .18s ease, opacity .15s ease;
}
.period-trigger--open .period-trigger__chev {
  transform: rotate(180deg);
  opacity: .8;
}
.period-trigger--open { background: rgba(255, 255, 255, .05); }

/* Picker popover */
.period-picker {
  position: fixed;
  z-index: 60;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, .65),
    0 0 0 1px rgba(255, 255, 255, .03);
  padding: 12px;
  animation: pickerPop .2s cubic-bezier(.2, .8, .2, 1);
  transform-origin: top right;
}
@keyframes pickerPop {
  from { opacity: 0; transform: translateY(-8px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.period-picker__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 2px;
}
.period-picker__year {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
  color: var(--text);
  user-select: none;
}
.period-picker__nav {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  width: 30px; height: 30px;
  cursor: pointer;
  transition: all .12s ease;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.period-picker__nav svg { width: 14px; height: 14px; }
.period-picker__nav:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
  transform: scale(1.04);
}
.period-picker__nav:active { transform: scale(.96); }

.period-picker__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.period-picker__cell {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  padding: 10px 6px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .12s ease;
  position: relative;
  text-align: center;
}
.period-picker__cell:hover {
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  border-color: var(--border);
  transform: translateY(-1px);
}
.period-picker__cell--current { color: var(--text); }
.period-picker__cell--current::after {
  content: '';
  position: absolute;
  bottom: 5px; left: 50%;
  width: 4px; height: 4px;
  margin-left: -2px;
  background: var(--text-muted);
  border-radius: 50%;
}
.period-picker__cell--selected {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(255, 255, 255, .12);
}
.period-picker__cell--selected:hover {
  background: var(--white);
  color: var(--black);
  transform: translateY(-1px);
}
.period-picker__cell--selected.period-picker__cell--current::after { background: var(--black); }

.period-picker__footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.period-picker__today-btn {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 8px;
  cursor: pointer;
  border-radius: 7px;
  transition: all .12s ease;
}
.period-picker__today-btn svg { width: 13px; height: 13px; opacity: .7; }
.period-picker__today-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .04);
  border-color: var(--border);
}

.content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all .12s ease;
  text-decoration: none;
  white-space: nowrap;
  height: 38px;
}
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
  font-weight: 500;
}
.btn-primary:hover:not(:disabled) {
  background: #e5e5e5;
  border-color: #e5e5e5;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-focus);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-2);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #d13a40; border-color: #d13a40; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .12s ease;
}
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* ============ Cards / Panels ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card--elevated { background: var(--surface-2); }

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.card__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: none;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.section-head h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text);
}
.section-head .actions { display: flex; gap: 8px; }

.grid { display: grid; gap: 16px; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ============ Stat cards ============ */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color .12s ease;
}
.stat:hover { border-color: var(--border-strong); }

.stat__label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.stat__value {
  font-size: 30px;
  font-weight: 600;
  margin-top: 8px;
  letter-spacing: -0.7px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat__sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
}

.stat--accent .stat__value { color: var(--white); }
.stat--success .stat__value { color: var(--success); }
.stat--danger .stat__value { color: var(--danger); }

/* ============ Owner split ============ */
.owner-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}
.owner-split__cell {
  padding: 22px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .12s ease;
}
.owner-split__cell:hover { border-color: var(--border-strong); }
.owner-split__name {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.owner-split__amount {
  font-size: 30px;
  font-weight: 600;
  margin-top: 8px;
  letter-spacing: -0.7px;
  font-variant-numeric: tabular-nums;
}

/* ============ Tables ============ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: max-content;
}
.table th, .table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 14px;
  white-space: nowrap;
}
.table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 500;
  background: transparent;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s ease; }
.table tbody tr:hover td { background: var(--surface-2); }

.table tfoot tr { background: var(--surface-2) !important; }
.table tfoot td { border-top: 1px solid var(--border); border-bottom: none; }

.table__num { font-variant-numeric: tabular-nums; font-weight: 500; }
.table__actions { display: flex; gap: 2px; justify-content: flex-end; }

.empty {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-muted);
}
.empty__icon {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.empty__icon svg { width: 28px; height: 28px; }
.empty h3 { margin: 0 0 8px; color: var(--text); font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.empty p { margin: 0 0 20px; font-size: 14px; }

/* ============ Forms ============ */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-row--3 { grid-template-columns: 1fr 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field--full { grid-column: 1 / -1; }
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.field .hint { font-size: 12px; color: var(--text-dim); }
.field .err { font-size: 13px; color: var(--danger); }

.input, .select, .textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .12s ease, background .12s ease;
  width: 100%;
  color-scheme: dark;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }

/* Нативные date/month inputs — стилизация иконки календаря */
.input[type="date"]::-webkit-calendar-picker-indicator,
.input[type="month"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85) brightness(0.95);
  opacity: .55;
  cursor: pointer;
  transition: opacity .15s ease;
  margin-right: 2px;
}
.input[type="date"]:hover::-webkit-calendar-picker-indicator,
.input[type="month"]:hover::-webkit-calendar-picker-indicator,
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="month"]:hover::-webkit-calendar-picker-indicator {
  opacity: 1;
}
.input[type="date"]::-webkit-datetime-edit-day-field:focus,
.input[type="date"]::-webkit-datetime-edit-month-field:focus,
.input[type="date"]::-webkit-datetime-edit-year-field:focus,
.input[type="month"]::-webkit-datetime-edit-month-field:focus,
.input[type="month"]::-webkit-datetime-edit-year-field:focus {
  background: rgba(255, 255, 255, .12);
  color: var(--text);
  border-radius: 3px;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--border-focus);
  background: var(--surface-3);
}
.textarea { min-height: 80px; resize: vertical; }
.input--num { font-variant-numeric: tabular-nums; }

.input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  transition: all .12s ease;
}
.input-group:hover { border-color: var(--border-strong); }
.input-group:focus-within {
  border-color: var(--border-focus);
  background: var(--surface-3);
}
.input-group .input { border: none; background: transparent; }
.input-group__suffix {
  display: inline-flex; align-items: center;
  padding: 0 14px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  border-left: 1px solid var(--border);
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.split-bar {
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
}
.split-bar__seg { height: 100%; }
.split-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* ============ Badges ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--text-muted);
  border: 1px solid var(--border);
  letter-spacing: 0;
}
.badge--accent {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-strong);
}
.badge--success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}
.badge--warn {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}
.badge--danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* ============ Modal ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}
.modal.open { display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}
.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 86vh;
  overflow: auto;
  animation: modalIn .18s ease;
}
.modal__dialog--sm { max-width: 460px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal__title { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }
.modal__body { padding: 22px; }

/* ============ Toasts ============ */
.toasts {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  min-width: 260px;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
  animation: toastIn .2s ease;
}
.toast--success { border-color: var(--success-border); color: var(--success); }
.toast--error   { border-color: var(--danger-border); color: var(--danger); }
.toast--warn    { border-color: var(--warning-border); color: var(--warning); }
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============ Helpers ============ */
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--white); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.fw-700 { font-weight: 600; }
.fw-600 { font-weight: 500; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap-8 { display: flex; gap: 8px; }
.flex-gap-12 { display: flex; gap: 12px; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ============ Vacancy cards ============ */
.vac-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color .12s ease;
}
.vac-card:hover { border-color: var(--border-strong); }
.vac-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.vac-card__title { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; color: var(--text); }
.vac-card__rate {
  font-size: 22px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.vac-card__desc { color: var(--text-muted); font-size: 14px; line-height: 1.55; }

/* ============ Tabs ============ */
.tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 1px;
}
.tabs button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: all .1s ease;
}
.tabs button.active { background: var(--surface-3); color: var(--text); }

kbd {
  display: inline-block;
  padding: 1px 5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ============ Charts ============ */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 220px;
  padding: 14px 0 0;
}
.chart__bar {
  flex: 1;
  background: var(--text);
  border-radius: 4px 4px 1px 1px;
  position: relative;
  min-height: 2px;
  transition: opacity .12s ease;
  cursor: pointer;
  opacity: .85;
}
.chart__bar:hover { opacity: 1; }
.chart__bar--neg { background: var(--danger); opacity: .7; }

.bar-with-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  gap: 5px;
  height: 240px;
}
.bar-with-label__bar { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar-with-label__label {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.bar-with-label__val {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

/* ============ Switch ============ */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { display: none; }
.switch__track {
  width: 36px; height: 20px;
  background: var(--surface-3);
  border-radius: 999px;
  position: relative;
  transition: background .15s ease;
  border: 1px solid var(--border);
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 1px; left: 1px;
  width: 16px; height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all .15s ease;
}
.switch input:checked + .switch__track {
  background: var(--white);
  border-color: var(--white);
}
.switch input:checked + .switch__track::after {
  left: 17px;
  background: var(--black);
}

/* ============ Sidebar mobile ============ */
@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    height: 100vh;
  }
  .sidebar.open { transform: translateX(0); }
  #sidebarToggle { display: inline-flex; }
  .topbar { padding: 14px 18px; }
  .content { padding: 20px; }
  .form-row, .form-row--3 { grid-template-columns: 1fr; }
  .section-head h2 { font-size: 22px; }
}

@media (max-width: 600px) {
  .period-input { min-width: 110px; font-size: 13px; }
  #periodToday { display: none; }
  .table th, .table td { padding: 12px 12px; font-size: 13px; }
  .stat__value { font-size: 24px; }
  .owner-split { grid-template-columns: 1fr; }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 25;
}
.sidebar-backdrop.show { display: block; }

/* ============ Scrollbar ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .08);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .18); background-clip: padding-box; }

/* ============ Selection ============ */
::selection { background: rgba(255, 255, 255, .2); color: var(--white); }

/* ============ Expense filters ============ */
.exp-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.exp-filters__summary {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.exp-filters__summary strong { color: var(--text); }
.exp-owner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.exp-owner::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.exp-owner--1::before { background: #4f9eff; }
.exp-owner--2::before { background: #f5a623; }

/* ============ KANBAN ============ */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(240px, 1fr));
  gap: 12px;
  align-items: start;
}
.kanban__col {
  background: rgba(255, 255, 255, .012);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  min-height: 280px;
  max-height: calc(100vh - 260px);
  transition: background .18s ease, border-color .18s ease;
  overflow: hidden;
}
.kanban__col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kanban__col-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600;
  color: var(--text);
  letter-spacing: .1px;
}
.kanban__col-icon { font-size: 13px; opacity: .85; }
.kanban__col-count {
  background: rgba(255, 255, 255, .07);
  color: var(--text-muted);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.kanban__col-sum {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.kanban__cards {
  flex: 1;
  display: flex; flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
  min-height: 60px;
  position: relative;
}
.kanban__cards.drag-over {
  background: rgba(255, 255, 255, .025);
}
.kanban__placeholder {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  padding: 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
.kanban__cards.drag-over .kanban__placeholder { opacity: .55; }
.kanban__cards:not(.drag-over) > .kanban__placeholder { display: none; }

.kanban__add {
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  padding: 8px 14px;
  margin: 0;
  cursor: pointer;
  transition: all .12s ease;
  text-align: left;
}
.kanban__add:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .03);
}

/* ----- Card (полноценная: bar + body + footer) ----- */
.kanban-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: grab;
  transition: background .12s ease, border-color .12s ease,
              box-shadow .15s ease, transform .15s cubic-bezier(.2,.8,.2,1),
              opacity .15s ease;
  user-select: none;
  animation: cardEnter .2s ease;
  overflow: hidden;
}
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cardJustDropped {
  0%   { box-shadow: 0 0 0 1px var(--white), 0 6px 20px rgba(255, 255, 255, .12); }
  100% { box-shadow: 0 0 0 0 transparent, 0 0 0 transparent; }
}
.kanban-card:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging {
  opacity: .4;
  border-color: var(--border-focus);
  transform: rotate(.8deg) scale(.98);
}
.kanban-card.just-dropped { animation: cardJustDropped .45s ease; }
.kanban-card.drop-before {
  box-shadow: 0 -2px 0 var(--white);
}
.kanban-card.drop-after {
  box-shadow: 0 2px 0 var(--white);
}

/* Цветной индикатор сверху по статусу */
.kanban-card__bar {
  height: 3px;
  width: 100%;
  background: var(--text-dim);
  transition: background .15s ease;
}
.kanban-card[data-status="backlog"]  .kanban-card__bar { background: rgba(255, 255, 255, .25); }
.kanban-card[data-status="progress"] .kanban-card__bar { background: var(--success); }
.kanban-card[data-status="review"]   .kanban-card__bar { background: var(--warning); }
.kanban-card[data-status="done"]     .kanban-card__bar { background: linear-gradient(90deg, var(--success), #4ade80); }
.kanban-card[data-status="paid"]     .kanban-card__bar { background: var(--white); }

/* Боковой акцент для high-priority */
.kanban-card[data-priority="high"] {
  border-left: 2px solid var(--danger);
}

/* Body */
.kanban-card__body {
  padding: 11px 12px 8px;
}
.kanban-card__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  letter-spacing: -.1px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kanban-card__desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Pills row */
.kanban-card__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.kanban-card__pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  white-space: nowrap;
}
.kanban-card__pill svg { width: 11px; height: 11px; opacity: .75; flex-shrink: 0; }
.kanban-card__pill--soon {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}
.kanban-card__pill--overdue {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
  animation: pillPulse 2.4s ease-in-out infinite;
}
.kanban-card__pill--high {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}
@keyframes pillPulse {
  0%, 100% { opacity: .92; }
  50% { opacity: 1; }
}

/* Footer */
.kanban-card__footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(255, 255, 255, .025);
}
.kanban-card__avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  color: var(--text-2);
  flex-shrink: 0;
}
.kanban-card__avatar--empty {
  background: transparent;
  border-style: dashed;
  color: var(--text-dim);
}
.kanban-card__amount {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.2px;
}

/* Hover actions */
.kanban-card__hover-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: flex; gap: 1px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.kanban-card:hover .kanban-card__hover-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.kanban-card__btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 22px; height: 22px;
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .1s ease;
}
.kanban-card__btn svg { width: 12px; height: 12px; }
.kanban-card__btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* Mobile */
@media (max-width: 1100px) {
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kanban__col { max-height: none; }
}
@media (max-width: 600px) {
  .kanban { grid-template-columns: 1fr; }
}

/* ============ AGENT ============ */
.agent {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  /* topbar ~70px + content vertical padding 56px + запас 4px */
  height: calc(100vh - 130px);
  min-height: 540px;
  position: relative;
  overflow: hidden;          /* клипим фоновые orbs и cursor-glow */
  border-radius: var(--radius-lg);
}

/* Фоновые градиентные orbs (как в reference: violet/indigo/fuchsia с большим blur'ом) */
.agent::before, .agent::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(120px);
  mix-blend-mode: screen;
  opacity: .55;
}
.agent::before {
  top: -10%; left: 30%;
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(139, 92, 246, .35), transparent 70%);
  animation: orbDrift1 14s ease-in-out infinite alternate;
}
.agent::after {
  bottom: -10%; right: 20%;
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(99, 102, 241, .28), transparent 70%);
  animation: orbDrift2 16s ease-in-out infinite alternate;
}
@keyframes orbDrift1 {
  0% { transform: translate(0,0); }
  100% { transform: translate(40px, 30px); }
}
@keyframes orbDrift2 {
  0% { transform: translate(0,0); }
  100% { transform: translate(-30px, -50px); }
}

/* Третий orb — добавим элементом в HTML */
.agent__bg-orb {
  position: absolute;
  top: 30%; right: 38%;
  width: 240px; height: 240px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(96px);
  background: radial-gradient(circle, rgba(217, 70, 239, .22), transparent 70%);
  mix-blend-mode: screen;
  opacity: .6;
  animation: orbDrift3 20s ease-in-out infinite alternate;
}
@keyframes orbDrift3 {
  0% { transform: translate(0,0); }
  100% { transform: translate(20px, -30px); }
}

/* Mouse-follow soft glow (внутри .agent — клипится overflow: hidden) */
.agent__cursor-glow {
  position: absolute;
  left: 0; top: 0;
  width: 600px; height: 600px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  filter: blur(96px);
  background: radial-gradient(circle, rgba(139, 92, 246, .14), rgba(79, 70, 229, .06) 40%, transparent 70%);
  opacity: 0;
  transition: opacity .4s ease;
  will-change: transform, opacity;
  margin-left: -300px; margin-top: -300px;
}
.agent__cursor-glow.visible { opacity: 1; }

.agent__sidebar, .agent__main { position: relative; z-index: 2; }

.agent__sidebar {
  display: flex; flex-direction: column;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.agent__sidebar-head {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.agent__convs {
  flex: 1; overflow-y: auto;
  padding: 6px;
}
.agent__conv {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s ease;
  border: 1px solid transparent;
  margin-bottom: 2px;
}
.agent__conv:hover { background: var(--surface-hover); }
.agent__conv.active {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.agent__conv-title {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent__conv-meta {
  font-size: 11px; color: var(--text-dim);
  margin-top: 2px;
  display: flex; justify-content: space-between; gap: 8px;
}
.agent__conv-del {
  opacity: 0; font-size: 14px; padding: 0 4px; color: var(--text-muted);
  background: none; border: none; cursor: pointer; transition: all .15s ease;
}
.agent__conv:hover .agent__conv-del { opacity: 1; }
.agent__conv-del:hover { color: var(--danger); }

.agent__main {
  display: flex; flex-direction: column;
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .05);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

.agent__messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  scroll-behavior: smooth;
}

/* Empty state — центрированный hero как в reference */
.agent__empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 8% 24px 40px;
  min-height: 100%;
  justify-content: center;
}
.agent__empty-orb {
  width: 72px; height: 72px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.85), rgba(255,255,255,.05) 60%, transparent 75%);
  box-shadow:
    0 0 80px rgba(139, 92, 246, .25),
    0 0 40px rgba(255,255,255,.1),
    0 0 24px rgba(255,255,255,.08),
    inset 0 0 30px rgba(255,255,255,.12);
  margin-bottom: 24px;
  animation: orbPulse 3s ease-in-out infinite;
}
@keyframes orbPulse {
  0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 80px rgba(139,92,246,.25), 0 0 40px rgba(255,255,255,.1), 0 0 24px rgba(255,255,255,.08), inset 0 0 30px rgba(255,255,255,.12); }
  50% { transform: scale(1.05); opacity: .92; box-shadow: 0 0 100px rgba(139,92,246,.35), 0 0 50px rgba(255,255,255,.14), 0 0 30px rgba(255,255,255,.1), inset 0 0 40px rgba(255,255,255,.16); }
}
.agent__empty-title {
  font-size: 32px; font-weight: 500;
  letter-spacing: -.8px; margin: 0 0 6px;
  background: linear-gradient(135deg, rgba(255,255,255,.95) 20%, rgba(255,255,255,.4));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1.1;
}
.agent__empty-sub {
  color: rgba(255,255,255,.4); font-size: 14px; margin: 0 0 24px;
  max-width: 460px;
}
.agent__empty-divider {
  width: 100%; max-width: 320px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  margin: 0 0 28px;
}
.agent__empty-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; width: 100%; max-width: 580px;
  margin-bottom: 24px;
}
.agent__empty-card {
  text-align: left;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: all .2s ease;
  backdrop-filter: blur(10px);
}
.agent__empty-card:hover {
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  transform: translateY(-1px);
}
.agent__empty-card-title { font-size: 14px; font-weight: 500; color: rgba(255,255,255,.9); }
.agent__empty-card-sub { font-size: 12px; color: rgba(255,255,255,.4); margin-top: 4px; }

.agent__empty-quick {
  display: flex; flex-wrap: wrap; gap: 6px;
  justify-content: center;
  max-width: 580px;
}
.agent__empty-quick button {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.05);
  color: rgba(255,255,255,.6);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
}
.agent__empty-quick button:hover {
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.9);
  border-color: rgba(255,255,255,.14);
}

/* Messages */
.agent-msg {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  animation: msgFadeIn .25s ease;
}
@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.agent-msg__avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  margin-top: 2px;
}
.agent-msg--user .agent-msg__avatar {
  background: var(--white); color: var(--black); border-color: transparent;
}
.agent-msg__body { flex: 1; min-width: 0; }
.agent-msg__role {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 4px;
}
.agent-msg__text {
  font-size: 14px; color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-msg--user .agent-msg__text {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

/* Thinking pulse */
.agent-thinking {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 10px;
}
.agent-thinking__dots { display: inline-flex; gap: 3px; }
.agent-thinking__dots span {
  width: 4px; height: 4px;
  background: var(--text-2); border-radius: 50%;
  animation: thinkBounce 1.2s infinite ease-in-out;
}
.agent-thinking__dots span:nth-child(2) { animation-delay: .15s; }
.agent-thinking__dots span:nth-child(3) { animation-delay: .3s; }
@keyframes thinkBounce {
  0%, 80%, 100% { opacity: .3; transform: scale(.7); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* Reasoning (chain-of-thought) */
.agent-reasoning {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 6px 0;
  background: linear-gradient(180deg, rgba(255,255,255,.025), transparent);
  overflow: hidden;
  animation: msgFadeIn .25s ease;
}
.agent-reasoning__head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: var(--text-muted);
}
.agent-reasoning__icon {
  font-size: 12px;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.3));
}
.agent-reasoning__label {
  font-weight: 500;
  letter-spacing: .2px;
}
.agent-reasoning__chevron {
  margin-left: auto;
  color: var(--text-dim);
  transition: transform .15s ease;
  font-size: 14px;
}
.agent-reasoning.expanded .agent-reasoning__chevron { transform: rotate(90deg); }
.agent-reasoning__body {
  padding: 0 14px 12px 30px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  display: none;
  border-left: 2px solid var(--border);
  margin-left: 16px;
}
.agent-reasoning.expanded .agent-reasoning__body { display: block; }

/* Tool calls — план агента */
.agent-tool {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 6px 0;
  background: var(--surface-2);
  overflow: hidden;
  animation: msgFadeIn .25s ease;
}
.agent-tool__head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.agent-tool__icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  flex-shrink: 0;
}
.agent-tool__icon--pending { background: var(--warning-bg); color: var(--warning); }
.agent-tool__icon--running {
  background: rgba(255,255,255,.06); color: var(--text);
  animation: spin 1.2s linear infinite;
}
.agent-tool__icon--done { background: var(--success-bg); color: var(--success); }
.agent-tool__icon--error { background: var(--danger-bg); color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }

.agent-tool__name {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
}
.agent-tool__status {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}
.agent-tool__chevron {
  color: var(--text-dim);
  transition: transform .15s ease;
  font-size: 14px;
}
.agent-tool.expanded .agent-tool__chevron { transform: rotate(90deg); }

.agent-tool__body {
  padding: 0 12px 10px 38px;
  font-size: 12px;
  color: var(--text-muted);
  display: none;
}
.agent-tool.expanded .agent-tool__body { display: block; }
.agent-tool__kv {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-2);
  max-height: 160px;
  overflow-y: auto;
}

/* Composer (как в reference: glass + rounded + slash palette) */
.agent__composer {
  border-top: 1px solid rgba(255,255,255,.05);
  background: transparent;
  padding: 14px 20px 18px;
  position: relative;
}
.agent__composer-inner {
  position: relative;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px;
  padding: 4px;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  transition: all .2s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.agent__composer-inner:focus-within {
  border-color: rgba(255,255,255,.15);
  background: rgba(255,255,255,.03);
  box-shadow:
    0 8px 32px rgba(0,0,0,.4),
    0 0 0 4px rgba(139, 92, 246, .08);
}
.agent__textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.92);
  font: inherit;
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 44px;
  max-height: 220px;
  padding: 14px 16px 6px;
  line-height: 1.5;
}
.agent__textarea::placeholder { color: rgba(255,255,255,.18); }
.agent__composer-actions {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 12px;
  border-top: 1px solid rgba(255,255,255,.04);
}
.agent__icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: transparent; border: none;
  color: rgba(255,255,255,.4);
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s ease;
}
.agent__icon-btn:hover {
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.9);
}
.agent__icon-btn.active {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.95);
}
.agent__icon-btn svg { width: 16px; height: 16px; }

.agent__send-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: auto;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all .15s ease;
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.4);
}
.agent__send-btn.ready {
  background: rgba(255,255,255,.95);
  color: #0a0a0a;
  box-shadow: 0 6px 20px rgba(255,255,255,.12);
}
.agent__send-btn.ready:hover { background: #fff; transform: translateY(-1px); }
.agent__send-btn:disabled { cursor: not-allowed; opacity: .65; }
.agent__send-btn svg { width: 14px; height: 14px; }

/* Slash command palette */
.agent__slash {
  position: absolute;
  left: 16px; right: 16px;
  bottom: calc(100% + 6px);
  background: rgba(15, 15, 17, .96);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  backdrop-filter: blur(20px);
  z-index: 10;
  overflow: hidden;
  animation: slashIn .15s ease;
}
@keyframes slashIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.agent__slash-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: background .12s ease;
}
.agent__slash-item:hover, .agent__slash-item.active {
  background: rgba(255,255,255,.06);
}
.agent__slash-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  background: rgba(255,255,255,.04);
  border-radius: 7px;
  flex-shrink: 0;
}
.agent__slash-text { flex: 1; min-width: 0; }
.agent__slash-label { color: rgba(255,255,255,.95); font-weight: 500; }
.agent__slash-desc { color: rgba(255,255,255,.4); font-size: 12px; margin-top: 2px; }
.agent__slash-prefix {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,.3);
  background: rgba(255,255,255,.04);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Quick chips под композером (только когда есть сообщения) */
.agent__quick {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 4px 6px;
}
.agent__chip {
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  transition: all .12s ease;
  font-family: inherit;
}
.agent__chip:hover {
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.9);
  border-color: rgba(255,255,255,.14);
}

/* Floating typing indicator (как в reference, плавающий внизу) */
.agent__floating-status {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 15, 17, .85);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 8px 16px 8px 10px;
  backdrop-filter: blur(16px);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,.7);
  z-index: 50;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
  animation: floatIn .25s ease;
}
@keyframes floatIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.agent__floating-status .agent-thinking__dots span { background: rgba(255,255,255,.85); }
.agent__floating-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,.9);
}

/* Mobile */
@media (max-width: 900px) {
  .agent { grid-template-columns: 1fr; height: auto; min-height: unset; }
  .agent__sidebar { display: none; }
  .agent__messages { padding: 16px; }
}

/* ============ Employee card ============ */
.emp-card { display: flex; flex-direction: column; gap: 16px; }

.emp-card__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}
.emp-card__info { min-width: 0; }
.emp-card__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.emp-card__name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.3px;
}
.emp-card__meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.emp-card__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.emp-card__empty {
  padding: 16px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.emp-card__placements {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.placement {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.placement__info { min-width: 0; }
.placement__title { font-weight: 600; font-size: 14px; }
.placement__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}
.placement__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.emp-card__total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.emp-card__total strong { color: var(--text); font-weight: 600; }

/* Когда вкладка "Агент" активна — отключаем скролл body, агент сам управляет высотой */
body:has(.agent) { overflow: hidden; }

/* На узких карточках — кнопки под именем */
@media (max-width: 700px) {
  .emp-card__head { grid-template-columns: 1fr; }
  .emp-card__actions { justify-content: flex-start; }
  .placement { grid-template-columns: 1fr; }
  .placement__actions { justify-content: flex-start; }
}

/* ============ Lock screen ============ */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  background: var(--bg);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lock-screen.open { display: flex; }
.lock-screen__panel {
  max-width: 400px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.lock-screen__brand { text-align: center; margin-bottom: 24px; }
.lock-screen__title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.4px;
  text-align: center;
}
.lock-screen__subtitle {
  margin: 0 0 22px;
  font-size: 14px;
  text-align: center;
}
.lock-screen .err {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-align: center;
  font-weight: 500;
}
.lock-screen .btn-primary { justify-content: center; }

