/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a0a14;
  --bg2:       #111122;
  --card:      #161628;
  --card2:     #1e1e38;
  --border:    rgba(108, 142, 247, 0.12);
  --border2:   rgba(255,255,255,0.06);
  --accent:    #6c8ef7;
  --accent2:   #8ba4ff;
  --success:   #4caf7a;
  --warning:   #ff9f43;
  --danger:    #ff6b6b;
  --text:      #e8e8f5;
  --text2:     #9090b8;
  --text3:     #5a5a7a;
  --tab-h:     calc(60px + env(safe-area-inset-bottom));
  --header-h:  52px;
  --sidebar-w: 240px;
  --rp-w:      300px;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

/* ────────────────────────────────────────────────────────────────────────────
   APP SHELL
   ──────────────────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
}

/* ── Header ── */
.header {
  flex-shrink: 0;
  height: var(--header-h);
  padding-top: env(safe-area-inset-top);
  background: rgba(10,10,20,0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  z-index: 200;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 100%;
}

.header-logo { display: flex; align-items: center; gap: 10px; }

.logo-g {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent), #4a6cf7);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; color: #fff;
}

.header-title { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }

.header-right { display: flex; align-items: center; gap: 10px; }

.header-time { font-size: 13px; color: var(--text3); font-variant-numeric: tabular-nums; }

.btn-icon {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 9px; color: var(--accent); cursor: pointer; transition: opacity .15s;
}
.btn-icon:active { opacity: .7; }
.btn-icon.spinning svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Body layout (below header) ── */
.body-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ────────────────────────────────────────────────────────────────────────────
   MAIN SCROLL AREA
   ──────────────────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 14px 14px calc(14px + var(--tab-h));
}

/* ────────────────────────────────────────────────────────────────────────────
   MOBILE: Bottom Tab Bar
   ──────────────────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(12,12,26,0.94);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 150;
}

.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 7px 4px; height: 60px;
  background: none; border: none; color: var(--text3);
  font-size: 10px; font-weight: 500; cursor: pointer; transition: color .15s;
  position: relative; letter-spacing: .2px;
}
.tab-icon { width: 22px; height: 22px; }
.tab.active { color: var(--accent); }
.tab.active .tab-icon { filter: drop-shadow(0 0 6px rgba(108,142,247,.5)); }

.tab-badge {
  position: absolute; top: 5px; right: calc(50% - 17px);
  min-width: 15px; height: 15px; background: var(--danger);
  border-radius: 8px; font-size: 9px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ────────────────────────────────────────────────────────────────────────────
   DESKTOP ≥ 768px: Sidebar + main (no right panel yet)
   ──────────────────────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .tab-bar { display: none !important; }

  .body-layout { overflow: hidden; }

  .main {
    padding: 20px 24px 20px;
  }

  /* Show sidebar */
  .sidebar {
    display: flex !important;
    flex-direction: column;
    width: var(--sidebar-w);
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg2);
  }

  /* Cards grid 2-col on desktop */
  .d-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .d-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

  /* Projects 2-col */
  .projects-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Finance side-by-side */
  .finance-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }

  .header-inner { padding: 0 20px; }
}

/* ────────────────────────────────────────────────────────────────────────────
   DESKTOP ≥ 1200px: + Right panel
   ──────────────────────────────────────────────────────────────────────────── */
@media (min-width: 1200px) {
  .right-panel {
    display: flex !important;
    flex-direction: column;
    width: var(--rp-w);
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    background: var(--bg2);
    overflow: hidden;
  }

  /* Brain tab hidden in sidebar since right panel is visible */
  .side-tab-brain { display: none !important; }
}

/* ────────────────────────────────────────────────────────────────────────────
   SIDEBAR (hidden on mobile)
   ──────────────────────────────────────────────────────────────────────────── */
.sidebar { display: none; }

.side-nav {
  padding: 12px 8px 4px;
  display: flex; flex-direction: column; gap: 2px;
}

