:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --card2: #f0f1f4;
  --text: #15171c;
  --muted: #646a75;
  --line: #e2e4e9;
  --accent: #2f6fed;
  --ok: #1f9d55;
  --warn: #c98a00;
  --bad: #d64545;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #181b21;
    --card2: #20242c;
    --text: #e8eaee;
    --muted: #949aa6;
    --line: #2a2e37;
    --accent: #5b8dff;
    --ok: #3cc47c;
    --warn: #e5a823;
    --bad: #ef5f5f;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "PingFang TC", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); color: var(--text); min-height: 40px; padding: 0 14px; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; min-height: 48px; padding: 0 22px; }
button.ghost { background: transparent; min-height: 34px; padding: 0 10px; }
a.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border-radius: 10px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand img { border-radius: 7px; }
.brand { min-width: 0; white-space: nowrap; }
.account { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sync { font-size: 12px; color: var(--muted); margin-right: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { max-width: 860px; margin: 0 auto; padding: 14px 12px 40px; }
.login { text-align: center; padding: 48px 12px; }
.login h1 { font-size: 22px; margin: 0 0 12px; }
.login p { color: var(--muted); max-width: 460px; margin: 0 auto 22px; }
.hint { font-size: 13px; color: var(--bad) !important; margin-top: 16px !important; }
.empty { color: var(--muted); text-align: center; padding: 32px 12px; }
.banner { background: color-mix(in srgb, var(--warn) 16%, var(--card)); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }

.node { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.node-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.host { margin: 0; font-size: 19px; }
.sub { color: var(--muted); font-size: 13px; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.online { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.offline { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }
.pill.run { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.pill.idle { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.pill.blocked { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }

.hw { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.meter { background: var(--card2); border-radius: 10px; padding: 8px 10px; }
.meter .label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); gap: 6px; }
.meter .label b { color: var(--text); font-weight: 600; }
.bar { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 22%, transparent); margin-top: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.bar > i.ok { background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.bad { background: var(--bad); }

.providers { display: grid; gap: 8px; margin-bottom: 10px; }
.provider { background: var(--card2); border-radius: 10px; padding: 10px; }
.provider-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.provider-head b { letter-spacing: .03em; }
.provider-head span { color: var(--muted); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.windows { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px 12px; }
.window .label { font-size: 12px; }

.settings { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 8px; }
.pending { font-size: 13px; color: var(--warn); margin-bottom: 8px; }

.task { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.task-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.task-title { font-weight: 650; word-break: break-word; }
.task-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.task-actions > * { flex: 1 1 auto; min-height: 44px; }
details.msgs { margin-top: 10px; }
details.msgs summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 0; }
.msg { font-size: 13px; padding: 6px 8px; border-radius: 8px; background: var(--card2); margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.msg .who { font-size: 11px; color: var(--muted); display: block; margin-bottom: 2px; }
.msg.user { background: color-mix(in srgb, var(--accent) 12%, var(--card2)); }
form.send { display: flex; gap: 8px; margin-top: 10px; }
form.send input { flex: 1; min-width: 0; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 0 12px; font: inherit; }
.note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; z-index: 10; }
