:root {
  color-scheme: light dark;
  --bg: #f2f3f6; --card: #ffffff; --text: #15171c; --muted: #646b78; --line: #e2e4ea;
  --accent: #2f6fde; --ok: #1f8a4c; --warn: #b26a00; --bad: #c62f2f; --pill: #eceef2;
  --bar: rgba(242, 243, 246, .86);
  --safe-t: env(safe-area-inset-top); --safe-b: env(safe-area-inset-bottom);
  --safe-l: env(safe-area-inset-left); --safe-r: env(safe-area-inset-right);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1117; --card: #161b22; --text: #e6e8eb; --muted: #8b93a1; --line: #262c36;
          --accent: #5b9bff; --ok: #3fbf74; --warn: #e0a03a; --bad: #ff6b6b; --pill: #222a35;
          --bar: rgba(13, 17, 23, .86); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
       font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
       overscroll-behavior-y: none; }

.top { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between;
       padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + 16px) 10px calc(var(--safe-l) + 16px);
       background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
       border-bottom: .5px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; }
.brand img { border-radius: 7px; }
h1 { margin: 0; font-size: 19px; letter-spacing: .1em; }
h2 { margin: 0 0 10px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.conn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 6px 12px;
        min-height: 32px; width: auto; background: var(--pill); color: var(--text); font-size: 13px; font-weight: 600; line-height: 1; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.conn.warn .dot { background: var(--warn); } .conn.bad .dot { background: var(--bad); }
.banner { margin: 0; padding: 10px calc(var(--safe-r) + 16px) 10px calc(var(--safe-l) + 16px);
          background: color-mix(in srgb, var(--bad) 14%, var(--bg)); color: var(--text); font-size: 15px; }

main { padding: 12px calc(var(--safe-r) + 16px) calc(var(--safe-b) + 84px) calc(var(--safe-l) + 16px);
       max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border: .5px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.hero { text-align: center; padding: 22px 16px; }
.hero-state { font-size: 26px; font-weight: 700; }
.muted { color: var(--muted); font-size: 15px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--pill); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0; font-size: 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 11px 0; border-top: .5px solid var(--line); overflow-wrap: anywhere; }
.list li:first-child { border-top: 0; padding-top: 0; }
.list li:last-child { padding-bottom: 0; }
.row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ctrl { padding: 14px 0; border-top: .5px solid var(--line); }
.ctrl:first-child { border-top: 0; padding-top: 0; }
.ctrl p { margin: 6px 0 12px; }

button { font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px 16px; min-height: 48px;
         width: 100%; cursor: pointer; touch-action: manipulation; }
button:active { transform: scale(.98); }
button.primary, button.secondary { background: var(--accent); color: #fff; }
button.secondary { background: var(--pill); color: var(--accent); margin-bottom: 10px; }
button.pause { background: var(--warn); color: #fff; } button.resume { background: var(--ok); color: #fff; }
button.danger { background: var(--pill); color: var(--bad); }
button:disabled { opacity: .45; }
input { font: 600 20px/1.2 ui-monospace, "SF Mono", monospace; width: 100%; padding: 14px; border-radius: 12px;
        border: 1px solid var(--line); background: var(--bg); color: var(--text); margin: 8px 0 12px;
        letter-spacing: .08em; text-transform: uppercase; text-align: center; }
code { font-size: 14px; background: var(--pill); padding: 1px 5px; border-radius: 5px; }
.msg { min-height: 1.2em; margin: 10px 0 0; font-size: 15px; }
.msg.ok { color: var(--ok); } .msg.bad { color: var(--bad); }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; grid-template-columns: repeat(5, 1fr);
        padding: 6px calc(var(--safe-r) + 4px) calc(var(--safe-b) + 6px) calc(var(--safe-l) + 4px);
        background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
        border-top: .5px solid var(--line); }
.tabs button { background: none; color: var(--muted); min-height: 50px; padding: 4px 0; border-radius: 10px;
               display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; }
.tabs .ico { font-size: 20px; line-height: 1; }
.tabs button[aria-current="page"] { color: var(--accent); }
.tabs button { position: relative; }
.badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px;
         border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; line-height: 16px; }

textarea { font: inherit; width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line);
           background: var(--bg); color: var(--text); resize: vertical; min-height: 110px; }
.form-foot { margin: 4px 0 10px; justify-content: flex-end; }
.small { font-size: 13px; margin: 10px 0 0; }
.job-text { margin: 4px 0; }
.job-result { white-space: pre-wrap; font-size: 15px; margin: 8px 0 0; padding: 10px 12px; border-radius: 10px;
              background: var(--bg); max-height: 60vh; overflow: auto; -webkit-overflow-scrolling: touch; }
.job-actions { display: flex; gap: 8px; margin-top: 8px; }
.job-actions button { min-height: 40px; padding: 8px 12px; font-size: 15px; }
