/* The review page. Phone first: 360px wide and up, no horizontal scroll. */

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

:root {
  --fg: #1a1a1a;
  --muted: #555;
  --bg: #fff;
  --panel: #f3f5f8;
  --line: #c9d1db;
  --accent: #1f3a5f;
  --accent-fg: #fff;
  --danger: #a4161a;
  --ok: #1b5e20;
  --warn-bg: #fff4d6;
  --warn-line: #b7791f;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #ececec;
    --muted: #b5b5b5;
    --bg: #121417;
    --panel: #1d2127;
    --line: #3a414b;
    --accent: #8fb3e0;
    --accent-fg: #0b1320;
    --danger: #ff8a80;
    --ok: #9ccc65;
    --warn-bg: #3a2f12;
    --warn-line: #e0b050;
  }
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  overflow-wrap: anywhere;
}

main, .alert, .status { max-width: 40rem; margin: 0 auto; padding: 0 1rem; }
main { padding-bottom: 3rem; }

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--accent-fg);
}
.bar a, .bar .link { color: var(--accent-fg); }
.brand { font-weight: 700; text-decoration: none; }
.bar nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: center; }
.bar nav[hidden] { display: none; }
.bar nav a, .bar nav .link { display: inline-flex; align-items: center; min-height: 44px; }

h1 { font-size: 1.4rem; margin: 1rem 0 0.75rem; }
h1:focus { outline: none; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }

a { color: var(--accent); }
@media (prefers-color-scheme: dark) { a { color: var(--accent); } }

.muted { color: var(--muted); }
.lead { font-size: 1.05rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.status { min-height: 1.5rem; margin-top: 0.5rem; color: var(--ok); }
.alert {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--danger);
  background: var(--panel);
  color: var(--fg);
}
.alert[hidden] { display: none; }
.alert-line { display: block; }
.alert-line + .alert-line { margin-top: 0.25rem; color: var(--muted); }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  max-width: 100%;
}
.primary { background: var(--accent); color: var(--accent-fg); }
.secondary { background: transparent; color: var(--accent); }
.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button:disabled { opacity: 0.6; cursor: default; }
button.link { border: 0; background: none; padding: 0; min-height: 0; font-weight: 400; text-decoration: underline; }
:focus-visible { outline: 3px solid var(--warn-line); outline-offset: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.toolbar p { margin: 0; }

.queue { list-style: none; margin: 1rem 0; padding: 0; }
.entry { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 0.5rem; background: var(--panel); }
.entry-body { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.75rem; min-width: 0; color: inherit; text-decoration: none; }
a.entry-body:hover .preview { text-decoration: underline; }
.entry.held { background: transparent; border-style: dashed; }
.preview { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-weight: 600; }
.meta { color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); }

.badges { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.badge {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.8rem;
  line-height: 1.5;
}
.badge.priority-high { border-color: var(--danger); color: var(--danger); font-weight: 700; }
.badge.approved { border-color: var(--ok); color: var(--ok); }
.badge.held { border-color: var(--warn-line); background: var(--warn-bg); color: var(--fg); font-weight: 700; }

.details { display: grid; grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr); gap: 0.25rem 0.75rem; margin: 0.75rem 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; min-width: 0; }

.fulltext {
  white-space: pre-wrap;
  unicode-bidi: plaintext;
  overflow-wrap: anywhere;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.confirm { border: 2px solid var(--accent); border-radius: 8px; padding: 0.25rem 0.75rem 0.75rem; }
/* Recipient and destination render as written: newlines kept, and bidi isolated per paragraph
   so a right-to-left run cannot reorder the text around it. */
.confirm dd, .prewrap { white-space: pre-wrap; unicode-bidi: plaintext; }
.confirm .destination { font-size: 1.1rem; }
.confirm .destination.unverified strong { color: var(--danger); }
.hidden-char {
  display: inline-block;
  padding: 0 0.2rem;
  margin: 0 0.1rem;
  border: 1px solid var(--danger);
  border-radius: 3px;
  color: var(--danger);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  unicode-bidi: isolate;
  direction: ltr;
}
.note { padding: 0.5rem 0.75rem; border-left: 4px solid var(--ok); background: var(--panel); }
.warning { padding: 0.5rem 0.75rem; border-left: 4px solid var(--warn-line); background: var(--warn-bg); }

form label { display: block; margin-top: 0.75rem; font-weight: 600; }
input[type="text"], textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}
textarea { resize: vertical; }

fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 1rem 0 0; padding: 0.5rem 0.75rem; min-width: 0; }
legend { font-weight: 700; padding: 0 0.25rem; }
label.option { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0.25rem 0; padding: 0.5rem 0; font-weight: 400; min-height: 44px; }
label.option input { margin-top: 0.3rem; width: 1.25rem; height: 1.25rem; flex: none; }
.letter { font-weight: 700; flex: none; min-width: 1.25rem; }
.option-text { min-width: 0; }
.recommended { color: var(--ok); }
.options-list { list-style: none; padding: 0; }

.passkeys { list-style: none; padding: 0; }
.passkey { border: 1px solid var(--line); border-radius: 8px; padding: 0 0.75rem; margin-bottom: 0.5rem; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-wrap: anywhere; word-break: break-all; }
.fingerprint { font-size: 1.1rem; font-weight: 700; word-break: normal; }
