:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e4e7ec;
  --text: #101828;
  --muted: #667085;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --node: #15803d;
  --node-soft: #dcfce7;
  --other: #475467;
  --other-soft: #f2f4f7;
  --warn: #b42318;
  --warn-soft: #fee4e2;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 12px rgba(16,24,40,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d12; --surface: #151922; --border: #262b36; --text: #eef0f4; --muted: #98a2b3;
    --accent: #818cf8; --accent-soft: #1e1b4b; --node: #4ade80; --node-soft: #12301f;
    --other: #cbd5e1; --other-soft: #1f2430; --warn: #fda29b; --warn-soft: #3b1512; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d12; --surface: #151922; --border: #262b36; --text: #eef0f4; --muted: #98a2b3;
  --accent: #818cf8; --accent-soft: #1e1b4b; --node: #4ade80; --node-soft: #12301f;
  --other: #cbd5e1; --other-soft: #1f2430; --warn: #fda29b; --warn-soft: #3b1512; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 16px 64px; }

.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.topbar a, .linkbtn { color: var(--muted); text-decoration: none; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.topbar a:hover, .linkbtn:hover { color: var(--accent); }

header { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0; font-size: 15px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
input[type="search"], input[type="email"], input[type="password"] {
  font: inherit; font-size: 14px; padding: 9px 12px; width: 240px; max-width: 100%;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.chip, .btn {
  font: inherit; font-size: 13px; font-weight: 500; padding: 8px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.danger { color: var(--warn); }
.btn:hover { border-color: var(--accent); }

.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 32px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; min-width: 130px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; font-weight: 700; }
.stat span { font-size: 13px; color: var(--muted); }

section { margin-bottom: 36px; }
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

a.card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
a.card:hover { transform: translateY(-2px); border-color: var(--accent); }
a.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.top { display: flex; align-items: center; gap: 12px; }
.icon {
  width: 40px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 16px;
}
.icon.has-img { background: var(--other-soft); }
.icon img { width: 26px; height: 26px; object-fit: contain; display: block; }
.title { font-weight: 600; font-size: 16px; }
.domain { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; color: var(--muted); word-break: break-all; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: auto; }
.tag { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--other-soft); color: var(--other); }
.tag.node { background: var(--node-soft); color: var(--node); }
.tag.off { background: var(--warn-soft); color: var(--warn); }
.date { font-size: 12px; color: var(--muted); margin-left: auto; }
.arrow { color: var(--muted); margin-left: auto; font-size: 18px; }
a.card:hover .arrow { color: var(--accent); }

.notice { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 12px 16px; margin-bottom: 24px; font-size: 14px; }
.notice.ok { background: var(--node-soft); color: var(--node); }
.empty { color: var(--muted); padding: 24px 0; display: none; }
footer { color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); padding-top: 16px; }

/* sign-in screen */
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; width: 100%; max-width: 400px; box-shadow: var(--shadow); text-align: center; }
.panel h1 { font-size: 24px; }
.panel p { color: var(--muted); font-size: 14px; }
.gbtn { display: flex; justify-content: center; margin: 20px 0 8px; min-height: 44px; }

/* admin */
.box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.box h2 { margin-bottom: 4px; }
.box p { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list { list-style: none; margin: 0 0 16px; padding: 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; word-break: break-all; }
.list li:last-child { border-bottom: 0; }
.list li form { margin-left: auto; }
