:root {
  --bg: #0d1020; --panel: #161a2e; --panel2: #1c2138; --line: #2a3052; --text: #e8eaf6; --muted: #8b90b0;
  --accent: #22d3ee; --ok: #34d399; --warn: #f59e0b; --bad: #f87171; --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(1200px 600px at 20% -10%, #2b1650 0%, transparent 60%), var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; min-height: 100vh; }
button, input { font: inherit; }
button { background: var(--accent); color: #04121a; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button.danger { background: transparent; color: var(--bad); border: 1px solid #5a2a35; font-weight: 500; }
button:disabled { opacity: .5; cursor: default; }
input[type=url], input[type=password], input[type=number] { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); vertical-align: middle; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 16px; align-items: center; padding: 12px 20px; background: rgba(13,16,32,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; }
.brand small { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }
nav { display: flex; gap: 4px; }
.tab { background: transparent; color: var(--muted); font-weight: 500; }
.tab.active { background: var(--panel2); color: var(--text); }
.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.conn { font-size: 12px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); }
.conn.on { color: var(--ok); border-color: #1f5a46; }
.conn.off { color: var(--bad); }

main { max-width: 960px; margin: 0 auto; padding: 20px 16px 80px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 10px; font-size: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input[type=url], .row input[type=password] { flex: 1; min-width: 220px; }
.filter { margin-bottom: 12px; color: var(--muted); }

.mon { padding: 0; overflow: hidden; }
.mon-head { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; background: linear-gradient(90deg, var(--panel2), var(--panel)); }
.mon-head .info { flex: 1; min-width: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.chip { font-size: 12px; padding: 1px 8px; border-radius: 6px; background: #22284a; color: var(--muted); }
.chip.site { color: var(--accent); }
.chip.err { color: var(--bad); background: #3a1d26; }
.mon-title { font-weight: 700; font-size: 16px; }
.mon-sub { color: var(--muted); font-size: 13px; }
.mon-sub .hit { color: var(--ok); }
.mon-sub .sold { color: var(--bad); }
.mon-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #39405f; border-radius: 99px; cursor: pointer; transition: .15s; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 18px; border-top: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td.num, th.num { text-align: right; }
td.status { text-align: right; font-weight: 600; }
.avail { color: var(--ok); }
.soldout { color: var(--muted); font-weight: 400; }
tr.watched td { background: rgba(34,211,238,.06); }
.mon-foot { display: flex; gap: 10px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.mon-foot input[type=number] { width: 60px; padding: 4px 8px; }
.collapsed table, .collapsed .mon-foot { display: none; }

.sessions { display: grid; gap: 8px; margin-top: 12px; }
.sessions button { text-align: left; background: var(--panel2); color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.preview { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.preview .bar { padding: 10px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.act { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); }
.badge.up { color: var(--ok); border-color: #1f5a46; }
.badge.down { color: var(--muted); }
.act .when { color: var(--muted); font-size: 12px; }
.act .what { grid-column: 1 / -1; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 10px; z-index: 10; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: #0f2d27; border: 1px solid #1f5a46; border-radius: 10px; padding: 12px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.error { background: #2d1219; border-color: #5a2a35; }
.toast b { display: block; margin-bottom: 2px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

@media (max-width: 600px) {
  th, td { padding: 8px 10px; }
  .mon-head { flex-direction: column; }
  .mon-actions { justify-content: flex-start; }
  .top-right { margin-left: 0; }
}

/* zone picker */
.picker { border-top: 1px solid var(--line); }
.preview .picker { border-top: 0; }
.tiers { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 18px 4px; }
.tier { background: var(--panel2); color: var(--text); border: 1px solid var(--line); font-weight: 500; padding: 4px 10px; font-size: 13px; }
.tier small { color: var(--muted); margin-left: 2px; }
.tier.on { background: rgba(34,211,238,.18); border-color: var(--accent); color: var(--accent); }
.tier.part { border-color: var(--accent); }
.tier.ghost { background: transparent; color: var(--muted); }
.picker-opts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 4px 18px 8px; font-size: 13px; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; font-size: 13px; }
td .note { color: var(--muted); font-size: 12px; }
td .chip { font-size: 11px; vertical-align: 1px; }
.mon.paused { opacity: .6; }
.mon-sub .hit { font-weight: 600; }
.zone-scroll { max-height: 460px; overflow-y: auto; }
.zone-scroll thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.mon-sub .stale { color: var(--warn); font-weight: 600; }
.mon:has(.chip.err) .status { opacity: .55; }

/* list bar, delete, refresh line */
.list-bar { display: flex; align-items: center; gap: 12px; margin: 4px 2px 10px; flex-wrap: wrap; }
.list-bar label { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 14px; }
select { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font: inherit; }
button.icon { padding: 6px 10px; font-size: 15px; line-height: 1; }
.mon-sub.refresh { font-size: 12px; margin-top: 2px; }
.mon-sub.refresh b { font-weight: 600; color: var(--text); }

/* social */
.count { background: var(--bad); color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.small { font-size: 12px; }
.warn { color: var(--warn); }
.social-head .row { gap: 12px; }
.sub-tabs { margin: 0 0 12px; }
.tab.small { font-size: 13px; padding: 6px 12px; }
.post { display: flex; gap: 14px; }
.post.unread { border-color: var(--warn); }
.post .thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; flex: none; background: var(--panel2); }
.post-body { flex: 1; min-width: 0; }
.post-text { white-space: pre-wrap; word-break: break-word; margin: 6px 0; max-height: 9em; overflow: hidden; }
.post-actions { margin-top: 6px; gap: 14px; }
.chip.ai { color: var(--ok); background: #0f2d27; }
.prof label { display: block; margin: 8px 0; font-size: 13px; color: var(--muted); }
.prof label.inline, #socialSettings label.inline { display: inline-flex; gap: 6px; align-items: center; margin-right: 16px; color: var(--text); }
.prof input:not([type=checkbox]), .prof textarea, #socialSettings input:not([type=checkbox]), #socialSettings select, .feed select {
  width: 100%; margin-top: 4px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; box-sizing: border-box; }
.prof .pname { max-width: 260px; font-weight: 700; }
.prof .row input.testText { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
#socialSettings label { display: block; margin: 8px 0; font-size: 13px; color: var(--muted); }
.dim { opacity: .5; }
details.card summary { cursor: pointer; color: var(--muted); }
#addProfile { margin: 4px 0 20px; }
@media (max-width: 700px) { .grid2, .grid3 { grid-template-columns: 1fr; } .post .thumb { width: 64px; height: 64px; } }
