/* Patient portal - shared styles (Spec 046).
   Source of truth for the look: docs/planning/mockups/patient-portal-mockup-v4.html
   (the binding demo). The demo's `.screen` became the page body; every token,
   radius and shadow below is copied from it. Regular hyphens only. */

:root {
  --paper-bg: rgb(251, 252, 253);
  --paper-ink: rgb(17, 24, 28);
  /* Accent = the logo's own gold (sampled 2026-08-27: #e0b040 dominant,
     #c09030 deep, #f0d060 light) - operator request: nothing that looks like
     a stock palette. Text-size links use a darker cut of the same hue so they
     stay readable on the paper (5.4:1 on white). */
  --accent: #e0b040;
  --accent-deep: #c09030;
  --accent-soft: #f0d060;
  --accent-rgb: 224, 176, 64;
  --accent-ink: #1a1714;
  --primary-gradient: linear-gradient(135deg, var(--accent-soft), var(--accent-deep));
  --link: #8a6414;
  --link-hover: #6b4d0f;
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-dark-bg: rgba(0, 0, 0, 0.2);
  --glass-dark-border: rgba(255, 255, 255, 0.2);
  --shadow-paper: 0 20px 60px rgba(0, 0, 0, 0.5);
  --font-sans: 'Inter', 'Segoe UI', Tahoma, sans-serif;
  --badge-checkin-bg: #e2f3ea;
  --badge-checkin-ink: #1f6f45;
  --badge-followup-bg: #e6eefc;
  --badge-followup-ink: #2456a6;
  --badge-first-bg: #fbeedd;
  --badge-first-ink: #95591b;
  --badge-other-bg: #ececf1;
  --badge-other-ink: #4a4f5c;
  /* No WhatsApp-green buttons (operator 2026-08-27): every call-to-action
     uses the portal's one primary gradient (--primary-gradient, logo gold). */
  --ink-warm: #f5ede2;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  direction: rtl;
  font-family: var(--font-sans);
  color: #fff;
  background: #1a1714;
  position: relative;
}
/* Photographic backdrop + dark overlay (demo `.screen`).
   Image URLs carry a version query: the platform's nginx sends
   `Cache-Control: max-age=1382400` even on a 404, so a browser that once
   fetched a missing image keeps the 404 for 16 days (2026-08-27 grey-avatar
   incident) - bump `?v=` whenever an image file changes. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('assets/bg-summary.jpg?v=2');
  background-size: cover;
  background-position: center;
}
body.portal-home::before {
  background-image: linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.42)), url('assets/bg-portal.jpg?v=2');
}
/* Food diary: the operator's own photo (2026-08-27), downscaled to 1920px /
   JPEG q70 (~4.9 MB → light), stored under a neutral file name. */
body.food-diary::before {
  background-image: linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.42)), url('assets/bg-food-diary.jpg?v=1');
}
[hidden] { display: none !important; }
button { font-family: inherit; }

/* ── Page frame ── */
.page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Operator feedback 2026-08-27: the action row hugs the top-right stack
     (chip / patient card) instead of sitting at a fixed 150px - no dead
     space when that stack is just a small chip (guest / admin). */
  padding: 20px 26px 60px;
}
.page--plain { padding: 20px 30px 50px; }
@media (max-width: 560px) {
  .page { padding: 14px 16px 50px; }
  .page--plain { padding: 14px 16px 44px; }
}

/* ── Brand logo (top-left, small, non-dominant) ── */
/* A link to the clinic's public site (operator 2026-08-27). */
.brand-logo {
  position: absolute;
  top: 16px;
  left: 18px;
  width: 44px;
  line-height: 0;
  opacity: 0.9;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
  transition: opacity .15s ease, transform .15s ease;
}
.brand-logo img { width: 100%; height: auto; display: block; }
.brand-logo:hover { opacity: 1; transform: scale(1.04); }
@media (max-width: 560px) { .brand-logo { width: 36px; top: 12px; left: 12px; } }

