:root{
  --bg:#0b0f16;
  --panel:#111827;
  --panel2:#0f172a;
  --card:#0f1524;
  --line:rgba(255,255,255,.08);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.62);
  --good:#35d39c;
  --warn:#f6c453;
  --bad:#ff5d5d;
  --accent:#3bd7a1;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --r:16px;
  --pad:14px;
  --fs:14px;
  --tap:44px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  font: 500 var(--fs)/1.35 system-ui, -apple-system, Segoe UI, Roboto, Arial;
}
.bg{
  background:
    radial-gradient(900px 450px at 20% 0%, rgba(59,215,161,.18), transparent 60%),
    radial-gradient(800px 420px at 80% 10%, rgba(76,110,245,.12), transparent 55%),
    var(--bg);
}

a{color:inherit;text-decoration:none}
.hidden{display:none !important}
.small{font-size:12px}
.muted{color:var(--muted)}
.h1{font-size:18px;font-weight:800;letter-spacing:.2px}
.divider{height:1px;background:var(--line);margin:14px 0}
.row{display:flex;gap:10px;align-items:center;justify-content:space-between}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:14px}
@media (max-width: 980px){.grid-2{grid-template-columns:1fr}}

.btn{
  height:var(--tap);
  padding:0 14px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--text);
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.btn:hover{background:rgba(255,255,255,.06)}
.btn.primary{background:linear-gradient(135deg, rgba(59,215,161,.95), rgba(59,215,161,.72)); border-color:rgba(59,215,161,.25); color:#04110c; font-weight:900}
.btn.danger{background:rgba(255,93,93,.12); border-color:rgba(255,93,93,.3)}
.btn.ghost{background:transparent}
.btn.tiny{height:36px;border-radius:10px;padding:0 10px;font-size:12px}

.input, .select{
  width:100%;
  height:var(--tap);
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  color:var(--text);
  padding:0 12px;
  outline:none;
}
.input:focus, .select:focus{border-color:rgba(59,215,161,.45); box-shadow:0 0 0 3px rgba(59,215,161,.12)}
.input.tiny{height:36px;border-radius:10px;font-size:12px}
.field label{display:block;font-size:12px;color:var(--muted);margin:0 0 6px}
.field{display:flex;flex-direction:column;gap:0}
.hint{font-size:12px;color:var(--muted);margin-top:6px}
.inline{display:flex;gap:8px;align-items:center}
.inline .input{flex:1}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  border:1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: var(--pad);
}
.card-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.card-title{font-weight:900;letter-spacing:.2px}
.mini-card{padding:12px}
.note{
  margin-top:12px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  color:var(--muted);
}

.app{display:grid;grid-template-columns:260px 1fr;min-height:100vh}
@media (max-width: 980px){.app{grid-template-columns:1fr}}
.sidebar{
  position:sticky; top:0; height:100vh;
  border-right:1px solid var(--line);
  background:rgba(0,0,0,.18);
  backdrop-filter: blur(10px);
  padding:14px;
  display:flex;flex-direction:column;justify-content:space-between;
}
@media (max-width: 980px){
  .sidebar{position:fixed; bottom:0; top:auto; height:auto; width:100%;
    border-right:none;border-top:1px solid var(--line);
    z-index:50;
    padding:10px 10px 12px;
  }
}
.side-top{display:flex;flex-direction:column;gap:14px}
.logo{display:flex;gap:10px;align-items:center}
.logo-dot{width:14px;height:14px;border-radius:999px;background:var(--accent); box-shadow:0 0 0 6px rgba(59,215,161,.12)}
.logo-title{font-weight:900}
.logo-sub{font-size:12px;color:var(--muted)}
.nav{display:flex;flex-direction:column;gap:8px}
@media (max-width: 980px){
  .nav{flex-direction:row; gap:8px; overflow:auto; padding-bottom:2px}
}
.nav-item{
  height:42px;
  padding:0 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  cursor:pointer;
  display:flex;align-items:center;
}
.nav-item.active{border-color:rgba(59,215,161,.45); background:rgba(59,215,161,.10)}
.nav-item.link{justify-content:center}
.side-bottom .mini{display:flex;flex-direction:column;gap:10px}
.mini-row{display:flex;justify-content:space-between;gap:10px;align-items:center}
.badge{
  font-size:12px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid rgba(59,215,161,.3);
  background:rgba(59,215,161,.12);
  color:rgba(59,215,161,.95);
}

