/* TickAccount — sign-in page and loading screen (2026-11-08). Scoped to #signin and #loading.
   Colours = the app's "Electric Violet" tokens (lib/app/constants.dart): the brand gradient on
   the brand panel, the main button and the loading bar; indigo for focus and links. */
:root {
  --brand-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
  --indigo: #4f46e5;          /* links, focus, the Show button */
  --ring: rgba(79, 70, 229, 0.3);
  --hover: #eef0fd;
  --ink: #1e1b4b;
  --muted: #5a5779;
  --outline: #8c88ae;         /* input borders: 3.4:1 on white */
  --track: #e4e2f3;
  --page: #f8f7ff;
  --surface: #fff;
  --error: #b42318;
  --error-bg: #fef3f2;
  --error-line: #fecdca;
  --warn: #8a4b00;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
/* The person chose dark mode in the app (login.js reads it): the same page, dark. */
html.theme-dark {
  --indigo: #a5b4fc;
  --ring: rgba(165, 180, 252, 0.35);
  --hover: rgba(165, 180, 252, 0.12);
  --ink: #edebff;
  --muted: #b8b4d9;
  --outline: #6e6a99;
  --track: #2e2a52;
  --page: #13112b;
  --surface: #1e1b3a;
  --error: #fda29b;
  --error-bg: rgba(253, 162, 155, 0.1);
  --error-line: rgba(253, 162, 155, 0.35);
  --warn: #fec84b;
  color-scheme: dark;
}

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); }

#signin, #loading { font-family: var(--font); color: var(--ink); line-height: 1.45; }
#signin *, #loading * { box-sizing: border-box; }

/* ── sign-in: laptop = brand panel | form; phone = blue strip, form below ── */
#signin {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(320px, 42%) 1fr;
  background: var(--page);
}

.brand {
  background: var(--brand-gradient);
  color: #fff;
  padding: 56px clamp(32px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.brand-head { display: flex; align-items: center; gap: 14px; }
.brand-logo { width: 52px; height: 52px; border-radius: 12px; display: block; background: #fff; padding: 6px; }
.brand-name { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
.brand-tagline { margin: 0; font-size: 18px; color: #fff; max-width: 30ch; text-wrap: pretty; }
.brand-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.brand-points li { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 500; }
.brand-points svg { flex: none; width: 22px; height: 22px; color: #fff; }

.panel {
  display: flex;
  flex-direction: column;
  padding: 24px clamp(20px, 5vw, 64px) 20px;
  min-width: 0;
}
.panel-top { display: flex; justify-content: flex-end; }
.lang-pick { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.lang-pick select {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 10px;
}

.form-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 0; }
form#signin-form { width: 100%; max-width: 380px; display: grid; gap: 18px; }
#signin h1 { margin: 0; font-size: 28px; font-weight: 650; letter-spacing: -0.01em; text-wrap: balance; }
.sub { margin: -8px 0 4px; color: var(--muted); font-size: 15px; text-wrap: pretty; }

.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; }
.field input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  font: inherit;
  font-size: 16px; /* 16px: iPhone does not zoom in */
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--ring); }
.lang-pick select:focus-visible { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--ring); }
.pw { position: relative; }
.pw input { padding-inline-end: 84px; }
.pw-toggle {
  position: absolute;
  inset-block: 3px;
  inset-inline-end: 3px;
  min-width: 72px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--indigo);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.pw-toggle:hover { background: var(--hover); }
.pw-toggle:focus-visible { outline: 2px solid var(--indigo); outline-offset: -2px; }
.caps { margin: 0; font-size: 13px; color: var(--warn); }

.error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--error-line);
  border-radius: 10px;
  background: var(--error-bg);
  color: var(--error);
  font-size: 14px;
  font-weight: 500;
}

.submit {
  height: 50px;
  border: 0;
  border-radius: 10px;
  background: var(--brand-gradient);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
.submit:hover { filter: brightness(0.93); }
.submit:active { filter: brightness(0.86); }
.submit:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.submit:disabled { opacity: 0.75; cursor: progress; }

.help { margin: 0; color: var(--muted); font-size: 14px; text-wrap: pretty; }
.foot { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.foot a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
/* The build version (stamped by tool/build-web.sh): tells support which version a screen shows. */
.foot-version { display: block; margin-top: 4px; font-size: 11px; letter-spacing: .02em; opacity: .8; }

@media (max-width: 860px) {
  #signin { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .brand { padding: 18px 20px; gap: 0; }
  .brand-logo { width: 38px; height: 38px; border-radius: 10px; padding: 4px; }
  .brand-name { font-size: 20px; }
  .brand-tagline, .brand-points { display: none; }
  .panel { padding: 16px 20px 18px; }
  .form-wrap { align-items: flex-start; padding: 12px 0 24px; }
  #signin h1 { font-size: 24px; }
}

/* ── loading screen ─────────────────────────────────────────────────────── */
#loading {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--page);
  transition: opacity 0.25s ease-out;
}
#loading.is-done { opacity: 0; pointer-events: none; }
.load-logo { width: 56px; height: 56px; border-radius: 14px; display: block; }
.load-name { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.load-bar { position: relative; width: 168px; height: 3px; border-radius: 3px; background: var(--track); overflow: hidden; margin-top: 6px; }
.load-bar::before {
  content: "";
  position: absolute;
  inset-block: 0;
  width: 40%;
  border-radius: 3px;
  background: var(--brand-gradient);
  animation: tick-slide 1.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes tick-slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
#loading[dir="rtl"] .load-bar::before { animation-direction: reverse; }
.load-status { margin: 0; min-height: 20px; font-size: 14px; color: var(--muted); text-align: center; padding: 0 24px; }
#loading.is-failed .load-bar { display: none; }
#loading.is-failed .load-status { color: var(--error); }
.load-retry {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--outline);
  border-radius: 10px;
  background: var(--surface);
  color: var(--indigo);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .load-bar::before { animation: none; transform: translateX(75%); }
  #loading, .field input, .submit, .pw-toggle { transition: none; }
}
