/* ============================================================
   Sber-inspired visual system: white cards, bright green,
   black type, pill controls, soft elevation.
   ============================================================ */

:root {
  --green: #21a038;
  --green-2: #0b7a22;
  --green-soft: #e9f8ec;
  --green-pale: #f4fbf5;
  --ink: #141414;
  --ink-soft: #3f3f3f;
  --muted: #7b7b7b;
  --muted-2: #a5a5a5;
  --bg: #f4f6f3;
  --paper: #ffffff;
  --paper-2: #f8f8f8;
  --line: #e7e8e4;
  --line-soft: #f0f1ee;
  --red: #e4352b;
  --orange: #f08b23;
  --amber: #c8a200;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 2px 10px rgba(13, 25, 15, .045);
  --shadow-lg: 0 16px 40px rgba(13, 25, 15, .09);
  --sans: "SB Sans", "Sber Sans", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.42;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

::selection { background: var(--green); color: #fff; }

/* ---------- shell ---------- */

.app {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 16px 22px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  color: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
}

.brand-mark {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  padding: 5px;
  border-radius: 9px;
  background: var(--green);
}
.brand-mark span { display: block; background: #fff; border-radius: 1px; }
.brand-mark span:nth-child(2) { grid-column: 2; opacity: .8; }
.brand-mark span:nth-child(3) { grid-column: 1 / span 2; opacity: .42; }

.brand-name {
  font-size: 13px;
  line-height: 1.1;
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--ink);
}
.brand-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.nav {
  margin-top: 52px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  transition: background .18s, color .18s;
}
.nav-item:hover { background: var(--paper-2); color: var(--ink); }
.nav-item.is-active {
  background: var(--green);
  color: #fff;
  font-weight: 600;
}
.nav-item:disabled { color: #b3b3b3; }
.nav-item.is-locked { color: #ababab; }
.nav-index {
  width: 18px;
  color: currentColor;
  font-family: var(--mono);
  font-size: 8px;
  opacity: .48;
}
.soon {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.nav-item.is-active .soon { background: rgba(255,255,255,.18); color: #fff; }

.sidebar-foot {
  margin-top: auto;
  padding: 0 8px;
  color: var(--muted);
  font-size: 10px;
}
.status-line {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}
.sidebar-foot p {
  margin: 8px 0 12px;
  color: var(--muted);
  line-height: 1.65;
}
.sidebar-rule {
  height: 1px;
  margin-bottom: 11px;
  background: var(--line);
}
.micro {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.65;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---------- topbar ---------- */

.main { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(14px);
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.crumbs strong { color: var(--ink); font-weight: 600; }
.crumb-sep { color: var(--muted-2); }

.top-actions { display: flex; align-items: center; gap: 10px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 260px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--muted);
  transition: background .18s, box-shadow .18s;
}
.search-box:focus-within {
  background: #fff;
  box-shadow: 0 0 0 2px var(--green);
}
.search-box svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}
.search-box input::placeholder { color: #9b9b9b; }

.ghost-btn {
  height: 38px;
  padding: 0 16px;
  border: 1px solid #e2e2e2;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  transition: border-color .18s, background .18s;
}
.ghost-btn:hover { border-color: var(--green); background: var(--green-pale); }

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-2);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}

/* ---------- page head ---------- */

.page {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 38px 32px 76px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  padding-bottom: 28px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 12px;
  color: var(--green-2);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1 {
  max-width: 660px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(38px, 4.1vw, 58px);
  font-weight: 650;
  line-height: 1.02;
  letter-spacing: -.055em;
}
.lede {
  max-width: 560px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.head-note {
  width: 230px;
  flex: 0 0 230px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--green-soft);
  color: var(--ink);
}
.head-note-label {
  display: block;
  margin-bottom: 5px;
  color: var(--green-2);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.head-note strong { display: block; font-size: 12px; font-weight: 650; }
.head-note-sub { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }

/* ---------- kpi ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 10px 0 26px;
}

.kpi {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.kpi-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kpi-value {
  margin-top: 2px;
  color: var(--ink);
  font-size: clamp(32px, 3vw, 42px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.06em;
}
.kpi-sub {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}
.kpi-sub b { color: var(--ink-soft); font-weight: 600; }
.kpi.accent .kpi-value { color: var(--red); }
.kpi.warm .kpi-value { color: var(--orange); }
.kpi:nth-child(1) { border-color: var(--green); background: var(--green); color: #fff; }
.kpi:nth-child(1) .kpi-label,
.kpi:nth-child(1) .kpi-sub { color: rgba(255,255,255,.72); }
.kpi:nth-child(1) .kpi-value { color: #fff; }
.kpi:nth-child(1) .kpi-sub b { color: #fff; }

/* ---------- workspace ---------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  gap: 20px;
  align-items: start;
}

.left-column { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 20px 15px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -.025em;
}
.panel-kicker { margin-bottom: 7px; }
.panel-aside {
  padding-top: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------- risk ---------- */

.risk-panel .panel-head { padding-bottom: 16px; }
.risk-bar {
  display: flex;
  gap: 4px;
  height: 12px;
  margin: 17px 20px 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-2);
}
.risk-bar span { display: block; height: 100%; transition: width .45s ease; }
.risk-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  padding: 17px 20px 19px;
}
.risk-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 100px;
}
.risk-dot {
  width: 7px;
  height: 7px;
  margin-top: 4px;
  flex: 0 0 7px;
  border-radius: 50%;
}
.risk-legend b {
  display: block;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.05;
}
.risk-legend span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---------- watch table ---------- */

.watch-head { gap: 12px; }
.watch-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}
.chip {
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  transition: background .18s, color .18s;
}
.chip:hover { background: #efefed; color: var(--ink); }
.chip.is-active { background: var(--ink); color: #fff; }
.row-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .03em;
}

.table-wrap { overflow-x: auto; }
.client-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}
.client-table .th-client { width: 34%; }
.client-table .th-risk { width: 15%; }
.client-table .th-rev { width: 15%; }
.client-table .th-trend { width: 12%; }
.client-table .th-trigger { width: 24%; }
.client-table th {
  padding: 10px 12px 9px 20px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 400;
  letter-spacing: .1em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.client-table th:not(:first-child) { padding-left: 10px; }
.client-table th:last-child { padding-right: 10px; }
.client-table td {
  padding: 11px 12px 11px 20px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.client-table td:not(:first-child) { padding-left: 10px; }
.client-table tbody tr {
  cursor: pointer;
  transition: background .15s;
}
.client-table tbody tr:hover { background: var(--green-pale); }
.client-table tbody tr.is-selected {
  background: var(--green-soft);
  box-shadow: inset 3px 0 0 var(--green);
}
.client-table tbody tr:last-child td { border-bottom: 0; }

.cell-client { min-width: 0; }
.client-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.client-meta {
  display: block;
  max-width: 100%;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.client-score {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 60px;
}
.client-score strong {
  min-width: 20px;
  font-size: 13px;
  font-weight: 650;
}
.client-score .micro {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.zone-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; }
.cell-num {
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.cell-num small {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  font-weight: 500;
}
.cell-num .down { color: var(--red); }
.cell-num .up { color: var(--green-2); }
.spark-cell { width: 76px; }
.spark-cell svg { display: block; overflow: visible; }
.trigger-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 100%;
}
.mini-tag {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--paper-2);
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-tag.red { background: #fdecea; color: var(--red); }
.mini-tag.amber { background: #fff6e3; color: #a27200; }

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 20px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}
.pager { display: flex; gap: 5px; }
.pager button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12px;
  transition: border-color .15s, background .15s;
}
.pager button:hover:not(:disabled) { border-color: var(--green); background: var(--green-pale); }
.pager button:disabled { opacity: .28; }

/* ---------- sector ---------- */

.sector-list { padding: 4px 20px 11px; }
.sector-row {
  display: grid;
  grid-template-columns: 1fr 62px 38px;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.sector-row:last-child { border-bottom: 0; }
.sector-name {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sector-bar { height: 5px; overflow: hidden; border-radius: 99px; background: var(--paper-2); }
.sector-bar span { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.sector-score { color: var(--muted); font-family: var(--mono); font-size: 9px; text-align: right; }

/* ---------- detail ---------- */

.detail-column {
  position: sticky;
  top: 82px;
  min-width: 0;
  max-height: calc(100vh - 102px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d7d7d7 transparent;
}
.detail-loading {
  padding: 26px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.detail-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-lg);
}

.detail-head {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 19px;
  background: var(--green);
  color: #fff;
}
.detail-head::after {
  content: "";
  position: absolute;
  top: -80px;
  right: -60px;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 50%;
  box-shadow: 0 0 0 22px rgba(255, 255, 255, .05), 0 0 0 52px rgba(255, 255, 255, .035);
}
.detail-kicker {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, .72);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.detail-title-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
}
.detail-title {
  max-width: 235px;
  margin: 0;
  color: #fff;
  font-size: 21px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -.035em;
}
.detail-meta {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  color: rgba(255, 255, 255, .72);
  font-size: 9.5px;
  line-height: 1.45;
}
.ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border-radius: 50%;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, .22) 0);
}
.ring::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--green);
}
.ring > div { position: relative; z-index: 1; color: #fff; text-align: center; }
.ring strong {
  display: block;
  font-size: 25px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.06em;
}
.ring span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, .70);
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: .08em;
}
.ring-zone {
  margin-top: 7px;
  color: rgba(255, 255, 255, .80) !important;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .05em;
  text-align: right;
  text-transform: uppercase;
}

.detail-body { padding: 17px 18px 18px; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
}
.metric {
  min-width: 0;
  padding: 10px 9px 9px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: #fff;
}
.metric:nth-child(3n) { border-right: 0; }
.metric:nth-last-child(-n+3) { border-bottom: 0; }
.metric-label {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 7px;
  font-weight: 500;
  letter-spacing: .02em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.metric-value {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.metric-value small { color: var(--muted); font-size: 7px; font-weight: 500; }
.metric-value.neg { color: var(--red); }
.metric-value.warn { color: var(--orange); }

.section-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 17px 0 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
}
.section-mini h3 {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 500;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.section-mini span { color: var(--green-2); font-family: var(--mono); font-size: 7px; }

.chart-wrap {
  padding: 8px 5px 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #fff;
}
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-legend {
  display: flex;
  gap: 14px;
  padding: 5px 7px 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-line { display: inline-block; width: 12px; height: 2px; border-radius: 2px; }

.signals { display: flex; flex-direction: column; gap: 3px; }
.signal {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 10px;
}
.signal:last-child { border-bottom: 0; }
.signal-badge {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: var(--amber);
}
.signal.sev-4 .signal-badge { background: var(--red); }
.signal.sev-3 .signal-badge { background: var(--orange); }
.signal-label { color: var(--ink-soft); font-weight: 550; }
.signal-value { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 8px; }

.event-list { display: flex; flex-direction: column; }
.event {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.event:last-child { border-bottom: 0; }
.event-date {
  width: 48px;
  flex: 0 0 48px;
  padding-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
}
.event-source {
  color: var(--green-2);
  font-family: var(--mono);
  font-size: 6.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.event-text { margin-top: 2px; color: var(--ink-soft); font-size: 8.5px; line-height: 1.35; }
.event-amount { margin-left: auto; color: var(--red); font-family: var(--mono); font-size: 8px; white-space: nowrap; }
.empty-mini { padding: 13px 0; color: var(--muted); font-size: 9.5px; font-style: italic; }

.tx-list { display: flex; flex-direction: column; }
.tx {
  display: grid;
  grid-template-columns: 55px 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 8.5px;
}
.tx:last-child { border-bottom: 0; }
.tx-date { color: var(--muted); font-family: var(--mono); font-size: 7px; }
.tx-cat { color: var(--ink-soft); text-transform: capitalize; }
.tx-amount { color: var(--ink); font-family: var(--mono); font-size: 8.5px; text-align: right; white-space: nowrap; }
.tx-amount.in { color: var(--green-2); }
.tx-amount .late { margin-left: 3px; color: var(--red); font-size: 6.5px; }

.counterparties { display: flex; flex-direction: column; gap: 7px; }
.counterparty { display: grid; grid-template-columns: 1fr 46px; gap: 8px; align-items: center; }
.counterparty-name {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.counterparty-share {
  height: 4px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--paper-2);
}
.counterparty-share span { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.counterparty-pct { color: var(--muted); font-family: var(--mono); font-size: 8px; text-align: right; }

.plan-card {
  margin-top: 18px;
  padding: 15px;
  border: 1px dashed #b9dfc0;
  border-radius: var(--radius-sm);
  background: var(--green-pale);
}
.plan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.plan-head h3 { margin: 0; color: var(--ink); font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
.plan-head span {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-2);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.plan-copy { margin: 9px 0 12px; color: var(--muted); font-size: 9px; line-height: 1.55; }
.plan-slot {
  position: relative;
  height: 14px;
  margin-top: 4px;
  border-bottom: 1px solid #d9eddf;
}
.plan-slot::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 0;
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: #d9eddf;
}
.plan-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}
.plan-foot span { color: #7fac89; font-family: var(--mono); font-size: 7px; }
.plan-foot button {
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 600;
  transition: background .15s;
}
.plan-foot button:hover { background: var(--green-2); }

.footer-note { margin: 15px 0 0; color: var(--muted); font-size: 8px; line-height: 1.55; }
.footer-note b { color: var(--ink-soft); font-weight: 600; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 100;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */

@media (max-width: 1240px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 350px; }
  .page { padding-left: 28px; padding-right: 28px; }
  .topbar { padding-left: 28px; padding-right: 28px; }
  .head-note { flex-basis: 200px; }
}

@media (max-width: 1080px) {
  .app { grid-template-columns: 74px minmax(0, 1fr); }
  .sidebar { padding: 20px 10px; }
  .brand { padding: 0; justify-content: center; }
  .brand-name, .brand-sub, .nav-index, .soon, .sidebar-foot { display: none; }
  .nav { margin-top: 46px; }
  .nav-item {
    position: relative;
    justify-content: center;
    min-height: 42px;
    padding: 0;
    color: transparent;
    font-size: 0;
  }
  .nav-item::after {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #c7c7c7;
  }
  .nav-item.is-active::after { background: #fff; }
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; }
  .head-note { display: none; }
}

@media (max-width: 880px) {
  .app { display: block; }
  .sidebar { display: none; }
  .topbar { height: 60px; padding: 0 18px; }
  .page { padding: 28px 18px 56px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi { min-height: 140px; }
  .workspace { display: block; }
  .detail-column { position: static; max-height: none; margin-top: 18px; overflow: visible; }
  .watch-head { flex-direction: column; align-items: flex-start; }
  .watch-tools { align-items: flex-start; width: 100%; }
  .filter-chips { justify-content: flex-start; }
  .search-box { width: 175px; }
  .ghost-btn { display: none; }
  h1 { font-size: 44px; }
}

@media (max-width: 560px) {
  .crumbs { display: none; }
  .topbar { justify-content: flex-end; height: 60px; }
  .search-box { width: calc(100vw - 40px); }
  .page-head { padding-bottom: 20px; }
  .kpi-grid { gap: 9px; }
  .kpi { min-height: 132px; padding: 15px 14px; }
  .kpi-value { font-size: 31px; }
  .risk-legend { gap: 8px 18px; }
  .client-table th:nth-child(3), .client-table td:nth-child(3),
  .client-table th:nth-child(4), .client-table td:nth-child(4) { display: none; }
  .client-table th, .client-table td { padding-left: 8px; }
  .client-table th:first-child, .client-table td:first-child { padding-left: 14px; }
  .trigger-cell { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