.main{padding:18px}
@media (max-width: 980px){.main{padding:16px 14px 86px}}
.topbar{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:16px}
@media (max-width: 980px){.topbar{flex-direction:column;gap:10px}}
.top-right{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.chip{display:flex;gap:8px;align-items:center;padding:8px 10px;border-radius:12px;border:1px solid var(--line);background:rgba(255,255,255,.03)}

.tab{display:none}
.tab.active{display:block}

.grid-cards{display:grid;grid-template-columns:1fr 1fr 1fr;gap:14px;margin-bottom:14px}
@media (max-width: 980px){.grid-cards{grid-template-columns:1fr}}

.meter{display:flex;gap:14px;align-items:center;margin-top:12px}
.meter-ring{
  width:90px;height:90px;border-radius:999px;
  background: conic-gradient(var(--accent) 0deg, rgba(255,255,255,.08) 0deg);
  display:flex;align-items:center;justify-content:center;
  position:relative;
}
.meter-ring::after{
  content:"";
  width:72px;height:72px;border-radius:999px;
  background:rgba(0,0,0,.28);
  border:1px solid var(--line);
  position:absolute;
}
.meter-ring span{position:relative;font-weight:900}
.meter-side{display:flex;flex-direction:column;gap:6px}
.kv{display:flex;justify-content:space-between;gap:14px}
.kv span{color:var(--muted);font-size:12px}
.kv b{font-size:14px}

.bigline{display:flex;justify-content:space-between;gap:14px;margin-top:10px}
.big{font-size:22px;font-weight:1000}
.val{font-size:18px;font-weight:950}

.liqbar{position:relative;height:38px;margin-top:12px}
.liqbar-track{position:absolute;inset:0;border-radius:14px;background:rgba(255,255,255,.04);border:1px solid var(--line)}
.liqbar-entry,.liqbar-sl,.liqbar-liq{
  position:absolute;top:6px;width:3px;height:26px;border-radius:999px;background:rgba(255,255,255,.65)
}
.liqbar-entry{background:rgba(59,215,161,.95)}
.liqbar-sl{background:rgba(246,196,83,.95)}
.liqbar-liq{background:rgba(255,93,93,.95)}

.calc-wrap{display:grid;grid-template-columns:1.12fr .88fr;gap:14px}
@media (max-width: 980px){.calc-wrap{grid-template-columns:1fr}}
.range{width:100%}
.seg{display:flex;border:1px solid var(--line);background:rgba(255,255,255,.03);border-radius:12px;overflow:hidden}
.seg-btn{
  flex:1;height:var(--tap);border:none;background:transparent;color:var(--muted);cursor:pointer;font-weight:900
}
.seg-btn.active{background:rgba(59,215,161,.12); color:var(--text)}

.result-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}
@media (max-width: 980px){.result-grid{grid-template-columns:1fr}}
.rbox{
  position:relative;
  padding:12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
}
.rbox.wide{grid-column:1/-1}
.info{
  position:absolute;top:10px;right:10px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  border-radius:10px;
  height:30px;padding:0 10px;cursor:pointer
}
.explain{
  padding:12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  color:var(--muted);
  min-height:92px;
  white-space:pre-wrap;
}

.guard{
  margin-top:12px;
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(246,196,83,.25);
  background:rgba(246,196,83,.10);
  display:none;
}
.guard-title{font-weight:1000;margin-bottom:6px}
.check{display:flex;gap:10px;align-items:flex-start;color:rgba(255,255,255,.82);font-size:13px}
.check input{margin-top:3px}
.guard-msg{margin-top:8px;color:rgba(255,255,255,.75);font-size:12px}

.saved,.glossary{display:flex;flex-direction:column;gap:10px;margin-top:12px}
.item{
  padding:12px;border-radius:14px;border:1px solid var(--line);background:rgba(0,0,0,.18);
  display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap
}
.item .meta{display:flex;flex-direction:column;gap:4px}
.item .meta b{font-weight:1000}
.item .actions{display:flex;gap:8px;align-items:center}

.toast{
  position:fixed;right:16px;bottom:16px;
  padding:12px 14px;border-radius:14px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  z-index:80;
}
.toast.ok{border-color:rgba(59,215,161,.35)}
.toast.bad{border-color:rgba(255,93,93,.35)}
.auth-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:16px}
.auth-card{width:min(520px,100%);padding:16px}
.brand-row{display:flex;gap:12px;align-items:center}
.brand-dot{width:18px;height:18px;border-radius:999px;background:var(--accent); box-shadow:0 0 0 8px rgba(59,215,161,.12)}

.admin-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:16px}
.admin-card{width:min(980px,100%)}
.table{margin-top:12px;border-radius:14px;overflow:hidden;border:1px solid var(--line)}
.trow{display:grid;grid-template-columns:140px 1fr 120px 120px 120px;gap:10px;align-items:center;padding:10px 12px;background:rgba(0,0,0,.18);border-bottom:1px solid var(--line)}
.trow.thead{background:rgba(255,255,255,.03);font-size:12px;color:var(--muted);font-weight:900}
@media (max-width: 980px){.trow{grid-template-columns:110px 1fr 90px 90px 90px}}

.sheet{
  position:fixed;left:0;right:0;bottom:0;
  background:rgba(10,14,22,.92);
  border-top:1px solid var(--line);
  border-top-left-radius:18px;border-top-right-radius:18px;
  box-shadow: 0 -20px 40px rgba(0,0,0,.5);
  z-index:90;
  padding:12px 12px 16px;
}
.sheet-handle{
  width:44px;height:5px;border-radius:999px;background:rgba(255,255,255,.18);
  margin:4px auto 10px;
}
.sheet-head{display:flex;justify-content:space-between;align-items:center;gap:10px}
.sheet-body{margin-top:10px}
.qres{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px;margin-top:12px}
@media (max-width: 480px){.qres{grid-template-columns:1fr}}
.qcard{
  padding:12px;border-radius:14px;border:1px solid var(--line);
  background:rgba(0,0,0,.18);
}

/* One-hand mode (moves focus lower, larger taps) */
.onehand .main{padding-bottom:104px}
.onehand .topbar{position:sticky;top:0;z-index:40;background:rgba(11,15,22,.70);backdrop-filter: blur(10px);padding:10px 0}
.onehand .btn, .onehand .input, .onehand .select{height:48px}
