/* MyStream: calm, plain and large enough to read on a phone. Every size is in rem so the text-size button scales it all. */
:root {
  --ink: #16282d;
  --muted: #56696f;
  --line: #d9e3e4;
  --bg: #f4f7f6;
  --card: #fff;
  --brand: #0f5e66;
  --brand-ink: #0a464c;
  --brand-soft: #e3f0f0;
  --sand: #faf6ef;
  --red: #b42318;
  --red-soft: #fdecea;
  --amber: #8a4f05;
  --amber-soft: #fdf3e1;
  --green: #1d6f47;
  --green-soft: #e5f3eb;
  --radius: 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: calc(17px * var(--text-scale, 1));
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--brand); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0.25rem 0 0.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 0.75rem 0 0.25rem; }
p { margin: 0.5rem 0; }
.small { font-size: 0.85rem; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--card); padding: 0.5rem 1rem; z-index: 20; }
.skip:focus { left: 0.5rem; }
:focus-visible { outline: 3px solid #e8a33d; outline-offset: 2px; }

/* buttons */
button, .button {
  font: inherit; font-weight: 600; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  padding: 0.65rem 1.25rem; min-height: 2.9rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  text-decoration: none; text-align: center;
}
button:disabled { opacity: 0.55; cursor: default; }
.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.primary:hover:not(:disabled) { background: var(--brand-ink); }
.secondary { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 0.5rem 0.75rem; min-height: 2.5rem; }
.link { background: none; border: none; padding: 0; min-height: 0; color: var(--brand); font-weight: 600; text-decoration: underline; }
.wide { width: 100%; }
.button.small, button.small { min-height: 2.3rem; padding: 0.35rem 0.9rem; font-size: 0.9rem; }

input, select, textarea {
  font: inherit; width: 100%; padding: 0.7rem 0.85rem; border: 1.5px solid #b9c8ca; border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
label { font-weight: 600; display: block; margin: 0.9rem 0 0.3rem; }
input.code { font-size: 1.6rem; letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums; }

.alert { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 0.7rem 0.9rem; margin: 0.75rem 0; }
.note { background: var(--sand); border-radius: 10px; padding: 0.75rem 0.95rem; margin: 0.75rem 0; }
.ok { color: var(--green); font-weight: 600; }
.empty { color: var(--muted); background: var(--card); border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 1.5rem; text-align: center; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

/* sign-in */
.signin-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.25rem; gap: 1rem; }
.signin-card { background: var(--card); border-radius: 20px; padding: 2rem 1.5rem; width: 100%; max-width: 27rem; box-shadow: 0 10px 30px rgba(15, 94, 102, 0.08); }
.signin-card h1 { color: var(--brand-ink); }
.signin-card form .primary { margin-top: 1rem; }
.logo { margin-bottom: 0.5rem; }

/* shell */
.app { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 5rem; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--brand-ink); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand .logo { margin: 0; }
.brand .logo svg { width: 2rem; height: 2rem; display: block; }
.brand small { display: block; font-weight: 500; font-size: 0.75rem; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 0.25rem; }
.textsize .big { font-size: 1.3em; margin-left: 0.05em; }

/* tabs: along the bottom on phones, under the header on wider screens */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.1rem; padding: 0.5rem 0.2rem; font-size: 0.72rem; color: var(--muted); text-decoration: none; font-weight: 600; }
.tabs svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--brand); }
.tabs a.on svg { stroke-width: 2.3; }
.tabs .badge { position: absolute; top: 0.25rem; left: calc(50% + 0.45rem); }
@media (min-width: 760px) {
  .app { padding-bottom: 0; }
  .tabs { position: sticky; top: 3.6rem; bottom: auto; display: flex; justify-content: center; gap: 0.25rem; border-top: none; border-bottom: 1px solid var(--line); padding: 0.35rem; }
  .tabs a { flex-direction: row; gap: 0.45rem; font-size: 0.95rem; padding: 0.45rem 1rem; border-radius: 999px; }
  .tabs a.on { background: var(--brand-soft); color: var(--brand-ink); }
  .tabs svg { width: 1.2rem; height: 1.2rem; }
  .tabs .badge { position: static; }
}
.badge { background: var(--red); color: #fff; border-radius: 999px; font-size: 0.72rem; font-weight: 700; min-width: 1.3rem; height: 1.3rem; padding: 0 0.35rem; display: inline-grid; place-items: center; }
main { width: 100%; max-width: 46rem; margin: 0 auto; padding: 1rem; flex: 1; }
main:focus { outline: none; }
footer { max-width: 46rem; margin: 0 auto; padding: 0 1rem 1.5rem; width: 100%; }
.crisis { background: var(--brand-soft); color: var(--brand-ink); border-radius: 12px; padding: 0.75rem 1rem; font-size: 0.92rem; margin: 1rem 0 0.5rem; width: 100%; max-width: 46rem; }
.crisis a { font-weight: 700; color: inherit; }

/* cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 0.75rem; }
.card h2:first-child { margin-top: 0; }
.list { list-style: none; padding: 0; margin: 0.5rem 0; }
.list.compact .card { padding: 0.7rem 1rem; }
.row-link { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; color: inherit; text-decoration: none; }
.row-link:hover { border-color: var(--brand); }
.row-link.unread { border-left: 4px solid var(--brand); }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.preview { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.92rem; }
.back { display: inline-block; margin-bottom: 0.25rem; font-weight: 600; text-decoration: none; }
.tag { display: inline-block; font-size: 0.75rem; font-weight: 700; border-radius: 999px; padding: 0.1rem 0.55rem; margin-left: 0.35rem; background: var(--brand-soft); color: var(--brand-ink); vertical-align: middle; }
.tag-new, .tag-assigned { background: var(--amber-soft); color: var(--amber); }
.tag-submitted, .tag-accepted { background: var(--green-soft); color: var(--green); }
.tag-off { background: #eee; color: #555; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1.1rem; display: flex; flex-direction: column; color: var(--muted); text-decoration: none; }
.tile b { color: var(--ink); font-size: 1.05rem; }
.tile.has { border-color: var(--brand); background: linear-gradient(0deg, var(--card), var(--brand-soft)); }
.tile.has span { color: var(--brand-ink); font-weight: 600; }

.appt { display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-start; }
.appt-when { display: flex; flex-direction: column; }
.appt.big .appt-when b { font-size: 1.2rem; }
.appt-what { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; }
.appt-what .tag { margin-left: 0; }
.appt.off { opacity: 0.6; }
.appt.off .appt-when b { text-decoration: line-through; }
.next { border-color: var(--brand); }

.team { list-style: none; padding: 0; margin: 0; }
.team li { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0; border-top: 1px solid var(--line); }
.team li:first-child { border-top: none; }
.team li > span:nth-child(2) { flex: 1; }
.avatar { width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; flex: none; }

/* forms */
.ff-section { border: none; background: var(--card); border-radius: var(--radius); padding: 1rem 1.15rem; margin: 0 0 0.9rem; border: 1px solid var(--line); }
.ff-section legend { font-weight: 700; font-size: 1.05rem; padding: 0; float: left; width: 100%; margin-bottom: 0.25rem; }
.ff-section legend + * { clear: both; }
.ff-desc, .ff-help { color: var(--muted); font-size: 0.9rem; }
.ff-q { padding: 0.75rem 0; border-top: 1px solid var(--line); }
.ff-q:first-of-type { border-top: none; }
.ff-label { font-weight: 600; margin: 0 0 0.4rem; display: block; }
.ff-q.has-error { border-left: 4px solid var(--red); padding-left: 0.75rem; }
.ff-error { color: var(--red); font-weight: 600; font-size: 0.9rem; }
.ff-info { background: var(--sand); border-radius: 10px; padding: 0.6rem 0.8rem; margin: 0.5rem 0; }
.ff-item { border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.8rem; margin: 0.5rem 0; }
.ff-item-head { display: flex; justify-content: space-between; }
.req { color: var(--red); }
.choices { display: grid; gap: 0.45rem; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice { margin: 0; font-weight: 500; display: flex; align-items: center; gap: 0.65rem; border: 1.5px solid #b9c8ca; border-radius: 12px; padding: 0.7rem 0.9rem; cursor: pointer; background: #fff; }
.choice input { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--brand); flex: none; }
.choice.on { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.actions { display: flex; gap: 0.6rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 0.75rem; }
.actions.sticky { border-top: 1px solid var(--line); padding-top: 1rem; }
.done { text-align: center; }

/* documents */
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.doc-section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.25rem 1.15rem 0.75rem; margin-bottom: 0.75rem; }
.rows { margin: 0.25rem 0; }
.rows dt { color: var(--muted); font-size: 0.9rem; margin-top: 0.65rem; }
.rows dd { margin: 0.1rem 0 0; font-weight: 500; white-space: pre-wrap; }
.score { font-size: 1.05rem; }
.doc-note { white-space: pre-wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
@media print {
  .top, .tabs, footer, .no-print, .skip { display: none !important; }
  :root { background: #fff; font-size: 11pt; }
  .doc-section, .card { border: 1px solid #ccc; break-inside: avoid; }
  main { max-width: none; }
}

/* messages */
.compose { padding-top: 0.75rem; }
.bubbles { list-style: none; padding: 0; margin: 0.5rem 0; display: flex; flex-direction: column; gap: 0.75rem; }
.bubbles li { display: flex; flex-direction: column; max-width: 85%; }
.bubbles .me { align-self: flex-end; align-items: flex-end; }
.bubble { white-space: pre-wrap; padding: 0.7rem 0.95rem; border-radius: 16px; background: var(--card); border: 1px solid var(--line); overflow-wrap: anywhere; }
.me .bubble { background: var(--brand); color: #fff; border-color: var(--brand); border-bottom-right-radius: 4px; }
.them .bubble { border-bottom-left-radius: 4px; }
.who { color: var(--muted); margin: 0 0.3rem 0.15rem; }
.reply { margin-top: 1rem; }

/* video visit */
.visit { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.back-link { font-weight: 600; text-decoration: none; }
.narrow { max-width: 30rem; margin: 1rem auto; display: flex; flex-direction: column; gap: 0.6rem; }
.waiting { text-align: center; align-items: center; }
.pulse { width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--brand); opacity: 0.85; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(0.85); opacity: 0.5; } 50% { transform: scale(1); opacity: 0.9; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.visit main { max-width: 64rem; }
.video-stage { display: flex; flex-direction: column; gap: 0.6rem; margin: 0.5rem 0; }
.video-main { position: relative; background: #0d2226; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; max-height: 75vh; }
@media (max-width: 600px) { .video-main { aspect-ratio: 3 / 4; } }
.video-main video { display: block; }
.video-main .hidden { display: none; }
.v-remote, .v-content { width: 100%; height: 100%; object-fit: contain; background: #0d2226; }
.v-local { position: absolute; right: 0.75rem; bottom: 0.75rem; width: 26%; min-width: 6rem; aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: 10px; border: 2px solid rgba(255,255,255,0.7); transform: scaleX(-1); background: #000; }
.v-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #cfe6e6; font-size: 1.1rem; padding: 1rem; text-align: center; }
.v-banner { position: absolute; top: 0.75rem; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.6); color: #fff; padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.85rem; }
.video-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.video-controls .spacer { flex: 1; }
.video-controls .on-alert { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.video-controls .danger { background: var(--red); color: #fff; border-color: var(--red); }