.side-tab {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  background: none; border: none; color: var(--text2);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all .15s; text-align: left; position: relative;
  width: 100%;
}
.side-tab:hover { background: rgba(108,142,247,.07); color: var(--text); }
.side-tab.active { background: rgba(108,142,247,.12); color: var(--accent); }
.side-tab.active .side-icon { filter: drop-shadow(0 0 4px rgba(108,142,247,.5)); }

.side-icon { width: 18px; height: 18px; flex-shrink: 0; }

.side-badge {
  margin-left: auto; min-width: 18px; height: 18px;
  background: var(--danger); border-radius: 9px;
  font-size: 10px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

/* Sidebar sections */
.sidebar-section {
  padding: 10px 12px 6px;
  border-top: 1px solid var(--border2);
  margin-top: 4px;
}

.sidebar-label {
  font-size: 10px; font-weight: 700; color: var(--text3);
  letter-spacing: .9px; text-transform: uppercase; margin-bottom: 8px; padding: 0 2px;
}

/* Agent list */
.agent-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 2px; font-size: 13px; color: var(--text2);
}
.agent-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.agent-dot.online  { background: var(--success); box-shadow: 0 0 5px rgba(76,175,122,.6); }
.agent-dot.offline { background: var(--text3); }
.agent-name { flex: 1; }
.agent-icon { font-size: 14px; }

.agent-skeleton {
  height: 24px; background: var(--card2); border-radius: 6px;
  margin-bottom: 4px; animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:.4} 50%{opacity:.7} }

/* Quick action buttons */
.quick-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px; margin-bottom: 4px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text2);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s;
  text-align: left;
}
.quick-btn:hover { border-color: var(--accent); color: var(--accent); }
.quick-btn:active { opacity: .7; }
.quick-btn.push-enabled { border-color: var(--success); color: var(--success); opacity: .7; cursor: default; }
.quick-btn.push-denied  { border-color: var(--text3);   color: var(--text3);   opacity: .7; cursor: default; }

.sidebar-footer {
  margin-top: auto;
  padding: 10px 14px 14px;
  font-size: 11px;
  color: var(--text3);
  border-top: 1px solid var(--border2);
  line-height: 1.7;
}

/* ────────────────────────────────────────────────────────────────────────────
   RIGHT PANEL — Решала (hidden < 1200px)
   ──────────────────────────────────────────────────────────────────────────── */
.right-panel { display: none; }

.rp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.rp-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--accent);
}

.btn-tiny {
  font-size: 11px; color: var(--text3); background: none; border: none;
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.btn-tiny:hover { color: var(--text2); }

.rp-history {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.rp-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  color: var(--text2); font-size: 13px; padding: 20px;
}

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

.qa-q {
  background: rgba(108,142,247,.1); border: 1px solid rgba(108,142,247,.18);
  border-radius: 10px 10px 3px 10px;
  padding: 8px 12px; font-size: 13px; color: var(--accent2); font-weight: 500;
}

.qa-a {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 3px 10px 10px 10px;
  padding: 10px 12px; font-size: 13px; line-height: 1.6; white-space: pre-wrap;
}

.qa-time { font-size: 10px; color: var(--text3); text-align: right; }

.rp-input-wrap {
  padding: 10px 12px;
  border-top: 1px solid var(--border); flex-shrink: 0;
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg2);
}

.rp-input {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 14px;
  font-family: inherit; resize: none; outline: none;
  max-height: 90px; line-height: 1.5; padding: 8px 12px;
}
.rp-input:focus { border-color: rgba(108,142,247,.4); }
.rp-input::placeholder { color: var(--text3); }

/* ────────────────────────────────────────────────────────────────────────────
   CARDS / UI COMPONENTS
   ──────────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}

.card-title { font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 8px; }
.card-value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; }
.card-sub   { font-size: 13px; color: var(--text2); margin-top: 3px; }

/* Stat cards */
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat-label { font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.1; letter-spacing: -.5px; }
.stat-sub   { font-size: 12px; color: var(--text2); margin-top: 3px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 10px; }

