/* ==========================================================================
   LITZEN SYSTEMS IDENTITY — sign-in
   Self-hosted styles only: no external font, no CDN, nothing the page's own
   Content-Security-Policy would refuse. No inline style attributes either.
   ========================================================================== */

:root {
  --bg: #080d18;
  --bg-grad-a: #0a1020;
  --bg-grad-b: #0d1424;
  --panel: #101a2e;
  --panel-inset: #0c1526;
  --line: #1c2942;
  --line-strong: #26364f;
  --ink: #e8eff9;
  --ink-soft: #a9bad4;
  --ink-dim: #6f83a3;
  --ink-faint: #4d5f7c;
  --blue: #4f9cf9;
  --teal: #2dd4bf;
  --amber: #f5b544;
  --red: #f4736b;
  --radius: 13px;
  --radius-sm: 9px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image:
    radial-gradient(900px 520px at 78% -8%, rgba(45, 212, 191, 0.07), transparent 60%),
    radial-gradient(760px 460px at 12% 0%, rgba(79, 156, 249, 0.09), transparent 62%),
    linear-gradient(180deg, var(--bg-grad-a), var(--bg-grad-b));
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Centring belongs to the authentication pages, not to every page. The
   account area stacks a full-width header, a growing main and a footer, and
   would fight a body that centred its children. */
body.auth-page {
  justify-content: center;
  align-items: center;
  padding: clamp(1rem, 4vw, 2.5rem);
}

/* ==========================================================================
   The authentication panel
   --------------------------------------------------------------------------
   A large centred two-column panel: identity on the left, the form on the
   right. Sized so it reads as a piece of infrastructure rather than a widget
   dropped on a page — generous padding, restrained radii, one soft shadow.
   ========================================================================== */

.auth {
  width: 100%;
  max-width: 71rem;                    /* ~1136px on a 16px root */
  margin: auto;
}

.auth--narrow { max-width: 30rem; }

.auth-panel {
  display: grid;
  grid-template-columns: 1fr 1.04fr;   /* the form side, very slightly wider */
  min-height: 41rem;                   /* ~656px; the panel should have height */
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 10px;                 /* professional, not bubbly */
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03) inset,
    0 2px 6px rgba(0, 0, 0, 0.4),
    0 34px 90px rgba(2, 7, 18, 0.6);
  overflow: hidden;
}

.auth-panel--single { grid-template-columns: 1fr; min-height: 0; }

/* --- left: identity ------------------------------------------------------- */

