:root{
  --bg:#0b0f17;
  --panel:#0f172a;
  --panel2:#111c36;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:rgba(255,255,255,.08);
  --accent:#7c3aed;
  --accent2:#22c55e;
  --danger:#ef4444;
  --shadow: 0 12px 30px rgba(0,0,0,.35);
  --radius: 16px;
  --max: 980px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  background: radial-gradient(1200px 700px at 15% 10%, rgba(124,58,237,.22), transparent 60%),
              radial-gradient(900px 600px at 85% 20%, rgba(34,197,94,.12), transparent 55%),
              var(--bg);
  color:var(--text);
}

.moneypos{ color: rgba(34,197,94,.95); font-weight:700; }
.moneyneg{ color: rgba(239,68,68,.95); font-weight:700; }

a{color:inherit; text-decoration:none}
.container{max-width:var(--max); margin:0 auto; padding:24px}
.nav{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px; border:1px solid var(--line); border-radius:var(--radius);
  background: rgba(15,23,42,.65); backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.brand{display:flex; gap:10px; align-items:center}
.dot{width:10px; height:10px; border-radius:999px; background:lightgreen}
.navlinks{display:flex; gap:14px; flex-wrap:wrap}
.badge{
  font-size:12px; color:var(--muted);
  border:1px solid var(--line); padding:6px 10px; border-radius:999px;
  background: rgba(255,255,255,.03);
}
.card{
  margin-top:18px;
  background: rgba(15,23,42,.75);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card .head{padding:18px 18px 0}
.card .body{padding:18px}
.h1{font-size:28px; margin:0 0 6px}
.p{margin:0; color:var(--muted); line-height:1.6}
.grid{display:grid; gap:14px}
.grid2{grid-template-columns: 1fr 1fr}

/* Ledger additions */

.statgrid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
  margin-top: 6px;
}
.stat{
  border:1px solid rgba(255,255,255,.08);
  border-radius:16px;
  padding:12px;
  background: rgba(255,255,255,.03);
}
.statlabel{
  font-size:12px;
  opacity:.75;
  margin-bottom:6px;
}
.statvalue{
  font-size:22px;
  font-weight:800;
  letter-spacing:.2px;
}
.badge{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
}
.badge.open{ opacity:1; }
.badge.paid{ opacity:1; }
.badge.cancelled{ opacity:.9; }

.chip{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.02);
  margin-left:8px;
}

.alert{
  border-radius:14px;
  padding:12px;
  margin-bottom:12px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}
.alert.danger{ }
.alert.success{ }

.muted{ opacity:.75; }


.navright{display:flex; align-items:center; gap:12px}
.burger{
  display:none;
  width:44px; height:40px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.05);
  cursor:pointer;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:0;
}
.burger:focus{
  outline:none;
  border-color: rgba(124,58,237,.55);
  box-shadow: 0 0 0 3px rgba(124,58,237,.18);
}
.burger .bar{
  width:18px; height:2px;
  background: var(--text);
  opacity:.9;
  border-radius:999px;
  display:block;
  transition: transform .2s ease, opacity .2s ease;
}
.burger[aria-expanded="true"] .bar:nth-child(1){ transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] .bar:nth-child(2){ opacity:0; }
.burger[aria-expanded="true"] .bar:nth-child(3){ transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 860px){
  .burger{display:inline-flex;}
  .navlinks{
    display:none;               /* hidden by default on mobile */
    width:100%;
    margin-top:12px;
    padding-top:12px;
    border-top:1px solid var(--line);
    flex-direction:column;
    gap:10px;
  }
  .nav.is-open .navlinks{display:flex;}
  .nav{
    flex-wrap:wrap;             /* allow dropdown under top row */
    align-items:flex-start;
  }
  .badge{width:100%;}           /* full width “pill” links */
}

@media (max-width: 900px){
  .statgrid{ grid-template-columns: 1fr; }
}


@media (max-width:860px){ .grid2{grid-template-columns:1fr} }

.form{
  display:grid; gap:12px; margin-top:12px;
}
.label{font-size:13px; color:var(--muted)}
.input{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  color:var(--text);
  outline:none;
}
.input:focus{
  border-color: rgba(124,58,237,.55);
  box-shadow: 0 0 0 3px rgba(124,58,237,.18);
}

.btnrow{display:flex; gap:10px; flex-wrap:wrap; align-items:center}
.btn{
  padding:11px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.05);
  color:var(--text);
  cursor:pointer;
  transition: transform .05s ease, background .2s ease, border-color .2s ease;
}
.btn:hover{background: rgba(255,255,255,.08)}
.btn:active{transform: translateY(1px)}
.btn.primary{
  background: rgba(124,58,237,.22);
  border-color: rgba(124,58,237,.45);
}
.btn.good{
  background: rgba(34,197,94,.16);
  border-color: rgba(34,197,94,.35);
}
.btn.danger{
  background: rgba(239,68,68,.16);
  border-color: rgba(239,68,68,.35);
}

.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius:14px;
  border:1px solid var(--line);
}
.table th, .table td{
  text-align:left;
  padding:12px 12px;
  border-bottom:1px solid var(--line);
  vertical-align:middle;
}
.table th{font-size:12px; color:var(--muted); letter-spacing:.04em; text-transform:uppercase}
.table tr:last-child td{border-bottom:none}
.small{font-size:12px; color:var(--muted)}
.flash{
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  margin-top:12px;
}
.flash.ok{border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.10)}
.flash.err{border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.10)}
.checkbox{transform: scale(1.15); accent-color: var(--accent); }


.tablewrap{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px){
  .table{
    min-width: 720px; /* force horizontal scroll */
  }
}