:root {
  color-scheme: dark light;
  --bg: #0e1118; --panel: #161a25; --fg: #eef1f8; --muted: #8f99b3; --border: #272d3c; --accent: #79a9ff; --ok: #3dbb5d; --warn: #f2a31a; --bad: #ff6b6b;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4f5f9; --panel: #fff; --fg: #12163a; --muted: #667089; --border: #e3e6ee; --accent: #2563eb; --bad: #c62828; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .5rem; }
h3 { font-size: .8rem; margin: 1.4rem 0 .5rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.note { color: var(--muted); margin: 0 0 .75rem; }
.error { color: var(--bad); }
.grow { flex: 1; }

.bar { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.brand { font-size: 1.05rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; }
.brand .logo { width: 2.4rem; height: 2.4rem; flex: none; }
.tag { padding: .1rem .5rem; border-radius: 99px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-size: .75rem; font-weight: 700; }
.who { color: var(--muted); font-size: .85rem; }

button { font: inherit; cursor: pointer; padding: .45rem .9rem; border-radius: 8px; border: 1px solid transparent; color: inherit; background: none; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: #fb923c; color: #2a1203; font-weight: 650; border-radius: 11px; }
button.ghost { border-color: var(--border); }
button.ghost:hover { border-color: var(--accent); }
button.danger { background: var(--bad); color: #fff; font-weight: 600; }
button.small { padding: .25rem .6rem; font-size: .8rem; }
button:disabled { opacity: .45; cursor: default; }
input { font: inherit; padding: .5rem .7rem; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
input[type=search], input[type=email] { min-width: 18rem; }

.gate { max-width: 30rem; margin: 12vh auto; padding: 0 1.25rem; text-align: center; }
#app { max-width: 78rem; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs button { border-radius: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: .65rem 1rem; color: var(--muted); font-weight: 600; }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: .6rem; align-items: center; margin: .75rem 0; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; }
.stat { padding: .9rem 1rem; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .8rem; }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.mono { font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; }
td.actions { text-align: right; }
td.actions button + button { margin-left: .4rem; }
.empty { padding: 1.5rem; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--border); border-radius: 12px; }
.dot::before { content: ""; display: inline-block; width: .55rem; height: .55rem; margin-right: .45rem; border-radius: 50%; background: var(--muted); }
.dot.on::before { background: var(--ok); }
.pill { padding: .1rem .5rem; border-radius: 99px; font-size: .75rem; font-weight: 600; background: color-mix(in srgb, var(--muted) 20%, transparent); }
.pill.good { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.command { display: flex; gap: .6rem; align-items: center; padding: .7rem .9rem; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.command code { flex: 1; overflow-x: auto; }

dialog { max-width: 32rem; width: calc(100% - 2rem); padding: 1.25rem; color: var(--fg); background: var(--panel); border: 1px solid var(--border); border-radius: 14px; }
dialog::backdrop { background: rgb(0 0 0 / .55); }
dialog h3 { margin: 0 0 .5rem; text-transform: none; letter-spacing: 0; font-size: 1.05rem; color: var(--fg); }
dialog ul { max-height: 16rem; overflow: auto; margin: .5rem 0; padding-left: 1.2rem; color: var(--muted); }
dialog .buttons { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

/* Website tab */
.inline { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); }
select { font: inherit; padding: .45rem .7rem; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 600; position: relative; }
.button-link { display: inline-block; padding: .45rem .9rem; border: 1px solid var(--border); border-radius: 8px; color: inherit; text-decoration: none; }
.button-link:hover { border-color: var(--accent); }
.frame-wrap { display: flex; justify-content: center; overflow: auto; padding: 1rem; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.frame { border: 0; background: #fff; border-radius: 8px; height: 75vh; min-height: 520px; box-shadow: 0 6px 24px rgb(0 0 0 / .25); }
.frame.desktop { width: 100%; }
.frame.tablet { width: 820px; max-width: 100%; }
.frame.phone { width: 390px; max-width: 100%; }
