/* Bright Life Care — shared tokens + components. Token names are stable: other areas depend on them. */
:root {
  --green: #0b7f91; --green-700: #086a7a; --green-900: #0f2647; --green-50: #e8f7f9; --green-100: #c9edf2;
  --gold: #ef7d00; --gold-50: #fff3e3; --orange: #f39c12; --orange-50: #e8f7f9;
  --bg: #f6f9fc; --surface: #ffffff; --surface-2: #f3f4f8; --ink: #14213d; --ink-2: #475569; --ink-3: #64748b;
  --line: #e6e7ee; --line-2: #eeeff4;
  --ok: #15803d; --ok-bg: #dcfce7; --warn: #b45309; --warn-bg: #fef3c7; --bad: #dc2626; --bad-bg: #fee2e2; --info: #1d4ed8; --info-bg: #dbeafe;
  --radius: 12px; --radius-sm: 8px; --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(27,16,48,.05), 0 2px 8px rgba(27,16,48,.05);
  --shadow-lg: 0 10px 30px rgba(27,16,48,.12);
  --font: "Plus Jakarta Sans", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Playfair Display", Georgia, serif;
  /* design additions */
  --heading: #0f2647;             /* display headings on light surfaces */
  --link: #0b7f91;
  --on-green: #ffffff;            /* text on var(--green) fills */
  --glass: rgba(255,255,255,.72); --glass-line: rgba(255,255,255,.6);
  --table-hover: #f3fafb;
  --ring: 0 0 0 3px rgba(239,125,0,.55);
  --shadow-xl: 0 30px 60px -20px rgba(15,38,71,.28), 0 12px 24px -12px rgba(15,38,71,.18);
  --ease: cubic-bezier(.2,.8,.2,1);
  --chart-1: #0b7f91; --chart-2: #ef7d00; --chart-grid: #eeeff4; --chart-text: #475569;
  color-scheme: light;
}
/* Dark theme: only for areas that opt in via the design head hook (data-area on <html>), so admin/staff stay light. */
@media (prefers-color-scheme: dark) {
  :root[data-area]:not([data-theme="light"]) {
    --green: #3fc6d6; --green-700: #6fd6e2; --green-50: #0e2a33; --green-100: #123b47;
    --gold: #ffad4d; --gold-50: #33240e; --orange: #ffb547; --orange-50: #33240e;
    --bg: #0a1424; --surface: #111e33; --surface-2: #17263f; --ink: #e8eef6; --ink-2: #b4c0d0; --ink-3: #8a9ab0;
    --line: #26364f; --line-2: #1b2a42;
    --ok: #4ade80; --ok-bg: #12301e; --warn: #fbbf24; --warn-bg: #33280e; --bad: #f87171; --bad-bg: #3b1717; --info: #7cb4ff; --info-bg: #142644;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);
    --shadow-lg: 0 14px 34px rgba(0,0,0,.45);
    --shadow-xl: 0 30px 60px -20px rgba(0,0,0,.7), 0 12px 24px -12px rgba(0,0,0,.5);
    --heading: #f2f6fb; --link: #6fd6e2; --on-green: #04161a;
    --glass: rgba(17,30,51,.72); --glass-line: rgba(255,255,255,.08);
    --table-hover: #15243b;
    --chart-1: #3fc6d6; --chart-2: #ffad4d; --chart-grid: #1b2a42; --chart-text: #b4c0d0;
    color-scheme: dark;
  }
}
:root[data-area][data-theme="dark"] {
  --green: #3fc6d6; --green-700: #6fd6e2; --green-50: #0e2a33; --green-100: #123b47;
  --gold: #ffad4d; --gold-50: #33240e; --orange: #ffb547; --orange-50: #33240e;
  --bg: #0a1424; --surface: #111e33; --surface-2: #17263f; --ink: #e8eef6; --ink-2: #b4c0d0; --ink-3: #8a9ab0;
  --line: #26364f; --line-2: #1b2a42;
  --ok: #4ade80; --ok-bg: #12301e; --warn: #fbbf24; --warn-bg: #33280e; --bad: #f87171; --bad-bg: #3b1717; --info: #7cb4ff; --info-bg: #142644;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);
  --shadow-lg: 0 14px 34px rgba(0,0,0,.45);
  --shadow-xl: 0 30px 60px -20px rgba(0,0,0,.7), 0 12px 24px -12px rgba(0,0,0,.5);
  --heading: #f2f6fb; --link: #6fd6e2; --on-green: #04161a;
  --glass: rgba(17,30,51,.72); --glass-line: rgba(255,255,255,.08);
  --table-hover: #15243b;
  --chart-1: #3fc6d6; --chart-2: #ffad4d; --chart-grid: #1b2a42; --chart-text: #b4c0d0;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { max-width: 100%; display: block; }
img.pimg { height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; } h4 { font-size: 1rem; }
.display { font-family: var(--font-display); font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-2); } .small { font-size: .85rem; } .tiny { font-size: .75rem; }
.num { font-variant-numeric: tabular-nums; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
::selection { background: rgba(239,125,0,.3); }

/* Focus: visible ring for keyboard users everywhere */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent; min-height: 40px;
  font: 600 .92rem/1.2 var(--font); cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .18s, box-shadow .18s, transform .18s var(--ease), color .18s, border-color .18s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(135deg, #4fd7ec, var(--green)); color: #fff; box-shadow: 0 6px 16px -6px rgba(11,127,145,.55); } .btn-primary:hover { background: var(--green-700); box-shadow: 0 10px 22px -8px rgba(11,127,145,.6); }
.btn-gold { background: linear-gradient(135deg, #ffa94d, var(--gold)); color: #fff; box-shadow: 0 6px 16px -6px rgba(239,125,0,.6); } .btn-gold:hover { background: #1569ad; }
.btn-accent { background: linear-gradient(135deg, #5ce9ff, var(--orange)); color: #fff; box-shadow: 0 6px 16px -6px rgba(243,156,18,.55); } .btn-accent:hover { background: #1faec4; }
.btn-outline { background: var(--surface); border-color: var(--line); color: var(--ink); } .btn-outline:hover { border-color: var(--green); color: var(--green); }
.btn-ghost { background: transparent; color: var(--green); } .btn-ghost:hover { background: var(--green-50); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .82rem; min-height: 34px; } .btn-lg { padding: 13px 24px; font-size: 1rem; min-height: 48px; } .btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-h h2, .card-h h3 { margin: 0; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { font-size: .78rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Grid */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .between { justify-content: space-between; }
.stack > * + * { margin-top: 16px; }

/* Forms */
label, .label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); min-height: 42px;
  font: 400 .95rem/1.3 var(--font); outline: none; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(63,198,214,.22); }
input[readonly] { background: var(--surface-2); }
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 14px; } .hint { font-size: .78rem; color: var(--ink-3); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); background: var(--surface-2); padding: 10px 12px; white-space: nowrap; }
.table td { padding: 10px 12px; border-top: 1px solid var(--line-2); vertical-align: middle; }
.table tr:hover td { background: var(--table-hover); }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 32px 16px; color: var(--ink-3); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); } .b-warn { background: var(--warn-bg); color: var(--warn); } .b-bad { background: var(--bad-bg); color: var(--bad); }
.b-info { background: var(--info-bg); color: var(--info); } .b-gold { background: var(--gold-50); color: #8a5d00; } .b-green { background: var(--green-50); color: var(--green); }

/* Alerts / flash */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 16px; border: 1px solid transparent; }
.alert-ok { background: var(--ok-bg); color: #14532d; border-color: #bbf7d0; } .alert-bad { background: var(--bad-bg); color: #7f1d1d; border-color: #fecaca; }
.alert-warn { background: var(--warn-bg); color: #78350f; border-color: #fde68a; } .alert-info { background: var(--info-bg); color: #1e3a8a; border-color: #bfdbfe; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; font: 600 .88rem var(--font); color: var(--ink-2); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none; }
.tabs .active { color: var(--green); border-bottom-color: var(--green); }

/* Progress */
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #ffa94d); border-radius: 99px; }

/* Pagination */
.pager { display: flex; gap: 6px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.pager a, .pager span { padding: 6px 11px; border: 1px solid var(--line); border-radius: 6px; font-size: .85rem; background: var(--surface); min-width: 36px; text-align: center; }
.pager .cur { background: var(--green); color: var(--on-green); border-color: var(--green); }

/* Modal (use <dialog class="modal">) */
dialog.modal { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); background: var(--surface); color: var(--ink); }
dialog.modal::backdrop { background: rgba(27,16,48,.45); backdrop-filter: blur(3px); }
dialog.modal .m-h { padding: 16px 18px; border-bottom: 1px solid var(--line-2); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
dialog.modal .m-b { padding: 18px; } dialog.modal .m-f { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Design system additions (site / member / franchise) ---------- */
/* Theme toggle */
.theme-tg { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: inline-grid; place-items: center; cursor: pointer; flex: none; position: relative; overflow: hidden; transition: background .2s, color .2s, border-color .2s; }
.theme-tg:hover { color: var(--gold); border-color: var(--gold); }
.theme-tg svg { width: 19px; height: 19px; position: absolute; transition: transform .45s var(--ease), opacity .3s; }
.theme-tg .i-moon { transform: translateY(0) rotate(0); opacity: 1; }
.theme-tg .i-sun { transform: translateY(26px) rotate(90deg); opacity: 0; }
html.is-dark .theme-tg .i-moon { transform: translateY(-26px) rotate(-90deg); opacity: 0; }
html.is-dark .theme-tg .i-sun { transform: none; opacity: 1; }

/* Toasts (server flash + JS) */
.toast-stack { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast-x { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 16px; border-radius: 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-xl); font-size: .9rem; position: relative; overflow: hidden; animation: toastIn .45s var(--ease) both; }
.toast-x.out { animation: toastOut .35s ease forwards; }
.toast-x .t-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.toast-x .t-ic svg { width: 17px; height: 17px; }
.toast-x .t-msg { flex: 1; padding-top: 4px; line-height: 1.4; }
.toast-x .t-x { border: 0; background: none; color: var(--ink-3); cursor: pointer; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.toast-x .t-x:hover { background: var(--surface-2); color: var(--ink); }
.toast-x::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: .25; transform-origin: left; animation: toastBar 6s linear forwards; }
.toast-x.ok .t-ic { background: var(--ok-bg); color: var(--ok); } .toast-x.ok::after { background: var(--ok); opacity: .7; }
.toast-x.bad .t-ic { background: var(--bad-bg); color: var(--bad); } .toast-x.bad::after { background: var(--bad); opacity: .7; }
.toast-x.warn .t-ic { background: var(--warn-bg); color: var(--warn); } .toast-x.warn::after { background: var(--warn); opacity: .7; }
.toast-x.info .t-ic { background: var(--info-bg); color: var(--info); } .toast-x.info::after { background: var(--info); opacity: .7; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
@keyframes toastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (max-width: 640px) { .toast-stack { top: auto; bottom: 84px; right: 16px; left: 16px; width: auto; } }

/* Skeleton loaders */
.skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; color: transparent !important; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: skel 1.3s infinite; }
html.is-dark .skel::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
.skel-line { height: 12px; margin: 8px 0; } .skel-line.w60 { width: 60%; } .skel-line.w80 { width: 80%; } .skel-block { height: 120px; border-radius: 12px; }
@keyframes skel { to { transform: translateX(100%); } }

/* Page fade-in */
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
html.js body.m-body .m-content, html.js body.fr main { animation: pageIn .45s var(--ease) both; }

/* Dark-mode fixes for literal colours in shared components */
html.is-dark .alert-ok { color: #bbf7d0; border-color: #1f5a35; } html.is-dark .alert-bad { color: #fecaca; border-color: #6b2222; }
html.is-dark .alert-warn { color: #fde68a; border-color: #5e4a12; } html.is-dark .alert-info { color: #c7dcff; border-color: #24406e; }
html.is-dark .b-gold { color: #bfe6ec; }
html.is-dark .btn-primary { background: linear-gradient(135deg, #1f6e7a, #237885); color: #fff; }
html.is-dark .btn-outline { background: var(--surface-2); }
html.is-dark img { color-scheme: light; }
/* the wordmark PNG is dark-on-transparent: give it a light plate in dark mode */
html.is-dark .m-logo img, html.is-dark .logo img, html.is-dark .mn-head img { background: #fff; border-radius: 12px; padding: 4px 10px; }

/* Mobile: comfortable touch targets */
@media (max-width: 640px) {
  .btn { min-height: 44px; } .btn-sm { min-height: 40px; }
  .input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=date], input[type=search], select { min-height: 46px; font-size: 16px; }
  .pager a, .pager span { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; }
  .tabs a, .tabs button { min-height: 44px; }
}

/* Screenshot mode (?shot=1): settle entrance transitions instantly */
html.shot .reveal { transition: none !important; }
html.shot .m-content, html.shot body.fr main { animation: none !important; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* Responsive safety net (QA 2026-10-26): grid/flex children may shrink below their content width,
   so wide tables or long text scroll inside their own box instead of widening the page. */
.grid > *, .form-grid > *, .form-grid3 > * { min-width: 0; }
.card { min-width: 0; }
.table-wrap, .card .table-wrap { max-width: 100%; }
img, svg, video, canvas, iframe { max-width: 100%; }
