/* SchuldenPortal v2.2 UI (hell, klar, professionell) */
:root{
  --bg:#f6f8fc;
  --surface:#ffffff;
  --surface-2:#f9fafb;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e2e8f0;
  --shadow: 0 10px 30px rgba(2,6,23,.06);

  --pri:#2563eb;
  --pri-2:#1d4ed8;

  --ok-bg:#ecfdf5; --ok-bd:#a7f3d0; --ok-tx:#065f46;
  --info-bg:#eff6ff; --info-bd:#bfdbfe; --info-tx:#1e40af;
  --warn-bg:#fff7ed; --warn-bd:#fed7aa; --warn-tx:#9a3412;
  --danger:#dc2626;
  --radius:16px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}

/* Accessibility */
.skip-link{
  position:absolute;left:-999px;top:0;
  background:var(--surface);border:1px solid var(--border);
  padding:10px 12px;border-radius:12px;z-index:9999;
}
.skip-link:focus{left:12px;top:12px}

.wrap{max-width:1120px;margin:0 auto;padding:18px}

/* Topbar */
.topbar{
  position:sticky;top:0;z-index:20;
  background:rgba(255,255,255,.9);
  backdrop-filter:saturate(180%) blur(12px);
  border-bottom:1px solid var(--border);
}
.topbar-inner{display:flex;align-items:center;justify-content:space-between;gap:14px}

.brand{
  display:flex;align-items:center;gap:10px;
  text-decoration:none;color:var(--text);font-weight:800;
}
.brand-mark{
  width:34px;height:34px;border-radius:12px;
  display:grid;place-items:center;
  background:linear-gradient(135deg, var(--pri), #60a5fa);
  color:white;font-weight:900;font-size:14px;
}
.brand-name{letter-spacing:.2px}
.badge{
  font-size:12px;color:var(--muted);
  padding:4px 10px;border:1px solid var(--border);
  border-radius:999px;background:var(--surface);
}

/* Nav */
.nav{display:flex;align-items:center;gap:10px}
.nav-link{
  text-decoration:none;color:var(--text);
  padding:10px 10px;border-radius:12px;
  font-weight:600;font-size:14px;
}
.nav-link:hover{background:var(--surface-2)}
.nav-sep{width:1px;height:20px;background:var(--border);margin:0 2px}

.burger{
  display:none;
  width:42px;height:42px;border-radius:14px;
  border:1px solid var(--border);
  background:var(--surface);
  cursor:pointer;
}
.burger span{display:block;height:2px;margin:6px 10px;background:var(--text);border-radius:2px;opacity:.85}

/* Buttons */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  background:var(--pri);
  color:white;
  padding:10px 14px;border-radius:14px;
  text-decoration:none;border:1px solid rgba(0,0,0,0);
  cursor:pointer;font-weight:700;
  box-shadow: 0 8px 20px rgba(37,99,235,.18);
}
.btn:hover{background:var(--pri-2)}
.btn.secondary{background:var(--text);box-shadow: 0 8px 20px rgba(15,23,42,.18)}
.btn.danger{background:var(--danger);box-shadow:none}
.btn:focus{outline:2px solid #93c5fd;outline-offset:2px}

/* Typography & layout */
h1{font-size:38px;line-height:1.1;margin:8px 0 10px}
h2{font-size:26px;margin:8px 0 14px}
h3{font-size:18px;margin:0 0 10px}
p{color:var(--muted);margin:0 0 12px}

.hero{padding:18px 0 6px}
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:14px}

/* Cards */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:16px;
  box-shadow:var(--shadow);
}
.card-head{display:flex;justify-content:space-between;align-items:center;gap:12px}
.small{color:var(--muted);font-size:13px}
.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}

/* Status pills */
.status{
  font-size:12px;padding:6px 10px;border-radius:999px;
  border:1px solid var(--border);color:var(--muted);background:var(--surface);
}
.status.paid{background:var(--ok-bg);border-color:var(--ok-bd);color:var(--ok-tx)}
.status.open{background:var(--info-bg);border-color:var(--info-bd);color:var(--info-tx)}

/* Forms */
.form{display:grid;gap:10px;max-width:560px}
.form label{font-weight:700;font-size:13px;color:var(--text)}
.form input,.form textarea,.form select{
  padding:12px 12px;border-radius:14px;
  border:1px solid var(--border);
  background:var(--surface);
  font-size:14px;
}
.form input:focus,.form textarea:focus,.form select:focus{
  outline:2px solid #93c5fd;outline-offset:2px;border-color:#93c5fd
}
.form-inline{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:12px 0}
.form-inline input,.form-inline select{
  padding:12px 12px;border-radius:14px;border:1px solid var(--border);background:var(--surface)
}
.alert{
  background:#fef2f2;border:1px solid #fecaca;color:#7f1d1d;
  padding:12px 14px;border-radius:14px
}
.pill{
  display:inline-flex;align-items:center;gap:8px;
  padding:8px 12px;border:1px solid var(--border);
  border-radius:999px;background:var(--surface);color:var(--muted)
}
.big{font-size:30px;font-weight:900;margin:0;color:var(--text)}

