:root{
  --bg:#f2f3f5; --card:#ffffff; --text:#111418; --muted:#8a9099;
  --accent:#111418; --line:#e6e8eb; --warn:#e8a33d; --ok:#2fb56b; --bad:#e05252;
  --radius:16px;
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html,body{margin:0;padding:0;background:var(--bg);color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;}
#app{max-width:720px;margin:0 auto;min-height:100vh;background:var(--bg);}

.topbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:var(--bg);}
.brand{font-weight:800;letter-spacing:.06em;font-size:15px;display:flex;align-items:center;gap:8px;}
.logo{font-size:18px;}
.icon-btn{background:transparent;border:none;font-size:20px;color:var(--text);cursor:pointer;padding:4px 8px;}

.tabs{display:flex;gap:8px;padding:0 12px 10px;overflow-x:auto;}
.tab{border:none;background:#e9ebee;color:#3a3f45;padding:9px 16px;border-radius:20px;
  font-size:14px;font-weight:600;white-space:nowrap;cursor:pointer;transition:.15s;}
.tab.active{background:var(--accent);color:#fff;}

#content{padding:4px 12px 40px;}
.page{display:none;animation:fade .15s ease;}
.page.active{display:block;}
@keyframes fade{from{opacity:.4}to{opacity:1}}

.page-title{font-size:30px;font-weight:800;margin:8px 4px 14px;}

.filters{display:flex;flex-direction:column;gap:10px;margin-bottom:14px;}
select,input[type=text],input[type=number]{width:100%;padding:12px 14px;border:1px solid var(--line);
  border-radius:12px;background:#fff;font-size:15px;color:var(--text);outline:none;}
select:focus,input:focus{border-color:#b9bec5;}
.dates{display:flex;align-items:center;gap:8px;}
.dates input{flex:1;text-align:center;}
.dates span{color:var(--muted);}

.grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
.card{background:var(--card);border-radius:var(--radius);padding:14px;position:relative;
  cursor:pointer;transition:.15s;box-shadow:0 1px 2px rgba(0,0,0,.04);}
.card:active{transform:scale(.985);}
.card .name{font-weight:700;font-size:14px;line-height:1.25;padding-right:22px;}
.card .meta{color:var(--muted);font-size:12px;margin-top:6px;}
.card .amount{font-size:20px;font-weight:800;margin-top:12px;}
.card .copy{position:absolute;top:12px;right:12px;font-size:13px;opacity:.45;}
.card .dup{margin-top:8px;font-size:11.5px;color:var(--warn);font-weight:600;}
.badge{display:inline-block;font-size:11px;padding:2px 8px;border-radius:10px;background:#eef0f2;color:#4a5057;}
.badge.new{background:#e7f0ff;color:#2b6cb0;}
.badge.accepted{background:#e6f7ee;color:#1f8a52;}
.badge.paid{background:#eae7ff;color:#5a4bd6;}
.badge.blocked{background:#fdeaea;color:#c73b3b;}
.badge.deferred{background:#fff4e0;color:#a9762a;}
.badge.frozen{background:#e7edff;color:#3b5bd6;}
.badge.active{background:#e6f7ee;color:#1f8a52;}
.role-pill{font-size:12px;font-weight:700;background:#e9ebee;color:#3a3f45;padding:5px 12px;border-radius:14px;}
.hint{color:var(--muted);font-size:13px;margin:4px 4px 14px;line-height:1.4;}

/* статистика контрагента (сегодня) */
.ctr-stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:14px;}
.ctr-stat{background:#fff;border-radius:var(--radius);padding:14px;position:relative;overflow:hidden;}
.ctr-stat .cs-num{font-size:26px;font-weight:800;line-height:1;}
.ctr-stat .cs-lbl{font-size:12px;color:var(--muted);margin-top:6px;}
.ctr-stat.ok .cs-num{color:var(--ok);}
.ctr-stat.bad .cs-num{color:var(--bad);}
.ctr-stat.warn .cs-num{color:var(--warn);}

/* замороженный реквизит у контрагента */
.req-card.req-frozen{opacity:.85;}
.req-card.req-frozen .rc-label{color:#3b5bd6;}

/* поле файла */
input[type=file]{width:100%;padding:10px;border:1px dashed #c6cace;border-radius:12px;
  background:#fff;font-size:14px;color:var(--muted);}

/* всплывающее уведомление */
.toast{position:fixed;left:50%;bottom:28px;transform:translate(-50%,20px);background:#111418;color:#fff;
  padding:12px 18px;border-radius:14px;font-size:14px;font-weight:600;opacity:0;transition:.25s;
  z-index:99;max-width:90%;text-align:center;box-shadow:0 6px 20px rgba(0,0,0,.25);}
.toast.show{opacity:1;transform:translate(-50%,0);}

.empty{text-align:center;color:var(--muted);padding:40px 0;}

.stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:14px;}
.stat{background:#fff;border-radius:var(--radius);padding:14px;}
.stat-label{font-size:12px;color:var(--muted);min-height:32px;}
.stat-value{font-size:22px;font-weight:800;margin-top:6px;}

.primary-btn{width:100%;padding:15px;border:none;border-radius:14px;background:var(--accent);
  color:#fff;font-size:16px;font-weight:700;cursor:pointer;margin-bottom:14px;}
.primary-btn:active{opacity:.9;}

.list{display:flex;flex-direction:column;gap:8px;}
.row{background:#fff;border-radius:14px;padding:12px 14px;display:flex;align-items:center;gap:12px;}
.row .check{width:22px;height:22px;border-radius:7px;border:2px solid var(--line);flex:0 0 auto;
  display:flex;align-items:center;justify-content:center;font-size:14px;color:#fff;}
.row.selected .check{background:var(--accent);border-color:var(--accent);}
.row .info{flex:1;}
.row .info b{font-size:15px;}
.row .info div{font-size:12px;color:var(--muted);margin-top:2px;}
.row .sum{font-weight:800;}

.payout-summary{background:#fff;border-radius:14px;padding:14px;margin-bottom:14px;display:flex;
  flex-direction:column;gap:8px;}
.payout-summary .primary-btn{margin:8px 0 0;}

.req-add{display:flex;flex-direction:column;gap:8px;margin-bottom:14px;}
.settings-card{background:#fff;border-radius:var(--radius);padding:16px;}
.muted{color:var(--muted);}

/* секция / кикер */
.section-head{margin:4px 4px 10px;}
.section-kicker{font-size:11px;font-weight:800;letter-spacing:.14em;color:var(--muted);}
.section-head .page-title{margin:2px 0 0;}

/* кнопка-призрак */
.ghost-btn{width:100%;padding:13px;border:1px dashed #c6cace;border-radius:14px;background:#fff;
  color:var(--text);font-size:15px;font-weight:700;cursor:pointer;margin-bottom:12px;}
.ghost-btn:active{opacity:.85;}

/* под-вкладки */
.subtabs{display:flex;gap:8px;margin-bottom:14px;overflow-x:auto;}
.subtab{border:none;background:#e9ebee;color:#3a3f45;padding:8px 14px;border-radius:16px;
  font-size:13px;font-weight:600;white-space:nowrap;cursor:pointer;}
.subtab.active{background:var(--accent);color:#fff;}

/* карточка реквизита */
.req-card{background:#fff;border-radius:var(--radius);padding:14px;cursor:pointer;}
.req-card:active{transform:scale(.99);}
.req-card .rc-top{display:flex;justify-content:space-between;align-items:center;gap:8px;}
.req-card .rc-label{font-weight:800;font-size:15px;}
.req-card .rc-ver{font-size:11px;color:var(--muted);background:#f0f1f3;padding:2px 8px;border-radius:10px;}
.req-card .rc-name{font-size:13px;margin-top:6px;}
.req-card .rc-iban{font-size:12px;color:var(--muted);margin-top:4px;word-break:break-all;font-family:ui-monospace,monospace;}
.req-card .rc-meta{display:flex;gap:14px;margin-top:10px;font-size:12px;color:#4a5057;}
.req-card .rc-meta b{color:var(--text);}

/* статистика реквизита */
.stat-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:12px 0;}
.stat-cell{background:#f6f7f8;border-radius:12px;padding:10px 12px;}
.stat-cell .sc-label{font-size:10.5px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;}
.stat-cell .sc-value{font-size:17px;font-weight:800;margin-top:3px;}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0;}
.chip{font-size:12px;background:#f0f1f3;padding:5px 10px;border-radius:12px;color:#4a5057;}
.chip b{color:var(--text);}
.calc-box{background:#f6f7f8;border-radius:12px;padding:12px;font-size:13px;margin:12px 0;}
.detail-tabs{display:flex;gap:8px;margin:10px 0 14px;overflow-x:auto;}
.detail-tab{border:none;background:#e9ebee;color:#3a3f45;padding:7px 13px;border-radius:14px;
  font-size:13px;font-weight:600;white-space:nowrap;cursor:pointer;}
.detail-tab.active{background:var(--accent);color:#fff;}
.dt-pane{display:none;}
.dt-pane.active{display:block;}
.info-row{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-bottom:1px solid var(--line);font-size:14px;}
.info-row .ir-k{color:var(--muted);}
.info-row .ir-v{font-weight:600;text-align:right;word-break:break-word;}
.frozen-note{background:#fff4e0;color:#a9762a;border-radius:12px;padding:12px;font-size:13px;margin:12px 0;}
.act-stack{display:flex;flex-direction:column;gap:8px;margin-top:14px;}
.act-stack button{padding:13px;border:none;border-radius:13px;font-size:15px;font-weight:700;cursor:pointer;}
.btn-dark{background:var(--accent);color:#fff;}
.btn-light{background:#fff;border:1px solid var(--line)!important;color:var(--text);}
.btn-danger{background:#fff;border:1px solid #f0c9c9!important;color:#c73b3b;}
.field{margin:10px 0;}
.field label{display:block;font-size:12px;color:var(--muted);margin-bottom:5px;}
.field textarea{width:100%;padding:12px 14px;border:1px solid var(--line);border-radius:12px;
  background:#fff;font-size:15px;color:var(--text);outline:none;resize:vertical;min-height:70px;
  font-family:inherit;}
.field-row{display:flex;gap:8px;}
.field-row .field{flex:1;}
.country-chips{display:flex;flex-wrap:wrap;gap:8px;margin:6px 0;}
.country-chip{border:1px solid var(--line);background:#fff;padding:7px 12px;border-radius:14px;
  font-size:13px;cursor:pointer;}
.country-chip.on{background:var(--accent);color:#fff;border-color:var(--accent);}
.check-row{display:flex;align-items:center;gap:10px;margin:12px 0;font-size:14px;cursor:pointer;}
.check-row input{width:20px;height:20px;}

/* переключатель */
.settings-row{background:#fff;border-radius:var(--radius);padding:14px 16px;display:flex;
  align-items:center;justify-content:space-between;font-size:15px;margin-bottom:12px;}
.switch{position:relative;display:inline-block;width:48px;height:28px;}
.switch input{opacity:0;width:0;height:0;}
.slider{position:absolute;inset:0;background:#d4d7da;border-radius:28px;transition:.2s;cursor:pointer;}
.slider::before{content:"";position:absolute;width:22px;height:22px;left:3px;top:3px;background:#fff;
  border-radius:50%;transition:.2s;}
.switch input:checked + .slider{background:var(--ok);}
.switch input:checked + .slider::before{transform:translateX(20px);}

.modal{position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:flex-end;
  justify-content:center;z-index:50;}
.modal[hidden]{display:none !important;}
.modal-card{background:#fff;border-radius:20px 20px 0 0;width:100%;max-width:720px;padding:20px;
  max-height:92vh;overflow-y:auto;animation:up .2s ease;}
@keyframes up{from{transform:translateY(30px);opacity:.5}to{transform:none;opacity:1}}
.modal h2{margin:0 0 4px;font-size:20px;}
.modal .sub{color:var(--muted);font-size:13px;margin-bottom:14px;}
.kv{display:flex;justify-content:space-between;gap:12px;padding:9px 0;border-bottom:1px solid var(--line);font-size:14px;}
.kv .k{color:var(--muted);}
.kv .v{font-weight:600;text-align:right;word-break:break-word;}
.receipt{width:100%;border-radius:12px;margin:12px 0;background:#f0f1f3;min-height:150px;
  display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:13px;}
.receipt img{width:100%;border-radius:12px;display:block;}
.actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:16px;}
.actions button{padding:14px;border:none;border-radius:13px;font-size:15px;font-weight:700;cursor:pointer;}
.act-accept{background:#e6f7ee;color:#1f8a52;}
.act-decline{background:#fdeaea;color:#c73b3b;}
.act-defer{background:#fff4e0;color:#a9762a;}
.act-block{background:#eceef1;color:#3a3f45;}
.act-pay{background:#eae7ff;color:#5a4bd6;}
.act-close{background:#eceef1;color:#3a3f45;}
