/*
 * Standalone layout for the server-rendered pages (templates/_standalone.html, Plan 8 Task 11): login, access
 * denied, access pending, forbidden and the MCP OAuth consent screen. Self-contained on purpose: atlas.css and
 * the old scripts are deleted at cutover, these pages are not. Tokens are DESIGN.md section 3 (frontend/src/theme.ts):
 * accent only on the primary button and the focus ring, 1px #e9e7f1 borders, 10px radius, no shadows, Inter,
 * spacing 4 / 8 / 12 / 16 / 24 / 32, 44px touch targets. Light only: DESIGN.md has no dark theme.
 */
:root {
  --accent: #693afa;
  --accent-text: #4e22d6;
  --border: #e9e7f1;
  --bg: #f7f6fb;
  --ink: #1d1b2e;
  --ink-muted: #5b5870;
  --green: #12a160;
  --green-text: #0b7a47;
  --red: #d92d20;
  --red-text: #b42318;
  --radius: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.standalone {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}

h1 { font-size: 22px; font-weight: 600; line-height: 1.3; }

a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--ink); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------ signed-in account line */
.standalone-account { display: flex; justify-content: flex-end; padding: 8px 16px 0; }
.standalone-logout {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  border-radius: var(--radius); color: var(--ink-muted); font-weight: 500; text-decoration: none;
}
.standalone-logout:hover { background: #ffffff; color: var(--ink); }

/* ------------------------------------------------------------- page body */
/* The landmark around the page: the same flex column as body, so a child's `flex: 1` still fills the height. */
.standalone-main { flex: 1 0 auto; display: flex; flex-direction: column; width: 100%; }
.page { width: 100%; max-width: 640px; margin: 0 auto; padding: 32px 16px; }
.page + .page { padding-top: 16px; }
.page-header { margin-bottom: 16px; }
.page-header h1 { margin: 0; }
.page-header .sub { margin-top: 4px; }
.sub { color: var(--ink-muted); font-size: 14px; }

.empty-state {
  background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 24px;
}

/* ----------------------------------------------------------------- flash */
.flash {
  margin-bottom: 12px; padding: 12px 16px; border-radius: var(--radius);
  background: #ffffff; border: 1px solid var(--border); color: var(--ink);
}
.flash.error { background: #fef3f2; border-color: #f6c9c5; color: var(--red-text); }
.flash.success, .flash.ok { background: #eefaf3; border-color: #b8e5cd; color: var(--green-text); }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: #ffffff; color: var(--ink);
  font: inherit; font-weight: 500; line-height: 1.2; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--bg); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.btn-primary:hover { background: var(--accent-text); border-color: var(--accent-text); color: #ffffff; }
.btn-block { display: flex; width: 100%; }
.btn-block + .btn-block { margin-top: 8px; }

/* ------------------------------------------------------- sign-in card(s) */
.login-wrap {
  flex: 1 0 auto; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.login-card {
  width: 360px; max-width: 100%; padding: 32px 24px 24px; text-align: center;
  background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius);
}
.login-logo {
  width: 48px; height: 48px; margin: 0 auto 16px; display: grid; place-items: center;
  border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); color: var(--ink);
}
.login-logo svg { width: 28px; height: 28px; }
.login-title { margin: 0; }
.login-tagline { margin: 4px 0 24px; color: var(--ink-muted); }
.login-note { margin: 0 0 8px; }
.login-note + .login-fineprint { margin-bottom: 24px; }
.login-fineprint { margin: 16px 0 0; color: var(--ink-muted); font-size: 13px; }
.login-fineprint a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-muted); }
.login-fineprint a:hover { color: var(--ink); }