/* ── Top-right stack: chips + patient card ── */
.topright {
  align-self: flex-start;   /* the right edge in RTL */
  margin: 0 0 30px;         /* the action row follows right below the stack */
  display: flex;
  flex-direction: column;
  align-items: flex-start;  /* chip and card both hug the right edge */
  gap: 8px;
  max-width: 260px;
}
.topright:empty { display: none; }
.topright:empty + * { margin-top: 26px; }   /* the demo's plain-screen rhythm (46px) when nothing sits top-right */
@media (max-width: 560px) { .topright { margin-bottom: 22px; max-width: 200px; } }

.chip {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: center;
  line-height: 1.4;
  max-width: 180px;
}
.chip--guest, .chip--pending { font-weight: 500; padding: 6px 12px; font-size: 12px; opacity: 0.9; }
@media (max-width: 560px) { .chip { font-size: 11px; padding: 7px 12px; max-width: 160px; } }

.patient-card {
  color: #fff;
  background: var(--glass-dark-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-dark-border);
  border-radius: 10px;
  padding: 15px 20px;
  max-width: 230px;
}
.patient-card h3 { margin: 0 0 6px; font-size: 14.5px; font-weight: 600; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7); }
.patient-card p { margin: 0; font-size: 12.5px; color: rgba(255, 255, 255, 0.72); text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7); }
@media (max-width: 560px) {
  .patient-card { padding: 11px 14px; max-width: 185px; }
  .patient-card h3 { font-size: 13px; }
  .patient-card p { font-size: 11px; }
}

/* ── Greeting (portal home) ── */
.greeting { margin: 0 0 18px; font-size: 20px; font-weight: 600; text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6); }

/* ── Navigation pills ── */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 0 22px;
  max-width: 680px;
}
.pill {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform .15s ease, background .15s ease;
}
.pill:hover { background: rgba(255, 255, 255, 0.24); transform: translateY(-1px); }
/* Operator 2026-08-27: the current tab must be unmistakable - the primary gradient (same as the latest-meeting ribbon) + bold + glow. */
.pill.is-current { background: var(--primary-gradient); color: var(--accent-ink); border-color: rgba(255, 255, 255, 0.55); font-weight: 700; box-shadow: 0 6px 18px rgba(var(--accent-rgb), 0.45); cursor: default; }
.pill.is-current:hover { transform: none; }
.pill-disabled { opacity: 0.45; cursor: not-allowed; }
.pill-disabled:hover { background: var(--glass-bg); transform: none; }
.pill svg { width: 15px; height: 15px; fill: currentColor; }

/* ── Share sheet (popover on desktop, bottom sheet on phones) ── */
.share-anchor { position: relative; display: inline-flex; }
/* Layering (operator bug 2026-08-27): the sheet opens from inside the tiles
   overlay too, so it sits ABOVE the overlay scrim (500) and the dialogs (600);
   only the toast (999) is higher. Both nodes are body children. */
