/* Esims Rail — дизайн-система. Минимализм: белые карточки, тонкие линии, цвет только у данных и статусов. */
:root {
  --page: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #f6f6f3;
  --surface-3: #eeeeea;
  --ink: #111110;
  --ink-2: #4e4e4a;
  --muted: #8b8a84;
  --line: #e7e6e0;
  --line-2: #d5d4cc;
  --accent: #2b7fff;
  --accent-ink: #1b5fd6;
  --accent-soft: #e9f0ff;
  --accent-100: #d2e1ff;
  --series-cost: #eb6834;
  --good: #16a34a;
  --good-text: #15803d;
  --good-soft: #e8f6ed;
  --good-line: #bfe3cb;
  --bad: #dc2626;
  --bad-text: #b91c1c;
  --bad-soft: #fdeceb;
  --warn-text: #92400e;
  --warn-soft: #fff4d9;
  --gift-soft: #f0efea;
  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 1px 2px rgba(17,17,16,.05), 0 12px 32px -16px rgba(17,17,16,.2);
  --shadow-pop: 0 4px 12px rgba(17,17,16,.08), 0 24px 48px -20px rgba(17,17,16,.28);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--page); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 24px; letter-spacing: -.02em; }
h2 { font-size: 15px; }
h3 { font-size: 13.5px; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; } .mb-s { margin-bottom: 8px; }
.hidden { display: none !important; }
.good-text { color: var(--good-text); } .bad-text { color: var(--bad-text); } .warn-text { color: var(--warn-text); }

