:root {
  --bg: #0b1020;
  --panel: #151b2f;
  --card: #1b233a;
  --line: rgba(255,255,255,.08);
  --text: #eef2ff;
  --muted: #8b93ad;
  --primary: #3b82f6;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tab-h: 56px;
  --top-h: 48px;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; background:var(--bg); color:var(--text);
  font-family: -apple-system, "PingFang SC", "Noto Sans SC", sans-serif;
  -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }

.login { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px; }
.login__card { width:100%; max-width:380px; background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:24px; }
.login h1 { margin:0; font-size:24px; }
.login__sub { margin:6px 0 20px; color:var(--muted); font-size:13px; }
.login__err { color:var(--red); font-size:13px; min-height:18px; margin:10px 0 0; }

.app { min-height:100vh; padding-top:calc(var(--top-h) + var(--safe-t)); padding-bottom:calc(var(--tab-h) + var(--safe-b) + 8px); }
.topbar {
  position:fixed; left:0; right:0; top:0; z-index:20;
  height:calc(var(--top-h) + var(--safe-t)); padding:var(--safe-t) 8px 0;
  display:flex; align-items:center; gap:4px;
  background:rgba(11,16,32,.92); backdrop-filter:blur(10px); border-bottom:1px solid var(--line);
}
.topbar__back, .topbar__action {
  width:40px; height:40px; border:0; background:transparent; color:var(--text); font-size:24px; line-height:1;
}
.topbar__title { flex:1; text-align:center; font-size:16px; font-weight:650; }
.topbar__action { font-size:22px; font-weight:600; color:var(--primary); }

.main { padding:12px; }
.tabbar {
  position:fixed; left:0; right:0; bottom:0; z-index:20;
  height:calc(var(--tab-h) + var(--safe-b)); padding-bottom:var(--safe-b);
  display:grid; grid-template-columns:repeat(2,1fr);
  background:rgba(15,20,36,.96); border-top:1px solid var(--line);
}
.tab { border:0; background:transparent; color:var(--muted); font-size:12px; }
.tab.is-on { color:var(--primary); font-weight:650; }

.field { display:block; margin-bottom:12px; }
.field > span { display:block; font-size:12px; color:var(--muted); margin-bottom:6px; }
.field input, .field select, .field textarea {
  width:100%; height:42px; border-radius:10px; border:1px solid var(--line);
  background:var(--card); padding:0 12px; outline:none;
}
.field textarea { height:84px; padding:10px 12px; resize:vertical; }
.field-row { display:grid; grid-template-columns:1fr 1fr; gap:8px; }

.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  height:40px; padding:0 14px; border-radius:10px; border:1px solid var(--line);
  background:var(--card); color:var(--text); cursor:pointer;
}
.btn-primary { background:var(--primary); border-color:var(--primary); color:#fff; font-weight:650; }
.btn-danger { background:rgba(239,68,68,.15); border-color:rgba(239,68,68,.4); color:#fda4a4; }
.btn-block { width:100%; }
.btn-sm { height:32px; padding:0 10px; font-size:12px; border-radius:8px; }
.btn[disabled] { opacity:.45; }

.card {
  background:var(--panel); border:1px solid var(--line); border-radius:14px;
  padding:12px 14px; margin-bottom:10px;
}
.card__title { font-size:15px; font-weight:650; margin:0 0 4px; }
.card__meta { font-size:12px; color:var(--muted); line-height:1.5; }
.card__ops { display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
.account-card { margin-top:18px; opacity:.95; }
.account-card a.btn { text-decoration:none; }
.list-empty { text-align:center; color:var(--muted); padding:40px 12px; font-size:14px; }

.tag {
  display:inline-flex; align-items:center; height:20px; padding:0 7px; border-radius:999px;
  font-size:11px; font-weight:650; background:rgba(255,255,255,.06); color:var(--muted);
}
.tag-green { background:rgba(34,197,94,.15); color:#86efac; }
.tag-red { background:rgba(239,68,68,.15); color:#fca5a5; }
.tag-blue { background:rgba(59,130,246,.15); color:#93c5fd; }
.tag-orange { background:rgba(245,158,11,.15); color:#fcd34d; }

.sec { margin:16px 0 8px; font-size:13px; font-weight:700; color:var(--muted); }
.kv { display:flex; justify-content:space-between; gap:8px; font-size:13px; padding:8px 0; border-bottom:1px dashed var(--line); }
.kv span:last-child { color:var(--muted); text-align:right; }

.sheet { position:fixed; inset:0; z-index:40; }
.sheet__mask { position:absolute; inset:0; background:rgba(0,0,0,.55); }
.sheet__panel {
  position:absolute; left:0; right:0; bottom:0; max-height:88vh;
  background:var(--panel); border-radius:16px 16px 0 0;
  display:flex; flex-direction:column; padding-bottom:var(--safe-b);
}
.sheet__head {
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; border-bottom:1px solid var(--line);
}
.sheet__head h3 { margin:0; font-size:16px; }
.sheet__close { border:0; background:transparent; color:var(--muted); font-size:18px; width:36px; height:36px; }
.sheet__body { overflow:auto; padding:14px 16px; -webkit-overflow-scrolling:touch; }
.sheet__foot { padding:10px 16px 14px; border-top:1px solid var(--line); display:flex; gap:8px; }
.sheet__foot .btn { flex:1; }

.row-mini {
  display:grid; gap:6px; margin-bottom:8px; padding:10px; border-radius:10px; background:var(--card); border:1px solid var(--line);
  grid-template-columns:1fr;
}
.row-mini .btn-sm { width:100%; }
.toast {
  position:fixed; left:50%; bottom:calc(var(--tab-h) + var(--safe-b) + 18px); transform:translateX(-50%);
  z-index:50; max-width:86vw; padding:10px 14px; border-radius:999px;
  background:rgba(30,41,59,.96); color:#fff; font-size:13px; opacity:0; pointer-events:none; transition:opacity .2s;
}
.toast.show { opacity:1; }
.toast.err { background:rgba(127,29,29,.95); }

.chips { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.chip {
  height:32px; padding:0 12px; border-radius:999px; border:1px solid var(--line);
  background:var(--card); color:var(--muted); font-size:12px;
}
.chip.is-on { background:rgba(59,130,246,.18); border-color:rgba(59,130,246,.5); color:#93c5fd; font-weight:650; }
