/* Ortho Consult Routing App
   Designed for a phone at 3am: large targets, high contrast, dark by default
   where the device asks for it. No external fonts or scripts (see the CSP). */

:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #d3d9e0;
  --text: #14181d;
  --muted: #5c6774;
  --accent: #12507e;
  --accent-text: #ffffff;
  --emergent: #b3261e;
  --urgent: #a35400;
  --routine: #1f6d3d;
  --err: #b3261e;
  --ok: #1f6d3d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b;
    --surface: #1b2128;
    --border: #333c46;
    --text: #e8edf2;
    --muted: #9aa7b4;
    --accent: #4b9fe1;
    --accent-text: #0b1015;
    --emergent: #ff6f61;
    --urgent: #ffb454;
    --routine: #6cc78d;
    --err: #ff6f61;
    --ok: #6cc78d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

h1 { font-size: 1.5rem; margin: 1rem 0 .25rem; }

/* ---- chrome ---- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.topbar nav a { color: var(--accent); text-decoration: none; }
.topbar nav a:hover { text-decoration: underline; }
form.inline { display: inline; margin: 0; }

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.banner-dev {
  margin: 0;
  padding: .5rem 1rem;
  background: var(--urgent);
  color: #14181d;
  font-weight: 600;
  font-size: .875rem;
  text-align: center;
}

footer {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  color: var(--muted);
  font-size: .8125rem;
}

/* ---- blocks ---- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: .5rem;
  padding: 1rem;
  margin: 1rem 0;
}

.card.phi { border-left: .25rem solid var(--accent); }

.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.big { font-size: 1.125rem; font-weight: 600; }
.req { color: var(--err); }

.case-ref {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .04em;
  margin: .5rem 0;
}

/* ---- forms ---- */

label { display: block; margin: 1rem 0 .25rem; font-weight: 600; }

input[type="text"], input[type="password"], input[type="tel"], input:not([type]),
select, textarea {
  width: 100%;
  padding: .625rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: .375rem;
}

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

textarea { resize: vertical; }

fieldset {
  margin: 1.25rem 0 0;
  padding: .75rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: .375rem;
}

legend { font-weight: 600; padding: 0 .375rem; }

label.check {
  display: flex;
  gap: .625rem;
  align-items: flex-start;
  margin: 0;
  padding: .5rem .25rem;
  font-weight: 400;
  cursor: pointer;
}

label.check input { width: 1.25rem; height: 1.25rem; margin: .125rem 0 0; flex: none; }

.tier-heading {
  margin: 1rem 0 .25rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
}

button.primary, a.button {
  display: inline-block;
  margin-top: 1.5rem;
  padding: .75rem 1.25rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: .375rem;
  text-decoration: none;
  cursor: pointer;
}

a.button { margin-top: .5rem; }

/* ---- urgency ---- */

.pill {
  display: inline-block;
  padding: .25rem .625rem;
  border-radius: 999px;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--accent-text);
}

.tier-emergent { color: var(--emergent); }
.tier-urgent { color: var(--urgent); }
.tier-routine { color: var(--routine); }

.pill.tier-emergent { background: var(--emergent); color: #fff; }
.pill.tier-urgent { background: var(--urgent); color: #fff; }
.pill.tier-routine { background: var(--routine); color: #fff; }

@media (prefers-color-scheme: dark) {
  .pill.tier-emergent, .pill.tier-urgent, .pill.tier-routine { color: #12161b; }
}

.dot {
  display: inline-block;
  width: .625rem;
  height: .625rem;
  margin-right: .5rem;
  border-radius: 50%;
  background: currentColor;
}

.findings { margin: 0; padding-left: 0; list-style: none; }
.findings li { padding: .1875rem 0; }

/* ---- data ---- */

dl { margin: 0; }
dt { margin-top: .875rem; font-size: .8125rem; font-weight: 700; color: var(--muted);
     text-transform: uppercase; letter-spacing: .04em; }
dd { margin: .1875rem 0 0; }
dd a { color: var(--accent); }

/* Tables scroll inside their own box so the page never scrolls sideways
   on a phone. */
.table-wrap { overflow-x: auto; margin-top: 1rem; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td {
  padding: .5rem .5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.grid th { font-size: .75rem; text-transform: uppercase; color: var(--muted); }
table.grid a {
  color: var(--accent);
  font-family: ui-monospace, Consolas, monospace;
  white-space: nowrap;
}
.unopened { color: var(--urgent); font-weight: 600; }

.action { font-size: .75rem; font-weight: 600; }
.action-phi { color: var(--emergent); }

.sms-body {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .875rem;
  word-break: break-all;
  margin: .25rem 0 0;
}

/* ---- notices ---- */

.flash { padding: .75rem 1rem; border-radius: .375rem; border: 1px solid var(--border); }
.flash-error { color: var(--err); border-color: var(--err); }
.flash-ok { color: var(--ok); border-color: var(--ok); }

.err { color: var(--err); font-size: .875rem; margin: .25rem 0 0; }
.err-note { color: var(--err); }
.ok-note { color: var(--ok); }

@media (max-width: 30rem) {
  table.grid { font-size: .875rem; }
  table.grid th, table.grid td { padding: .5rem .25rem; }
}

/* Passkey call-to-action: the primary path on a phone at 3am, so it sits
   above the password form and gets the larger target. */
.passkey-cta { margin-top: 0; width: 100%; padding: .875rem 1.25rem; font-size: 1.0625rem; }
#passkey-status { margin: .75rem 0 0; }
.card h2 { font-size: 1rem; margin: 0 0 .5rem; }

/* Shown only when a short demo password is in use somewhere reachable. */
.banner-weak {
  margin: 0;
  padding: .5rem 1rem;
  background: var(--emergent);
  color: #fff;
  font-weight: 600;
  font-size: .875rem;
  text-align: center;
}
.banner-weak code { background: rgba(0,0,0,.2); padding: .0625rem .25rem; border-radius: .1875rem; }