/* ---------- layout */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; color: var(--ink); padding: 2px 8px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; flex: none; }
.logo-big { width: 64px; height: 64px; margin: 0 auto 4px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-s); color: var(--ink-2); font-weight: 500; font-size: 13.5px; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.ic { width: 16px; height: 16px; display: inline-block; background: currentColor; -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; opacity: .8; }
.ic-dash { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='9' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='5' rx='1.5'/%3E%3Crect x='14' y='12' width='7' height='9' rx='1.5'/%3E%3Crect x='3' y='16' width='7' height='5' rx='1.5'/%3E%3C/svg%3E"); }
.ic-orders { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6h16M4 12h16M4 18h10'/%3E%3C/svg%3E"); }
.ic-topups { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='5' width='20' height='14' rx='2'/%3E%3Cpath d='M2 10h20M6 15h4'/%3E%3C/svg%3E"); }
.ic-recon { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E"); }
.ic-exp { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v18M17 7H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6'/%3E%3C/svg%3E"); }
.ic-set { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 00.3 1.8l.1.1a2 2 0 11-2.8 2.8l-.1-.1a1.7 1.7 0 00-1.8-.3 1.7 1.7 0 00-1 1.5V21a2 2 0 11-4 0v-.1a1.7 1.7 0 00-1.1-1.5 1.7 1.7 0 00-1.8.3l-.1.1a2 2 0 11-2.8-2.8l.1-.1a1.7 1.7 0 00.3-1.8 1.7 1.7 0 00-1.5-1H3a2 2 0 110-4h.1a1.7 1.7 0 001.5-1.1 1.7 1.7 0 00-.3-1.8l-.1-.1a2 2 0 112.8-2.8l.1.1a1.7 1.7 0 001.8.3H9a1.7 1.7 0 001-1.5V3a2 2 0 114 0v.1a1.7 1.7 0 001 1.5 1.7 1.7 0 001.8-.3l.1-.1a2 2 0 112.8 2.8l-.1.1a1.7 1.7 0 00-.3 1.8V9a1.7 1.7 0 001.5 1H21a2 2 0 110 4h-.1a1.7 1.7 0 00-1.5 1z'/%3E%3C/svg%3E"); }
.ic-api { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 18l6-6-6-6M8 6l-6 6 6 6'/%3E%3C/svg%3E"); }
.ic-cal { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
.ic-chev { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
.ic-left { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 6l-6 6 6 6'/%3E%3C/svg%3E"); }
.ic-right { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E"); }
.sidebar-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 8px; display: flex; flex-direction: column; gap: 6px; }
.sidebar-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 6px; }
.sidebar-foot .dot.off { background: var(--line-2); }
.main { padding: 26px 32px 72px; min-width: 0; max-width: 1400px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- controls */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: var(--radius-s); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; line-height: 1.2; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.danger { color: var(--bad-text); border-color: #f0c1bf; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn.xs { padding: 2px 7px; font-size: 12px; border-radius: 6px; }
.btn.wide { width: 100%; justify-content: center; }
.btn.good { color: var(--good-text); border-color: var(--good-line); }
.btn.good:hover { background: var(--good-soft); }
.btn.icon { padding: 6px; }
.input, .select, textarea.input { padding: 7px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); font: inherit; font-size: 13.5px; color: var(--ink); min-width: 0; }
.input:focus, .select:focus, textarea.input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.input.sm, .select.sm { padding: 4px 8px; font-size: 12.5px; }
.select { appearance: none; padding-right: 26px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234e4e4a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.field > span { font-weight: 500; }
.field .input, .field .select { width: 100%; }
.field .hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 14px; }
.form-grid .span2 { grid-column: span 2; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; cursor: pointer; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .sw { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.segmented { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-s); overflow: hidden; background: var(--surface); }
.segmented button { border: 0; background: transparent; padding: 6px 11px; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.active { background: var(--ink); color: #fff; }
.error { color: var(--bad-text); font-size: 13px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); }

/* ---------- календарь периода */
.range { position: relative; }
.range-btn { gap: 8px; padding-left: 10px; }
.range-btn .ic { opacity: .6; }
.range-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); display: flex; overflow: hidden; }
.range-presets { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border-right: 1px solid var(--line); min-width: 168px; background: var(--surface-2); }
.range-presets button { text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 7px; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.range-presets button:hover { background: var(--surface-3); color: var(--ink); }
.range-presets button.active { background: var(--ink); color: #fff; }
.range-cal { padding: 14px 16px 12px; }
.cal-months { display: flex; gap: 22px; }
.cal-month { width: 238px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 600; font-size: 13.5px; }
.cal-head .btn { border-color: transparent; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; }
.cal-grid .wd { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0 6px; font-weight: 500; }
.cal-day { height: 32px; border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; border-radius: 8px; font-variant-numeric: tabular-nums; position: relative; }
.cal-day:hover { background: var(--surface-3); }
.cal-day.out { color: var(--line-2); pointer-events: none; }
.cal-day.today { font-weight: 700; color: var(--accent-ink); }
.cal-day.in { background: var(--accent-soft); border-radius: 0; }
.cal-day.start, .cal-day.end { background: var(--accent); color: #fff; border-radius: 8px; }
.cal-day.start { border-radius: 8px 0 0 8px; }
.cal-day.end { border-radius: 0 8px 8px 0; }
.cal-day.start.end { border-radius: 8px; }
.cal-day.future { color: var(--line-2); }
.cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }

/* ---------- cards / kpi */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.card + .card { margin-top: 14px; }
.grid-2 > .card, .grid-3 > .card, .stack > .card, .cards > .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 15px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 12px 14px; border-radius: var(--radius-s); background: var(--surface-2); }
.kpi .label { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 19px; font-weight: 600; margin-top: 2px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.good .value { color: var(--good-text); }
.kpi.bad .value { color: var(--bad-text); }
.kpi.accent { background: var(--accent-soft); }
.hero-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; }
.hero { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
.hero .label { font-size: 12.5px; color: var(--muted); }
.hero .value { font-size: 30px; font-weight: 650; letter-spacing: -.025em; line-height: 1.15; }
.hero .value.sm { font-size: 22px; font-weight: 600; }
.hero .sub { font-size: 12px; color: var(--muted); }
.currency-tag { font-size: 11px; font-weight: 600; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.meter { height: 6px; border-radius: 3px; background: var(--accent-100); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.over > i { background: var(--bad); }
.details { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; }
.details summary { cursor: pointer; font-size: 12.5px; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; user-select: none; }
.details summary::-webkit-details-marker { display: none; }
.details summary .ic { width: 12px; height: 12px; transition: transform .15s; }
.details[open] summary .ic { transform: rotate(180deg); }
.details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 16px; margin-top: 10px; }
.details-grid .d-label { font-size: 11.5px; color: var(--muted); }
.details-grid .d-value { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.partner-strip { display: grid; grid-template-columns: auto repeat(4, minmax(0, 1fr)) auto; gap: 18px; align-items: center; }
.partner-strip .who { display: flex; align-items: center; gap: 10px; padding-right: 18px; border-right: 1px solid var(--line); }
.partner-strip .who b { font-size: 14px; display: block; }
.partner-strip .who .small { display: block; }
.dir-row { display: grid; grid-template-columns: minmax(180px, 1.3fr) repeat(4, minmax(0, 1fr)); gap: 12px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--line); }
.dir-row:first-child { border-top: 0; }
.dir-row .v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dir-row .l { font-size: 11.5px; color: var(--muted); }

/* ---------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; letter-spacing: .02em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl td.ellipsis { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl td.ellipsis .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: rgba(17,17,16,.025); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.row-settled td { background: var(--good-soft); }
.tbl tr.row-refund td { background: var(--bad-soft); }
.tbl tr.row-gift td { background: var(--gift-soft); color: var(--ink-2); }
.tbl tr.row-pending td { background: var(--warn-soft); }
.tbl tr.row-cancel td { color: var(--muted); text-decoration: line-through; }
.tbl tr.row-settled.clickable:hover td { background: #daf0e1; }
.tbl tr.row-refund.clickable:hover td { background: #f9dcda; }
.tbl tr.row-gift.clickable:hover td { background: #e7e6df; }
.tbl tr.row-pending.clickable:hover td { background: #ffeab8; }
.tbl tr.total td { font-weight: 600; background: var(--surface-2); }
.tbl .sub { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.tbl.compact td { padding: 7px 10px; }
.legend-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend-row .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); vertical-align: -2px; margin-right: 5px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.settled, .badge.matched, .badge.applied { background: var(--good-soft); color: var(--good-text); }
.badge.unsettled, .badge.unmatched { background: #fff; border: 1px dashed var(--line-2); color: var(--muted); }
.badge.refunded { background: var(--bad-soft); color: var(--bad-text); }
.badge.gift { background: var(--gift-soft); color: var(--ink-2); }
.badge.pending, .badge.proposed, .badge.partial { background: var(--warn-soft); color: var(--warn-text); }
.badge.cancelled, .badge.ignored, .badge.uploaded, .badge.debit { color: var(--muted); }
.badge.plain::before { display: none; }
.dir-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink-2); margin-bottom: 4px; font-weight: 600; }
.banner { padding: 10px 14px; border-radius: var(--radius-s); background: var(--warn-soft); color: var(--warn-text); font-size: 13px; display: flex; gap: 10px; align-items: center; }
.banner.info { background: var(--accent-soft); color: var(--accent-ink); }
.banner.good { background: var(--good-soft); color: var(--good-text); }
.banner.bad { background: var(--bad-soft); color: var(--bad-text); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 7px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 8px 12px; font: inherit; font-weight: 500; font-size: 13.5px; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--ink); }
.code { background: #17181a; color: #ecece7; border-radius: var(--radius-s); padding: 12px 14px; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; overflow: auto; white-space: pre; }
.keybox { font-family: var(--mono); font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; word-break: break-all; }
.conf { display: inline-block; min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; font-size: 11.5px; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
.conf.hi { background: var(--good-soft); color: var(--good-text); }
.conf.mid { background: var(--warn-soft); color: var(--warn-text); }
.conf.lo { background: var(--bad-soft); color: var(--bad-text); }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--ink-2); background: var(--surface); cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { display: none; }
.pill-list { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.pill-list a { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border-radius: 5px; padding: 1px 6px; color: var(--ink-2); }
.pill-list a:hover { background: var(--accent-soft); color: var(--accent-ink); text-decoration: none; }

/* ---------- топапы */
.topup { padding: 0; overflow: hidden; }
.topup-head { display: grid; grid-template-columns: 1.4fr 1fr 1fr 180px auto; gap: 16px; align-items: center; padding: 16px 22px; cursor: pointer; }
.topup-head:hover { background: var(--surface-2); }
.topup-head .amount { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.topup-body { border-top: 1px solid var(--line); background: var(--surface-2); padding: 6px 12px 12px; }
.topup-body .table-wrap { border-radius: var(--radius-s); }

/* ---------- сверка */
.st-line { display: grid; grid-template-columns: 96px 130px minmax(200px, 1.2fr) minmax(220px, 1.4fr) auto; gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.st-line:first-child { border-top: 0; }
.st-line.matched { background: var(--good-soft); }
.st-line.proposed { background: var(--warn-soft); }
.st-line.ignored, .st-line.debit { color: var(--muted); background: var(--surface-2); }
.st-line .amt { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.st-line .actions { display: flex; gap: 4px; justify-content: flex-end; }
.st-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }

/* ---------- charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .baseline { stroke: var(--line-2); }
.chart .hit { fill: transparent; }
.chart .cross { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.chart-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-legend .ln { display: inline-block; width: 14px; height: 2px; border-radius: 1px; margin-right: 6px; vertical-align: 3px; }
.tooltip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; padding: 8px 11px; border-radius: 8px; font-size: 12px; line-height: 1.45; white-space: nowrap; box-shadow: var(--shadow); z-index: 5; transform: translate(-50%, calc(-100% - 12px)); }
.tooltip b { font-weight: 600; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip .t-row i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------- overlays */
.login { position: fixed; inset: 0; display: grid; place-items: center; background: var(--page); }
.login-card { width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 30px 28px; display: flex; flex-direction: column; gap: 12px; text-align: center; box-shadow: var(--shadow); }
.login-card h1 { font-size: 20px; }
.login-card .field { text-align: left; }
.login-card p { margin: -6px 0 6px; }
.modal-back { position: fixed; inset: 0; background: rgba(17,17,16,.35); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--surface); border-radius: 16px; width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: var(--shadow-pop); }
.modal.wide { width: min(920px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal-body { padding: 16px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 18px; }
.drawer-back { position: fixed; inset: 0; z-index: 40; background: rgba(17,17,16,.18); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop); z-index: 45; overflow: auto; padding: 22px 24px; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.close { border: 0; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.close:hover { background: var(--surface-2); color: var(--ink); }
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); max-width: 380px; animation: fade .2s; }
.toast.error { background: var(--bad); }
.toast.success { background: var(--good-text); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 40px; text-align: center; color: var(--muted); }

@media (max-width: 1100px) {
  .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .partner-strip { grid-template-columns: 1fr 1fr; }
  .partner-strip .who { grid-column: span 2; border-right: 0; }
  .cards { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; overflow-x: auto; }
  .nav { flex-direction: row; }
  .nav a { padding: 6px 9px; }
  .nav a .ic { display: none; }
  .sidebar-foot { display: none; }
  .main { padding: 16px 14px 50px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .kv { grid-template-columns: 1fr; }
  .hero-grid { grid-template-columns: 1fr; }
  .dir-row { grid-template-columns: 1fr 1fr; }
  .cal-months { flex-direction: column; }
  .range-pop { flex-direction: column; right: auto; left: 0; }
  .st-line { grid-template-columns: 1fr; }
}
