:root{
  --bg:#f5f7fb;
  --panel:#ffffff;
  --text:#0f172a;
  --muted:#475569;
  --ok:#16a34a;
  --bad:#dc2626;
  --line:rgba(15,23,42,.12);
  --btn:#0f172a;
  --btntext:#ffffff;
  --soft:#eef2ff;
}

*{ box-sizing:border-box; }
html,body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(22,163,74,.10), transparent 60%),
              radial-gradient(900px 600px at 80% 10%, rgba(220,38,38,.08), transparent 55%),
              var(--bg);
  color:var(--text);
}

.wrap{
  max-width:1100px;
  margin:0 auto;
  padding:16px;
}

.titleblock h1{
  margin:8px 0 6px;
  font-size:34px;
  letter-spacing:.2px;
}
.sub{
  color:var(--muted);
  font-size:18px;
  line-height:1.35;
}

.cards{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
  margin-top:14px;
}

.card{
  background: var(--panel);
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
}
.card.warn{ border-color: rgba(220,38,38,.28); }
.card.ok{ border-color: rgba(22,163,74,.35); }
.card-label{ color:var(--muted); font-size:16px; }
.card-value{ font-size:30px; margin-top:6px; font-weight:800; }

.panel{
  margin-top:14px;
  background: var(--panel);
  border:1px solid var(--line);
  border-radius:18px;
  padding:16px;
}

.panel h2{
  margin:0 0 8px;
  font-size:26px;
}
.hint{
  color:var(--muted);
  font-size:16px;
  margin-bottom:12px;
}

.tablewrap{
  overflow:auto;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.20);
}

.bigtable{
  width:100%;
  border-collapse:collapse;
  min-width: 980px;
}
.bigtable.thin{ min-width: 720px; }
.bigtable th, .bigtable td{
  padding:12px 10px;
  border-bottom:1px solid var(--line);
  vertical-align:top;
}
.bigtable thead th{
  position:sticky;
  top:0;
  background: var(--panel);
  backdrop-filter: blur(6px);
  font-size:16px;
  text-align:left;
  z-index:2;
}
.center{ text-align:center; }
.right{ text-align:right; }

.monthcell .monthname{ font-weight:800; font-size:18px; }
.monthcell .monthkey{ color:var(--muted); font-size:14px; margin-top:2px; }

.badge{
  display:inline-block;
  padding:8px 10px;
  border-radius:999px;
  font-weight:800;
  font-size:16px;
  border:1px solid var(--line);
  min-width: 110px;
}
.badge.paid{
  background: rgba(22,163,74,.12);
  border-color: rgba(22,163,74,.35);
}
.badge.debt{
  background: rgba(220,38,38,.10);
  border-color: rgba(220,38,38,.28);
}

.footerline{
  margin-top:14px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.adminlink{
  color:var(--text);
  font-size:18px;
  text-decoration:none;
  border-bottom:1px solid rgba(15,23,42,.28);
}
.adminlink:hover{ border-bottom-color: transparent; }

.form{
  display:grid;
  gap:14px;
  max-width:520px;
}
.label{ color:var(--muted); font-size:16px; margin-bottom:6px; }
input{
  width:100%;
  padding:14px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  color: var(--text);
  font-size:18px;
  outline:none;
}
input:focus{ border-color: rgba(255,255,255,.35); }

.btn{
  appearance:none;
  border:none;
  border-radius:14px;
  padding:14px 16px;
  font-size:18px;
  font-weight:900;
  background:var(--btn);
  color:var(--btntext);
  cursor:pointer;
}
.btn:active{ transform: translateY(1px); }

.btn.small{
  padding:10px 12px;
  border-radius:12px;
  font-size:16px;
  width: 120px;
}
.btn.ghost{
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.alert, .okbox{
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  margin:10px 0 14px;
  font-size:18px;
}
.alert{
  background: rgba(255,92,92,.12);
  border-color: rgba(220,38,38,.28);
}
.okbox{
  background: rgba(46,204,113,.14);
  border-color: rgba(22,163,74,.35);
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:10px;
  flex-wrap:wrap;
}

.cellstack{
  display:flex;
  flex-direction:column;
  gap:8px;
  align-items:center;
}

form.mini{ margin:0; }
.tiny{
  color:var(--muted);
  font-size:13px;
}

@media (max-width: 720px){
  .titleblock h1{ font-size:30px; }
  .sub{ font-size:17px; }
  .cards{ grid-template-columns: 1fr; }
  .card-value{ font-size:28px; }
  .panel h2{ font-size:24px; }
}


/* Быстрые кнопки годов */
.yearbtns{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin: 8px 0 12px;
}
.yearbtns a{
  display:inline-block;
  padding:10px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  text-decoration:none;
  color:var(--text);
  font-weight:900;
  font-size:18px;
  background: rgba(255,255,255,.06);
}
.yearbtns a.active{
  border-color: rgba(46,204,113,.45);
  background: rgba(46,204,113,.12);
}


/* Мобильные карточки месяцев */
.desktop-only{ display:block; }
.mobile-only{ display:none; }

.monthcard{
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
  margin-bottom:12px;
}
.monthcard .head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
}
.monthcard .head .mname{
  font-weight:900;
  font-size:18px;
}
.monthcard .head .mkey{
  color:var(--muted);
  font-size:13px;
  margin-top:2px;
}
.monthcard .head .mdebt{
  text-align:right;
}
.monthcard .head .mdebt .lbl{ color:var(--muted); font-size:13px; }
.monthcard .head .mdebt .val{ font-weight:900; font-size:18px; }

.aptgrid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:8px;
  margin-top:10px;
}
.aptpill{
  border:1px solid var(--line);
  border-radius:14px;
  padding:8px 8px;
  text-align:center;
  font-weight:900;
  font-size:14px;
  background:#fff;
}
.aptpill.ok{ background: rgba(22,163,74,.10); border-color: rgba(22,163,74,.28); }
.aptpill.bad{ background: rgba(220,38,38,.08); border-color: rgba(220,38,38,.22); }
.aptpill.zero{ background: rgba(2,132,199,.08); border-color: rgba(2,132,199,.22); }

