:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #667089;
  --line: #e5e9f2;
  --accent: #2f6bff;
  --accent-soft: #e8efff;
  --ok: #1a9350;
  --ok-soft: #e4f6ec;
  --warn: #b97300;
  --warn-soft: #fff3dc;
  --bad: #cf3f3f;
  --bad-soft: #fdeaea;
  --idle: #7b8499;
  --idle-soft: #eef0f5;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(28, 35, 51, .05), 0 6px 18px rgba(28, 35, 51, .06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif; }
body { min-height: 100vh; padding-bottom: calc(76px + var(--safe-bottom)); }
[hidden] { display: none !important; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.2px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 22px 4px 8px; font-weight: 600; }
p { margin: 0; }

.devbar { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: 13px; padding: 6px 12px; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; position: sticky; top: 0; background: linear-gradient(var(--bg) 82%, rgba(244,246,251,0)); z-index: 5; }
main { padding: 4px 14px 24px; max-width: 640px; margin: 0 auto; }

.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); color: var(--accent); display: grid; place-items: center; }
.icon-btn svg, .tab svg, .hidden-card svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; }
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.995); background: #fbfcff; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
.gap { margin-top: 10px; }

.avatar { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; background: var(--idle-soft); flex: none; box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--line); }
.avatar.sm { width: 36px; height: 36px; box-shadow: none; }
.avatar.working { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--accent); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--idle-soft); color: var(--idle); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.work { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 12px; background: var(--idle-soft); color: var(--muted); margin: 2px 4px 0 0; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.lock { background: var(--accent-soft); color: var(--accent); }

.btn { appearance: none; border: 0; border-radius: 14px; min-height: 46px; padding: 0 16px; font: inherit; font-weight: 600; background: var(--accent); color: #fff; }
.btn:active { opacity: .85; }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; flex: none; }
.row.between { justify-content: space-between; }
.row.between h2 { margin-right: 8px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btns .btn { flex: 1; min-width: 120px; }

.big { font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 0; border-radius: 999px; padding: 8px 14px; background: var(--card); color: var(--text); font: inherit; font-size: 14px; box-shadow: var(--shadow); }
.chip.on { background: var(--accent); color: #fff; }

.banner { border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.banner.warn { background: var(--warn-soft); color: #7a4d00; }
.banner.bad { background: var(--bad-soft); color: #8f2a2a; }
.banner.info { background: var(--accent-soft); color: #1d4fc4; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 15px; }
.kv:first-of-type { border-top: 0; }
.kv span:last-child { text-align: right; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--idle); flex: none; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.hidden-card { display: flex; gap: 10px; align-items: center; color: var(--accent); background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-bottom)); z-index: 10; }
.tab { border: 0; background: none; color: var(--idle); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font: inherit; font-size: 11px; font-weight: 500; }
.tab.on { color: var(--accent); }

.sheet-back { position: fixed; inset: 0; background: rgba(20, 26, 40, .35); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 8px 14px calc(18px + var(--safe-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.15); }
.grab { width: 40px; height: 5px; border-radius: 3px; background: #cfd5e3; margin: 6px auto 12px; }
.sheet h3 { margin: 4px 4px 12px; font-size: 20px; }
textarea { width: 100%; min-height: 110px; border: 1px solid var(--line); border-radius: 14px; padding: 12px; font: inherit; background: #fff; color: var(--text); resize: vertical; }
textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.check:first-child { border-top: 0; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-bottom)); transform: translateX(-50%); background: #1c2333; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 30; font-size: 14px; max-width: 90vw; text-align: center; }
.toast.err { background: var(--bad); }
.skeleton { height: 88px; border-radius: var(--radius); background: linear-gradient(90deg, #eceff6 25%, #f6f8fc 50%, #eceff6 75%); background-size: 200% 100%; animation: sh 1.2s infinite; margin-bottom: 12px; }
@keyframes sh { to { background-position: -200% 0; } }
.hidden-card svg { width: 20px; height: 20px; flex: none; }
