/* Secure report viewer: shared styles for the sign-in page and the reader. */

:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5b6676;
  --line: #d9dfe7;
  --primary: #1f3a5f;
  --primary-hover: #17304f;
  --primary-text: #ffffff;
  --danger: #a1262b;
  --danger-bg: #fdecec;
  --warn-bg: #fff6e0;
  --ok-bg: #e8f5ee;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  .page-signin {
    --bg: #11151b;
    --card: #1a2029;
    --text: #e8edf3;
    --muted: #9aa6b6;
    --line: #2d3644;
    --primary: #5b8fd6;
    --primary-hover: #7aa5e2;
    --primary-text: #0c1118;
    --danger: #ff9c9f;
    --danger-bg: #3a1c1e;
    --warn-bg: #3a3118;
    --ok-bg: #173325;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Sign-in ---------- */

.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: 0 8px 28px rgba(15, 25, 40, 0.08);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 { margin: 0 0 16px; font-size: 26px; line-height: 1.2; }
h2 { margin: 0 0 4px; font-size: 20px; line-height: 1.3; }

.stack { display: flex; flex-direction: column; gap: 12px; }

.lede { margin: 0; color: var(--muted); }
.note { margin: 0; font-size: 14px; color: var(--muted); }
.note.support { color: var(--danger); font-weight: 600; }
.fine { margin: 20px 0 0; font-size: 13px; color: var(--muted); }

label { font-size: 14px; font-weight: 600; }

input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px; /* 16px stops iOS Safari zooming the page on focus */
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 143, 214, 0.28); }

.btn {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-weight: 600;
  padding: 12px 16px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { color: var(--primary-text); background: var(--primary); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.small { padding: 7px 12px; font-size: 14px; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.link { border: 0; padding: 8px 0; color: var(--muted); font-weight: 500; text-decoration: underline; }

.banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
  background: var(--danger-bg);
  color: var(--danger);
}
.banner.info { background: var(--warn-bg); color: var(--text); }

.devices { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.devices li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
}
.devices .dev-name { font-weight: 600; word-break: break-word; }
.devices .dev-meta { font-size: 13px; color: var(--muted); }
.devices .badge {
  display: inline-block; margin-left: 6px; padding: 1px 8px; font-size: 12px;
  border-radius: 99px; background: var(--ok-bg); color: var(--text);
}

/* ---------- Reader ---------- */

.page-reader {
  --bg: #20242b;
  --card: #2a2f38;
  --text: #e8edf3;
  --muted: #a3adbb;
  --line: #3a4150;
  --primary: #5b8fd6;
  --primary-text: #0c1118;
  --danger: #ff9c9f;
  --danger-bg: #3a1c1e;
  --ok-bg: #173325;
  background: var(--bg);
  /* Deterrents: no selection, no iOS long-press menu, no tap highlight. */
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.reader {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.bar-left { display: flex; flex-direction: column; min-width: 0; flex: 1 1 0; }
.bar-right { display: flex; gap: 8px; flex: 1 1 0; justify-content: flex-end; }
.doc-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.licensee { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pager { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.icon-btn {
  appearance: none; -webkit-appearance: none;
  width: 40px; height: 40px;
  font-size: 26px; line-height: 1;
  color: var(--text); background: transparent;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.icon-btn:hover:not(:disabled) { border-color: var(--muted); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

.page-jump { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 500; }
.page-jump input {
  width: 3.2em; padding: 8px 4px; text-align: center;
  -webkit-user-select: text; user-select: text; /* the only field that needs selection */
}
.total { min-width: 3em; }

.stage {
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  outline: none;
}

.status { text-align: center; color: var(--muted); padding: 48px 0; }
.status.error { color: var(--danger); }

.page-wrap {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.45);
}
.page { display: block; width: 100%; height: auto; pointer-events: none; -webkit-user-drag: none; }
/* Transparent layer above the image so long-press / drag / "save image" hit this, not the picture. */
.shield { position: absolute; inset: 0; background: transparent; }

.foot {
  flex: 0 0 auto;
  padding: 6px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--card);
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed; left: 50%; bottom: 56px; transform: translateX(-50%);
  max-width: min(92vw, 520px);
  padding: 10px 16px; border-radius: 10px;
  font-size: 14px; text-align: center;
  color: #fff; background: rgba(10, 14, 20, 0.94);
  border: 1px solid var(--line);
  z-index: 30;
}

.modal {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(5, 8, 12, 0.7);
}
.modal-card {
  width: 100%; max-width: 480px; max-height: 90vh; overflow: auto;
  display: flex; flex-direction: column; gap: 12px;
  padding: 22px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
}

@media (max-width: 640px) {
  .bar { flex-wrap: wrap; row-gap: 6px; padding: 8px 10px; }
  .bar-left { flex: 1 1 100%; order: 1; flex-direction: row; align-items: baseline; gap: 8px; }
  .pager { order: 2; }
  .bar-right { order: 3; flex: 1 1 auto; }
  .licensee { display: none; }
  .stage { padding: 8px; }
  .foot { font-size: 11px; }
}

/* Printing: show nothing at all. */
@media print {
  html, body { display: none !important; }
}
