/* ===========================================================================
 * The Platform Admin console's server-rendered pages (M6.L1): sign-in, sign-out
 * and the signed-in frame.
 *
 * THE PLATFORM'S OWN THEME. Every colour, radius and font here is a design
 * token (/assets/tokens.css, the platform's one token file, served by the
 * console from the same bytes the municipality app serves). The frame is the
 * platform's sign-in frame — a hero pane in the theme's dark teal, the form
 * beside it — with NO municipality in it: no crest, no municipal name, no
 * municipal colour. The console belongs to no municipality.
 *
 * The controls are drawn as the platform's kit draws them (the same sizes,
 * borders and focus ring), written here on the tokens because the console's
 * bundle — which will carry the kit itself — is M6.L2's.
 *
 * RTL AND LTR FROM ONE SHEET: logical properties only. Nothing inline (the
 * console's Content-Security-Policy allows no inline style and no script).
 * ======================================================================== */

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

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

body.pc {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--s-1);
  color: var(--ink-900);
  font-family: var(--la);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
html[lang="ar"] body.pc { font-family: var(--ar); }

/* ---- the sign-in frame ---------------------------------------------------- */
body.pc-auth { display: flex; flex-direction: column; }

.pc-hero {
  position: relative;
  flex: none;
  min-block-size: 150px;
  block-size: 24vh;
  block-size: 24dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  padding: 20px 20px 22px;
  background-color: var(--acc-700);
  background-image: linear-gradient(to top, color-mix(in srgb, var(--ink-900) 45%, transparent), transparent 75%);
  color: var(--s-0);
}
.pc-hero-title { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.pc-hero-sub { margin: 0; font-size: 14px; color: var(--acc-100); }

.pc-pane {
  flex: 1 1 auto;
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 20px 28px;
}
.pc-panel { inline-size: 100%; max-inline-size: 420px; }

.pc-lang {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-block-size: 40px;
  padding-inline: 16px;
  border: 1px solid var(--s-line);
  border-radius: 999px;
  background: var(--s-0);
  color: var(--ink-700);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}
.pc-lang[lang="ar"] { font-family: var(--ar); }
.pc-lang[lang="en"] { font-family: var(--la); }
.pc-lang:hover { border-color: var(--acc-500); color: var(--acc-700); }
.pc-lang:focus-visible { outline: 2px solid var(--acc-500); outline-offset: 2px; }

.pc-title { margin: 12px 0 6px; font-size: 24px; font-weight: 700; line-height: 1.35; text-align: center; text-wrap: balance; }
.pc-note { margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: var(--ink-500); text-align: center; }

.pc-alert {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--st-late);
  border-radius: var(--r-md);
  background: var(--s-0);
  color: var(--st-late);
  font-size: 14px;
  font-weight: 600;
}
.pc-alert-info { border-color: var(--acc-500); color: var(--acc-700); background: var(--acc-050); }

/* ---- the form ------------------------------------------------------------- */
.pc-form { display: grid; gap: 18px; }
.pc-field { display: grid; gap: 8px; min-inline-size: 0; }
.pc-label { font-size: 14px; font-weight: 500; color: var(--ink-700); }
.pc-input {
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: 48px;
  padding-inline: 12px;
  border: 1px solid var(--s-line);
  border-radius: var(--r-md);
  background: var(--s-0);
  color: var(--ink-900);
  font: inherit;
  font-size: 15px;
}
.pc-input::placeholder { color: var(--ink-400); }
.pc-input:focus-visible { outline: none; border-color: var(--acc-500); box-shadow: 0 0 0 3px var(--acc-100); }
/* An email address and a password are identifiers: typed left to right in either language. */
.pc-input[dir="ltr"] { text-align: left; }
[dir="rtl"] .pc-input[dir="ltr"]:placeholder-shown { text-align: right; direction: rtl; }

.pc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-block-size: 44px;
  padding-inline: 16px;
  border: 1px solid var(--s-line);
  border-radius: var(--r-md);
  background: var(--s-0);
  color: var(--ink-700);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.pc-btn:hover { background: var(--acc-050); border-color: var(--acc-500); color: var(--acc-700); }
