/* ---------- Базовые токены ---------- */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --border: #e3e6ea;
  --border-soft: #eef0f3;
  --text: #1f2328;
  --muted: #6e7781;
  --primary: #2b6cb0;
  --primary-hover: #224d80;
  --primary-soft: #ebf4ff;
  --danger: #c53030;
  --green: #2f855a;
  --yellow: #b7791f;
  --gray: #718096;
  --sidebar-bg: #ffffff;
  --sidebar-border: #e3e6ea;
  --sidebar-w: 240px;
  --drawer-w: 560px;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

button { font-family: inherit; }

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

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 16px 8px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 12px;
}
.brand-mark {
  width: 32px; height: 32px;
  background: var(--primary); color: white;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.brand-title { font-weight: 600; font-size: 14px; line-height: 1.1; }
.brand-version { color: var(--muted); font-size: 11px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  color: var(--muted); text-decoration: none;
  font-size: 13.5px; cursor: pointer; user-select: none;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.nav-ico {
  width: 18px;
  display: inline-flex; justify-content: center;
  font-size: 14px; opacity: 0.85;
}
.nav-item.active .nav-ico { opacity: 1; }
.nav-label { flex: 1; }
.nav-soon {
  font-size: 10px; color: var(--muted);
  background: var(--panel-2);
  padding: 2px 6px; border-radius: 8px;
  text-transform: uppercase; letter-spacing: 0.04em;
}

.nav-divider { height: 1px; background: var(--border-soft); margin: 10px 4px; }

.sidebar-footer {
  margin-top: 8px; padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; }
.me-avatar {
  width: 32px; height: 32px;
  background: #ed8936; color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.me-name { font-weight: 600; font-size: 13px; }
.me-role { color: var(--muted); font-size: 11px; }

/* ---------- Content ---------- */
.content { padding: 24px 28px; min-width: 0; }

.page-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 22px; font-weight: 600; }
.page-head .crumb { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.page-head .right { display: flex; gap: 8px; align-items: center; }

.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0 0 16px 0; gap: 12px;
}
.toolbar h2 { margin: 0; font-size: 18px; font-weight: 600; }
.toolbar .right { display: flex; gap: 8px; align-items: center; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-secondary, .btn-link, .btn-danger {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px; cursor: pointer;
  font-family: inherit; font-weight: 500;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled {
  background: var(--panel-2); color: var(--muted);
  cursor: not-allowed; border-color: var(--border);
}
.btn-secondary { background: white; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--panel-2); }
.btn-link { background: transparent; color: var(--primary); padding: 4px 6px; }
.btn-link:hover { text-decoration: underline; }
.btn-danger { background: transparent; color: var(--danger); padding: 4px 6px; }
.btn-danger:hover { text-decoration: underline; }
.btn-close {
  background: none; border: none;
  font-size: 22px; color: var(--muted);
  cursor: pointer; line-height: 1; padding: 4px 8px;
}
.btn-close:hover { color: var(--text); }

select, input, textarea {
  padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--panel);
  font-size: 14px; font-family: inherit;
}
textarea { min-height: 70px; resize: vertical; width: 100%; }

/* ---------- Cards / tables ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border-soft);
}
.card-head h2 { margin: 0; font-size: 20px; }
.card-head h3 { margin: 0; font-size: 15px; }
.card-body { padding: 16px 20px; }

table {
  width: 100%; border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
table th, table td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border-soft); font-size: 13px;
}
table th {
  background: var(--panel-2); font-weight: 600;
  font-size: 11.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
table tr:last-child td { border-bottom: none; }
table tr.clickable { cursor: pointer; }
table tr.clickable:hover td { background: #f2f6fb; }

.inner-table { border: none; border-radius: 0; }
.inner-table th { background: transparent; }
.row-actions { white-space: nowrap; text-align: right; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px; font-weight: 500;
  background: #edf2f7; color: var(--gray);
}
.badge-active   { background: #c6f6d5; color: var(--green); }
.badge-training { background: #fefcbf; color: var(--yellow); }
.badge-paused   { background: #feebc8; color: var(--yellow); }
.badge-fired    { background: #fed7d7; color: var(--danger); }
.badge-closed   { background: #e2e8f0; color: var(--gray); }
.badge-draft    { background: #e2e8f0; color: var(--gray); }
.badge-candidate{ background: #bee3f8; color: #2c5282; }

/* ---------- Pair (label/value rows in cards) ---------- */
.pair {
  display: grid; grid-template-columns: 220px 1fr;
  padding: 6px 0; gap: 12px;
  border-bottom: 1px dashed var(--border-soft);
}
.pair:last-child { border-bottom: none; }
.pair-label { color: var(--muted); }
.pair-value { color: var(--text); }
.pair.notes .pair-value { white-space: pre-wrap; }
.pair-value code {
  background: var(--bg); padding: 1px 6px;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  font-size: 12px; margin-right: 8px;
}
.pair-value .badge { margin-right: 8px; }

/* ---------- Drawer (right slide-over) ---------- */
.drawer {
  position: fixed; top: 0; right: 0;
  width: var(--drawer-w); max-width: 96vw; height: 100vh;
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px rgba(15, 23, 42, 0.08);
  display: flex; flex-direction: column;
  z-index: 200;
  transform: translateX(0);
  transition: transform 0.22s ease;
}
.drawer.hidden { transform: translateX(105%); pointer-events: none; }
.drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 22px; border-bottom: 1px solid var(--border-soft);
}
.drawer-eyebrow {
  color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.drawer-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-foot {
  padding: 14px 22px; border-top: 1px solid var(--border-soft);
  display: flex; justify-content: flex-end; gap: 8px;
}
.drawer-foot.hidden { display: none; }

.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.25);
  z-index: 150;
  opacity: 1;
  transition: opacity 0.2s ease;
}
.drawer-backdrop.hidden { opacity: 0; pointer-events: none; }