/* Table */
.table{
  width:100%;border-collapse:separate;border-spacing:0;
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)
}
.table th,.table td{padding:12px 12px;border-bottom:1px solid var(--border);text-align:left;font-size:14px}
.table th{background:var(--surface-2);color:var(--muted);font-weight:800}
.table tr:last-child td{border-bottom:none}

/* Footer */
.footer{border-top:1px solid var(--border);background:var(--surface);margin-top:22px}
.footer-inner{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.footer-brand{font-weight:900}
.footer-muted{color:var(--muted);font-size:13px}

/* Admin look (clearly different) */
body.admin{
  --bg:#0b1220;
  --surface:#0f172a;
  --surface-2:#111c33;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --border:#22304a;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --pri:#60a5fa;
  --pri-2:#3b82f6;
}
body.admin .topbar{background:rgba(15,23,42,.92)}
body.admin .brand-mark{background:linear-gradient(135deg, #60a5fa, #a78bfa)}
body.admin .nav-link:hover{background:rgba(255,255,255,.06)}
body.admin .badge{background:rgba(255,255,255,.04)}
body.admin .table th{background:rgba(255,255,255,.04)}

/* Mobile */
@media (max-width: 900px){
  h1{font-size:32px}
  .grid2,.cards{grid-template-columns:1fr}
  .burger{display:inline-block}
  .nav{
    position:absolute;left:0;right:0;top:70px;
    display:none;flex-direction:column;align-items:stretch;
    padding:12px;margin:0 12px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
  }
  body.admin .nav{background:var(--surface)}
  .nav.open{display:flex}
  .nav-link{padding:12px 12px}
  .nav-sep{display:none}
}


/* Admin shell (Sidebar layout) */
.admin-shell{
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
}

.admin-side{
  position: sticky;
  top: 86px;
  align-self: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  min-height: calc(100vh - 120px);
}

.admin-side-title{
  font-weight: 900;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .2px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.side-link{
  display: block;
  text-decoration: none;
  color: var(--text);
  padding: 10px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
}

.side-link:hover{ background: rgba(255,255,255,.06); }
body.app .side-link:hover{ background: var(--surface-2); }

.side-sep{
  height: 1px;
  background: var(--border);
  margin: 10px 0;
  opacity: .9;
}

.admin-content{ padding: 0; }

/* Admin dashboard chart */
.chart{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.bar{
  display: grid;
  grid-template-columns: 160px 1fr 72px;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.bar:last-child{ border-bottom: none; }
.bar .label{ color: var(--muted); font-weight: 800; font-size: 13px; }
.bar .track{
  height: 10px;
  border-radius: 999px;
  background: rgba(148,163,184,.25);
  overflow: hidden;
}
.bar .fill{
  height: 100%;
  border-radius: 999px;
  background: var(--pri);
}
.bar .value{ text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; }

@media (max-width: 1100px){
  .admin-shell{ grid-template-columns: 1fr; }
  .admin-side{ position: relative; top: 0; min-height: auto; }
}

/* Active admin link */
.side-link.active{
  background: rgba(96,165,250,.18);
  border: 1px solid rgba(96,165,250,.35);
}
body.app .side-link.active{
  background: var(--surface-2);
  border: 1px solid var(--border);
}

/* Activity list */
.activity{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-top: 14px;
}
.activity-item{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:10px 0;
  border-bottom:1px solid var(--border);
}
.activity-item:last-child{border-bottom:none}
.activity-left{display:flex;flex-direction:column;gap:2px}
.activity-title{font-weight:900}
.activity-meta{color:var(--muted);font-size:13px}
.activity-time{color:var(--muted);font-size:13px;white-space:nowrap}


/* Dashboard improvements */
.dash-head{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;flex-wrap:wrap}
.dash-actions{flex:1;display:flex;justify-content:flex-end}
.grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.debt-card .actions{gap:10px}
.progress{display:flex;align-items:center;gap:10px;margin-top:12px}
.progress-track{flex:1;height:10px;border-radius:999px;background:rgba(148,163,184,.25);overflow:hidden}
.progress-fill{height:100%;border-radius:999px;background:var(--pri)}
.history{margin-top:10px}
@media (max-width: 900px){
  .grid3{grid-template-columns:1fr}
  .dash-actions{justify-content:flex-start}
}