.auth-brand {
  position: relative;
  display: flex;
  align-items: center;
  padding: clamp(2.25rem, 3.6vw, 3.6rem);
  /* A shade deeper than the form side, with a blue glow behind the mark and
     a faint grid fading in at the bottom. All CSS: no image, no asset. */
  background:
    radial-gradient(620px 420px at 18% 12%, rgba(79, 156, 249, 0.16), transparent 66%),
    radial-gradient(520px 380px at 90% 96%, rgba(45, 212, 191, 0.07), transparent 68%),
    linear-gradient(160deg, #0d1729, #0a1120 62%, #091020);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.auth-brand::after {
  /* The subtle technical treatment near the bottom. Low-contrast, and masked
     away well before it reaches the copy. */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 45%;
  background-image:
    repeating-linear-gradient(90deg, rgba(79, 156, 249, 0.13) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, rgba(79, 156, 249, 0.10) 0 1px, transparent 1px 64px);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 85%);
  mask-image: linear-gradient(180deg, transparent, #000 85%);
  pointer-events: none;
}

.auth-brand-inner { position: relative; width: 100%; }

.brand--large { gap: 1rem; margin-bottom: 2.6rem; }

.brand--large .brand-glyph {
  width: 54px;
  height: 54px;
  border-radius: 13px;
  font-size: 1.45rem;
  box-shadow: 0 6px 20px rgba(79, 156, 249, 0.28);
}

.brand-lockup { display: flex; flex-direction: column; gap: 0.22rem; }

.brand--large .brand-name {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.19em;
  line-height: 1;
  color: var(--ink);
}

.brand-product {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.34em;
  line-height: 1;
  color: var(--blue);
}

.auth-headline {
  margin: 0;
  font-size: clamp(1.75rem, 3.2vw, 2.3rem);    /* 32–37px on desktop */
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: -0.024em;
  color: #f2f7fd;
}

.auth-lede {
  margin: 1.05rem 0 0;
  max-width: 27rem;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.auth-features {
  margin: 2.9rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1.5rem;
}

.auth-features li {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: start;
  gap: 1rem;
}

.feature-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(79, 156, 249, 0.26);
  background: rgba(79, 156, 249, 0.09);
  color: var(--blue);
}

.feature-icon svg { width: 21px; height: 21px; display: block; }

.feature-text { display: flex; flex-direction: column; gap: 0.22rem; }

.feature-title {
  font-size: 0.985rem;
  font-weight: 640;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.feature-note {
  font-size: 0.865rem;
  line-height: 1.5;
  color: var(--ink-dim);
  max-width: 24rem;
}

/* --- right: the form ------------------------------------------------------ */

.auth-form {
  display: flex;
  align-items: center;
  padding: clamp(2.25rem, 3.6vw, 3.6rem);
}

.auth-form-inner { width: 100%; max-width: 24rem; margin: 0 auto; }

.auth-title {
  margin: 0;
  font-size: clamp(1.6rem, 2.6vw, 2rem);       /* 28–32px on desktop */
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #f2f7fd;
}

.auth-panel--single .auth-title { margin-top: 1.9rem; }

.auth-sub {
  margin: 0.6rem 0 2.35rem;
  font-size: 0.95rem;
  color: var(--ink-dim);
}

.auth-help {
  margin: 2rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.auth-footer {
  margin: 1.75rem 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.notice, .error {
  margin: 0 0 1.4rem;
  padding: 0.8rem 0.95rem;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  background: var(--panel-inset);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.notice strong { color: var(--amber); }

.error { border-color: rgba(244, 115, 107, 0.4); color: var(--ink); }

.field { margin-bottom: 1.35rem; }

.field label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.field input {
  width: 100%;
  min-height: 3.15rem;                 /* ~50px */
  font: inherit;
  font-size: 0.97rem;
  color: var(--ink);
  background: #0a1220;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.75rem 0.95rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field input:hover { border-color: #2f4363; }

/* On focus as well as focus-visible: a field somebody is typing a password
   into should say unambiguously that it is the focused one, whether they got
   there by keyboard or by pointer. */
.field input:focus,
.field input:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.22);
}
.field input:disabled { color: var(--ink-faint); cursor: not-allowed; }

.signin-button {
  width: 100%;
  min-height: 3.15rem;                 /* matches the inputs */
  margin-top: 0.65rem;
  padding: 0.8rem 1rem;
  font: inherit;
  font-size: 0.97rem;
  font-weight: 650;
  color: #04101f;
  background: linear-gradient(135deg, var(--blue) 6%, var(--teal) 130%);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: filter 120ms ease;
}

.signin-button:hover { filter: brightness(1.06); }

.signin-button:disabled {
  background: var(--panel-inset);
  border: 1px solid var(--line-strong);
  color: var(--ink-faint);
  cursor: not-allowed;
}

.signin-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }


/* --- signed-in page ------------------------------------------------------ */

.signed-in-as {
  margin: 0 0 1.25rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.signed-in-as strong {
  color: var(--ink);
}

.session-facts {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-inset);
  font-size: 0.78rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 1rem;
}

.session-facts dt {
  color: var(--ink-dim);
}

.session-facts dd {
  margin: 0;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* --- service access ------------------------------------------------------ */

.section-title {
  margin: 0 0 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.service-access {
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.service {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  background: var(--panel-inset);
  font-size: 0.85rem;
}

.service + .service {
  border-top: 1px solid var(--line);
}

.service-name {
  color: var(--ink-soft);
}

.service-state {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.is-allowed .service-state { color: var(--teal); }
.is-denied .service-state { color: var(--ink-faint); }
.is-allowed .service-name { color: var(--ink); }

/* ===========================================================================
   The account shell
   ===========================================================================
   One header, one nav, one card style, shared by every authenticated page.
   Written once here rather than cloned per template — the reason the pages
   look like one application is that they are one stylesheet.
   ======================================================================== */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.6rem 1rem;
  background: var(--panel);
  color: var(--ink);
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 10;
}

.skip-link:focus { left: 0; }

.site-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: rgba(16, 26, 46, 0.6);
}

.brand--inline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand--inline .brand-name {
  font-size: 0.6rem;
  line-height: 1.15;
  letter-spacing: 0.16em;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover { background: var(--panel-inset); color: var(--ink); }

.site-nav a[aria-current="page"] {
  background: var(--panel-inset);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--blue);
}

.site-signout button {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.site-signout button:hover { color: var(--ink); border-color: var(--ink-dim); }

.account {
  width: 100%;
  max-width: 46rem;
  /* Grows so the footer sits at the bottom of a short page rather than
     halfway up it — the body is a flex column now, not a centring grid. */
  flex: 1 0 auto;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2.5rem) 3rem;
}

.page-head { margin-bottom: 1.5rem; }

.page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.page-sub {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-dim);
  max-width: 42rem;
}

.card {
  margin: 0 0 1.25rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.card--prompt { border-color: var(--line-strong); background: var(--panel-inset); }

.card-title {
  margin: 0 0 0.9rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.card-note {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-dim);
}

.card-note a { color: var(--blue); }

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(9rem, auto) 1fr;
  gap: 0.45rem 1.25rem;
  font-size: 0.86rem;
}

.facts dt { color: var(--ink-dim); }
.facts dd { margin: 0; color: var(--ink-soft); }
.facts dd.good { color: var(--teal); }
.facts dd.warn { color: var(--amber); }

/* --- sessions ------------------------------------------------------------ */

.session-list { margin: 0; padding: 0; list-style: none; }

.session + .session { margin-top: 0.85rem; padding-top: 0.85rem; border-top: 1px solid var(--line); }

.session-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.session-device { font-size: 0.92rem; color: var(--ink); font-weight: 500; }

.session-status { margin-left: auto; font-size: 0.75rem; color: var(--ink-dim); }

.is-ended .session-device { color: var(--ink-faint); }
.is-ended .session-meta dd { color: var(--ink-faint); }

.pill {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(79, 156, 249, 0.15);
  color: var(--blue);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.session-meta {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(6rem, auto) 1fr;
  gap: 0.25rem 1rem;
  font-size: 0.78rem;
}

.session-meta dt { color: var(--ink-faint); }
.session-meta dd { margin: 0; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

.inline-form { display: inline-block; margin: 0.75rem 0.5rem 0 0; }
.stack { margin-top: 0.75rem; }

.button {
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #06152b;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.button--quiet {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

.button--danger {
  background: transparent;
  border-color: rgba(244, 115, 107, 0.45);
  color: var(--red);
}

.button:hover { filter: brightness(1.08); }

/* --- service access ------------------------------------------------------ */

.service-access {
  margin: 0;
  padding: 0;
  list-style: none;
}

.service {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  font-size: 0.88rem;
}

.service + .service { border-top: 1px solid var(--line); }

.service-name { color: var(--ink-soft); }

.service-state {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.is-allowed .service-state { color: var(--teal); }
.is-denied .service-state { color: var(--ink-faint); }
.is-allowed .service-name { color: var(--ink); }

/* --- one-time secrets ---------------------------------------------------- */

.setup-key {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  word-break: break-all;
}

.setup-key code,
.recovery-codes code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--teal);
}

.recovery-codes {
  margin: 0;
  padding: 0.85rem 1rem;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.4rem 1rem;
}

.field-help { margin: 0.35rem 0 0; font-size: 0.75rem; color: var(--ink-dim); }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem clamp(1rem, 4vw, 2.5rem) 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--ink-faint);
}

/* --- authentication panel, tablet and below ------------------------------- */

@media (max-width: 68rem) {
  /* Two columns while they still earn their space. Height comes off first:
     the panel should stay comfortably inside a laptop viewport. */
  .auth-panel { min-height: 37rem; }
  .auth-features { gap: 1.25rem; margin-top: 2.2rem; }
  .auth-headline { font-size: 1.72rem; }
}

@media (max-width: 56rem) {
  /* Still two columns, but the identity side gives up width first — the form
     is what the visitor came for. */
  .auth-panel { grid-template-columns: 0.92fr 1fr; min-height: 34rem; }
  .auth-lede { font-size: 0.94rem; }
  .feature-note { font-size: 0.83rem; }
  .brand--large { margin-bottom: 2rem; }
}

@media (max-width: 48rem) {
  /* One column, form first in visual weight. The identity panel keeps its
     branding and headline but compacts: the four rows lose their descriptions
     and sit two-up, which keeps the page's meaning without pushing the form
     below a second screenful. */
  .auth { max-width: 30rem; }
  .auth-panel { grid-template-columns: 1fr; min-height: 0; }

  .auth-brand {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 2rem 1.75rem 1.75rem;
  }

  .auth-brand::after { height: 60%; }

  .brand--large { margin-bottom: 1.6rem; gap: 0.85rem; }
  .brand--large .brand-glyph { width: 46px; height: 46px; font-size: 1.25rem; }

  .auth-headline { font-size: 1.55rem; }
  .auth-lede { margin-top: 0.8rem; font-size: 0.92rem; max-width: none; }

  .auth-features {
    margin-top: 1.6rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem 1.1rem;
  }

  .auth-features li { grid-template-columns: 34px 1fr; gap: 0.7rem; align-items: center; }
  .feature-icon { width: 34px; height: 34px; border-radius: 9px; }
  .feature-icon svg { width: 18px; height: 18px; }
  .feature-title { font-size: 0.88rem; }
  .feature-note { display: none; }

  .auth-form { padding: 2rem 1.75rem 2.25rem; }
  .auth-form-inner { max-width: none; }
  .auth-title { font-size: 1.5rem; }
  .auth-sub { margin-bottom: 1.8rem; }
}

@media (max-width: 30rem) {
  body.auth-page { padding: 0.9rem; }
  .auth-features { grid-template-columns: 1fr; gap: 0.75rem; }
  .auth-headline { font-size: 1.42rem; }

  /* Comfortable targets on a phone; the controls stay full width. */
  .field input,
  .signin-button { min-height: 3.35rem; font-size: 1rem; }
}

@media (max-width: 34rem) {
  .site-header { gap: 0.75rem; }
  .site-nav { order: 3; width: 100%; }
  .site-signout { margin-left: auto; }
  .facts, .session-meta { grid-template-columns: 1fr; gap: 0.15rem; }
  .facts dt, .session-meta dt { margin-top: 0.4rem; }
}