/* ---------- Form (внутри drawer) ---------- */
.form {
  display: grid; grid-template-columns: 180px 1fr;
  gap: 10px 14px; align-items: center;
}
.form label { font-size: 13px; color: var(--muted); }
.form input, .form select, .form textarea { width: 100%; }
.form .req { color: var(--danger); margin-left: 2px; }
.form-hint-row {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 180px 1fr; gap: 14px;
  margin-top: -4px;
}
.form-hint { font-size: 12px; color: var(--muted); font-style: italic; }
.form details.extra {
  grid-column: 1 / -1; margin-top: 8px;
  border-top: 1px solid var(--border-soft); padding-top: 8px;
}
.form details.extra summary {
  cursor: pointer; font-size: 13px; color: var(--muted); padding: 4px 0;
}
.form .extra-grid {
  display: grid; grid-template-columns: 180px 1fr; gap: 10px 14px;
  align-items: center; margin-top: 8px;
}

/* ---------- Toast ---------- */
#toast-layer {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 1000;
  display: flex; flex-direction: column; gap: 8px; max-width: 420px;
}
.toast {
  background: #2d3748; color: white;
  padding: 12px 16px; border-radius: 8px;
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.toast a { color: #90cdf4; text-decoration: underline; }
.toast code {
  background: rgba(255,255,255,0.15);
  padding: 1px 6px; border-radius: 3px;
  font-family: ui-monospace, monospace; font-size: 12px;
}
.toast-msg { flex: 1; line-height: 1.45; }
.toast-close {
  background: none; border: none; color: white;
  cursor: pointer; font-size: 18px; line-height: 1; opacity: 0.6;
}
.toast-close:hover { opacity: 1; }
.toast-info { background: #2b6cb0; }

/* ---------- Progress bar (карточка проекта) ---------- */
.progress-row { display: flex; flex-direction: column; gap: 10px; }
.progress-numbers { display: flex; align-items: baseline; gap: 10px; }
.progress-big { font-size: 32px; font-weight: 600; color: var(--text); }
.progress-bar {
  height: 10px; background: var(--bg);
  border-radius: 5px; overflow: hidden; border: 1px solid var(--border);
}
.progress-fill { height: 100%; background: var(--green); transition: width 0.3s ease; }
.progress-fill.overrun { background: var(--danger); }
.progress-meta { font-size: 13px; }

/* ---------- Чек-лист ---------- */
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.checklist li.done .check-label { color: var(--text); }
.checklist li.pending .check-label { color: var(--muted); }
.check-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 13px; font-weight: 600;
}
.checklist li.done .check-mark { background: #c6f6d5; color: var(--green); }
.checklist li.pending .check-mark { background: #edf2f7; color: var(--muted); }

/* ---------- Артефакты клиента ---------- */
.artifact-row {
  display: grid; grid-template-columns: 220px 1fr auto;
  gap: 14px; padding: 10px 0;
  border-bottom: 1px dashed var(--border-soft);
  align-items: center;
}
.artifact-row:last-child { border-bottom: none; }
.artifact-label { color: var(--muted); font-size: 13px; }
.artifact-value { font-size: 13px; }
.artifact-value code {
  background: var(--bg); padding: 1px 6px;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  font-size: 12px; margin-right: 8px;
}
.reset-btn {
  font-size: 16px; font-weight: bold; color: var(--danger);
  padding: 0 6px; margin-left: 6px;
  background: none; border: none; cursor: pointer; vertical-align: middle;
}
.reset-btn:hover { color: #9b2c2c; }

/* ---------- Integrations cards ---------- */
.integrations-list { display: flex; flex-direction: column; gap: 16px; }
.int-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
}
.int-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.int-head h3 { margin: 0; font-size: 16px; }
.int-meta { display: flex; gap: 10px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--muted); }
.int-meta code {
  background: var(--bg); padding: 1px 6px; border-radius: 3px;
  font-family: ui-monospace, monospace;
}
.int-desc { margin: 10px 0 14px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.int-form {
  border-top: 1px dashed var(--border-soft); padding-top: 14px; margin-top: 8px;
  display: flex; flex-direction: column; gap: 12px;
}
.int-field { display: grid; grid-template-columns: 200px 1fr; gap: 8px 14px; align-items: center; }
.int-field label { color: var(--muted); font-size: 13px; }
.int-field input {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-size: 13px; width: 100%;
}
.int-field .form-hint { grid-column: 2 / 3; margin-top: -4px; }
.int-actions { display: flex; gap: 10px; align-items: center; padding-top: 6px; border-top: 1px dashed var(--border-soft); }
.int-last-check { margin-left: auto; font-size: 12px; }
.int-error {
  margin-top: 8px; padding: 8px 12px;
  background: #fff5f5; color: var(--danger);
  border: 1px solid #fed7d7; border-radius: 6px;
  font-size: 12px; font-family: ui-monospace, monospace; white-space: pre-wrap;
}
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; }
.toggle input { width: 16px; height: 16px; cursor: pointer; }

/* ---------- Прогресс в ячейке таблицы ---------- */
.cell-progress { display: flex; flex-direction: column; gap: 4px; min-width: 180px; }
.cell-progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.cell-progress-fill {
  height: 100%;
  background: var(--green);
  transition: width 0.3s ease;
}
.cell-progress-fill.overrun { background: var(--danger); }
.cell-progress-text { font-size: 12px; color: var(--text); }

/* ---------- Finance / Pace / Tasks ---------- */
.finance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}
.finance-cell {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.finance-cell.finance-margin {
  background: #f0fff4;
  border-color: #c6f6d5;
}
.cell-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.cell-big {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.cell-sub {
  font-size: 11.5px;
  margin-top: 4px;
  line-height: 1.4;
}
.finance-notes {
  border-top: 1px dashed var(--border-soft);
  padding-top: 10px;
  margin-top: 8px;
  line-height: 1.55;
}

/* Pace */
.pace-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.pace-stat {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.pace-graph {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 0 4px 0;
  border-top: 1px dashed var(--border-soft);
  margin-top: 6px;
}
.pace-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: default;
}
.pace-bar-fill {
  width: 100%;
  max-width: 28px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}
.pace-bar-count {
  font-size: 10px;
  color: var(--muted);
  height: 12px;
}
.pace-bar-label {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

/* Tasks */
.tasks {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.task-mark {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fefcbf; color: var(--yellow);
  border-radius: 50%;
  font-weight: 700;
}
.task-title { font-size: 14px; }
.task-meta { margin-top: 2px; }
.task-action { white-space: nowrap; }

/* Прогресс-ячейка в общей таблице проектов */
.cell-progress {
  display: flex; flex-direction: column; gap: 4px;
}
.cell-progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.cell-progress-fill { height: 100%; background: var(--green); }
.cell-progress-fill.overrun { background: var(--danger); }
.cell-progress-text { font-size: 12px; }

/* ---------- Плитки проектов на карточке клиента ---------- */
.project-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.proj-tile {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, transform 0.05s;
}
.proj-tile:hover { border-color: var(--primary); }
.proj-tile:active { transform: scale(0.995); }
.proj-tile-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.proj-tile-head strong { font-size: 14px; }
.proj-tile-stats { font-size: 13px; }
.proj-tile-big { font-size: 22px; font-weight: 600; color: var(--text); }
.proj-tile-bonus {
  margin-top: -4px;
  color: var(--green) !important;
  font-weight: 500;
}
.proj-tile-foot {
  display: flex; gap: 8px; align-items: center;
  margin-top: 2px;
}
.proj-tile-foot code {
  background: var(--bg); padding: 1px 6px; border-radius: 3px;
  font-family: ui-monospace, monospace; font-size: 11px;
}

.projects-table-toggle { margin-top: 8px; }
.projects-table-toggle summary {
  cursor: pointer; padding: 6px 0;
  border-top: 1px dashed var(--border-soft);
}

/* ---------- Timeline (история событий) ---------- */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border-soft);
}
.tl-item {
  position: relative;
  padding: 6px 0 14px 28px;
}
.tl-item:last-child { padding-bottom: 0; }
.tl-marker {
  position: absolute;
  left: 0;
  top: 9px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--gray);
}
.tl-client_created  .tl-marker { border-color: var(--primary); background: var(--primary-soft); }
.tl-project_created .tl-marker { border-color: var(--green); }
.tl-project_started .tl-marker { background: var(--green); border-color: var(--green); }
.tl-contract_added  .tl-marker { border-color: var(--yellow); }
.tl-contract_signed .tl-marker { background: var(--yellow); border-color: var(--yellow); }
.tl-head {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-bottom: 2px;
}
.tl-date { color: var(--muted); font-size: 12px; }
.tl-time { color: var(--muted); }
.tl-tag {
  background: var(--panel-2);
  color: var(--muted);
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tl-title { font-size: 14px; }
.tl-details { margin-top: 2px; }

/* ---------- Заглушка «скоро» ---------- */
.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 100px 30px; text-align: center;
  background: var(--panel); border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.placeholder-ico { font-size: 48px; color: var(--muted); opacity: 0.4; margin-bottom: 16px; }
.placeholder h2 { margin: 0 0 8px 0; font-size: 18px; color: var(--text); }
.placeholder p { margin: 0; color: var(--muted); max-width: 480px; font-size: 13.5px; line-height: 1.5; }

/* --- Auth: login-модал и user-chip --- */
.login-backdrop {
  position: fixed; inset: 0; background: rgba(15,20,30,.45);
  display: flex; align-items: center; justify-content: center; z-index: 9000;
}
.login-card {
  background: var(--panel); padding: 32px; border-radius: var(--radius);
  width: 340px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 16px 48px rgba(15,20,30,.18);
  border: 1px solid var(--border);
}
.login-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.login-card input {
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--panel-2); color: var(--text);
  font-size: 14px;
}
.login-card input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.login-card button {
  padding: 10px; background: var(--primary); color: #fff;
  border: 0; border-radius: 6px; font-weight: 600; cursor: pointer;
}
.login-card button:hover { background: var(--primary-hover); }
.login-error { color: var(--danger); font-size: 13px; min-height: 16px; }

/* Бейдж роли (используется внутри .me в сайдбар-футере) */
.user-chip-role {
  display: inline-block;
  font-size: 10px; padding: 1px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.user-chip-role.role-admin  { background: var(--primary-soft); color: var(--primary); }
.user-chip-role.role-viewer { background: var(--border-soft); color: var(--muted); }

/* Кнопка выхода рядом с именем */
.me-logout {
  margin-left: auto;
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.me-logout:hover { background: var(--border-soft); color: var(--text); }

/* В viewer-режиме все кнопки .admin-only прячутся */
body.role-viewer .admin-only { display: none !important; }

/* --- Платежи клиента --- */
.payments-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.ps-item {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.ps-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.ps-value { font-size: 18px; font-weight: 600; margin-top: 4px; color: var(--text); }

.cell-purpose {
  max-width: 360px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- Finance banner на странице клиентов --- */
.finance-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.fb-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.fb-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.fb-value { font-size: 20px; font-weight: 600; margin-top: 4px; color: var(--text); }
.fb-warn {
  border-color: var(--yellow);
  background: #fffbeb;
  cursor: pointer;
}
.fb-warn:hover { background: #fef3c7; }
.fb-warn .fb-value { color: var(--yellow); }

/* --- Страница «К разбору» --- */
.unmatched-group .card-head {
  flex-wrap: wrap;
  gap: 10px;
}
.unmatched-actions {
  display: flex; gap: 8px; align-items: center;
}
.match-client-select {
  min-width: 240px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font-size: 13px;
}
