/* Aegis Rental Platform - operator UI.
   Mobile-first, dark, big touch targets. No inline styles anywhere: the app
   ships a strict CSP (style-src 'self'), so everything lives in this file. */

:root {
  --bg: #0d0d0d;
  --surface: #181818;
  --surface-2: #202020;
  --line: #2a2a2a;
  --text: #ececec;
  --muted: #9a9a9a;
  --accent: #00d4aa;
  --accent-dim: #00a486;
  --danger: #ff5f56;
  --warn: #ffb020;
  --radius: 14px;
  --tap: 52px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- layout ---------- */
.centre {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.stack {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.login-card {
  width: 100%;
  max-width: 420px;
}

/* ---------- brand ---------- */
.brand { text-align: center; margin-bottom: 22px; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: linear-gradient(145deg, var(--accent), var(--accent-dim));
  color: #04120e;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -1px;
}

.brand-mark.small { width: 30px; height: 30px; font-size: 16px; border-radius: 9px; }

.brand h1, .h1 {
  margin: 14px 0 4px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.sub { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.who { color: var(--muted); font-size: 14px; }
.inline { display: inline; margin: 0; }

.link { color: var(--accent); text-decoration: none; font-size: 14px; padding: 8px 0; }
.link:hover { text-decoration: underline; }

/* ---------- forms ---------- */
label {
  display: block;
  margin: 16px 0 6px;
  font-size: 14px;
  color: var(--muted);
}

input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px; /* 16px stops iOS zooming the page on focus */
}

input:focus, select:focus, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease;
}

.btn-primary {
  width: 100%;
  margin-top: 22px;
  background: var(--accent);
  color: #04120e;
}
.btn-primary:hover { background: var(--accent-dim); }

.btn-quiet {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
  font-weight: 500;
}
.btn-quiet:hover { border-color: var(--accent); color: var(--accent); }

.btn-copy {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
  white-space: nowrap;
}
.btn-copy.done { background: var(--accent); color: #04120e; }

.hint { margin: 16px 0 0; color: var(--muted); font-size: 13.5px; }

/* ---------- alerts ---------- */
.alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14.5px;
  border: 1px solid;
}
.alert-error { background: rgba(255, 95, 86, 0.09); border-color: rgba(255, 95, 86, 0.45); color: #ffb3ae; }
.alert-warn  { background: rgba(255, 176, 32, 0.09); border-color: rgba(255, 176, 32, 0.40); color: #ffd489; }
.alert-ok    { background: rgba(0, 212, 170, 0.10); border-color: rgba(0, 212, 170, 0.45); color: var(--accent); }

/* ---------- action cards ---------- */
.action { padding: 0; overflow: hidden; }

.action > summary {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 78px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.action > summary::-webkit-details-marker { display: none; }
.action > summary:hover { background: var(--surface-2); }

.action .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--accent);
  font-weight: 700;
}

.action .labels { display: flex; flex-direction: column; line-height: 1.25; }
.action .labels strong { font-size: 18px; font-weight: 600; }
.action .labels em { font-style: normal; color: var(--muted); font-size: 14px; }
.action[open] > summary { border-bottom: 1px solid var(--line); }
.action .body { padding: 4px 20px 22px; }

/* ---------- signing links ---------- */
.result h2 { margin: 0 0 6px; font-size: 19px; }

.linkrow {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.linkmeta { font-size: 14.5px; color: var(--muted); }
.linkmeta strong { color: var(--text); }
.linkfield { font-size: 14px; font-family: Consolas, "Cascadia Mono", monospace; }

/* ---------- lists ---------- */
.doclist, .statuslist { list-style: none; margin: 14px 0 0; padding: 0; }

.doclist li, .statuslist li {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.docmeta { display: flex; flex-direction: column; font-size: 14.5px; }
.docmeta span { color: var(--muted); font-size: 13.5px; }
.docmeta .ts { font-variant-numeric: tabular-nums; }

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.statuslist .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 10px;
  background: var(--muted);
}
.statuslist .ok .dot { background: var(--accent); }
.statuslist .bad .dot { background: var(--danger); }
.statuslist .detail { color: var(--muted); font-size: 13.5px; }

/* ---------- auth: passkeys, 2FA ---------- */
.hidden { display: none !important; }

.btn-block { width: 100%; margin-top: 18px; }
.btn-passkey { margin-top: 4px; }
.centred { text-align: center; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 4px;
  color: var(--muted);
  font-size: 13px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.code-input {
  font-size: 26px;
  letter-spacing: 7px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Cascadia Mono", monospace;
}

.qr {
  display: block;
  width: 220px;
  height: 220px;
  margin: 18px auto 12px;
  padding: 10px;
  background: #fff;          /* QR needs a light quiet zone to scan reliably */
  border-radius: 10px;
}

.secret {
  margin: 0 0 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 15px;
  letter-spacing: 2px;
  text-align: center;
  word-break: break-all;
}

.steps { margin: 16px 0; padding-left: 22px; color: var(--muted); font-size: 14.5px; }
.steps li { margin-bottom: 8px; }

/* used by the clipboard fallback in app.js (no clipboard API over plain http) */
.offscreen-copy { position: absolute; left: -9999px; opacity: 0; }

/* ---------- footer ---------- */
.footer {
  padding: 20px 16px 26px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.footer strong { color: var(--text); font-weight: 600; }

@media (min-width: 640px) {
  .linkrow { flex-direction: row; align-items: center; }
  .linkfield { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
