/* =========================================================================
   Daryeel Waalid design system
   One stylesheet for the public website and all four portals.
   Official brand colours only; portals change accents via data-portal.
   ========================================================================= */
:root {
  --green: #1F5B3D;          /* Primary brand green */
  --green-ink: #174a31;      /* hover / pressed */
  --doctor: #8DBB9D;         /* Doctor light green */
  --gold: #B78A3B;           /* Admin brown-gold */
  --gold-ink: #8f6a2b;       /* hover; AA contrast on white for text */
  --beige: #F3E8D5;          /* Admin background */
  --white: #FFFFFF;
  --ink: #27342E;            /* Dark text */
  --mint: #EAF1EC;           /* Light green background */
  --line: #D7DED9;           /* Borders */
  --muted: #56655d;          /* secondary text (AA on white and mint) */
  --danger: #A3372B;         /* critical / errors – muted, accessible */
  --danger-bg: #F8E6E3;
  --warn-bg: #FBF1DD;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(39,52,46,.06), 0 4px 16px rgba(39,52,46,.06);
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Portal theme hooks (defaults = nurse / public) */
  --accent: var(--green);
  --accent-ink: var(--green-ink);
  --accent-soft: var(--mint);
  --on-accent: #fff;
  --page: #fff;
  --nav-bg: var(--green);
  --nav-ink: #fff;
  --nav-muted: rgba(255,255,255,.72);
  --nav-active-bg: rgba(255,255,255,.14);
  --nav-active-ink: #fff;
  --nav-active-bar: var(--doctor);
}
[data-portal="admin"]  { --accent: var(--gold); --accent-ink: var(--gold-ink); --accent-soft: #f8f0e2; --page: var(--beige);
  --nav-bg: var(--ink); --nav-active-bar: var(--gold); --nav-active-bg: rgba(183,138,59,.18); }