.pc-btn:focus-visible { outline: 2px solid var(--acc-500); outline-offset: 2px; }
.pc-btn-primary { background: var(--acc-600); border-color: var(--acc-600); color: var(--s-0); }
.pc-btn-primary:hover { background: var(--acc-700); border-color: var(--acc-700); color: var(--s-0); }
.pc-form .pc-btn-primary { inline-size: 100%; min-block-size: 50px; font-size: 16px; margin-block-start: 4px; }
.pc-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pc-actions .pc-btn { flex: 1 1 140px; min-block-size: 50px; font-size: 16px; }

.pc-foot { margin: 28px 0 0; text-align: center; font-size: 14px; color: var(--ink-500); }

/* ---- the second sign-in step (ADR-0017 A1.4): the code field, the enrolment key, the recovery codes ------ */
/* A code is an identifier too: digits or a recovery code, typed left to right, spaced so it reads in groups. */
.pc-input-code { font-variant-numeric: tabular-nums; letter-spacing: 0.08em; }
/* the hint is a sentence — Arabic letters must stay joined */
.pc-input-code::placeholder { letter-spacing: normal; }
.pc-enrol {
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--s-line);
  border-radius: var(--r-md);
  background: var(--s-0);
}
.pc-qr-box { display: flex; justify-content: center; margin: 8px 0 14px; }
.pc-qr { display: block; inline-size: 196px; max-inline-size: 100%; block-size: auto; border-radius: var(--r-sm); }
.pc-key {
  margin: 8px 0 12px;
  font-family: var(--la);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  line-height: 1.6;
  color: var(--ink-900);
  text-align: center;
  overflow-wrap: anywhere;
}
.pc-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.pc-facts dt { color: var(--ink-500); }
.pc-facts dd { margin: 0; color: var(--ink-900); min-inline-size: 0; overflow-wrap: anywhere; }
.pc-facts dd[dir="ltr"] { text-align: start; }
/* an address or a host in an Arabic page: written left to right, set against the page's start (the right) */
[dir="rtl"] .pc-facts dd[dir="ltr"] { text-align: right; }
.pc-note-after { margin: 16px 0 0; }
.pc-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 0 0 16px;
  padding: 14px 16px;
  padding-inline-start: 40px;
  border: 1px solid var(--s-line);
  border-radius: var(--r-md);
  background: var(--s-0);
}
.pc-codes li { min-inline-size: 0; color: var(--ink-500); }
.pc-codes code { font-family: var(--la); font-size: 16px; font-weight: 700; letter-spacing: 0.06em; color: var(--ink-900); white-space: nowrap; }
/* a phone: one code a line, never broken at its hyphen */
@media (max-width: 480px) { .pc-codes { grid-template-columns: minmax(0, 1fr); } }
.pc-foot bdi { font-family: var(--la); font-weight: 600; }

@media (min-width: 900px) {
  body.pc-auth { flex-direction: row; }
  .pc-hero { flex: 0 0 42%; block-size: auto; min-block-size: 100vh; min-block-size: 100dvh; padding: 48px; }
  .pc-hero-title { font-size: 30px; max-inline-size: 18ch; }
  .pc-hero-sub { font-size: 16px; }
  .pc-pane { justify-content: center; position: relative; padding: 48px; }
  .pc-lang { position: absolute; inset-block-start: 24px; inset-inline-end: 24px; }
}

/* ---- the signed-in frame --------------------------------------------------- */
.pc-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-block-size: 60px;
  padding: 8px 20px;
  background: var(--acc-700);
  color: var(--s-0);
}
.pc-top-name { flex: 1 1 auto; min-inline-size: 0; margin: 0; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.pc-top-who { flex: 0 1 auto; min-inline-size: 0; font-size: 14px; color: var(--acc-100); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-top a {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-block-size: 40px;
  padding-inline: 12px;
  border: 1px solid color-mix(in srgb, var(--s-0) 40%, transparent);
  border-radius: var(--r-md);
  color: var(--s-0);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.pc-top a:hover { background: color-mix(in srgb, var(--s-0) 14%, transparent); }
.pc-top a:focus-visible { outline: 2px solid var(--s-0); outline-offset: 2px; }
.pc-main { padding: 24px 20px; max-inline-size: 1100px; margin-inline: auto; }
.pc-main h1 { margin: 0 0 8px; font-size: 22px; font-weight: 700; }
.pc-main p { margin: 0; color: var(--ink-500); }

@media (max-width: 520px) {
  .pc-top { flex-wrap: wrap; }
  .pc-top-who { flex-basis: 100%; order: 3; }
}
