:root{
  --bg:#0b0b10; --card:#141420; --muted:#a7a7b6; --text:#f2f2f7;
  --accent:#7c5cff; --danger:#ff4d6d; --border:rgba(255,255,255,.10);
}
*{box-sizing:border-box}
body{
  margin:0; font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial;
  background: var(--bg);
  color:var(--text);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

header{
  max-width:980px; margin:0 auto; padding:22px 16px 10px;
  display:flex; gap:12px; align-items:flex-start; justify-content:space-between;
}
h1{margin:0; font-size:20px; letter-spacing:.2px}
.sub{margin-top:6px; color:var(--muted); font-size:13px; line-height:1.3}

main{max-width:980px; margin:0 auto; padding:0 16px 32px}
.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center}

.btn{
  border:1px solid var(--border); background:rgba(255,255,255,.06); color:var(--text);
  padding:10px 12px; border-radius:12px; cursor:pointer; font-weight:700;
  user-select:none; -webkit-tap-highlight-color: transparent;
}
.btn:hover{background:rgba(255,255,255,.10)}
.btn.primary{border-color:rgba(124,92,255,.45); background:rgba(124,92,255,.22)}
.btn.primary:hover{background:rgba(124,92,255,.30)}
.btn.danger{border-color:rgba(255,77,109,.35); background:rgba(255,77,109,.18)}
.btn.danger:hover{background:rgba(255,77,109,.26)}
.btn:disabled{opacity:.45; cursor:not-allowed}

.topbar{
  display:flex; gap:10px; align-items:center; justify-content:space-between;
  margin: 12px 0 14px; flex-wrap:wrap;
}
.search{flex:1; min-width:220px}
input[type="search"]{
  width:100%; padding:10px 12px; border-radius:12px; border:1px solid var(--border);
  background:rgba(255,255,255,.05); color:var(--text); outline:none;
}
input[type="search"]::placeholder{color:rgba(167,167,182,.75)}

.grid{display:grid; grid-template-columns:repeat(auto-fit, minmax(250px,1fr)); gap:12px}
.card{
  border:1px solid var(--border); background:rgba(20,20,32,.88);
  border-radius:18px; padding:14px; display:flex; flex-direction:column; gap:10px;
  box-shadow:0 10px 25px rgba(0,0,0,.30);
}
.card h3{margin:0; font-size:16px}
.meta{color:var(--muted); font-size:13px; line-height:1.35}
.pillrow{display:flex; gap:8px; flex-wrap:wrap}
.pill{
  font-size:12px; padding:6px 8px; border-radius:999px; border:1px solid var(--border);
  background:rgba(255,255,255,.04); color:var(--muted);
}
.pill.accent{
  border-color:rgba(124,92,255,.45);
  color:rgba(225,219,255,.95);
  background:rgba(124,92,255,.18);
}
.actions{display:flex; gap:8px; flex-wrap:wrap}

.hint{color:var(--muted); font-size:12px; margin-top:10px}

/* Modal */
.backdrop{
  position:fixed; inset:0; background:rgba(0,0,0,.55);
  display:none; align-items:center; justify-content:center; padding:16px;
}
.backdrop.open{display:flex}
.modal{
  width:min(640px,100%); border-radius:18px; border:1px solid var(--border);
  background:rgba(18,18,28,.98); box-shadow:0 25px 70px rgba(0,0,0,.55);
  padding:16px;
}
.modal_header{
  max-width:none; margin:0 0 10px 0; padding:0;
  display:flex; align-items:center; justify-content:space-between;
}
.modal h2{margin:0; font-size:18px}
form{display:grid; grid-template-columns:1fr 1fr; gap:10px 12px}
label{font-size:12px; color:var(--muted); display:block; margin-bottom:6px}
input, select, textarea{
  width:100%; padding:10px 12px; border-radius:12px; border:1px solid var(--border);
  background:rgba(255,255,255,.05); color:var(--text); outline:none;
}
textarea{min-height:86px; resize:vertical}
.span2{grid-column:span 2}
.footer{grid-column:span 2; display:flex; justify-content:flex-end; gap:10px; margin-top:6px}

/* Lock screen */
.lockwrap{
  max-width:480px; margin: 18px auto 0; padding: 14px;
  border:1px solid var(--border); border-radius:18px; background:rgba(20,20,32,.80);
  box-shadow:0 10px 25px rgba(0,0,0,.25);
}
.lockwrap h2{margin:0; font-size:18px}
.pinrow{display:flex; gap:10px; margin-top:12px; align-items:center}
.pin{
  flex:1; font-size:18px; letter-spacing:8px; text-align:center; padding:12px 12px;
}

.toast{
  position:fixed; left:50%; transform:translateX(-50%);
  bottom: max(14px, env(safe-area-inset-bottom));
  background:rgba(0,0,0,.70); border:1px solid rgba(255,255,255,.12);
  padding:10px 12px; border-radius:12px; font-size:13px; color:var(--text);
  display:none;
}
.toast.show{display:block}
.totals{
  display:flex; gap:10px; flex-wrap:wrap;
  margin: 10px 0 14px;
  padding: 12px;
  border:1px solid var(--border);
  border-radius: 18px;
  background: rgba(20,20,32,.72);
  box-shadow:0 10px 25px rgba(0,0,0,.20);
}
.totals_item{min-width:120px}
.totals_label{color:var(--muted); font-size:12px}
.totals_value{font-size:16px; font-weight:800}



/* Section toggles */
.togglebar{gap:10px; flex-wrap:wrap}
.toggle{
  display:flex; align-items:center; gap:8px;
  padding:8px 12px;
  border:1px solid var(--border);
  border-radius:999px;
  background:var(--card);
  color:var(--text);
  font-size:14px;
}
.toggle input{width:16px; height:16px;}


/* Toggle chips (Show/Hide buttons) */
.btn.chip{
  padding:8px 12px;
  border-radius:999px;
  font-size:14px;
  line-height:1;
}
.togglebar{
  gap:8px;
  flex-wrap:wrap;
}
