:root {
  color-scheme: light;
  --blue: #153d6f;
  --blue-hover: #0e315b;
  --blue-soft: #e7eff8;
  --ink: #1c2733;
  --heading: #142f50;
  --muted: #5d6877;
  --line: #d7dee8;
  --bg: #f1f4f8;
  --surface: #fff;
  --surface-soft: #f7faff;
  --field-bg: #fff;
  --field-line: #b9c4d2;
  --notice-bg: #eaf2fb;
  --notice-ink: #234462;
  --error-bg: #fae7e7;
  --error-ink: #852020;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); line-height: 1.55; }
a { color: var(--blue); }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #2b70b951; outline-offset: 2px; }

.shell { width: min(1100px, calc(100% - 32px)); margin: 0 auto; padding: 18px 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.brand { display: flex; flex-direction: column; color: var(--heading); text-decoration: none; white-space: nowrap; }
.brand-kicker { color: #235a96; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.brand-title { font-size: clamp(1.35rem, 2.5vw, 1.75rem); font-weight: 750; line-height: 1.2; }
.logo { width: 125px; max-height: 55px; object-fit: contain; }
.toplinks { display: flex; align-items: center; justify-content: flex-end; gap: 18px; margin-left: auto; color: var(--muted); font-size: .9rem; }
.toplinks a { font-weight: 700; text-decoration: none; }
.toplinks a:hover, .ghost:hover { text-decoration: underline; }
.toplinks form { margin: 0; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #b9c9da; border-radius: 999px; padding: 8px 13px; background: var(--surface); color: #24496d; font-size: .84rem; font-weight: 750; white-space: nowrap; }
.theme-toggle:hover { background: var(--blue-soft); }
.theme-toggle [data-theme-icon] { font-size: 1.12rem; line-height: 1; }
.ghost { border: 0; padding: 0; background: none; color: var(--blue); font-weight: 700; }

.hero { margin-bottom: 20px; border-top: 5px solid var(--blue); border-radius: 12px; padding: clamp(20px, 3vw, 28px); background: linear-gradient(135deg, var(--surface) 0%, var(--surface-soft) 68%, #edf4fc 100%); box-shadow: 0 8px 28px #19365316; }
.eyebrow { color: #235a96; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
h1, h2 { color: var(--heading); line-height: 1.2; }
.hero h1 { margin: 9px 0 12px; font-size: clamp(1.9rem, 4vw, 2.45rem); }
.hero p { max-width: 680px; margin: 0; color: var(--muted); font-size: 1.02rem; }
.home-head { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin: 22px 0 19px; }
.home-head h1 { margin: 4px 0 1px; font-size: clamp(1.6rem, 3vw, 2rem); }
.home-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.home-tools { display: flex; align-items: center; gap: 12px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 20px 0; }
.toolbar form { margin: 0; }
.search, .field input, .card-edit input { border: 1px solid var(--field-line); border-radius: 7px; padding: 11px 12px; background: var(--field-bg); color: var(--ink); }
.search { width: min(275px, 100%); }
.search::placeholder { color: var(--muted); }
.count, .status { color: var(--muted); font-size: .88rem; }
.count { white-space: nowrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 116px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: 0 8px 28px #19365312; transition: transform .16s, border-color .16s, box-shadow .16s; }
.card:hover { transform: translateY(-2px); border-color: #9eb9d6; box-shadow: 0 11px 30px #19365324; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--blue-soft); color: var(--blue); font-size: .9rem; font-weight: 800; }
.arrow { color: var(--blue); font-size: 1.25rem; }
.domain { color: var(--heading); font-size: 1rem; font-weight: 750; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: .87rem; overflow-wrap: anywhere; }

.panel { border-radius: 12px; padding: clamp(20px, 3vw, 30px); background: var(--surface); box-shadow: 0 8px 28px #19365316; }
.auth { width: min(470px, 100%); margin: 32px auto 60px; border-top: 5px solid var(--blue); }
.auth h1 { margin: 8px 0; font-size: clamp(1.9rem, 4vw, 2.45rem); }
.auth p { margin: 0 0 22px; color: var(--muted); }
.field { display: grid; gap: 7px; margin: 0 0 18px; font-size: .9rem; font-weight: 680; }
.field input { width: 100%; }
.primary, .secondary { border-radius: 7px; padding: 11px 16px; font-weight: 750; }
.primary { border: 0; background: var(--blue); color: #fff; }
.primary:hover { background: var(--blue-hover); }
.secondary { border: 1px solid var(--line); background: var(--blue-soft); color: var(--blue); white-space: nowrap; }
.secondary:hover { background: #d9e4ef; }
.error, .notice { margin: 16px 0; border-radius: 8px; padding: 14px 16px; }
.error { background: var(--error-bg); color: var(--error-ink); }
.notice { background: var(--notice-bg); color: var(--notice-ink); }
.section-title { margin: 32px 0 14px; font-size: 1.45rem; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding: 18px 0; }
.admin-row:first-child { border-top: 0; padding-top: 0; }
.admin-row:last-child { padding-bottom: 0; }
.admin-main { flex: 1; min-width: 0; }
.admin-main strong { display: block; overflow-wrap: anywhere; }
.admin-main small { display: block; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.card-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 10px; margin-top: 14px; }
.card-edit label { display: grid; gap: 6px; color: var(--muted); font-size: .82rem; font-weight: 680; }
.card-edit input { min-width: 0; width: 100%; }
.switch { display: flex; align-items: center; gap: 9px; color: var(--ink); white-space: nowrap; font-weight: 680; }
.switch input { width: 19px; height: 19px; accent-color: var(--blue); }
.empty { border-radius: 12px; padding: 25px; background: var(--surface); color: var(--muted); box-shadow: 0 8px 28px #19365312; }
.footer { margin-top: 32px; border-top: 1px solid var(--line); padding: 18px 2px; color: var(--muted); font-size: .88rem; }

@media (max-width: 800px) {
  .card-edit { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .card-edit button { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 650px) {
  .shell { padding: 12px 0; }
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-bottom: 12px; }
  .toplinks { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; width: 100%; gap: 8px; margin: 0; }
  .logo { width: 100px; max-height: 46px; }
  .theme-label { display: none; }
  .home-head, .home-tools { align-items: stretch; flex-direction: column; }
  .home-head { gap: 8px; margin: 6px 0 12px; }
  .home-head .eyebrow, .home-head p { display: none; }
  .home-head h1 { margin: 0; font-size: 1.4rem; }
  .home-tools { gap: 4px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { min-height: 96px; gap: 5px; padding: 10px; }
  .icon { width: 28px; height: 28px; }
  .domain { font-size: .9rem; }
  .card .muted { font-size: .72rem; }
  .toolbar, .admin-row { align-items: stretch; flex-direction: column; }
  .search, .admin-main { width: 100%; }
  .card-edit { grid-template-columns: 1fr; }
  .card-edit button { grid-column: auto; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --blue: #8bbcf6;
  --blue-hover: #397cbd;
  --blue-soft: #29425d;
  --ink: #e9f0f7;
  --heading: #f2f7fc;
  --muted: #b2c0d0;
  --line: #3b5066;
  --bg: #101923;
  --surface: #1c2937;
  --surface-soft: #1b2d42;
  --field-bg: #142232;
  --field-line: #59738d;
  --notice-bg: #223e59;
  --notice-ink: #e0efff;
  --error-bg: #542b32;
  --error-ink: #ffd4da;
}
:root[data-theme="dark"] .hero { background: linear-gradient(135deg, #1c2937 0%, #1b2d42 68%, #18364f 100%); box-shadow: 0 8px 28px #0005; }
:root[data-theme="dark"] .eyebrow { color: #8bbcf6; }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .panel, :root[data-theme="dark"] .empty { box-shadow: 0 8px 28px #0005; }
:root[data-theme="dark"] .card:hover { border-color: #6684a2; box-shadow: 0 11px 30px #0008; }
:root[data-theme="dark"] .primary { background: #2d6dab; color: #fff; }
:root[data-theme="dark"] .brand-kicker { color: #8bbcf6; }
:root[data-theme="dark"] .logo { filter: invert(1); }
:root[data-theme="dark"] .primary:hover { background: #397cbd; }
:root[data-theme="dark"] .theme-toggle { border-color: #56718e; background: #263a50; color: #e2f0ff; }
:root[data-theme="dark"] .theme-toggle:hover { background: #34516e; }
:root[data-theme="dark"] .secondary { background: #30465d; color: #eef6ff; }
:root[data-theme="dark"] .secondary:hover { background: #3a5673; }
:root[data-theme="dark"] .icon { color: #d1e6ff; }
:root[data-theme="dark"] .field input::placeholder, :root[data-theme="dark"] .card-edit input::placeholder { color: #a7b8c9; }