.share-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.share-backdrop.is-open { opacity: 1; pointer-events: auto; }
.share-sheet {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, -6px);
  width: 280px;
  max-width: calc(100vw - 40px);
  background: var(--paper-bg);
  color: var(--paper-ink);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  z-index: 701;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  direction: rtl;
  text-align: right;
}
.share-sheet.is-open { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
@media (max-width: 560px) {
  /* Pinned INSIDE the viewport - the demo's sheet drifted off-screen (handoff §3.2). */
  .share-sheet {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 18px 18px 0 0;
    transform: translateY(16px);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .share-sheet.is-open { transform: translateY(0); }
}
.share-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(17, 24, 28, 0.08);
  font-weight: 600;
  font-size: 14px;
}
.share-sheet-close { background: none; border: none; font-size: 15px; cursor: pointer; color: inherit; padding: 4px; line-height: 1; }
.share-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  text-align: right;
  font: inherit;
  font-size: 14px;
  color: var(--paper-ink);
  padding: 13px 18px;
  cursor: pointer;
  border-bottom: 1px solid rgba(17, 24, 28, 0.06);
}
.share-row:last-child { border-bottom: none; }
.share-row:hover { background: rgba(17, 24, 28, 0.05); }
.share-row[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.share-row[aria-disabled="true"]:hover { background: none; }
.share-icon { font-size: 16px; width: 20px; text-align: center; flex: 0 0 auto; }

/* ── The paper ── */
.paper-wrap { display: flex; align-items: flex-start; justify-content: center; width: 100%; margin-bottom: 40px; gap: 18px; }
/* Operator 2026-08-27: "סיכום עבור …" belongs to the paper, not to the page
   top next to the navigation. Wide screens: a sticky card at the paper's
   right edge, level with where the summary starts. Narrower screens and
   phones: a slim strip right above the paper. */
.paper-side { flex: 0 0 auto; position: sticky; top: 24px; }
@media (max-width: 1099px) {
  .paper-wrap { flex-direction: column; align-items: center; gap: 12px; }
  .paper-side { position: static; width: 100%; max-width: 760px; display: flex; justify-content: flex-start; }
  .paper-side .patient-card { max-width: none; padding: 10px 16px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
  .paper-side .patient-card h3 { margin: 0; }
}
.paper-shell { position: relative; max-width: 760px; width: 100%; }
.paper {
  background: var(--paper-bg);
  border-radius: 12px;
  box-shadow: var(--shadow-paper);
  padding: 44px 48px;
  color: var(--paper-ink);
  line-height: 1.8;
  font-size: 15px;
  direction: rtl;
  text-align: right;
  overflow-wrap: anywhere;
}
.paper[dir="ltr"] { direction: ltr; text-align: left; }
@media (max-width: 560px) { .paper { padding: 26px 22px; } }
.paper-byline { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; }
.avatar {
  background-image: url('assets/avatar.jpg?v=2');
  background-size: cover;
  background-position: center;
  background-color: rgba(17, 24, 28, 0.08);
  border-radius: 50%;
  flex: 0 0 auto;
}
.avatar-sm { width: 44px; height: 44px; }
.avatar-tiny { width: 26px; height: 26px; }
.byline-text { font-size: 12.5px; color: rgba(17, 24, 28, 0.55); font-weight: 500; }
/* Operator 2026-08-27: on desktop the avatar + name sit at the paper corner
   (the left side of an RTL paper, right side of an LTR one) beside the first
   line - no vertical space taken; the first block leaves room for it. On
   phones the byline stays in flow, compact. */
@media (min-width: 561px) {
  .paper { position: relative; }
  .paper-byline { position: absolute; top: 40px; left: 44px; margin: 0; flex-direction: row-reverse; gap: 8px; }
  .paper[dir="ltr"] .paper-byline { left: auto; right: 44px; flex-direction: row; }
  .paper-byline + .summary-date { margin-top: 0; padding-left: 170px; min-height: 44px; }
  .paper-byline + .content-host > :first-child { padding-left: 170px; min-height: 44px; }
  .paper[dir="ltr"] .paper-byline + .summary-date,
  .paper[dir="ltr"] .paper-byline + .content-host > :first-child { padding-left: 0; padding-right: 170px; }
  .modal-body .paper-byline { top: 26px; left: 30px; }
  .modal-body .paper[dir="ltr"] .paper-byline { left: auto; right: 30px; }
}
@media (max-width: 560px) {
  .paper-byline { margin: 0 0 12px; gap: 8px; }
  .paper-byline .avatar-sm { width: 30px; height: 30px; }
  .byline-text { font-size: 12px; }
}
.paper h1 {
  font-size: 30px;
  font-weight: 600;
  color: var(--paper-ink);
  border-bottom: 2px solid var(--paper-ink);
  padding-bottom: 10px;
  margin: 0 0 22px;
  text-wrap: balance;
}
@media (max-width: 560px) { .paper h1 { font-size: 22px; } }
.paper h2 { font-size: 17px; font-weight: 600; color: var(--paper-ink); margin: 26px 0 10px; }
.paper h2:first-of-type { margin-top: 0; }
.paper h3 { font-size: 15.5px; font-weight: 600; margin: 20px 0 8px; }
.paper ul, .paper ol { margin: 0 0 4px; padding: 0 22px 0 0; }
.paper[dir="ltr"] ul, .paper[dir="ltr"] ol { padding: 0 0 0 22px; }
.paper li { margin-bottom: 8px; }
.paper p { margin: 0 0 12px; }
.paper .closing { margin: 26px 0 0; font-weight: 500; }
.paper .summary-date { margin: -12px 0 20px; color: rgba(17, 24, 28, 0.5); font-size: 13px; font-weight: 500; }
.paper a { color: var(--link); border-bottom: 1px solid var(--link); text-decoration: none; }
.paper a:hover { color: var(--link-hover); border-bottom-color: var(--link-hover); }
.paper hr { border: none; border-top: 1px solid rgba(17, 24, 28, 0.15); margin: 18px 0; }
.paper blockquote { margin: 12px 0; padding: 0 14px 0 0; border-right: 3px solid rgba(var(--accent-rgb), 0.6); color: rgba(17, 24, 28, 0.75); }
.paper code { font-family: ui-monospace, Consolas, monospace; font-size: 0.92em; background: rgba(17, 24, 28, 0.06); padding: 1px 5px; border-radius: 4px; }
.paper .content--whatsapp { white-space: pre-wrap; }
.paper[contenteditable="true"], .paper.is-editing .content { outline: 2px dashed rgba(var(--accent-rgb), 0.7); outline-offset: 6px; cursor: text; border-radius: 12px; }
.paper .status-line { color: rgba(17, 24, 28, 0.6); font-size: 14px; margin: 0; }

/* WhatsApp-format rendering (engine classes, read style map from the CRM) */
.wa-live-bold { font-weight: 700; }
.wa-live-italic { font-style: italic; }
.wa-live-strike { text-decoration: line-through; }
.wa-live-mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.95em; }
.wa-live-marker { color: rgba(17, 24, 28, 0.35); }
.wa-link { color: var(--link); text-decoration: underline; word-break: break-all; }

/* ── Admin edit affordances ── */
.edit-fab {
  display: none;
  position: absolute;
  top: -16px;
  right: -16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(17, 24, 28, 0.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  z-index: 5;
}
.edit-fab.is-visible { display: flex; }
.edit-fab[disabled] { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 560px) { .edit-fab { right: -6px; top: -12px; } }
.edit-toolbar {
  position: sticky;
  top: 8px;
  z-index: 6;
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 0 0 12px;
}
.edit-toolbar button {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.edit-toolbar button:hover { background: rgba(255, 255, 255, 0.3); }
.edit-toolbar button[disabled] { opacity: 0.4; cursor: not-allowed; }
.edit-toolbar .tb-publish { background: var(--primary-gradient); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.edit-toolbar .tb-status { font-size: 12px; color: rgba(255, 255, 255, 0.85); margin-inline-start: 6px; }

/* ── Logout (discreet, fixed bottom-left) ── */
.logout-link {
  position: fixed;
  bottom: 14px;
  left: 18px;
  z-index: 40;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  text-decoration: none;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
  opacity: .82;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}
.logout-link:hover { opacity: 1; text-decoration: underline; }

/* ── Tiles ── */
.tiles-grid { display: grid; gap: 18px; width: 100%; max-width: 760px; grid-template-columns: repeat(2, 1fr); }
@media (max-width: 899px) { .tiles-grid { grid-template-columns: 1fr; } }
.tile {
  position: relative;
  background: var(--paper-bg);
  border-radius: 12px;
  padding: 22px 24px;
  color: var(--paper-ink);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  text-align: right;
  direction: rtl;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42); }
.tile[data-highlight="true"] {
  border: 2px solid transparent;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.4);
  background-image: linear-gradient(var(--paper-bg), var(--paper-bg)), var(--primary-gradient);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
.tile-ribbon {
  position: absolute;
  top: -11px;
  right: 18px;
  background: var(--primary-gradient);
  color: var(--accent-ink);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(var(--accent-rgb), 0.45);
}
.tile-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.tile-head-left { display: flex; align-items: center; gap: 9px; }
.badge { font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.badge.checkin { background: var(--badge-checkin-bg); color: var(--badge-checkin-ink); }
.badge.followup { background: var(--badge-followup-bg); color: var(--badge-followup-ink); }
.badge.first { background: var(--badge-first-bg); color: var(--badge-first-ink); }
.badge.other { background: var(--badge-other-bg); color: var(--badge-other-ink); }
.tile time { font-size: 12.5px; color: rgba(17, 24, 28, 0.55); }
.tile-preview { margin: 0; line-height: 1.7; font-size: 14.5px; }
.tile-toggle { display: block; margin-top: 12px; background: none; border: none; color: var(--link); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 0; }
.tile-toggle:hover { color: var(--link-hover); }

/* ── Full-summary overlay ── */
.modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 44px 20px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.modal-scrim.is-open { opacity: 1; pointer-events: auto; }
.modal-panel {
  position: relative;
  background: var(--paper-bg);
  border-radius: 14px;
  max-width: 760px;
  width: 100%;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 88px);
  transform: translateY(10px);
  transition: transform .2s ease;
  direction: rtl;
}
.modal-scrim.is-open .modal-panel { transform: translateY(0); }
.modal-topbar { padding: 14px 18px; border-bottom: 1px solid rgba(17, 24, 28, 0.1); background: rgba(17, 24, 28, 0.02); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.modal-back {
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--link);
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
}
.modal-back:hover { background: rgba(var(--accent-rgb), 0.26); }
.modal-topbar .pill { color: var(--paper-ink); background: rgba(17, 24, 28, 0.06); border-color: rgba(17, 24, 28, 0.12); }
.modal-topbar .pill:hover { background: rgba(17, 24, 28, 0.12); }
.modal-body { overflow-y: auto; padding: 10px; }
.modal-body .paper-shell { max-width: none; }
.modal-body .paper { box-shadow: none; padding: 30px 34px; }
@media (max-width: 560px) {
  .modal-scrim { padding: 0; }
  .modal-panel { max-height: 100vh; border-radius: 0; }
  .modal-body .paper { padding: 26px 20px; }
}

/* ── Invitation / empty cards, WhatsApp button ── */
.invite-card, .empty-card, .state-card {
  background: rgba(251, 252, 253, 0.95);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 14px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.4);
  color: var(--paper-ink);
  max-width: 480px;
  width: 100%;
  direction: rtl;
}
.invite-card { padding: 40px 42px; text-align: center; }
.empty-card, .state-card { padding: 40px 44px; text-align: right; }
.state-card { text-align: center; }
@media (max-width: 560px) { .invite-card, .empty-card, .state-card { padding: 28px 24px; } }
.invite-card p, .empty-card p, .state-card p { margin: 0 0 22px; line-height: 1.75; font-size: 15px; }
.invite-card p:last-of-type, .empty-card p:last-of-type, .state-card p:last-of-type { margin-bottom: 26px; }
/* Operator 2026-08-27: the first line of the food-diary card must not be missed - full ink, larger, bold. */
.empty-card .muted-line { color: var(--paper-ink); font-size: 17px; font-weight: 600; margin-bottom: 12px; }
.state-card .muted { color: rgba(17, 24, 28, 0.55); font-size: 14px; margin-bottom: 14px; }
.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-gradient);
  color: var(--accent-ink);
  border: none;
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  padding: 12px 26px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  line-height: 1.35;
  box-shadow: 0 8px 22px rgba(var(--accent-rgb), 0.35);
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.wa-btn:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 10px 26px rgba(var(--accent-rgb), 0.5); }
/* The WhatsApp glyph (operator 2026-08-27: a WhatsApp icon, not a generic bubble). */
.wa-icon { display: inline-flex; width: 18px; height: 18px; flex: 0 0 auto; }
.wa-icon svg { width: 100%; height: 100%; fill: currentColor; }
.wa-inline .wa-icon { width: 15px; height: 15px; vertical-align: -3px; }
@media (max-width: 560px) { .wa-btn { padding: 10px 20px; font-size: 13.5px; } }
.quiet-btn { margin-top: 16px; background: none; border: 1px solid rgba(17, 24, 28, 0.25); border-radius: 8px; padding: 6px 14px; color: rgba(17, 24, 28, 0.6); font-size: 13px; cursor: pointer; }