.section-slim{ margin-top:12px; }

@media (max-width: 720px){
  .desktop-only{ display:none; }
  .mobile-only{ display:block; }
  .cards{ grid-template-columns: 1fr; }
  .bigtable{ min-width: 0; }
  .panel{ padding:14px; }
  .aptgrid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


/* Очень компактные кнопки для админки */
.btn.tiny{
  padding:6px 10px;
  border-radius:12px;
  font-size:13px;
  font-weight:900;
}
.btn.tiny.ghost{
  background: transparent;
  color: var(--text);
  border:1px solid var(--line);
}
.adminbar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:flex-end;
  margin: 10px 0 14px;
}
.adminbar label{ display:block; }
.adminbar select, .adminbar input[type=number]{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  font-size:16px;
}


/* Mobile Admin v11 */
.mwrap{ max-width: 920px; margin: 0 auto; padding: 14px; }
.mtop{
  display:flex; justify-content:space-between; align-items:center;
  gap:12px; flex-wrap:wrap;
}
.mtitle h1{ margin:0; font-size:24px; }
.mtitle .sub{ color:var(--muted); font-weight:800; margin-top:4px; }

.mchips{ display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.mchip{
  padding:8px 10px; border-radius:999px; border:1px solid var(--line);
  background:#fff; font-weight:900; font-size:13px;
}

.mkpis{
  display:grid; grid-template-columns: 1fr 1fr; gap:10px; margin-top:12px;
}
@media(min-width:720px){ .mkpis{ grid-template-columns: repeat(4, minmax(0,1fr)); } }
.mkpi{
  border:1px solid var(--line); border-radius:16px; padding:12px; background:var(--panel);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
}
.mkpi .k{ color:var(--muted); font-weight:900; font-size:13px; }
.mkpi .v{ font-weight:1000; font-size:22px; margin-top:6px; }

.navbottom{
  position: sticky; bottom: 10px; z-index: 5;
  background: rgba(245,247,251,.92);
  backdrop-filter: blur(8px);
  border:1px solid var(--line);
  border-radius:18px;
  padding:8px;
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:8px;
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
}
.navbottom button{
  border:1px solid var(--line);
  background:#fff;
  border-radius:14px;
  padding:10px 8px;
  font-weight:1000;
  font-size:13px;
}
.navbottom button.active{ background: var(--soft); border-color: rgba(2,132,199,.25); }

.card{
  border:1px solid var(--line); border-radius:16px; background:var(--panel);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
  padding:12px;
}
.stack{ display:flex; flex-direction:column; gap:10px; }
.row2{ display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
@media(max-width:420px){ .row2{ grid-template-columns: 1fr; } }

.input, select{
  width:100%;
  padding:10px 12px; border-radius:14px; border:1px solid var(--line);
  background:#fff; font-size:16px;
}
.label2{ color:var(--muted); font-weight:900; font-size:13px; margin: 2px 0 6px; }

.btn2{
  padding:10px 12px; border-radius:14px; border:1px solid var(--btn);
  background: var(--btn); color: var(--btntext);
  font-weight:1000; font-size:14px;
}
.btn2.ghost{
  background:#fff; color:var(--text); border:1px solid var(--line);
}
.btn2.danger{
  background: rgba(220,38,38,.10);
  border-color: rgba(220,38,38,.28);
  color:#7f1d1d;
}
.pills{
  display:flex; gap:8px; flex-wrap:wrap;
}
.pill{
  border:1px solid var(--line); border-radius:999px; padding:8px 10px;
  font-weight:900; font-size:13px; background:#fff;
}
.pill.ok{ background: rgba(22,163,74,.10); border-color: rgba(22,163,74,.28); }
.pill.bad{ background: rgba(220,38,38,.08); border-color: rgba(220,38,38,.22); }

.paylist{
  margin-top:10px;
  border:1px solid var(--line);
  border-radius:16px;
  overflow:hidden;
  background:#fff;
}
.payrow{
  display:grid;
  grid-template-columns: 84px 1fr 110px;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  border-top:1px solid var(--line);
}
.payrow:first-child{ border-top:none; }
.payrow .meta{ color:var(--muted); font-weight:800; font-size:12px; margin-top:2px; }

.toast{ margin-top:12px; padding:10px 12px; border-radius:14px; border:1px solid rgba(22,163,74,.28); background: rgba(22,163,74,.08); font-weight:900; }
.toast.bad{ border-color: rgba(220,38,38,.22); background: rgba(220,38,38,.06); color:#7f1d1d; }



/* Force mobile layout everywhere */
.mobile-only{ display:block !important; }
.desktop-only{ display:none !important; }
