/* HSP Application Sandbox — shared styles. No external fonts or assets. */
:root {
  --navy-950: #07111f;
  --navy-900: #0b1b33;
  --navy-800: #122a4c;
  --blue-600: #1f5fbf;
  --blue-500: #2f74d6;
  --teal-600: #0b7f7a;
  --teal-400: #2cc3b5;
  --gold-500: #c8a14a;
  --gold-300: #e3c989;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --text: #0f1b2d;
  --muted: #4a5a70;
  --border: #d5dde9;
  --focus: #2f74d6;
  --link: #1f5fbf;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --ok: #0b6e4f;
  --ok-bg: #e3f5ee;
  --warn: #8a5a00;
  --warn-bg: #fdf3dc;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(11, 27, 51, 0.06), 0 6px 20px rgba(11, 27, 51, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #081322;
    --surface: #0f2038;
    --surface-2: #142a48;
    --text: #e8eef7;
    --muted: #a8b6ca;
    --border: #243b5e;
    --focus: #6fa8ff;
    --link: #8fbaff;
    --danger: #ffb4ab;
    --danger-bg: #3b1512;
    --ok: #7fe0c0;
    --ok-bg: #0c3328;
    --warn: #f3cf7a;
    --warn-bg: #3a2c0a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--link); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  background: var(--gold-300); color: var(--navy-950); padding: 0.5rem 1rem; border-radius: 6px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.masthead { background: var(--navy-900); color: #eef3fb; border-bottom: 3px solid var(--gold-500); }
.brand-bar { display: flex; align-items: center; gap: 1rem; padding-block: 1rem; min-height: 4rem; }
.brand-bar .spacer { flex: 1; }
.brand-bar h1, .title-link { margin: 0; font-size: 1.35rem; font-weight: 600; color: inherit; text-decoration: none; }

/* ---------- Home ---------- */
.intro { margin: 0 0 0.75rem; color: var(--muted); }
.notice { margin: 0 0 1.5rem; padding: 0.6rem 0.9rem; border-left: 4px solid var(--gold-500); background: var(--surface); border-radius: 6px; color: var(--muted); }
.notice strong { color: var(--text); }
.search { max-width: 22rem; margin-bottom: 1.25rem; }

/* ---------- Forms ---------- */
label, .label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 0.35rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.75rem; min-height: 2.75rem;
}
textarea { resize: vertical; min-height: 5rem; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.3rem 0 0; }
.field { margin-bottom: 1rem; }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-radius: 8px 0 0 8px; }
.input-suffix span {
  display: flex; align-items: center; padding: 0 0.75rem; border: 1px solid var(--border); border-left: 0;
  border-radius: 0 8px 8px 0; background: var(--surface-2); color: var(--muted); white-space: nowrap; font-size: 0.95rem;
}
.grid-2 { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  font: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1;
  min-height: 2.75rem; padding: 0.65rem 1.1rem; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; white-space: nowrap;
  background: var(--blue-600); color: #fff;
}
.btn:hover { background: var(--blue-500); }
.btn.teal { background: var(--teal-600); }
.btn.teal:hover { background: #0a6f6b; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.small { min-height: 2.25rem; padding: 0.45rem 0.8rem; font-size: 0.875rem; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.row .spacer { flex: 1; }

/* ---------- Cards ---------- */
.cards { list-style: none; margin: 0 0 3rem; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 0.75rem; height: 100%;
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--teal-600);
  border-radius: var(--radius); padding: 1.25rem;
}
.card h2 { margin: 0; font-size: 1.2rem; line-height: 1.3; }
.card p { margin: 0; color: var(--muted); }
.card .desc { flex: 1; }
.card .host { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; display: flex; align-items: center; gap: 0.4rem; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.card .btn { align-self: flex-start; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); margin-bottom: 3rem; }

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem; flex: none;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.25rem 0.6rem; border-radius: 999px; border: 1px solid transparent;
}
.badge::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; }
.badge.concept { color: #5b4a8a; background: #efeaf9; }
.badge.prototype { color: #1f4f99; background: #e5eefc; }
.badge.testing { color: #085f5b; background: #dff5f2; }
.badge.live { color: #7a5a12; background: #fbf1d8; border-color: #e3c989; }
@media (prefers-color-scheme: dark) {
  .badge.concept { color: #cdbdf5; background: #2a2145; }
  .badge.prototype { color: #a9c8ff; background: #15315e; }
  .badge.testing { color: #86e6da; background: #0b3a39; }
  .badge.live { color: #f0d796; background: #3a2d0c; border-color: #6b5518; }
}
.pill { font-size: 0.8rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; display: inline-block; }
.pill.active { color: var(--ok); background: var(--ok-bg); }
.pill.pending { color: var(--warn); background: var(--warn-bg); }
.pill.error, .pill.manual { color: var(--danger); background: var(--danger-bg); }

/* ---------- Panels (admin) ---------- */
.page { padding-block: 2rem 3rem; flex: 1; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.panel h2 { margin: 0 0 1rem; font-size: 1.2rem; }
.panel.narrow { max-width: 26rem; margin-inline: auto; }
.error-msg { color: var(--danger); background: var(--danger-bg); border-radius: 8px; padding: 0.6rem 0.8rem; margin: 0 0 1rem; }
.ok-msg { color: var(--ok); background: var(--ok-bg); border-radius: 8px; padding: 0.6rem 0.8rem; margin: 0 0 1rem; }
.checks { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.5rem; }
.checks li { display: flex; gap: 0.6rem; align-items: flex-start; }
.checks .dot { flex: none; width: 1.3rem; height: 1.3rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; margin-top: 0.1rem; }
.checks .dot.ok { background: var(--ok-bg); color: var(--ok); }
.checks .dot.bad { background: var(--danger-bg); color: var(--danger); }
details { border-top: 1px solid var(--border); padding-top: 0.75rem; margin-top: 0.75rem; }
summary { cursor: pointer; font-weight: 600; }
details ol, details ul { padding-left: 1.25rem; color: var(--muted); }
details li { margin-bottom: 0.35rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: var(--surface-2); padding: 0.1rem 0.35rem; border-radius: 4px; overflow-wrap: anywhere; }
.admin-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.admin-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.admin-item h3 { margin: 0; font-size: 1.1rem; }
.admin-item dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0.9rem 0; font-size: 0.925rem; }
.admin-item dt { color: var(--muted); }
.admin-item dd { margin: 0; overflow-wrap: anywhere; }
.admin-item .message { font-size: 0.9rem; color: var(--muted); margin: 0 0 0.9rem; }
.test-results { font-size: 0.9rem; margin: 0 0 0.9rem; padding: 0.75rem; background: var(--surface-2); border-radius: 8px; }
.test-results p { margin: 0.2rem 0; }
@media (max-width: 34rem) {
  .admin-item dl { grid-template-columns: 1fr; }
  .admin-item dt { margin-top: 0.4rem; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-950); color: #b8c7de; font-size: 0.9rem; padding-block: 1.5rem; border-top: 3px solid var(--gold-500); margin-top: auto; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }
.site-footer a { color: #d6e4ff; }


/* ---------- Admin helpers ---------- */
.btn.on-dark { color: #eef3fb; border-color: #3a5680; }
.btn.on-dark:hover { background: rgba(255, 255, 255, 0.08); }
.btn.full { width: 100%; }
.panel-title { margin: 0 0 0.5rem; font-size: 1.4rem; }
.hint.lead { margin: 0 0 1.25rem; }
.list-head { margin-bottom: 1rem; }
.list-head h2 { margin: 0; font-size: 1.2rem; }