[data-portal="doctor"] { --accent: var(--green); --accent-soft: var(--mint); --page: #f6faf7;
  --nav-bg: var(--doctor); --nav-ink: var(--ink); --nav-muted: #2f4a3c; --nav-active-bg: rgba(255,255,255,.55); --nav-active-ink: var(--green); --nav-active-bar: var(--green); }
[data-portal="family"] { --page: #f7faf8; font-size: 17px; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--page); line-height: 1.5; font-size: 15px; }
[data-portal="family"] body, body[data-portal="family"] { font-size: 17px; }
img { max-width: 100%; display: block; }
a { color: var(--green); }
a:hover { color: var(--green-ink); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; color: var(--ink); }
h1, h2, .serif { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.logo img { width: 42px; height: 42px; }
.logo-word { font-family: var(--serif); font-weight: 700; font-size: 1.45rem; letter-spacing: -.01em; line-height: 1; }
.logo-word b { color: var(--green); font-weight: 700; }
.logo-word i { color: var(--gold); font-style: normal; }
.logo small { display: block; font-family: var(--sans); font-size: .62rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.logo.on-dark .logo-word b { color: #fff; }
.logo.on-dark small { color: rgba(255,255,255,.7); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 999px;
  padding: 10px 20px; font: 600 .95rem/1.2 var(--sans); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s;
  background: var(--accent); color: var(--on-accent); min-height: 42px; }
.btn:hover { background: var(--accent-ink); color: var(--on-accent); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-green { background: var(--green); color: #fff; } .btn-green:hover { background: var(--green-ink); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; } .btn-gold:hover { background: var(--gold-ink); color: #fff; }
.btn-outline { background: transparent; color: var(--green); border-color: var(--green); }
.btn-outline:hover { background: var(--mint); color: var(--green-ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--mint); color: var(--ink); }
.btn-light { background: #fff; color: var(--green); } .btn-light:hover { background: var(--mint); color: var(--green-ink); }
.btn-danger { background: var(--danger); color: #fff; } .btn-danger:hover { background: #862b21; color: #fff; }
.btn-sm { padding: 6px 13px; min-height: 34px; font-size: .85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; min-height: 52px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--green); padding: 0; min-height: 0; font-weight: 600; cursor: pointer; text-decoration: underline; font-size: inherit; }
.btn-link:hover { background: none; color: var(--green-ink); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .field .label { font-weight: 600; font-size: .88rem; color: var(--ink); }
.field .hint { font-size: .8rem; color: var(--muted); }
.field .req { color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=datetime-local],
input[type=search], input[type=month], select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; min-height: 44px; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,91,61,.15); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field .error { color: var(--danger); font-size: .82rem; font-weight: 600; }
.input-unit { display: flex; align-items: center; gap: 8px; } .input-unit span { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; padding: 6px 0; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--green); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.checklist-groups { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.checklist-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--mint); }
.checklist-group h5 { margin: 0 0 4px; color: var(--green); text-transform: uppercase; font-size: .75rem; letter-spacing: .06em; }

/* ---------- Cards, badges, tables ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.1rem; font-family: var(--sans); font-weight: 700; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700;
  background: var(--mint); color: var(--green); white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.gold { background: #f6ecd9; color: var(--gold-ink); }
.badge.grey { background: #eef0ef; color: #5a6560; }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.warn { background: var(--warn-bg); color: #7a5a1f; }
.badge.solid { background: var(--green); color: #fff; }
.badge.outline { background: #fff; border-color: var(--line); color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fafbfa; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid #edf1ee; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; } .table tr.clickable:hover td { background: var(--mint); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: .84rem; } .nowrap { white-space: nowrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; } .spacer { flex: 1; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: block; text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--accent); }
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 1.9rem; font-weight: 700; font-family: var(--serif); color: var(--ink); margin-top: 4px; line-height: 1.1; }
.stat .sub { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.stat.accent { border-left: 4px solid var(--accent); }
.stat.alert { border-left: 4px solid var(--danger); }
dl.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 8px 16px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .85rem; } dl.kv dd { margin: 0; font-weight: 500; white-space: pre-wrap; }
.notice { border-radius: var(--radius-sm); padding: 12px 14px; font-size: .9rem; display: flex; gap: 10px; align-items: flex-start; background: var(--mint); border: 1px solid #cfe0d4; }
.notice.warn { background: var(--warn-bg); border-color: #ecd9b0; } .notice.danger { background: var(--danger-bg); border-color: #efc6c0; color: #6d2017; }
.notice.gold { background: #f8f0e2; border-color: #e7d3ab; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .icon { font-size: 1.8rem; margin-bottom: 6px; opacity: .6; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin; }
.tabs a, .tabs button { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; border: 0; background: none; border-bottom: 3px solid transparent; white-space: nowrap; cursor: pointer; font-family: inherit; }
.tabs a.active, .tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--green); }
.timeline li:last-child { border-left-color: transparent; }
.record { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; background: #fff; }
.record + .record { margin-top: 10px; }
.record.superseded { opacity: .65; background: #fafafa; }
.record-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.record-head strong { font-size: .98rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.vitals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.vital { background: var(--mint); border-radius: var(--radius-sm); padding: 10px 12px; }
.vital .k { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.vital .v { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.vital .v small { font-size: .75rem; color: var(--muted); font-weight: 500; }
.vital.flag { background: var(--warn-bg); outline: 1px solid #e3c98e; }
.chart { width: 100%; height: auto; }
.chart text { font: 11px var(--sans); fill: var(--muted); }

/* ---------- Modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(23,35,29,.45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.15rem; font-family: var(--sans); }
.modal-body { padding: 20px; } .modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 1.4rem; line-height: 1; padding: 6px 10px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--mint); color: var(--ink); }
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 36px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: .92rem; max-width: 420px; animation: toastIn .2s ease-out; }
.toast.success { background: var(--green); } .toast.error { background: var(--danger); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

/* =========================================================================
   Public website
   ========================================================================= */
.site-header { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 74px; gap: 20px; }
.nav-links { display: flex; gap: 4px; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav-links a { text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; padding: 8px 12px; border-radius: 8px; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--green); background: var(--mint); }
.nav-toggle { display: none; }
.hero { position: relative; background: linear-gradient(180deg, #fbf7ef 0%, #fff 100%); overflow: hidden; }
.hero::after { content: ''; position: absolute; left: -10%; right: -10%; bottom: -120px; height: 200px; background: var(--green); border-radius: 50% 50% 0 0; opacity: .06; }
.hero-inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; padding-top: 64px; padding-bottom: 80px; position: relative; z-index: 1; }
.eyebrow { display: inline-block; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-ink); font-weight: 700; margin-bottom: 14px; }
.hero h1 { font-size: clamp(2.3rem, 4.6vw, 3.6rem); color: var(--green); margin-bottom: 14px; }
.tagline { font-family: var(--serif); font-style: italic; font-size: clamp(1.2rem, 2.1vw, 1.5rem); color: var(--ink); margin-bottom: 18px; }
.lead { font-size: 1.12rem; color: #3d4b44; max-width: 560px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-photo { position: relative; }
.hero-photo img { border-radius: 28px 28px 120px 28px; box-shadow: 0 24px 60px rgba(31,91,61,.18); width: 100%; aspect-ratio: 392/262; object-fit: cover; }
.hero-photo .floating { position: absolute; left: -26px; bottom: -22px; background: #fff; border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); }
.hero-photo .floating .dot { width: 40px; height: 40px; border-radius: 50%; background: var(--mint); display: grid; place-items: center; color: var(--green); font-size: 1.2rem; }
.section { padding: 76px 0; } .section.alt { background: var(--mint); } .section.beige { background: #faf5ec; }
.section-head { max-width: 680px; margin: 0 auto 40px; text-align: center; }
.section-head h2 { font-size: clamp(1.8rem, 3.2vw, 2.5rem); color: var(--green); }
.section-head .rule { width: 64px; height: 3px; background: var(--gold); margin: 14px auto 16px; border-radius: 3px; }
.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.service { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; gap: 16px; align-items: flex-start; }
.service .ico { flex: none; width: 52px; height: 52px; border-radius: 50%; background: #f4ecdc; color: var(--gold-ink); display: grid; place-items: center; }
.service .ico svg { width: 26px; height: 26px; }
.service h3 { font-size: 1.05rem; margin-bottom: 4px; font-family: var(--sans); }
.service p { margin: 0; color: var(--muted); font-size: .93rem; }
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; list-style: none; padding: 0; margin: 0; }
.steps li { background: #fff; border-radius: var(--radius); padding: 22px 20px; border: 1px solid var(--line); position: relative; }
.steps li::before { counter-increment: step; content: counter(step); width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; margin-bottom: 12px; }
.steps h3 { font-size: 1rem; font-family: var(--sans); margin-bottom: 4px; } .steps p { color: var(--muted); font-size: .92rem; margin: 0; }
.why { display: grid; grid-template-columns: .9fr 1.1fr; gap: 48px; align-items: center; }
.why img { border-radius: 24px; width: 100%; box-shadow: var(--shadow); }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.ticks li { display: flex; gap: 12px; align-items: flex-start; font-size: 1.02rem; }
.ticks li::before { content: '✓'; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 700; margin-top: 1px; }
.family-band { background: var(--green); color: #fff; border-radius: 28px; padding: 48px; display: grid; grid-template-columns: 1.2fr .8fr; gap: 36px; align-items: center; }
.family-band h2 { color: #fff; font-size: clamp(1.7rem, 3vw, 2.3rem); } .family-band p { color: rgba(255,255,255,.88); }
.family-band .card { color: var(--ink); }
.contact-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 28px; align-items: start; }
.contact-card { background: #faf5ec; border: 1px solid #ecdcbf; border-radius: var(--radius); padding: 26px; }
.contact-line { display: flex; gap: 14px; align-items: center; padding: 10px 0; }
.contact-line .ico { width: 44px; height: 44px; border-radius: 50%; background: var(--gold); color: #fff; display: grid; place-items: center; flex: none; }
.contact-line .ico svg { width: 20px; height: 20px; }
.contact-line strong { display: block; font-size: 1.05rem; }
.page-hero { background: linear-gradient(180deg, #faf5ec, #fff); padding: 58px 0 40px; text-align: center; }
.page-hero h1 { color: var(--green); font-size: clamp(2rem, 4vw, 2.9rem); }
.prose { max-width: 760px; margin: 0 auto; font-size: 1.05rem; }
.prose h2 { color: var(--green); margin-top: 1.6em; }
.values { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-top: 24px; }
.values .card h3 { font-family: var(--sans); font-size: 1.02rem; color: var(--green); }
.site-footer { background: var(--ink); color: rgba(255,255,255,.82); padding: 56px 0 26px; font-size: .93rem; }
.site-footer a { color: #fff; text-decoration: none; } .site-footer a:hover { text-decoration: underline; color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; }
.site-footer h4 { color: #fff; font-family: var(--sans); font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 14px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.14); margin-top: 36px; padding-top: 18px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .82rem; color: rgba(255,255,255,.6); }
.disclaimer { font-size: .85rem; color: var(--muted); border-left: 3px solid var(--gold); padding-left: 12px; }

/* Login page */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--green); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side h2 { color: #fff; font-size: 2.1rem; max-width: 420px; }
.auth-side p { color: rgba(255,255,255,.85); max-width: 420px; }
.auth-side::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 50%; border: 50px solid rgba(183,138,59,.25); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 22px; background: #fff; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h1 { font-size: 1.9rem; color: var(--green); }
.portal-pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 22px; }
.demo-box { margin-top: 22px; background: #faf5ec; border: 1px dashed #d9c08f; border-radius: var(--radius-sm); padding: 12px 14px; font-size: .84rem; }
.demo-box button { margin: 3px 4px 0 0; }

/* =========================================================================
   Portal application shell
   ========================================================================= */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--nav-bg); color: var(--nav-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar .brand { padding: 20px 20px 14px; }
.sidebar .brand .logo-word { font-size: 1.25rem; }
.sidebar .brand .portal-name { margin-top: 12px; display: inline-block; font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.14); }
[data-portal="doctor"] .sidebar .brand .portal-name { background: rgba(255,255,255,.55); color: var(--green); }
[data-portal="admin"] .sidebar .brand .portal-name { background: rgba(183,138,59,.25); color: #f3e3c3; }
.side-nav { list-style: none; margin: 0; padding: 6px 10px 20px; flex: 1; }
.side-nav .group { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--nav-muted); padding: 14px 12px 6px; font-weight: 700; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; text-decoration: none; color: var(--nav-ink); font-weight: 500; font-size: .92rem; position: relative; opacity: .92; }
.side-nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.side-nav a:hover { background: var(--nav-active-bg); opacity: 1; color: var(--nav-ink); }
.side-nav a.active { background: var(--nav-active-bg); color: var(--nav-active-ink); font-weight: 700; opacity: 1; }
.side-nav a.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--nav-active-bar); }
.side-nav .count { margin-left: auto; background: var(--gold); color: #fff; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.sidebar .side-foot { padding: 14px 20px 20px; font-size: .8rem; color: var(--nav-muted); border-top: 1px solid rgba(255,255,255,.12); }
[data-portal="doctor"] .sidebar .side-foot { border-top-color: rgba(39,52,46,.15); }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px); }
[data-portal="admin"] .topbar { background: rgba(255,255,255,.88); }
.topbar .menu-btn { display: none; }
.topbar .who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
[data-portal="doctor"] .avatar { background: var(--doctor); color: var(--ink); }
.who-text { line-height: 1.15; } .who-text strong { display: block; font-size: .9rem; } .who-text span { font-size: .76rem; color: var(--muted); }
.bell { position: relative; } .bell .dot { position: absolute; top: 2px; right: 4px; min-width: 17px; height: 17px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .66rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.sync-pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; border: 1px solid var(--line); background: #fff; cursor: pointer; font-family: inherit; color: var(--ink); }
.sync-pill .led { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.sync-pill.offline .led { background: var(--danger); } .sync-pill.pending .led { background: var(--gold); }
.content { padding: 26px 28px 60px; max-width: 1320px; width: 100%; }
.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title h1 { font-size: 1.75rem; margin: 0; }
.page-title p { margin: 4px 0 0; color: var(--muted); }
.breadcrumb { font-size: .84rem; color: var(--muted); margin-bottom: 6px; } .breadcrumb a { color: var(--muted); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input[type=search] { max-width: 300px; } .filters select { width: auto; min-width: 150px; }
.client-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.client-head .big-avatar { width: 58px; height: 58px; border-radius: 50%; background: var(--mint); color: var(--green); display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; font-family: var(--serif); }
.allergy { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 4px 10px; font-weight: 700; font-size: .82rem; }
.notif-panel { position: absolute; right: 18px; top: 58px; width: 380px; max-width: calc(100vw - 24px); max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0,0,0,.15); z-index: 40; }
.notif-panel .item { padding: 12px 16px; border-bottom: 1px solid #eef1ef; display: block; text-decoration: none; color: inherit; }
.notif-panel .item.unread { background: var(--mint); } .notif-panel .item:hover { background: #f4f7f5; }
.visit-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 16px; display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; align-items: center; }
.visit-card + .visit-card { margin-top: 10px; }
.visit-card .time { text-align: center; background: var(--mint); border-radius: 10px; padding: 8px 4px; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.visit-card .time small { display: block; font-weight: 600; color: var(--muted); font-size: .72rem; }
.visit-card.done { opacity: .75; } .visit-card.active { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,91,61,.12); }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 8px; }
.cal-day { background: #fff; border: 1px solid var(--line); border-radius: 10px; min-height: 160px; padding: 8px; }
.cal-day.today { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(183,138,59,.25); }
.cal-day h4 { font-size: .8rem; margin: 0 0 6px; color: var(--muted); font-family: var(--sans); }
.cal-ev { display: block; font-size: .76rem; padding: 5px 7px; border-radius: 7px; background: var(--mint); margin-bottom: 5px; border-left: 3px solid var(--green); text-decoration: none; color: var(--ink); cursor: pointer; }
.cal-ev.missed, .cal-ev.cancelled { border-left-color: var(--danger); background: var(--danger-bg); } .cal-ev.completed { border-left-color: var(--doctor); background: #f2f7f3; opacity: .85; }
.cal-ev.in_progress { border-left-color: var(--gold); background: var(--warn-bg); }
.step-bar { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; }
.step-bar .s { flex: 1; min-width: 110px; padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: .82rem; font-weight: 600; color: var(--muted); cursor: pointer; text-align: left; font-family: inherit; }
.step-bar .s.done { background: var(--mint); color: var(--green); border-color: #cfe0d4; } .step-bar .s.current { border-color: var(--green); color: var(--ink); box-shadow: 0 0 0 2px rgba(31,91,61,.15); }
.big-action { display: block; width: 100%; text-align: left; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; color: inherit; }
.big-action:hover { border-color: var(--green); background: var(--mint); }
.big-action strong { display: block; font-size: 1rem; } .big-action span { font-size: .85rem; color: var(--muted); }
.emergency-banner { background: var(--danger-bg); border: 1px solid #efc6c0; color: #6d2017; border-radius: var(--radius-sm); padding: 10px 14px; font-size: .88rem; font-weight: 600; }
.pending-sync { border-style: dashed; border-color: var(--gold); background: #fffaf0; }
.print-only { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .service-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .steps { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .calendar { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; z-index: 45; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 44; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 16px 60px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .hero-inner, .why, .contact-grid, .family-band, .auth-page { grid-template-columns: 1fr; }
  .hero-inner { padding-top: 40px; padding-bottom: 60px; gap: 34px; }
  .hero-photo .floating { left: 12px; }
  .auth-side { display: none; }
  .values { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .nav-links { display: none; position: absolute; left: 0; right: 0; top: 74px; background: #fff; flex-direction: column; align-items: stretch; padding: 10px 16px 18px; border-bottom: 1px solid var(--line); }
  .nav-links.open { display: flex; }
  .family-band { padding: 30px 24px; }
  .who-text { display: none; }
}
@media (max-width: 620px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .service-grid, .steps, .footer-grid { grid-template-columns: 1fr; }
  .form-grid, .checklist-groups { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; }
  .visit-card { grid-template-columns: 64px 1fr; } .visit-card > :last-child { grid-column: 1 / -1; }
  .calendar { grid-template-columns: 1fr 1fr; }
  dl.kv { grid-template-columns: 1fr; gap: 2px 0; } dl.kv dd { margin-bottom: 8px; }
  .page-title h1 { font-size: 1.45rem; }
  .hide-sm { display: none; }
  .topbar { gap: 8px; }
  .section { padding: 54px 0; }
  .stat .value { font-size: 1.5rem; }
  .modal-backdrop { padding: 0; } .modal { border-radius: 0; min-height: 100vh; }
}
@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .app { display: block; } .content { padding: 0; max-width: none; }
  .card, .stat, .table-wrap { box-shadow: none; break-inside: avoid; }
  body { background: #fff; } .print-only { display: block; }
}
