/* Clave web app. One stylesheet, no build step, no framework — the whole
   surface is a handful of pages and this is smaller than the config a
   bundler would need. */

:root {
  color-scheme: light dark;

  --bg: #fbfbf9;
  --surface: #ffffff;
  --border: #e4e3dd;
  --text: #1b1a17;
  --muted: #6b6862;
  --accent: #1b1a17;
  --accent-text: #ffffff;
  --error: #a4302a;
  --ok-bg: #e7f2e9;
  --ok-text: #285c36;
  --wait-bg: #f4eddb;
  --wait-text: #7a5a17;

  --radius: 10px;
  --maxw: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --surface: #1f1e1b;
    --border: #333029;
    --text: #f0efea;
    --muted: #9d9890;
    --accent: #f0efea;
    --accent-text: #161513;
    --error: #e88b84;
    --ok-bg: #1e3524;
    --ok-text: #9ed3ab;
    --wait-bg: #3a2f14;
    --wait-text: #e3c37a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Header */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}

.account {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.875rem;
}

.account .email { color: var(--muted); }

.account form { margin: 0; }

/* Layout */

main {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

.stack { display: grid; gap: 2.25rem; }

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
}

h2 {
  font-size: 1rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.85rem;
}

.lede { margin: 0; color: var(--muted); }

/* Card — the sign-in surfaces */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.card h1 { margin-bottom: 0.5rem; }

/* Forms */

form { margin: 1.5rem 0 0; }

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

input[type="email"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

input[type="email"]:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button[type="submit"], .button-link {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.65rem 1.4rem;
  font: inherit;
  font-weight: 500;
  color: var(--accent-text);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

button[type="submit"]:hover, .button-link:hover { opacity: 0.88; }

/* Qualified with the element so it out-specifies button[type="submit"]
   above — sign-out is a form submit too, and would otherwise render as a
   second primary button in the header. */
button.linkish {
  padding: 0;
  font: inherit;
  font-size: 0.875rem;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

button.linkish:hover { color: var(--text); }

.error {
  margin: 0.85rem 0 0;
  font-size: 0.9rem;
  color: var(--error);
}

.fineprint {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Account panel */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 1.25rem;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}

.row:last-child { border-bottom: 0; }

.label { color: var(--muted); font-size: 0.9rem; }

.value { font-variant-numeric: tabular-nums; }

/* Sites */

.sites {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.sites li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.site-main { display: grid; gap: 0.15rem; min-width: 0; }

.site-name { font-weight: 500; }

.site-host {
  font-size: 0.875rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

a.site-host { color: var(--muted); }
a.site-host:hover { color: var(--text); }

.muted { color: var(--muted); }

.badge {
  flex: none;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 999px;
  text-transform: lowercase;
}

.badge-active { background: var(--ok-bg); color: var(--ok-text); }
.badge-provisioning { background: var(--wait-bg); color: var(--wait-text); }

.empty {
  margin: 0;
  padding: 1.5rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