.section-title {
  font-size: 17px; font-weight: 700; margin: 16px 0 9px; letter-spacing: -.3px;
}
.section-title:first-child { margin-top: 2px; }

/* Weather */
.weather-card {
  background: linear-gradient(135deg,#1a1a3e,#0f1040);
  border: 1px solid rgba(108,142,247,.2);
  border-radius: var(--radius); padding: 16px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 14px;
}
.weather-icon { font-size: 40px; line-height: 1; }
.weather-info { flex: 1; }
.weather-temp { font-size: 34px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.weather-desc { font-size: 13px; color: var(--text2); margin-top: 2px; text-transform: capitalize; }
.weather-meta { display: flex; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.weather-chip { font-size: 11px; color: var(--text3); background: rgba(255,255,255,.06); padding: 2px 8px; border-radius: 10px; }

/* Pills */
.pill { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: .4px; }
.pill-red    { background: rgba(255,107,107,.14); color: var(--danger); }
.pill-orange { background: rgba(255,159,67,.14);  color: var(--warning); }
.pill-green  { background: rgba(76,175,122,.14);  color: var(--success); }
.pill-blue   { background: rgba(108,142,247,.14); color: var(--accent); }
.pill-gray   { background: rgba(144,144,184,.1);  color: var(--text2); }

/* Payments */
.payment-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.payment-item:last-child { border-bottom: none; }
.payment-name  { font-size: 14px; font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; }
.payment-right { text-align: right; flex-shrink: 0; }
.payment-amount { font-size: 15px; font-weight: 700; }
.payment-date  { font-size: 12px; color: var(--text2); margin-top: 1px; }

/* Project cards */
.project-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
  transition: border-color .15s;
}
.project-card:hover { border-color: rgba(108,142,247,.3); }
.project-name   { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.project-meta   { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.project-tag    { font-size: 12px; color: var(--text2); }
.progress-wrap  { background: rgba(255,255,255,.06); border-radius: 4px; height: 4px; margin-bottom: 8px; overflow: hidden; }
.progress-bar   { height: 100%; background: linear-gradient(90deg,var(--accent),var(--accent2)); border-radius: 4px; transition: width .5s ease; }
.project-footer { display: flex; justify-content: space-between; align-items: center; }
.project-stage  { font-size: 12px; color: var(--accent); font-weight: 500; }
.project-amount { font-size: 14px; font-weight: 700; }

/* Filter chips */
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 12px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; font-size: 13px; font-weight: 500; padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--card); color: var(--text2); cursor: pointer; transition: all .15s; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Finance / payment cards */
.payment-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.payment-card.urgent  { border-left: 3px solid var(--warning); }
.payment-card.overdue { border-left: 3px solid var(--danger); }
.payment-card.paid    { opacity: .45; }
.payment-body  { padding: 12px 14px; }
.payment-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.payment-purpose { font-size: 12px; color: var(--text2); margin-bottom: 8px; }
.payment-row   { display: flex; justify-content: space-between; align-items: center; }
.payment-sum   { font-size: 18px; font-weight: 700; }
.payment-actions { display: flex; gap: 8px; padding: 0 14px 12px; }
.btn-approve { flex: 1; padding: 8px; background: rgba(76,175,122,.12); border: 1px solid rgba(76,175,122,.28); border-radius: var(--radius-sm); color: var(--success); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-approve:active { background: rgba(76,175,122,.25); }
.btn-reject  { flex: 1; padding: 8px; background: rgba(255,107,107,.09); border: 1px solid rgba(255,107,107,.22); border-radius: var(--radius-sm); color: var(--danger); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-reject:active { background: rgba(255,107,107,.22); }

/* Credits */
.credit-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.credit-item:last-child { border-bottom: none; }
.credit-header { display: flex; justify-content: space-between; margin-bottom: 2px; }
.credit-name   { font-size: 14px; font-weight: 500; }
.credit-amount { font-size: 14px; font-weight: 700; }
.credit-meta   { display: flex; justify-content: space-between; align-items: center; }
.credit-entity { font-size: 12px; color: var(--text2); }
.credit-days   { font-size: 12px; }

/* Brain (mobile tab) */
.brain-history { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.brain-input-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 6px 6px 14px; display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; }
.brain-input { flex: 1; background: none; border: none; color: var(--text); font-size: 15px; font-family: inherit; resize: none; outline: none; max-height: 100px; line-height: 1.5; padding: 4px 0; }
.brain-input::placeholder { color: var(--text3); }

.btn-send { width: 34px; height: 34px; background: var(--accent); border: none; border-radius: 9px; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
.btn-send:active { transform: scale(.92); }
.btn-send:disabled { background: var(--card2); color: var(--text3); }

/* Loading / Empty */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text3); gap: 12px; }
.spinner { width: 28px; height: 28px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.empty { text-align: center; padding: 32px 20px; color: var(--text3); font-size: 14px; }
.empty-icon { font-size: 34px; margin-bottom: 8px; }

/* Toast */
.toast { position: fixed; bottom: calc(var(--tab-h) + 10px); left: 50%; transform: translateX(-50%) translateY(16px); background: #252540; border: 1px solid var(--border); color: var(--text); font-size: 14px; padding: 9px 20px; border-radius: 20px; white-space: nowrap; opacity: 0; transition: all .22s; z-index: 1000; pointer-events: none; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 768px) {
  .toast { bottom: 20px; left: calc(var(--sidebar-w) + 20px); transform: translateY(16px); }
  .toast.show { transform: translateY(0); }
}

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(8px); z-index: 500; display: none; align-items: flex-end; }
.modal-overlay.show { display: flex; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); width: 100%; }
@media (min-width: 768px) {
  .modal-overlay { align-items: center; justify-content: center; }
  .modal { border-radius: var(--radius); max-width: 420px; width: 100%; }
}
.modal-title    { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.modal-input    { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 15px; font-family: inherit; padding: 11px 14px; outline: none; margin-bottom: 16px; }
.modal-input:focus { border-color: var(--accent); }
.modal-buttons  { display: flex; gap: 10px; }
.btn-secondary  { flex: 1; padding: 11px; background: var(--card2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 15px; font-weight: 500; cursor: pointer; }
.btn-danger     { flex: 1; padding: 11px; background: rgba(255,107,107,.13); border: 1px solid rgba(255,107,107,.28); border-radius: var(--radius-sm); color: var(--danger); font-size: 15px; font-weight: 600; cursor: pointer; }

/* Alerts */
.alert-banner { background: rgba(255,107,107,.09); border: 1px solid rgba(255,107,107,.22); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; color: var(--danger); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.alert-banner.warning { background: rgba(255,159,67,.09); border-color: rgba(255,159,67,.22); color: var(--warning); }

/* Divider + misc */
.divider { height: 1px; background: var(--border); margin: 8px 0; }
.updated-at { font-size: 12px; color: var(--text3); text-align: center; padding: 4px 0 12px; }

/* ────────────────────────────────────────────────────────────────────────────
   PROJECT DETAIL
   ──────────────────────────────────────────────────────────────────────────── */
.detail-header {
  margin-bottom: 16px;
}

.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--accent);
  font-size: 14px; font-weight: 500; padding: 7px 14px;
  cursor: pointer; transition: all .15s;
}
.btn-back:active { opacity: .7; }

.detail-title {
  font-size: 20px; font-weight: 800; letter-spacing: -.4px;
  line-height: 1.2; margin-bottom: 4px; color: var(--text);
}
@media (min-width: 768px) { .detail-title { font-size: 24px; } }

.detail-client {
  font-size: 14px; color: var(--text2); margin-bottom: 14px;
}

.detail-meta-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 14px;
}
@media (min-width: 768px) { .detail-meta-grid { grid-template-columns: repeat(4, 1fr); } }

.detail-meta-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.detail-meta-label { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 4px; }
.detail-meta-val   { font-size: 15px; font-weight: 600; color: var(--text); }

.detail-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row span:first-child { color: var(--text2); }
.detail-row span:last-child  { font-weight: 600; }

/* Stages list */
.stages-list {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 20px;
}

.stage-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--border2);
  transition: background .1s;
}
.stage-item:last-child { border-bottom: none; }

.stage-item.stage-active {
  background: rgba(255, 107, 107, 0.06);
}
.stage-item.stage-done {
  opacity: .75;
}

.stage-icon  { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.stage-name  { flex: 1; font-size: 14px; color: var(--text); }

.stage-item.stage-active .stage-name { color: var(--text); font-weight: 600; }
.stage-item.stage-done  .stage-name  { color: var(--text2); }
.stage-item.stage-pending .stage-name { color: var(--text3); }

.stage-badge {
  font-size: 10px; font-weight: 700; color: var(--danger);
  background: rgba(255,107,107,.12); border: 1px solid rgba(255,107,107,.25);
  border-radius: 10px; padding: 2px 8px; flex-shrink: 0;
  text-transform: uppercase; letter-spacing: .4px;
}

/* ────────────────────────────────────────────────────────────────────────────
   FINANCE — new payment card design
   ──────────────────────────────────────────────────────────────────────────── */
.payment-entity-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px; flex-wrap: wrap; gap: 4px;
}
.payment-entity { font-size: 12px; color: var(--text2); }

.payment-sum-row { display: flex; align-items: center; gap: 10px; }

/* Three action buttons */
.payment-actions-3 {
  display: flex; gap: 6px; padding: 0 14px 12px; flex-wrap: wrap;
}

.btn-full {
  flex: 1; min-width: 100px; padding: 9px 6px;
  background: rgba(76,175,122,.1); border: 1px solid rgba(76,175,122,.25);
  border-radius: var(--radius-sm); color: var(--success);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.btn-full:active { background: rgba(76,175,122,.22); }

.btn-alt {
  flex: 1; min-width: 100px; padding: 9px 6px;
  background: rgba(108,142,247,.1); border: 1px solid rgba(108,142,247,.25);
  border-radius: var(--radius-sm); color: var(--accent);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.btn-alt:active { background: rgba(108,142,247,.22); }

.btn-decline {
  flex: 1; min-width: 100px; padding: 9px 6px;
  background: rgba(255,107,107,.08); border: 1px solid rgba(255,107,107,.2);
  border-radius: var(--radius-sm); color: var(--danger);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.btn-decline:active { background: rgba(255,107,107,.2); }

/* Inline forms */
.alt-form, .reject-form {
  display: flex; flex-direction: column; gap: 8px;
  padding: 0 14px 14px; border-top: 1px solid var(--border2); padding-top: 12px;
}

.alt-form-row { display: flex; gap: 8px; }

.alt-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 14px; font-family: inherit; padding: 9px 12px; outline: none;
}
.alt-input:focus { border-color: rgba(108,142,247,.5); }

.alt-select {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 14px; font-family: inherit; padding: 9px 10px; outline: none;
  flex-shrink: 0;
}

.alt-form-btns { display: flex; gap: 8px; }

.btn-cancel-sm {
  flex: 1; padding: 8px; background: var(--card2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text2); font-size: 13px; font-weight: 500; cursor: pointer;
}

.btn-confirm-sm {
  flex: 1; padding: 8px;
  background: rgba(108,142,247,.12); border: 1px solid rgba(108,142,247,.3);
  border-radius: var(--radius-sm); color: var(--accent);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-confirm-sm:active { background: rgba(108,142,247,.25); }

.btn-confirm-danger {
  flex: 1; padding: 8px;
  background: rgba(255,107,107,.12); border: 1px solid rgba(255,107,107,.3);
  border-radius: var(--radius-sm); color: var(--danger);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-confirm-danger:active { background: rgba(255,107,107,.25); }