/* ── Embedded board ── */
.board-wrap { width: 100%; max-width: 1100px; }
.board-frame {
  width: 100%;
  min-height: 70vh;
  height: 78vh;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-paper);
}
.board-fallback { margin-top: 10px; font-size: 13px; color: rgba(255, 255, 255, 0.8); text-align: center; }
.board-fallback a { color: #fff; }

/* ── Dialogs (payment, prompts) - same chrome as the sheet ── */
.dialog-scrim {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dialog {
  background: var(--paper-bg);
  color: var(--paper-ink);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 420px;
  padding: 22px 22px 18px;
  direction: rtl;
  text-align: right;
}
.dialog h3 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.dialog p { margin: 0 0 10px; line-height: 1.6; font-size: 14.5px; }
.dialog .dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; margin-top: 16px; }
.dialog .btn {
  font: inherit;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid rgba(17, 24, 28, 0.18);
  background: #fff;
  color: var(--paper-ink);
  cursor: pointer;
}
.dialog .btn-primary { background: var(--primary-gradient); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.dialog .btn-link { background: none; border: none; color: var(--link); text-decoration: underline; padding: 8px 4px; }
.bank-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(17, 24, 28, 0.08); }
.bank-row:last-of-type { border-bottom: none; }
.bank-row .label { font-size: 13.5px; color: rgba(17, 24, 28, 0.65); }
.bank-row .value { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; }
.bank-row.is-account .value { font-size: 19px; letter-spacing: 0.04em; color: var(--link-hover); }
.copy-icon { background: none; border: 1px solid rgba(17, 24, 28, 0.18); border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 12px; color: var(--paper-ink); }
.copy-icon:hover { background: rgba(17, 24, 28, 0.06); }
@media (max-width: 560px) {
  .dialog-scrim { align-items: flex-end; padding: 0; }
  .dialog { max-width: none; border-radius: 18px 18px 0 0; max-height: 80vh; overflow-y: auto; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0)); }
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 20px);
  z-index: 999;
  background: #100e0c;
  color: var(--ink-warm);
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  max-width: 90vw;
  text-align: center;
  direction: rtl;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Loading ── */
.loading-card { color: rgba(255, 255, 255, 0.85); font-size: 14px; text-align: center; padding: 30px; }

*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── Print: the paper only, white, RTL ── */
@media print {
  body { background: #fff !important; color: #000; }
  body::before { display: none !important; }
  .page { padding: 0 !important; min-height: auto; display: block; }
  .brand-logo, .topright, .paper-side, .pill-row, .share-backdrop, .share-sheet, .logout-link,
  .edit-fab, .edit-toolbar, .toast, .dialog-scrim, .modal-topbar, .tiles-grid { display: none !important; }
  .paper-wrap { margin: 0; }
  .paper-shell { max-width: none; }
  .paper { box-shadow: none !important; border-radius: 0; padding: 0 !important; color: #000; }
  .paper a { color: #000; border-bottom: 1px solid #000; }
  @page { margin: 15mm; }
}
