/* Eightyniners Staff Portal — styles. Brand green from the group logo (#2B4039); grainy green wallpapers from the Assets folder. */

:root {
  --brand: #2b4039;
  --brand-2: #3d5a50;
  --brand-tint: #e3ebe7;
  --brand-ink: #ffffff;
  --accent: #806375;
  --gold: #b8913f;
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #1d2824;
  --ink-soft: #5d6a65;
  --ink-faint: #8b958f;
  --line: #e6e0d6;
  --line-strong: #d3cabc;
  --ok: #2f7a55;
  --ok-bg: #e2f1e8;
  --warn: #9a6a12;
  --warn-bg: #fbefd6;
  --bad: #a63d3d;
  --bad-bg: #f8e1df;
  --info-bg: #e6eef6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(29, 40, 36, .05), 0 8px 24px -12px rgba(29, 40, 36, .18);
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --tabbar-h: 68px;
  --emerald: #1e6b59;
  --mint: #43a07a;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --brand: #8fb5a6;
    --brand-2: #a9c9bc;
    --brand-tint: #22322c;
    --brand-ink: #10201a;
    --accent: #c9a6b8;
    --gold: #d8b56a;
    --bg: #121a17;
    --surface: #1a2420;
    --surface-2: #1f2a26;
    --ink: #eef1ec;
    --ink-soft: #aab6b0;
    --ink-faint: #7f8b85;
    --line: #2c3833;
    --line-strong: #3b4a44;
    --ok: #7cc9a0;
    --ok-bg: #1d3328;
    --warn: #e2b866;
    --warn-bg: #3a2f18;
    --bad: #ec9a92;
    --bad-bg: #3d2222;
    --info-bg: #1f2b36;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --brand: #8fb5a6;
  --brand-2: #a9c9bc;
  --brand-tint: #22322c;
  --brand-ink: #10201a;
  --accent: #c9a6b8;
  --gold: #d8b56a;
  --bg: #121a17;
  --surface: #1a2420;
  --surface-2: #1f2a26;
  --ink: #eef1ec;
  --ink-soft: #aab6b0;
  --ink-faint: #7f8b85;
  --line: #2c3833;
  --line-strong: #3b4a44;
  --ok: #7cc9a0;
  --ok-bg: #1d3328;
  --warn: #e2b866;
  --warn-bg: #3a2f18;
  --bad: #ec9a92;
  --bad-bg: #3d2222;
  --info-bg: #1f2b36;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}



/* ---------- type scale ----------
   One set of sizes for the whole portal (rem, so the "Larger text" setting scales everything together):
   headline  — page titles (h1)                          28
   title     — section and card headers (h2), big figures 20
   sub       — subtitles under a page title, sub-heads    17
   body      — reading text                               15
   body-sm   — dense rows: tables, lists                  14
   label     — buttons, form labels, secondary lines      13
   caption   — footnotes, captions, column headers        12
   tiny      — badges and overlines                       11  */
:root {
  --fs-hero: 3.25rem; --fs-display: 2rem; --fs-headline: 1.75rem; --fs-title: 1.25rem; --fs-sub: 1.0625rem;
  --fs-body: .9375rem; --fs-body-sm: .875rem; --fs-label: .8125rem; --fs-caption: .75rem; --fs-tiny: .6875rem;
}
@media (max-width: 640px) { :root { --fs-hero: 2.75rem; --fs-display: 1.625rem; --fs-headline: 1.5rem; --fs-title: 1.125rem; --fs-sub: 1rem; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-body)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font: 600 var(--fs-headline)/1.15 var(--font-display); letter-spacing: -.01em; }
h2 { font: 600 var(--fs-title)/1.25 var(--font-display); }
h3 { font-size: var(--fs-body); font-weight: 600; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.small { font-size: var(--fs-label); }
.tiny { font-size: var(--fs-caption); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- layout ---------- */
.app { min-height: 100dvh; }
.sidebar { display: none; }
.main { padding: 16px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  color: #fff;
  background: linear-gradient(rgba(4, 16, 12, .35), rgba(4, 16, 12, .45)), url('/img/bg/green4-1200.jpg') 40% 55% / cover, #0b2a20;
}
.topbar .wordmark { height: 26px; width: auto; }
.topbar .who { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.16); color: #fff; font-weight: 600; font-size: var(--fs-label); border: 0; cursor: pointer;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-faint); text-decoration: none; font-size: var(--fs-tiny); font-weight: 500; position: relative;
}
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a[aria-current='page'] { color: var(--brand); }
.tabbar a[aria-current='page']::before {
  content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand);
}
.badge-dot {
  position: absolute; top: 8px; left: calc(50% + 8px); min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 9px; background: var(--bad); color: #fff; font-size: var(--fs-tiny); line-height: 17px; text-align: center; font-weight: 600;
}

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 248px 1fr; }
  .topbar, .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; align-self: start;
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent;
    color: #fff; padding: 26px 16px 18px;
    background: linear-gradient(180deg, rgba(5, 18, 14, .25) 0%, rgba(5, 18, 14, .55) 100%), url('/img/bg/green2-700.jpg') center 30% / cover, #0f2e26;
  }
  .sidebar::-webkit-scrollbar { width: 6px; } .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 3px; }
  .sidebar > * { flex-shrink: 0; }
  .sidebar .logo { width: 150px; margin: 4px 10px 28px; }
  .sidebar nav { display: flex; flex-direction: column; gap: 2px; }
  .sidebar nav .group { margin: 18px 12px 6px; font-size: var(--fs-tiny); letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
  .sidebar nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: rgba(255,255,255,.82); text-decoration: none; font-weight: 500; font-size: var(--fs-body-sm); position: relative;
  }
  .sidebar nav a svg { width: 20px; height: 20px; opacity: .9; }
  .sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
  .sidebar nav a[aria-current='page'] { background: rgba(255,255,255,.14); color: #fff; }
  .sidebar nav a .count { margin-left: auto; background: #fff; color: var(--brand); border-radius: 9px; padding: 0 7px; font-size: var(--fs-tiny); font-weight: 600; }
  .sidebar .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.07); }
  .sidebar .me .avatar { flex: none; }
  .sidebar .me .name { font-weight: 600; font-size: var(--fs-label); line-height: 1.2; }
  .sidebar .me .role { font-size: var(--fs-caption); opacity: .7; }
  .main { padding: 36px 40px 60px; }
}

/* ---------- cards & grid ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head a { font-size: var(--fs-label); font-weight: 500; text-decoration: none; }
.grid { display: grid; gap: 14px; }
.grid > .card + .card { margin-top: 0; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .grid-home { grid-template-columns: 1.35fr 1fr; align-items: start; } }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.empty { text-align: center; padding: 26px 12px; color: var(--ink-soft); }
.empty svg { width: 34px; height: 34px; opacity: .45; margin: 0 auto 8px; display: block; }

/* ---------- today hero ---------- */
.hero {
  color: #fff; border: 0; position: relative; overflow: hidden; min-height: 176px;
  background: linear-gradient(100deg, rgba(4, 18, 12, .82) 0%, rgba(4, 18, 12, .55) 50%, rgba(4, 18, 12, .1) 100%), url('/img/bg/green1-1200.jpg') 65% 55% / cover, #0b2a20;
}
.hero .eyebrow { font-size: var(--fs-caption); letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.hero .shift-big { font: 600 var(--fs-display)/1.1 var(--font-display); margin: 6px 0 4px; }
.hero .meta { opacity: .85; font-size: var(--fs-body-sm); }
.hero .chip-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .pill { background: rgba(255,255,255,.14); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }


/* ---------- week strip ---------- */
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(64px, 1fr); gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.day {
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px; text-align: center; background: var(--surface-2);
}
.day .dow { font-size: var(--fs-tiny); color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; }
.day .dnum { font-weight: 600; font-size: var(--fs-sub); margin: 1px 0 5px; }
.day.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.day.ph { background: var(--brand-tint); }

/* ---------- shift chip ---------- */
.shift {
  /* Equal square cells, coloured like the Monthly Schedule workbook. */
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; padding: 0; border-radius: 8px;
  font-size: var(--fs-tiny); font-weight: 600; letter-spacing: .01em; line-height: 1;
  color: #1d2824; background: #eee; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
}
.shift.none { background: transparent; color: var(--ink-faint); box-shadow: none; }

/* ---------- pills & status ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: var(--fs-caption); font-weight: 500; background: var(--surface-2); color: var(--ink-soft); border: 1px solid transparent; white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--ink-soft); }
.pill.brand { background: var(--brand-tint); color: var(--brand); }

/* ---------- balance rings ---------- */
.rings { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px 8px; }
.ring { text-align: center; }
.ring svg { width: 84px; height: 84px; display: block; margin: 0 auto 6px; }
.ring .val { font: 600 var(--fs-title)/1 var(--font); fill: var(--ink); }
.ring .of { font-size: var(--fs-tiny); fill: var(--ink-faint); }
.ring .label { font-size: var(--fs-caption); font-weight: 500; }
.ring .sub { font-size: var(--fs-tiny); color: var(--ink-faint); }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 2px; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 500; }
.item .sub { font-size: var(--fs-caption); color: var(--ink-soft); }
.item-link { text-decoration: none; color: inherit; border-radius: 10px; }
.item-link:hover .title { color: var(--brand); }
.icon-circle { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); flex: none; }
.icon-circle svg { width: 19px; height: 19px; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 500; font-size: var(--fs-body-sm); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 34px; padding: 0 12px; font-size: var(--fs-label); border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 38px; padding: 0; }

.field { display: grid; gap: 6px; margin-bottom: 14px; align-content: start; }
.field label, .label { font-size: var(--fs-label); font-weight: 500; color: var(--ink-soft); }
.field .hint { font-size: var(--fs-caption); color: var(--ink-faint); }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 13px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 84px; padding: 11px 13px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.input.sm { height: 36px; border-radius: 10px; font-size: var(--fs-body-sm); }
.check { display: flex; align-items: center; gap: 10px; font-size: var(--fs-body-sm); margin: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.form-grid { display: grid; gap: 0 14px; }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-size: var(--fs-label); font-weight: 500; color: var(--ink-soft); cursor: pointer;
}
.segmented button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.alert { padding: 11px 14px; border-radius: 12px; font-size: var(--fs-body-sm); margin-bottom: 14px; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.info { background: var(--info-bg); color: var(--ink); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- auth ---------- */
.auth {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: linear-gradient(rgba(3, 14, 10, .1), rgba(3, 14, 10, .3)), url('/img/bg/green1-2400.jpg') 60% center / cover, #0b2a20;
}
@media (max-width: 700px), (orientation: portrait) {
  .auth { background-image: linear-gradient(rgba(3, 14, 10, .1), rgba(3, 14, 10, .3)), url('/img/bg/green5-1000.jpg'); background-position: center; }
}

.auth-card {
  width: 100%; max-width: 400px; border-radius: 24px; padding: 30px 26px 26px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, .3); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .7);
}
.auth-card .logo { width: 150px; margin: 0 auto 22px; }
.auth-card h1 { font-size: var(--fs-headline); text-align: center; }
.auth-card .lead { text-align: center; color: var(--ink-soft); margin: 6px 0 22px; font-size: var(--fs-body-sm); }
.auth-foot { text-align: center; color: rgba(255,255,255,.85); text-shadow: 0 1px 8px rgba(0,0,0,.5); font-size: var(--fs-caption); margin-top: 18px; }

/* ---------- month nav ---------- */
.monthnav { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.monthnav .label { min-width: 132px; text-align: center; font-weight: 600; color: var(--ink); font-size: var(--fs-body-sm); }
.monthnav button { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 9px; cursor: pointer; display: grid; place-items: center; color: var(--ink-soft); }
.monthnav button:hover { background: var(--surface-2); color: var(--ink); }
.monthnav svg { width: 18px; height: 18px; }

/* ---------- my calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: var(--fs-tiny); color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; padding-bottom: 2px; }
.cal .cell {
  min-height: 74px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 6px;
  display: flex; flex-direction: column; gap: 4px; position: relative;
}
.cal .cell.blank { background: transparent; border-color: transparent; }
.cal .cell .d { font-size: var(--fs-caption); font-weight: 600; color: var(--ink-soft); }
.cal .cell.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal .cell.today .d { color: var(--brand); }
.cal .cell.ph { background: var(--brand-tint); }
.cal .cell .shift { align-self: center; }
.cal .cell .loc { font-size: var(--fs-tiny); color: var(--ink-faint); text-align: center; }
.cal .cell .ph-tag { font-size: var(--fs-tiny); color: var(--brand); font-weight: 600; line-height: 1.15; }
@media (max-width: 520px) {
  .cal { gap: 4px; }
  .cal .cell { min-height: 62px; padding: 4px; border-radius: 9px; }
  .cal .cell .shift { width: 28px; height: 28px; font-size: var(--fs-tiny); border-radius: 7px; }
  .cal .cell .ph-tag { display: none; }
  .cal .cell .loc { font-size: var(--fs-tiny); }
}

/* ---------- team grid ---------- */
.grid-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-height: 72vh; }
table.team { border-collapse: separate; border-spacing: 0; font-size: var(--fs-caption); min-width: 100%; }
table.team th, table.team td { padding: 5px 3px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.team thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; font-weight: 500; color: var(--ink-faint); }
table.team thead th .n { display: block; color: var(--ink); font-weight: 600; font-size: var(--fs-label); }
table.team th.name, table.team td.name {
  position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; padding: 6px 12px; min-width: 150px;
  border-right: 1px solid var(--line); font-size: var(--fs-label);
}
table.team thead th.name { z-index: 3; }
table.team td.name .t { display: block; font-size: var(--fs-tiny); color: var(--ink-faint); }
/* Rows alternate (zebra); weekend and public-holiday columns are tinted on top; today is outlined in the header. */
table.team { --wk: color-mix(in srgb, var(--brand) 11%, transparent); --ph: color-mix(in srgb, var(--gold) 24%, transparent); --today: color-mix(in srgb, var(--brand) 18%, transparent); }
table.team tbody tr td { background-color: var(--surface); }
table.team tbody tr:nth-child(even) td { background-color: color-mix(in srgb, var(--ink) 5%, var(--surface)); }
table.team tbody tr.me td { background-color: color-mix(in srgb, var(--gold) 12%, var(--surface)); }
table.team .col-wknd { background-image: linear-gradient(var(--wk), var(--wk)); }
table.team .col-ph { background-image: linear-gradient(var(--ph), var(--ph)); }
table.team .col-today { background-image: linear-gradient(var(--today), var(--today)); }
table.team thead th.col-wknd, table.team thead th.col-wknd .n { color: var(--brand); }
table.team thead th.col-ph .n { color: color-mix(in srgb, var(--gold) 80%, var(--ink)); }
table.team thead th.col-ph .n::after { content: 'PH'; display: block; font-size: var(--fs-tiny); letter-spacing: .06em; font-weight: 700; color: color-mix(in srgb, var(--gold) 85%, var(--ink)); }
table.team thead th.col-today .n { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.lg-swatch { width: 36px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background-color: var(--surface); }
.lg-swatch.wk { background-image: linear-gradient(color-mix(in srgb, var(--brand) 11%, transparent), color-mix(in srgb, var(--brand) 11%, transparent)); }
.lg-swatch.ph { background-image: linear-gradient(color-mix(in srgb, var(--gold) 24%, transparent), color-mix(in srgb, var(--gold) 24%, transparent)); }
@media (max-width: 600px) { .lg-swatch { width: 34px; height: 28px; } }
table.team .shift { width: 32px; height: 32px; font-size: var(--fs-tiny); }
table.team td { padding: 3px 2px; }
table.team td.cellbtn { cursor: pointer; }
table.team td.cellbtn:hover { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 6px; }
table.team td.dirty { box-shadow: inset 0 0 0 2px var(--gold); border-radius: 6px; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: var(--fs-caption); color: var(--ink-soft); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- paint palette (roster editor) ---------- */
.palette { display: flex; flex-wrap: wrap; gap: 6px; }
.palette button { border: 2px solid transparent; border-radius: 9px; padding: 0; background: none; cursor: pointer; }
.palette button[aria-pressed='true'] { border-color: var(--ink); }
.palette .shift { width: 40px; height: 40px; font-size: var(--fs-caption); border-radius: 9px; }
.sticky-bar {
  position: sticky; bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); z-index: 20;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
@media (min-width: 900px) { .sticky-bar { bottom: 16px; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-body-sm); }
table.data th { text-align: left; font-size: var(--fs-caption); font-weight: 500; color: var(--ink-faint); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--surface-2); }
table.data .r { text-align: right; }

/* ---------- sheet / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 22, 19, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; background: var(--surface);
  border-radius: 22px 22px 0 0; padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); animation: up .2s ease;
}
.sheet.wide { max-width: 980px; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 4px auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
@media (min-width: 640px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 22px; padding: 22px 26px 24px; }
  .sheet .grab { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-size: var(--fs-body-sm); z-index: 60;
  box-shadow: var(--shadow); animation: up .2s ease; max-width: calc(100% - 32px);
}
@media (min-width: 900px) { .toast { bottom: 28px; } }

.date-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.date-chip { display: inline-flex; flex-direction: column; align-items: center; padding: 5px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); line-height: 1.15; }
.date-chip b { font-size: var(--fs-body); }
.date-chip span { font-size: var(--fs-tiny); color: var(--ink-faint); text-transform: uppercase; }

.secret { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: var(--fs-title); letter-spacing: .03em; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 12px; padding: 14px; text-align: center; margin: 10px 0; user-select: all; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; height: 120px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- payslip ---------- */
.payslip {
  background: #fff; color: #1d2824; border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow);
  max-width: 820px; margin: 0 auto; overflow: hidden;
}
.payslip .ps-head { background: linear-gradient(95deg, rgba(3, 20, 18, .85) 0%, rgba(3, 20, 18, .5) 60%, rgba(3, 20, 18, .15) 100%), url('/img/bg/green3-1200.jpg') 40% 40% / cover, #0b2a20; color: #fff; padding: 26px 30px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.payslip .ps-head img { height: 58px; width: auto; }
.payslip .ps-head .ttl { text-align: right; }
.payslip .ps-head .ttl .k { font-size: var(--fs-tiny); letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.payslip .ps-head .ttl .v { font: 600 var(--fs-headline)/1.1 'Playfair Display', Georgia, serif; }
.payslip .ps-body { padding: 26px 30px 30px; }
.payslip .ps-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; padding-bottom: 20px; border-bottom: 1px solid #e6e0d6; }
@media (min-width: 640px) { .payslip .ps-meta { grid-template-columns: repeat(4, 1fr); } }
.payslip .ps-meta .k { font-size: var(--fs-tiny); color: #8b958f; text-transform: uppercase; letter-spacing: .06em; }
.payslip .ps-meta .v { font-weight: 500; font-size: var(--fs-body-sm); }
.payslip .ps-cols { display: grid; gap: 22px; margin-top: 22px; }
@media (min-width: 640px) { .payslip .ps-cols { grid-template-columns: 1fr 1fr; gap: 34px; } }
.payslip h4 { margin: 0 0 8px; font-size: var(--fs-caption); letter-spacing: .1em; text-transform: uppercase; color: #2b4039; }
.payslip .line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed #e6e0d6; font-size: var(--fs-body-sm); }
.payslip .line .note { display: block; font-size: var(--fs-caption); color: #8b958f; }
.payslip .line.total { border-bottom: 0; border-top: 1px solid #1d2824; margin-top: 4px; font-weight: 600; }
/* Gross pay and Total deductions sit on the same line, at the bottom of their columns. */
.payslip .ps-cols section { display: flex; flex-direction: column; }
.payslip .ps-cols section .line.total { margin-top: auto; }
.payslip .ps-cols section .line:nth-last-child(2) { margin-bottom: 4px; }
.payslip .nett { margin-top: 26px; background: #f3efe7; border-radius: 14px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.payslip .nett .k { font-size: var(--fs-caption); letter-spacing: .1em; text-transform: uppercase; color: #5d6a65; }
.payslip .nett .v { font: 600 var(--fs-display)/1 'Playfair Display', Georgia, serif; color: #2b4039; }
.payslip .ps-foot { margin-top: 22px; font-size: var(--fs-caption); color: #8b958f; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.payslip .notes { margin-top: 16px; font-size: var(--fs-label); color: #5d6a65; background: #faf8f4; border-radius: 10px; padding: 10px 14px; }

.money-hidden { filter: blur(7px); user-select: none; transition: filter .2s; cursor: pointer; }

/* ---------- payslip editor ---------- */
.lines { display: grid; gap: 8px; }
.line-row { display: grid; grid-template-columns: 1fr 120px 36px; gap: 8px; align-items: center; }
.line-row .lbl { font-size: var(--fs-body-sm); }
.line-row .note-input { grid-column: 1 / -1; }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.totals div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.totals .k { font-size: var(--fs-caption); color: var(--ink-faint); }
.totals .v { font-weight: 600; font-size: var(--fs-sub); }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; }
  .sidebar, .topbar, .tabbar, .no-print, .toast { display: none !important; }
  .app { display: block; }
  .main { padding: 0 !important; max-width: none; }
  .payslip { box-shadow: none; border: 0; max-width: none; }
  .payslip .ps-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .payslip .nett { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .money-hidden { filter: none; }
}
svg.inline { width: 15px; height: 15px; vertical-align: -3px; display: inline-block; }
.alert.row svg { width: 20px; height: 20px; flex: none; }
.grid > *, .stack > * { min-width: 0; }
.main { width: 100%; }
.payslip .ps-head .brand img { height: 40px; width: auto; }
.payslip .ps-head .brand .co { font-size: var(--fs-caption); opacity: .75; margin-top: 6px; letter-spacing: .02em; }
.payslip .nett .v { white-space: nowrap; }
@media (max-width: 480px) {
  .payslip .ps-head, .payslip .ps-body { padding-left: 18px; padding-right: 18px; }
  .payslip .ps-head .brand img { height: 30px; }
  .payslip .ps-head .ttl .v { font-size: var(--fs-title); }
  .payslip .nett { padding: 14px 16px; }
  .payslip .nett .v { font-size: var(--fs-headline); }
}

@media (max-width: 480px) { .payslip .ps-head .brand .co { display: none; } }

/* ---------- avatars, docs, team ---------- */
.avatar-img, .avatar-ph { border-radius: 50%; flex: none; display: inline-grid; place-items: center; object-fit: cover; background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.sidebar .avatar-ph, .topbar .avatar-ph { background: rgba(255,255,255,.16); color: #fff; }
.who a, .sidebar .me { text-decoration: none; }
table.team td.name .who-cell { display: flex; align-items: center; gap: 9px; }
.doc-link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); font-size: var(--fs-caption); text-decoration: none; color: var(--ink); max-width: 100%; }
.doc-link svg { width: 15px; height: 15px; color: var(--brand); flex: none; }
.doc-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.team-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.person { display: flex; gap: 14px; align-items: center; padding: 14px; cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit; }
.person:hover { border-color: var(--brand); }
.person .n { font-weight: 600; line-height: 1.25; }
.person .t { font-size: var(--fs-caption); color: var(--ink-soft); }
.person .c { font-size: var(--fs-caption); color: var(--ink-faint); margin-top: 2px; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 20px 0 10px; font-size: var(--fs-label); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.section-title svg { width: 15px; height: 15px; }
.private-note { display: flex; gap: 8px; align-items: center; font-size: var(--fs-caption); color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.private-note svg { width: 16px; height: 16px; flex: none; color: var(--brand); }
.photo-edit { position: relative; display: inline-block; }
.photo-edit button { position: absolute; right: -2px; bottom: -2px; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface); background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; }
.photo-edit button svg { width: 16px; height: 16px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: var(--fs-body-sm); }
dl.facts dt { color: var(--ink-faint); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.branch-text { font-family: var(--font-display); font-weight: 600; color: var(--ink); letter-spacing: .01em; }
.branch-head { display: flex; align-items: center; gap: 14px; margin: 0 0 12px; min-height: 40px; }
.branch-head picture, .branch-head img { display: block; }
.auth-card picture { display: block; }
.auth-card .logo { width: 170px; }
.sidebar .logo { width: 128px; }
.hero .branch-ico { position: absolute; right: 18px; bottom: 16px; height: 44px; width: auto; opacity: .85; z-index: 1; }

/* ---------- org chart (tree) ---------- */
.tree-wrap { overflow-x: auto; padding: 6px 0 18px; }
.tree { display: inline-block; min-width: 100%; text-align: center; }
.tree ul { display: flex; justify-content: center; padding: 22px 0 0; margin: 0; position: relative; }
.tree li { list-style: none; position: relative; padding: 22px 8px 0; display: flex; flex-direction: column; align-items: center; }
.tree li::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 0; border-top: 2px solid var(--line-strong); }
.tree li:first-child::before { left: calc(50% - 1px); }
.tree li:last-child::before { right: calc(50% - 1px); }
.tree li:only-child::before { display: none; }
.tree li::after { content: ''; position: absolute; top: 0; left: calc(50% - 1px); width: 0; height: 22px; border-left: 2px solid var(--line-strong); }
.tree ul ul::before { content: ''; position: absolute; top: 0; left: calc(50% - 1px); width: 0; height: 22px; border-left: 2px solid var(--line-strong); }
.tree ul.roots { padding-top: 0; gap: 28px; }
.tree ul.roots > li { padding-top: 0; }
.tree ul.roots > li::before, .tree ul.roots > li::after { display: none; }
.leaf-stack { display: flex; flex-direction: column; gap: 8px; position: relative; }
.leaf-stack .ls-item { position: relative; }
.leaf-stack .ls-item + .ls-item::before { content: ''; position: absolute; top: -8px; left: calc(50% - 1px); height: 8px; border-left: 2px solid var(--line-strong); }
.tree .person { margin: 0; }

/* Equal-size name boxes everywhere (text is fitted inside) */
.person { width: 200px; height: 84px; padding: 10px 12px; gap: 10px; position: relative; overflow: hidden; }
.team-grid .person { width: 100%; }
.person .ptext { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 1px; text-align: left; }
.person .n, .person .t { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.person .n { font-size: var(--fs-label); font-weight: 600; line-height: 1.2; -webkit-line-clamp: 2; }
.person .t { font-size: var(--fs-tiny); line-height: 1.25; color: var(--ink-soft); -webkit-line-clamp: 2; }
.person .c { font-size: var(--fs-tiny); color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person.lead { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent), var(--shadow); }

/* Phones: the same tree as an indented outline */
@media (max-width: 720px) {
  .tree-wrap { overflow: visible; }
  .tree { display: block; text-align: left; }
  .tree ul { display: block; padding: 0 0 0 18px; margin-left: 20px; border-left: 2px solid var(--line-strong); }
  .tree ul.roots { padding: 0; margin: 0; border: 0; }
  .tree ul.roots > li + li { margin-top: 18px; }
  .tree li { display: block; padding: 10px 0 0; }
  .tree li::before { display: block !important; content: ''; position: absolute; top: 52px; left: -18px; width: 16px; height: 0; border: 0; border-top: 2px solid var(--line-strong); border-radius: 0; }
  .tree li::after, .tree ul ul::before { display: none; }
  .tree ul.roots > li::before { display: none !important; }
  .tree .person { width: 100%; max-width: 360px; }
  .leaf-stack .ls-item + .ls-item::before { display: none; }
  .tree li:first-child::before, .tree li:last-child::before { left: -18px; right: auto; }
}
table.team tr.locum td { background-color: color-mix(in srgb, var(--gold) 6%, var(--surface)); }
table.team tr.locum td.name { font-style: italic; }
table.team tr.locum-first td { border-top: 2px dashed var(--line-strong); }
.main { min-width: 0; }
/* Each top-level tree (Dr Isaura's, then the Managing Director's) sits on its own band. */
@media (min-width: 721px) {
  .tree ul.roots { flex-direction: column; align-items: center; gap: 40px; }
  .tree ul.roots > li + li { padding-top: 34px; border-top: 1px dashed var(--line); }
}

/* ---------- password show/hide ---------- */
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { padding-right: 48px; }
.pw-eye {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-faint); display: grid; place-items: center; cursor: pointer;
}
.pw-eye:hover, .pw-eye[aria-pressed='true'] { color: var(--brand); background: var(--surface-2); }
.pw-eye svg { width: 19px; height: 19px; }
.pw-match[data-state='ok'] { color: var(--ok); }
.pw-match[data-state='bad'] { color: var(--bad); }

/* Location under each shift (My shifts, next two weeks) */
.cal .cell .loc, .day .loc { font-size: var(--fs-tiny); font-weight: 600; letter-spacing: .04em; color: var(--brand); text-align: center; line-height: 1; }
.day .loc { margin-top: 4px; }
.legend .loc-code { font-size: var(--fs-tiny); color: var(--brand); letter-spacing: .04em; }

/* Small, even chevrons on list rows (More page, payslips, etc.) */
.item > svg, .item-link > svg { width: 18px; height: 18px; flex: none; color: var(--ink-faint); }

/* ---------- Phase 2: clock in / out ---------- */
.clock-card { text-align: center; }
.clock-now { font-family: var(--font-display, inherit); font-size: var(--fs-hero); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.clock-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.clock-steps > div { border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.clock-steps > div.done { background: var(--ok-bg); border-color: transparent; }
.clock-steps .k { font-size: var(--fs-caption); color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.clock-steps .v { font-size: var(--fs-title); font-weight: 600; font-variant-numeric: tabular-nums; }
.clock-btn { font-size: var(--fs-sub); padding: 14px 18px; }
.tiny-pill { font-size: var(--fs-tiny); padding: 1px 8px; }
.date-box { width: 44px; flex: none; text-align: center; line-height: 1.1; }
.date-box span { display: block; font-size: var(--fs-tiny); color: var(--ink-faint); text-transform: uppercase; }
.date-box b { font-size: var(--fs-sub); }
.selfie-wrap { position: relative; width: min(300px, 80vw); aspect-ratio: 1; margin: 0 auto 10px; border-radius: 50%; overflow: hidden; background: var(--surface-2); }
.selfie-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.selfie-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--brand, #2B4039) 70%, transparent); pointer-events: none; }
.att-thumb { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; vertical-align: middle; cursor: zoom-in; background: var(--surface-2); }
.auto-tag { font-size: var(--fs-tiny); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ok); background: var(--ok-bg); border-radius: 6px; padding: 1px 5px; margin-left: 6px; vertical-align: middle; }
.ps-employer { margin-top: 10px; font-size: var(--fs-caption); color: #5d6a65; }
.late-txt { color: var(--bad); font-weight: 600; }
.hero .hero-clock { background: #fff; color: var(--brand); border-color: transparent; font-weight: 600; }
[hidden] { display: none !important; }

/* Theme-aware images (logos): .only-light / .only-dark */
.only-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .only-light { display: none !important; }
  :root:not([data-theme='light']) .only-dark { display: block !important; }
}
:root[data-theme='dark'] .only-light { display: none !important; }
:root[data-theme='dark'] .only-dark { display: block !important; }
/* Larger text option */
:root[data-text='large'] { font-size: 17.5px; }
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-pick button { border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px; cursor: pointer; display: grid; gap: 8px; justify-items: center; font-size: var(--fs-label); color: var(--ink); }
.theme-pick button[aria-pressed='true'] { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.theme-pick .sw { width: 100%; aspect-ratio: 16/10; border-radius: 9px; border: 1px solid var(--line); overflow: hidden; display: grid; grid-template-rows: 28% 1fr; }
.theme-pick .sw.light { background: #f4f1ec; } .theme-pick .sw.light i { background: #2b4039; }
.theme-pick .sw.dark { background: #121a17; } .theme-pick .sw.dark i { background: #1f3a30; }
.theme-pick .sw.auto { background: linear-gradient(135deg, #f4f1ec 50%, #121a17 50%); } .theme-pick .sw.auto i { background: #2b4039; }
.theme-pick .sw b { margin: 8px; border-radius: 5px; background: rgba(127,127,127,.25); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.where-box { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); text-align: left; }
/* Roster key: even grid, chip column + text column, same on desktop and phones */
.legend.lg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 18px; align-items: start; margin-top: 16px; }
.lg-item { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 10px; min-width: 0; font-size: var(--fs-label); color: var(--ink); }
.lg-item > .chip, .lg-item > span:first-child { justify-self: start; }
.lg-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.lg-txt small { color: var(--ink-faint); font-size: var(--fs-caption); margin-top: 1px; }
.legend.lg-loc { padding-top: 12px; border-top: 1px solid var(--line); gap: 6px 18px; }
.lg-loc .loc-code { font-size: var(--fs-caption); letter-spacing: .04em; color: var(--brand); text-align: left; }
@media (max-width: 600px) {
  .legend.lg-grid { grid-template-columns: 1fr 1fr; gap: 10px 12px; }
  .lg-item { grid-template-columns: 36px 1fr; gap: 8px; font-size: var(--fs-caption); }
}
.legend.lg-grid, .lg-item, .lg-txt { text-align: left; }
.lg-txt { align-items: flex-start; }
.lg-item > .shift { width: 36px; height: 30px; min-width: 0; font-size: var(--fs-tiny); display: inline-grid; place-items: center; padding: 0; border-radius: 8px; }
@media (max-width: 600px) { .lg-item > .shift { width: 34px; height: 28px; font-size: var(--fs-tiny); } }
.legend .lg-txt { display: flex; flex-direction: column; align-items: flex-start; justify-self: stretch; text-align: left; gap: 0; }
.legend .lg-txt > span { display: block; }
.legend .lg-item > .shift { width: 36px; height: 30px; min-width: 0; font-size: var(--fs-tiny); display: inline-grid; place-items: center; padding: 0; border-radius: 8px; }
@media (max-width: 600px) { .legend .lg-item > .shift { width: 34px; height: 28px; font-size: var(--fs-tiny); } }
.team-grid > .card + .card, .leaf-stack .card + .card { margin-top: 0; }
/* Notifications */
.bell-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #fff; background: rgba(255,255,255,.1); }
.bell-btn svg { width: 21px; height: 21px; }
.bell-btn .badge-dot { position: absolute; top: -3px; right: -5px; left: auto; }
.notif-list .item.unread { background: color-mix(in srgb, var(--brand) 7%, transparent); border-radius: 12px; }
.notif-list .item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; margin-top: 7px; }
.notif-list .item .when { font-size: var(--fs-tiny); color: var(--ink-faint); white-space: nowrap; }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row .lbl { flex: 1; font-size: var(--fs-body-sm); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 13px; background: var(--line-strong); transition: background .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.ot-ask { border: 2px solid color-mix(in srgb, var(--gold) 60%, transparent); background: color-mix(in srgb, var(--gold) 10%, var(--surface)); border-radius: 16px; padding: 14px 16px; margin: 0 0 14px; text-align: left; }
.ot-ask .q { font-family: var(--font-display); font-size: var(--fs-title); font-weight: 600; }
.choice { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; cursor: pointer; flex-wrap: wrap; }
.choice input[type=radio] { width: auto; margin: 0; }
.choice:has(input[type=radio]:checked) { border-color: var(--brand); background: var(--brand-tint); }
.payslip .for-m { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; font-size: var(--fs-tiny); font-weight: 600; line-height: 16px; vertical-align: 1px; background: #eef2ef; color: #4d5f57; }
.payslip .ps-basis { margin: 0 0 12px; font-size: var(--fs-caption); color: #5d6a65; background: #faf8f4; border-radius: 10px; padding: 8px 12px; }
.policy-list { display: grid; gap: 10px; }
.policy-item { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--ink); }
.policy-item p { margin: 3px 0 0; font-size: var(--fs-label); line-height: 1.45; }
.policy-ic { color: var(--warn); flex: none; margin-top: 2px; }
.selfie-wrap.place { border-radius: 16px; aspect-ratio: 4 / 3; width: min(340px, 86vw); }
.selfie-wrap.place video { transform: none; }

/* ---------- who's off ---------- */
table.off-grid { min-width: 720px; }
table.off-grid th, table.off-grid td { text-align: center; vertical-align: middle; }
table.off-grid th:first-child, table.off-grid td:first-child { text-align: left; min-width: 170px; }
table.off-grid .today { background: color-mix(in srgb, var(--brand) 9%, transparent); }
table.off-grid tr.group-row td { background: var(--surface-2); text-align: left; padding: 8px 12px; }
.leave-chip { background: color-mix(in srgb, var(--warn) 18%, var(--surface)); color: var(--ink); }
.pending-chip { opacity: .5; }
/* ---------- announcements ---------- */
.ann { border-left: 0; }
.ann.unread .ann-title::after { content: "New"; display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: .625rem; font-weight: 600; vertical-align: 2px; background: var(--brand); color: #fff; }
.ann.pinned .ann-title::before { content: '📌 '; }
.ann-body { white-space: pre-wrap; line-height: 1.55; margin: 10px 0 0; }
.ann-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: var(--fs-caption); color: var(--ink-faint); }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); }
/* ---------- licences ---------- */
.lic-status { font-size: var(--fs-caption); }
.exp-bad { color: var(--bad); font-weight: 600; }
.exp-warn { color: var(--warn); font-weight: 600; }
.code-input { font-size: var(--fs-title); letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.qr-box { background: #fff; padding: 10px; border-radius: 12px; display: inline-block; line-height: 0; }
.recovery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; font-family: ui-monospace, Menlo, monospace; font-size: var(--fs-body); background: var(--surface-2); padding: 12px 14px; border-radius: 12px; }
.check-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.check-item:first-child { border-top: 0; }
.check-item input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--brand); }
.check-item.done .lbl { text-decoration: line-through; color: var(--ink-faint); }
@media print { .ea-sheet { box-shadow: none !important; border: 0 !important; } }

/* payslip: year to date */
.payslip .ps-ytd { margin-top: 22px; padding-top: 18px; border-top: 1px solid #e6e0d6; }
.payslip .ps-ytd-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.payslip .ps-ytd-head h4 { margin: 0; }
.payslip .ps-ytd-head span { font-size: var(--fs-caption); color: #5d6a65; }
.payslip .ps-ytd .ps-cols { margin-top: 12px; }
.payslip .ps-ytd h5 { margin: 0 0 4px; font-size: var(--fs-tiny); font-weight: 600; color: #8b958f; text-transform: uppercase; letter-spacing: .06em; }
.payslip .ps-ytd .line { font-size: var(--fs-label); padding: 5px 0; }
.payslip .ps-ytd-nett { margin-top: 14px; display: flex; justify-content: space-between; gap: 12px; background: #faf8f4; border-radius: 10px; padding: 10px 14px; font-size: var(--fs-label); color: #5d6a65; }
.payslip .ps-ytd-nett b { color: #2b4039; font-size: var(--fs-body); }
/* Payslips page: earnings this year */
.ytd-earn .line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line, #e6e0d6); font-size: var(--fs-body-sm); }
.ytd-earn .line.total { border-bottom: 0; border-top: 1px solid var(--ink, #1d2824); margin-top: 4px; font-weight: 600; }
/* Salary costs */
.grid.grid-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .grid.grid-4 { grid-template-columns: repeat(4, 1fr); } }
/* Payslip on phones: a little smaller so it's shorter to scroll (the PDF is the same on every device) */
@media (max-width: 640px) {
  .payslip .line { font-size: var(--fs-label); padding: 5px 0; }
  .payslip .line .note { font-size: var(--fs-tiny); }
  .payslip h4 { font-size: var(--fs-tiny); margin-bottom: 4px; }
  .payslip .ps-meta { gap: 8px 16px; padding-bottom: 14px; }
  .payslip .ps-meta .v { font-size: var(--fs-label); }
  .payslip .ps-meta .k { font-size: var(--fs-tiny); }
  .payslip .ps-basis { font-size: var(--fs-tiny); padding: 6px 10px; }
  .payslip .ps-cols { gap: 16px; margin-top: 14px; }
  .payslip .ps-head { padding-top: 18px; padding-bottom: 18px; }
  .payslip .ps-body { padding-top: 18px; padding-bottom: 20px; }
  .payslip .nett { margin-top: 18px; }
  .payslip .nett .v { font-size: var(--fs-title); }
  .payslip .nett .k, .payslip .nett .small { font-size: var(--fs-tiny); }
  .payslip .ps-employer, .payslip .ps-foot { font-size: var(--fs-tiny); }
  .payslip .ps-ytd { margin-top: 16px; padding-top: 14px; }
  .payslip .ps-ytd .line { font-size: var(--fs-caption); padding: 4px 0; }
  .payslip .ps-ytd-nett { font-size: var(--fs-caption); padding: 8px 12px; }
  .payslip .ps-ytd-nett b { font-size: var(--fs-label); }
}

/* ---------- shared text roles & italics ---------- */
h3 { font-size: var(--fs-sub); }
.caption { font-size: var(--fs-caption); color: var(--ink-faint); font-style: italic; }
.footnote { margin: 10px 0 0; font-size: var(--fs-caption); color: var(--ink-faint); font-style: italic; line-height: 1.5; }
.cell-note { font-size: var(--fs-caption); color: var(--ink-soft); font-style: italic; font-weight: 400; margin-top: 1px; }
p.small.faint, .tiny.faint, p.tiny { font-style: italic; }
.item .sub { font-style: normal; }
blockquote, .quote, em { font-family: var(--font-display); font-style: italic; }

/* ---------- tables: numbers line up, columns even ---------- */
table.data th, table.data td { line-height: 1.35; }
table.data td.num, table.data .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data thead th.r { text-align: right; }
table.data tr.total td, table.data tfoot td, table.data tfoot th { border-top: 1.5px solid var(--ink); border-bottom: 0; font-weight: 600; }
table.data tr.sub td { font-weight: 600; border-top: 1px solid var(--line-strong); }
table.data tr.group td { padding: 18px 10px 6px; font: 600 var(--fs-caption)/1.3 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); border-bottom: 1px solid var(--line); }
table.data tr.sel td { background: var(--surface-2); }
table.data .strong { font-weight: 600; }
/* Salary costs: same label column on every table, the rest share the width evenly */
table.data.fin { table-layout: fixed; }
table.data.fin col.lab { width: 46%; }
table.data.fin.cols-7 col.lab, table.data.fin.cols-8 col.lab { width: 22%; }
table.data.fin.cols-7, table.data.fin.cols-8 { min-width: 760px; }
table.data.fin th { white-space: normal; vertical-align: bottom; line-height: 1.3; }
table.data.fin td:first-child { white-space: normal; }
.fin-co { margin: -6px 0 16px; }
.month-nav { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; flex-wrap: wrap; }
.month-nav h2 { min-width: 9.5em; text-align: center; }
.stats { margin-bottom: 14px; align-items: stretch; }
.card.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-k { font-size: var(--fs-label); color: var(--ink-soft); }
.stat-v { font: 600 var(--fs-title)/1.2 var(--font); }
.stat-s { font-size: var(--fs-caption); color: var(--ink-faint); font-style: italic; margin-top: auto; }
.grid.grid-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .grid.grid-4 { grid-template-columns: repeat(4, 1fr); } }
.card-head .caption { text-align: right; }
/* My payslips table */
table.data.pay-table { min-width: 560px; }
table.data.pay-table td:first-child, table.data.pay-table th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.data.pay-table td:first-child a { font-weight: 500; text-decoration: none; color: var(--ink); }
table.data.pay-table td:last-child { width: 28px; padding-left: 0; color: var(--ink-faint); }


/* payslip: italics */
.payslip .ps-basis, .payslip .line .note, .payslip .nett .sub, .payslip .ps-employer, .payslip .ps-foot span:last-child, .payslip .ps-ytd-head span, .payslip .ps-ytd-nett span { font-style: italic; }
.payslip .nett .sub { font-size: var(--fs-label); color: #5d6a65; }
.payslip .ps-head .brand .co span { opacity: .8; }
.payslip .ps-ytd-head h4 { font-family: var(--font); }

/* Payslip figures: left-aligned in a fixed amount column, so every "RM" starts at the same place */
.payslip .line { display: grid; grid-template-columns: minmax(0, 1fr) 8.25em; align-items: start; column-gap: 12px; }
.payslip .line > .num { text-align: left; white-space: nowrap; }

/* ================= Manage (Phase 4) =================
   Same layout and type as the staff portal; an off-white base and the blue wallpapers from Assets for the bars,
   menu and accents. Dark mode has its own navy steps. */
:root[data-area='manage'] {
  --brand: #1f4f8f; --brand-2: #1c86a8; --brand-tint: #e6eef8; --brand-ink: #ffffff;
  --accent: #1c86a8; --gold: #c08a2b;
  --bg: #f7f7f5; --surface: #ffffff; --surface-2: #f5f7f9;
  --ink: #15202d; --ink-soft: #536170; --ink-faint: #8693a0;
  --line: #e4e8ed; --line-strong: #cfd6de;
  --info-bg: #e8f0fa;
}
@media (prefers-color-scheme: dark) {
  :root[data-area='manage']:not([data-theme='light']) {
    --brand: #8fb4e6; --brand-2: #6cc6dc; --brand-tint: #1b2a3c; --brand-ink: #0c1622; --accent: #6cc6dc;
    --bg: #0e141b; --surface: #151d27; --surface-2: #1a2430; --ink: #eaf0f6; --ink-soft: #a7b4c2; --ink-faint: #7c8a99;
    --line: #26323f; --line-strong: #344354; --info-bg: #182637;
  }
}
:root[data-area='manage'][data-theme='dark'] {
  --brand: #8fb4e6; --brand-2: #6cc6dc; --brand-tint: #1b2a3c; --brand-ink: #0c1622; --accent: #6cc6dc;
  --bg: #0e141b; --surface: #151d27; --surface-2: #1a2430; --ink: #eaf0f6; --ink-soft: #a7b4c2; --ink-faint: #7c8a99;
  --line: #26323f; --line-strong: #344354; --info-bg: #182637;
}
[data-area='manage'] .topbar { background: linear-gradient(rgba(10, 20, 45, .25), rgba(10, 20, 45, .35)), url('/img/bg/blue4-1200.jpg') 30% 50% / cover, #1f3f7a; }
[data-area='manage'] .tabbar a[aria-current='page'] { color: var(--brand); }
@media (min-width: 900px) {
  [data-area='manage'] .sidebar { background: linear-gradient(180deg, rgba(8, 18, 40, .15) 0%, rgba(8, 18, 40, .45) 100%), url('/img/bg/blue1-700.jpg') center 30% / cover, #1f4f8f; }
  [data-area='manage'] .sidebar nav a .count { color: #1f4f8f; }
}
.m-brand { display: flex; align-items: center; gap: 10px; }
.m-brand span { white-space: nowrap; font: 600 var(--fs-caption)/1 var(--font); letter-spacing: .16em; text-transform: uppercase; padding: 5px 9px; border-radius: 999px; background: rgba(255,255,255,.16); color: #fff; }
.sidebar .m-brand { flex-direction: column; align-items: flex-start; margin: 4px 10px 26px; gap: 10px; }
.sidebar .m-brand .logo { margin: 0; }
.topbar-link { color: #fff; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.14); }
.topbar-link svg { width: 18px; height: 18px; }
[data-area='manage'] .hero { background: linear-gradient(100deg, rgba(10, 22, 50, .78) 0%, rgba(10, 22, 50, .45) 55%, rgba(10, 22, 50, .05) 100%), url('/img/bg/blue3-1200.jpg') 60% 50% / cover, #1f4f8f; }
[data-area='manage'] .auth { background: linear-gradient(rgba(10, 20, 45, .05), rgba(10, 20, 45, .25)), url('/img/bg/blue2-1200.jpg') center / cover, #1f4f8f; }

/* Manage building blocks */
.kpis > .card + .card { margin-top: 0; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 14px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; position: relative; margin-top: 10px; }
.meter > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--brand); }
.meter > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; }
.branch-row { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(0, 1fr)); gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.branch-row:last-child { border-bottom: 0; }
.branch-row .num { text-align: right; }
.flag-list { display: grid; gap: 8px; }
.flag-list .alert { margin: 0; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 400 11px var(--font); fill: var(--ink-faint); }
.chart .bar { fill: var(--brand); }
.chart .bar.today { fill: var(--brand-2); }
.chart .bar.hit { fill: var(--brand); }
.chart .bar.dim { fill: color-mix(in srgb, var(--brand) 35%, var(--surface)); }
.chart .tline { stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 0.1 6; stroke-linecap: round; stroke-linejoin: round; opacity: .55; fill: none; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .hit-area { fill: transparent; cursor: default; }
.chart-tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--surface); border-radius: 8px; padding: 6px 9px; font-size: var(--fs-caption); line-height: 1.4; white-space: nowrap; box-shadow: var(--shadow); }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--fs-caption); color: var(--ink-soft); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--brand); vertical-align: -2px; margin-right: 6px; }
.chart-legend i.line { height: 0; width: 18px; border-top: 3px dotted var(--ink); opacity: .6; border-radius: 0; vertical-align: 3px; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: 8em minmax(0, 1fr) auto; gap: 12px; align-items: center; font-size: var(--fs-body-sm); }
.hbar .track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.hbar .num { text-align: right; white-space: nowrap; min-width: 4.5em; }
.form-sec { margin: 18px 0 8px; font: 600 var(--fs-caption)/1.3 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.money-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
@media (min-width: 700px) { .money-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.money-grid .field { margin: 0; }
.input.rm { text-align: right; font-variant-numeric: tabular-nums; }
.sum-bar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: var(--brand-tint); margin: 14px 0; font-size: var(--fs-body-sm); }
.sum-bar b { font-size: var(--fs-sub); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; }
.photo-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.photo-pick .doc-link { font-size: var(--fs-label); }

table.data.fin.bonus col.lab { width: 26%; }
table.data.fin.bonus col.how { width: 56%; }
table.data.fin.cols-5, table.data.fin.cols-6 { min-width: 600px; }
@media (max-width: 640px) {
  .branch-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .branch-row > div:first-child { grid-column: 1 / -1; }
  .hbar { grid-template-columns: 6.5em minmax(0, 1fr) auto; }
}

/* Ops: the theme previews in Settings show the Ops colours (blue / off-white, blue / navy) */
[data-area='manage'] .theme-pick .sw.light { background: #f7f7f5; } [data-area='manage'] .theme-pick .sw.light i { background: #1f4f8f; }
[data-area='manage'] .theme-pick .sw.dark { background: #0e141b; } [data-area='manage'] .theme-pick .sw.dark i { background: #1f4f8f; }
[data-area='manage'] .theme-pick .sw.auto { background: linear-gradient(135deg, #f7f7f5 50%, #0e141b 50%); } [data-area='manage'] .theme-pick .sw.auto i { background: #1f4f8f; }

/* ---------- six-up KPI rows, treatment visits ---------- */
.kpis.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1240px) { .kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.kpis .stat { display: flex; flex-direction: column; min-height: 100%; }
.input.locked { display: flex; align-items: center; gap: 8px; background: var(--surface-2); color: var(--ink-soft); cursor: not-allowed; }
.input.locked svg { width: 15px; height: 15px; }
table.data tr.group-row td { background: var(--surface-2); font-size: var(--fs-caption); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); padding-top: 8px; padding-bottom: 8px; }
.tx-line { display: grid; grid-template-columns: minmax(0, 2.4fr) .55fr 1fr 1fr .6fr .8fr auto; gap: 0 10px; align-items: start; padding: 10px 0 2px; border-top: 1px dashed var(--line); }
.tx-line:first-child { border-top: 0; padding-top: 0; }
.tx-line .field { margin-bottom: 8px; }
.tx-line .tx-rem { grid-column: 1 / -2; margin: 0 0 6px; }
.tx-line .tx-del { grid-column: -2; grid-row: 1; align-self: start; margin-top: 26px; }
.tx-line .tx-tooth[hidden] { display: none; }
@media (max-width: 760px) {
  .tx-line { grid-template-columns: 1fr 1fr 1fr; }
  .tx-line .tx-name { grid-column: 1 / -1; }
  .tx-line .tx-del { grid-column: 3; grid-row: auto; justify-self: end; margin-top: 0; }
  .tx-line .tx-rem { grid-column: 1 / 3; }
}
table.data.visits .cell-note { max-width: 46ch; }

/* ================= Compact phones =================
   Closer to the density of everyday phone apps (Shopee, TNG, Kenangan, Apple Store): smaller type, tighter cards,
   rows and bars — roughly a third more on screen. Form fields keep 16px text on iPhone so Safari doesn't zoom in. */
@media (max-width: 640px) {
  :root {
    --fs-hero: 2rem; --fs-display: 1.3rem; --fs-headline: 1.25rem; --fs-title: 1rem; --fs-sub: .875rem;
    --fs-body: .8125rem; --fs-body-sm: .78rem; --fs-label: .75rem; --fs-caption: .6875rem; --fs-tiny: .625rem;
    --tabbar-h: 56px; --radius: 14px; --radius-sm: 9px;
  }
  body { line-height: 1.45; }
  .main { padding: 10px 12px calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom)); }
  .topbar { padding: calc(7px + env(safe-area-inset-top)) 12px 7px; gap: 8px; }
  .topbar .wordmark { height: 20px; }
  .avatar { width: 28px; height: 28px; }
  .topbar .who { gap: 7px; }
  .m-brand { gap: 7px; }
  .m-brand span { font-size: .5625rem; padding: 4px 7px; letter-spacing: .12em; }
  .topbar-link, .bell-btn { width: 30px !important; height: 30px !important; }
  .topbar-link svg, .bell-btn svg { width: 16px !important; height: 16px !important; }
  .tabbar a { gap: 2px; }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a[aria-current='page']::before { width: 22px; height: 2.5px; }
  .badge-dot { top: 5px; min-width: 15px; height: 15px; line-height: 15px; padding: 0 4px; }
  .page-head { margin: 4px 0 12px; gap: 8px; }
  .page-head p { margin-top: 2px; }
  .card { padding: 12px 13px; }
  .card + .card { margin-top: 10px; }
  .card-head { margin-bottom: 8px; gap: 8px; }
  .grid, .stack { gap: 10px; }
  .kpis { gap: 8px; margin-bottom: 10px; }
  .kpis .stat { padding: 10px 11px; }
  .stat-v { font-size: 1.0625rem; }
  .hero { min-height: 136px; }
  .item { gap: 10px; padding: 9px 0; }
  .icon-circle { width: 30px; height: 30px; border-radius: 9px; }
  .icon-circle svg { width: 16px; height: 16px; }
  .btn { height: 36px; padding: 0 13px; border-radius: 10px; gap: 6px; }
  .btn svg { width: 16px; height: 16px; }
  .btn.sm { height: 30px; padding: 0 10px; border-radius: 8px; }
  .icon-btn { width: 32px; }
  .field { gap: 4px; margin-bottom: 10px; }
  .input, select.input { height: 38px; padding: 0 11px; border-radius: 10px; }
  textarea.input { min-height: 68px; padding: 9px 11px; }
  .segmented { border-radius: 10px; padding: 2px; }
  .segmented button { padding: 5px 10px; border-radius: 8px; }
  .alert { padding: 8px 11px; border-radius: 10px; margin-bottom: 10px; }
  .month-nav { gap: 6px; margin-bottom: 10px; }
  .month-nav h2 { min-width: 8em; }
  .sheet { padding: 6px 14px calc(14px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; }
  .sheet .grab { margin: 3px auto 10px; }
  .sheet-head { margin-bottom: 10px; }
  .sheet-foot { margin-top: 12px; gap: 8px; }
  table.data th, table.data td { padding-top: 7px; padding-bottom: 7px; }
  .check { gap: 8px; }
  .check input { width: 16px; height: 16px; }
  .empty { padding: 18px 10px; }
  .chart text { font-size: 10px; }
  :root[data-text='large'] { font-size: 17px; }
}


/* ---------- first-time tips ---------- */
.tour-ov { position: fixed; inset: 0 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom)) 0; z-index: 90; background: rgba(8, 14, 20, .38); display: flex; align-items: flex-end; justify-content: center; padding: 16px 12px 14px; animation: fade .2s ease; }
@media (min-width: 900px) { .tour-ov { inset: 0 0 0 248px; align-items: center; padding: 24px; } }
.tour-card { width: 100%; max-width: 400px; background: var(--surface); color: var(--ink); border-radius: 18px; padding: 14px 16px 14px; box-shadow: 0 18px 50px -12px rgba(0,0,0,.45); animation: up .22s ease; }
.tour-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tour-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); }
.tour-ic svg { width: 17px; height: 17px; }
.tour-count { font-size: var(--fs-caption); color: var(--ink-faint); }
.tour-skip { margin-left: auto; border: 0; background: none; color: var(--ink-soft); font-size: var(--fs-label); font-weight: 500; cursor: pointer; padding: 6px; }
.tour-card h3 { font: 600 var(--fs-title)/1.25 var(--font-display); margin: 0 0 4px; }
.tour-card p { margin: 0; font-size: var(--fs-body-sm); color: var(--ink-soft); }
.tour-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-dots { display: flex; gap: 5px; margin-right: auto; }
.tour-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--line-strong); transition: width .2s; }
.tour-dots i.on { width: 16px; background: var(--brand); }
.tour-hl { position: relative; z-index: 95; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 55%, transparent), 0 0 0 8px color-mix(in srgb, var(--brand) 18%, transparent); border-radius: 12px; animation: tourpulse 1.6s ease-in-out infinite; }
.sidebar a.tour-hl { background: rgba(255,255,255,.18); box-shadow: 0 0 0 2px rgba(255,255,255,.8); }
.tabbar a.tour-hl { color: var(--brand); background: var(--surface); }
@keyframes tourpulse { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 55%, transparent), 0 0 0 12px color-mix(in srgb, var(--brand) 6%, transparent); } }

/* ---------- loading: the 89 mark in the portal's colours ---------- */
.page-loader { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; pointer-events: none; color: var(--brand); opacity: 0; animation: fade .2s ease .15s forwards; }
.page-loader .mark89 { width: 58px; height: 58px; fill: currentColor; }
@keyframes fadein { to { opacity: 1; } }
.page-loader { animation-name: fadein; }
.mark89 .d1, .mark89 .d2, .mark89 .d3, .mark89 .d4 { transform-box: fill-box; transform-origin: center; animation: m89 1.2s ease-in-out infinite; }
.mark89 .d2 { animation-delay: .15s; } .mark89 .d3 { animation-delay: .3s; } .mark89 .d4 { animation-delay: .45s; }
@keyframes m89 { 0%, 100% { opacity: .25; transform: scale(.82); } 45% { opacity: 1; transform: scale(1); } }

/* ================= 10 Oct: crisper bars, smaller type, menu sheet, collapsible side menu ================= */
/* Top bar on phones: a clean gradient in the portal's colours (the photo wallpaper looked soft when stretched). */
.topbar { background: linear-gradient(118deg, #0c2a21 0%, #1d4a3c 58%, #2f6150 100%); }
[data-area='manage'] .topbar { background: linear-gradient(118deg, #123667 0%, #1f4f8f 55%, #1d7fa3 100%); }

/* One step smaller everywhere (computers and phones), with icons to match */
:root {
  --fs-hero: 2.5rem; --fs-display: 1.6rem; --fs-headline: 1.375rem; --fs-title: 1rem; --fs-sub: .875rem;
  --fs-body: .8125rem; --fs-body-sm: .78rem; --fs-label: .75rem; --fs-caption: .6875rem; --fs-tiny: .625rem;
  --side-w: 224px;
}
.btn { height: 36px; padding: 0 14px; border-radius: 10px; gap: 6px; }
.btn svg { width: 15px; height: 15px; }
.btn.sm { height: 30px; padding: 0 10px; }
.icon-btn { width: 34px; }
.input, select.input { height: 38px; border-radius: 10px; }
.icon-circle { width: 32px; height: 32px; border-radius: 10px; }
.icon-circle svg { width: 16px; height: 16px; }
.card { padding: 15px; }
.stat-v { font-size: 1.125rem; }
.item { padding: 10px 0; }
@media (min-width: 900px) {
  .app { grid-template-columns: var(--side-w) 1fr; transition: grid-template-columns .25s ease; }
  .sidebar { padding: 20px 12px 14px; }
  .sidebar .logo { width: 112px; }
  .sidebar nav a { padding: 8px 10px; gap: 10px; border-radius: 9px; }
  .sidebar nav a svg { width: 16px; height: 16px; }
  .sidebar nav .group { margin: 14px 10px 4px; }
  .sidebar .me { padding: 8px; }
  .main { padding: 28px 32px 48px; }
  .tour-ov { inset: 0 0 0 var(--side-w) !important; }
}
@media (max-width: 640px) {
  :root {
    --fs-hero: 1.75rem; --fs-display: 1.125rem; --fs-headline: 1.125rem; --fs-title: .875rem; --fs-sub: .8125rem;
    --fs-body: .75rem; --fs-body-sm: .72rem; --fs-label: .6875rem; --fs-caption: .625rem; --fs-tiny: .5625rem;
    --tabbar-h: 52px;
  }
  .topbar .wordmark { height: 18px; }
  .avatar { width: 26px; height: 26px; font-size: .625rem; }
  .topbar-link, .bell-btn { width: 28px !important; height: 28px !important; }
  .topbar-link svg, .bell-btn svg { width: 15px !important; height: 15px !important; }
  .tabbar a svg { width: 18px; height: 18px; }
  .card { padding: 11px 12px; }
  .kpis .stat { padding: 9px 10px; }
  .stat-v { font-size: .9375rem; }
  .icon-circle { width: 26px; height: 26px; border-radius: 8px; }
  .icon-circle svg { width: 14px; height: 14px; }
  .btn { height: 32px; padding: 0 11px; }
  .btn svg { width: 14px; height: 14px; }
  .btn.sm { height: 28px; padding: 0 9px; }
  .input, select.input { height: 34px; }
  .item { padding: 8px 0; gap: 9px; }
  .hero { min-height: 118px; }
}

/* Bottom tabs: one marker that glides to the current tab */
.tabbar { position: fixed; }
.tabbar a[aria-current='page']::before { display: none; }
.tab-ind { position: absolute; top: 0; left: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); opacity: 0;
  transition: transform .32s cubic-bezier(.3,1.3,.5,1), opacity .2s; pointer-events: none; }
.tabbar a { transition: color .2s; }
.tabbar a svg { transition: transform .25s cubic-bezier(.3,1.4,.5,1); }
.tabbar a[aria-current='page'] svg { transform: translateY(-1px) scale(1.08); }

/* Menu: everything, sliding up from the bottom (phones) */
.menu-ov { position: fixed; inset: 0; z-index: 80; background: rgba(8, 14, 20, 0); display: flex; align-items: flex-end; justify-content: center; transition: background .25s; }
.menu-ov.open { background: rgba(8, 14, 20, .42); }
.menu-sheet { width: 100%; max-width: 560px; max-height: 86dvh; overflow: auto; background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 4px 14px calc(16px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.9,.25,1); overscroll-behavior: contain; }
.menu-ov.open .menu-sheet { transform: none; }
.menu-sheet .grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 6px auto 10px; }
.menu-me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); color: inherit; text-decoration: none; font-size: var(--fs-body-sm); }
.menu-me > span:not(.avatar) { flex: 1; line-height: 1.3; }
.menu-me .avatar { flex: none; width: 38px; height: 38px; background: var(--brand-tint); color: var(--brand); }
.menu-me > svg { width: 16px; height: 16px; color: var(--ink-faint); }
.menu-h { font-size: var(--fs-caption); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); margin: 14px 4px 6px; }
.menu-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 6px; }
.menu-tile { display: grid; justify-items: center; gap: 5px; padding: 8px 2px; border-radius: 12px; color: var(--ink); text-decoration: none; text-align: center; }
.menu-tile:active { background: var(--surface-2); }
.mt-ic { position: relative; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); }
.mt-ic svg { width: 19px; height: 19px; }
.mt-badge { position: absolute; top: -4px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--bad); color: #fff; font-size: .5625rem; line-height: 16px; font-weight: 600; }
.mt-l { font-size: var(--fs-caption); line-height: 1.2; }
@media (min-width: 900px) { .menu-ov { align-items: center; } .menu-sheet { border-radius: 20px; max-width: 520px; } }

/* Side menu on computers: collapse to a slim bar of icons; hover (or tap) pops it out over the page */
.rail-btn { display: none; }
@media (min-width: 900px) {
  .sidebar { position: sticky; z-index: 40; transition: width .25s ease, box-shadow .25s; }
  .rail-btn { display: grid; place-items: center; position: absolute; top: 14px; right: 10px; width: 26px; height: 26px; border-radius: 8px; border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; z-index: 2; }
  .rail-btn svg { width: 14px; height: 14px; transition: transform .25s; }
  .app.rail { grid-template-columns: 64px 1fr; }
  .app.rail .sidebar { width: 64px; overflow-x: hidden; }
  .app.rail .rail-btn svg { transform: rotate(180deg); }
  .app.rail .sidebar:hover { width: var(--side-w); box-shadow: 12px 0 40px -12px rgba(0,0,0,.45); }
  .app.rail .sidebar:not(:hover) nav a > span, .app.rail .sidebar:not(:hover) .group, .app.rail .sidebar:not(:hover) .me > span,
  .app.rail .sidebar:not(:hover) .m-brand span, .app.rail .sidebar:not(:hover) .rail-btn { display: none; }
  .app.rail .sidebar:not(:hover) .logo { width: 34px; }
  .app.rail .sidebar:not(:hover) nav a { justify-content: center; padding: 9px 0; }
  .app.rail .sidebar:not(:hover) nav a .count { position: absolute; top: 2px; right: 4px; }
  .app.rail .tour-ov { inset: 0 0 0 64px !important; }
}

/* Phones: the top bar stays put while the page scrolls, so nothing slides underneath the status bar
   (iPhone blurs whatever passes under it). The space above the page, when pulled down, is the bar's colour. */
@media (max-width: 899px) {
  .topbar { position: sticky; top: 0; z-index: 25; }
  html { background: #0c2a21; }
  html[data-area='manage'] { background: #123667; }
  body { min-height: 100dvh; }
}
@media (min-width: 900px) { .page-loader { left: var(--side-w); } .app.rail .page-loader { left: 64px; } }

/* Side menu sections that roll up / down (Manage, Directors & finance…) */
.sidebar nav .nav-sec .group { display: flex; align-items: center; gap: 6px; width: calc(100% - 20px); border: 0; background: none; color: inherit; font: inherit; font-size: var(--fs-tiny); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; text-align: left; padding: 0; }
.sidebar nav .nav-sec .group svg { width: 12px; height: 12px; margin-left: auto; transition: transform .25s; }
.sidebar nav .nav-sec.closed .group svg { transform: rotate(-90deg); }
.nav-sec-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .28s ease; }
.nav-sec-body > div { overflow: hidden; display: flex; flex-direction: column; gap: 2px; }
.nav-sec.closed .nav-sec-body { grid-template-rows: 0fr; }

/* Side menu on computers: the arrow switches between icons only and the full menu (no hover pop-out) */
@media (min-width: 900px) {
  .app.rail .sidebar:hover { width: 64px; box-shadow: none; }
  .app.rail .sidebar nav a > span, .app.rail .sidebar .group, .app.rail .sidebar .me > span, .app.rail .sidebar .m-brand span { display: none; }
  .app.rail .sidebar .logo { width: 34px; }
  .app.rail .sidebar nav a { justify-content: center; padding: 9px 0; }
  .app.rail .sidebar nav a .count { position: absolute; top: 2px; right: 4px; }
  .app.rail .nav-sec.closed .nav-sec-body { grid-template-rows: 1fr; }
  .app.rail .sidebar .rail-btn { display: grid; position: static; margin: 0 auto 14px; }
  .app.rail .sidebar .m-brand { align-items: center; margin: 0 0 18px; }
  .app.rail .sidebar .nav-sec { border-top: 1px solid rgba(255,255,255,.12); margin-top: 8px; padding-top: 6px; }
}
@media (min-width: 900px) {
  .app.rail .sidebar:not(:hover) .rail-btn, .app.rail .sidebar .rail-btn { display: grid; position: static; margin: 0 auto 14px; }
  .app.rail .sidebar:hover nav a > span, .app.rail .sidebar:hover .group, .app.rail .sidebar:hover .me > span, .app.rail .sidebar:hover .m-brand span { display: none; }
  .app.rail .sidebar:hover .logo { width: 34px; }
  .app.rail .sidebar:hover nav a { justify-content: center; padding: 9px 0; }
}

/* Clock in: live digital clock with seconds, and how early you are */
.clock-now small { font-size: .5em; opacity: .55; margin-left: 1px; }
.clock-until { font-weight: 600; font-size: var(--fs-body); margin: -2px 0 6px; font-variant-numeric: tabular-nums; }
.clock-until.ok { color: var(--ok); } .clock-until.warn { color: #c98a05; } .clock-until.bad { color: var(--bad); }

/* A row of photo fields (daily report): label, hint line, then the button — all lined up */
.photo-grid { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: start; }
.photo-field { grid-template-rows: auto auto auto; align-content: start; }
.photo-field > label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-field .hint { margin-top: -2px; }
@media (max-width: 640px) { .photo-grid { grid-template-columns: 1fr; } .photo-field > label { white-space: normal; } }

/* iPhone home-screen apps added before 10 Oct still run under a see-through status bar, where iOS 26 draws its
   "Liquid Glass" blur over the top ~40pt. There, push the bar's contents down below that blur (nothing changes
   once the app is re-added: the status bar is then solid and the safe-area inset is 0). */
@media (max-width: 899px) { .topbar { padding-top: calc(7px + env(safe-area-inset-top) * 1.7); } }

.nudge { text-align: center; }
.nudge-ic { width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); }
.nudge-ic svg { width: 22px; height: 22px; }
.nudge p { margin: 0; color: var(--ink-soft); }
.nudge .sheet-foot { justify-content: center; }

/* One text size for every field, everywhere (pop-up sheets included). iPhone's zoom-on-tap is turned off by the
   page's viewport setting instead of making the text bigger; people can still pinch to zoom. */
.input, select.input, textarea.input, .sheet .input, .sheet select, .sheet textarea { font-size: var(--fs-body); }
.input::placeholder { color: var(--ink-faint); opacity: 1; }
/* Dates: left-aligned like the other fields, and never wider than the screen */
input[type='date'].input, input[type='time'].input, input[type='month'].input { -webkit-appearance: none; appearance: none; text-align: left; min-width: 0; max-width: 100%; display: block; }
input[type='date']::-webkit-date-and-time-value, input[type='time']::-webkit-date-and-time-value { text-align: left; margin: 0; }
.sheet { overflow-x: hidden; }
.sheet-body, .sheet form { overflow-x: hidden; max-width: 100%; }
.sheet .field, .sheet .form-grid, .sheet .money-grid { min-width: 0; }
.sheet .form-grid > *, .sheet .money-grid > * { min-width: 0; }
.sheet .sheet-head h2 { font-size: var(--fs-title); }
.sheet .field label, .sheet .label { font-size: var(--fs-label); }
.sheet .alert, .sheet p { font-size: var(--fs-body-sm); }

.leave-help { margin: -4px 0 8px; }
.leave-help:empty { display: none; }
.leave-which { margin: 0 0 12px; font-size: var(--fs-body-sm); }
.leave-which summary { cursor: pointer; color: var(--brand); font-weight: 500; }
.leave-which ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-soft); }
.leave-intro { margin: 0 0 10px; }

/* Date and time fields: text sits in the middle of the box, like every other field (iPhone draws these
   differently and ignores the usual padding, so the line height is set to the box height). */
:root { --in-h: 38px; }
@media (max-width: 640px) { :root { --in-h: 34px; } }
.input, select.input { height: var(--in-h); }
.input.sm { --in-h: 36px; }
@media (max-width: 640px) { .input.sm { --in-h: 32px; } }
/* iPhone ignores line-height inside these fields and pins the text to the top of the box. So instead the text box is
   given an exact height (1.4em) and the padding above and below is worked out to fill the rest — centred either way. */
input[type='date'].input, input[type='time'].input, input[type='month'].input, input[type='datetime-local'].input {
  box-sizing: border-box; height: var(--in-h); min-height: var(--in-h); line-height: 1.4;
  padding-top: calc((var(--in-h) - 1.4em - 2px) / 2); padding-bottom: calc((var(--in-h) - 1.4em - 2px) / 2);
  display: block; vertical-align: middle;
}
input[type='date']::-webkit-date-and-time-value, input[type='time']::-webkit-date-and-time-value,
input[type='month']::-webkit-date-and-time-value, input[type='datetime-local']::-webkit-date-and-time-value {
  display: block; height: 1.4em; min-height: 1.4em; line-height: 1.4em; margin: 0; padding: 0; text-align: left;
}
input[type='date']::-webkit-datetime-edit, input[type='time']::-webkit-datetime-edit,
input[type='month']::-webkit-datetime-edit, input[type='datetime-local']::-webkit-datetime-edit { padding: 0; line-height: 1.4em; height: 1.4em; display: block; }
input[type='date']::-webkit-datetime-edit-fields-wrapper, input[type='time']::-webkit-datetime-edit-fields-wrapper { padding: 0; }
input[type='date']::-webkit-calendar-picker-indicator, input[type='time']::-webkit-calendar-picker-indicator { margin: 0; padding: 0; height: 1.4em; }
select.input { line-height: calc(var(--in-h) - 2px); padding-top: 0; padding-bottom: 0; }

/* Folded side menu: just the round 89 mark; unfolding brings back the full logo and the portal name */
.sidebar .rail-mark { display: none; }
@media (min-width: 900px) {
  .sidebar .m-brand .logo, .sidebar .m-brand span { transition: opacity .25s ease, transform .25s ease; }
  .app.rail .sidebar .m-brand .logo, .app.rail .sidebar:hover .m-brand .logo, .app.rail .sidebar:not(:hover) .m-brand .logo { display: none; }
  .app.rail .sidebar .rail-mark { display: block; width: 32px; height: 32px; fill: #fff; margin: 0 auto; animation: railin .25s ease; }
  .app:not(.rail) .sidebar .m-brand .logo, .app:not(.rail) .sidebar .m-brand span { animation: railin .3s ease; }
}
@keyframes railin { from { opacity: 0; transform: scale(.9); } }

/* Ops dashboard ▸ Cash to collect */
.alert.cash-collect { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.alert.cash-collect .btn { flex: none; }

/* Home ▸ Today: who's working with me */
.hero .with-me { margin: 12px 0 4px; position: relative; z-index: 1; }
.hero .with-me-k { font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em; opacity: .75; margin-bottom: 6px; }
.hero .with-me-list { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.hero .with-me-list::-webkit-scrollbar { display: none; }
.hero .with-me-p { display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 4px 10px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); }
.hero .with-me-p .avatar-ph { background: rgba(255,255,255,.22); color: #fff; }
.hero .with-me-p > span:last-child { display: flex; flex-direction: column; line-height: 1.15; }
.hero .with-me-p b { font-size: .75rem; font-weight: 600; white-space: nowrap; }
.hero .with-me-p small { font-size: .625rem; opacity: .8; }

/* Staff ▸ Former staff: dates, service and their time with us in columns */
table.data.former th.r, table.data.former td.r { text-align: right; }
table.data.former .nowrap { white-space: nowrap; }
table.data.former td { vertical-align: middle; }

/* Announcements: photo slideshow, posted-by footer, file picker */
.ann-deck { --ar: .8; margin: 16px auto 0; max-width: 460px; outline: none; user-select: none; -webkit-user-select: none; }
.ann-stage { position: relative; width: 100%; aspect-ratio: var(--ar); max-height: 68vh; margin: 0 auto; touch-action: pan-y; }
.ann-deck.multi .ann-stage { width: calc(100% - 34px); margin-right: 34px; }
.ann-card { position: absolute; inset: 0; margin: 0; padding: 7px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 10px 26px -12px rgba(0,0,0,.35); transform-origin: 50% 85%; transition: transform .38s cubic-bezier(.2,.8,.2,1), opacity .3s; display: grid; place-items: center; overflow: hidden; }
.ann-card img { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; background: var(--surface-2); pointer-events: none; }
.ann-card.front { cursor: zoom-in; }
.ann-deck.dragging .ann-card.front { transition: none; cursor: grabbing; }
.ann-ctrl { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.ann-nav { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; background: var(--surface); color: var(--ink); cursor: pointer; padding: 0; }
.ann-nav svg { width: 16px; height: 16px; }
.ann-nav[disabled] { opacity: .35; cursor: default; }
.ann-dots { display: flex; gap: 5px; }
.ann-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--line-strong); transition: width .25s, background .25s; }
.ann-dots i.on { width: 16px; background: var(--brand); }
.ann-count { font-size: var(--fs-caption); color: var(--ink-faint); font-variant-numeric: tabular-nums; min-width: 34px; text-align: center; }
.ann-viewer .ann-deck { max-width: min(92vw, 900px); width: 100%; margin: 0; }
.ann-viewer .ann-stage { max-height: 80vh; }
.ann-viewer .ann-card { background: #1b1f1d; border-color: rgba(255,255,255,.12); }
.ann-viewer .ann-card.front { cursor: grab; }
.ann-viewer .ann-nav { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.ann-viewer .ann-dots i { background: rgba(255,255,255,.35); } .ann-viewer .ann-dots i.on { background: #fff; }
.ann-viewer .ann-count { color: rgba(255,255,255,.7); }
.ann-by { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: var(--fs-caption); line-height: 1.35; }
.ann-viewer { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.ann-viewer .ann-slides { width: 100%; max-width: 1100px; margin: 0; background: transparent; border-radius: 0; }
.ann-viewer .ann-slide img { max-height: 88vh; cursor: default; }
.ann-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; display: grid; place-items: center; cursor: pointer; }
.ann-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.ann-pick:empty { display: none; }
.ann-thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.ann-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ann-thumb > span { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 4px; padding: 4px; text-align: center; }
.ann-thumb small { font-size: .5625rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ann-thumb button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.ann-thumb button svg { width: 12px; height: 12px; }

/* Pop-ups keep their size on computers (560px; wide forms 980px; short action menus 420px) */
.sheet.narrow { max-width: 420px; }
/* Action lists in pop-ups: plain rows, left-aligned, not grey buttons */
button.item { width: 100%; background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; padding: 11px 6px; margin: 0; -webkit-appearance: none; appearance: none; }
.sheet .list > .item:first-child { border-top: 0; }
button.item:hover { background: var(--surface-2); }
button.item:hover .title { color: var(--brand); }
button.item .title { font-weight: 500; }
/* Icon-only buttons (e.g. the pop-up's close ×): never squeeze the icon */
.btn.icon-btn { padding: 0; justify-content: center; }
.btn.icon-btn svg { flex: none; }

/* Home ▸ Today: everyone working today (MD and HR) */
.hero .wt-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.hero .wt-loc { flex: none; min-width: 38px; text-align: center; font-size: .625rem; font-weight: 700; letter-spacing: .06em; padding: 3px 6px; border-radius: 6px; background: rgba(255,255,255,.2); }
.hero .wt-row .with-me-list { min-width: 0; }
.hero .wt-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; background: rgba(255,255,255,.5); }
.hero .wt-in .wt-dot { background: #4ade80; }
.hero .wt-late .wt-dot { background: #fbbf24; }
.hero .wt-not_in .wt-dot { background: #f87171; }
.hero .wt-out .wt-dot { background: rgba(255,255,255,.35); }
.hero .wt-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: .625rem; opacity: .8; }
/* Working today (MD and HR): small, even chips in matching columns on every branch row — they wrap, never crop */
.hero .wt-row { align-items: flex-start; }
.hero .wt-loc { margin-top: 5px; }
.hero .wt-grid { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 5px; }
.hero .with-me-p.wt-p { min-width: 0; gap: 5px; padding: 3px 7px 3px 3px; height: 30px; box-sizing: border-box; }
.hero .with-me-p.wt-p .avatar-img, .hero .with-me-p.wt-p .avatar-ph { flex: none; font-size: 8px !important; }
.hero .with-me-p.wt-p > span:last-child { min-width: 0; }
.hero .with-me-p.wt-p b { font-size: .5625rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero .with-me-p.wt-p small { font-size: .5rem; line-height: 1.15; white-space: nowrap; }
.hero .wt-p .wt-dot { width: 5px; height: 5px; margin-right: 3px; }

/* Celebrations: birthday, work anniversary, New Year, festive days */
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 4001; }
.celebrate-ov { position: fixed; inset: 0; z-index: 4000; display: grid; place-items: center; padding: 20px; background: rgba(8, 18, 14, .55); animation: fade .2s ease; }
.celebrate-ov.out { opacity: 0; transition: opacity .2s; }
.celebrate { width: 100%; max-width: 380px; text-align: center; background: var(--surface); border-radius: 22px; padding: 26px 24px 22px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.5); animation: pop .45s cubic-bezier(.2,1.4,.4,1); }
.celebrate-emoji { font-size: 52px; line-height: 1; margin-bottom: 10px; animation: wiggle 1.2s ease-in-out .3s 2; }
.celebrate h2 { font-family: var(--font-display, Lora, serif); font-size: 1.375rem; margin: 0 0 8px; color: var(--brand); }
.celebrate p { margin: 0 0 8px; line-height: 1.5; color: var(--ink-soft); font-size: var(--fs-body); }
.celebrate .celebrate-from { font-size: var(--fs-caption); color: var(--ink-faint); font-style: italic; margin-bottom: 16px; }
.celebrate .btn { min-width: 140px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
/* Working today: each box only as wide as the name, with the same space on both sides */
.hero .wt-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.hero .with-me-p.wt-p { flex: none; padding: 3px 9px 3px 4px; padding-inline: 6px; gap: 6px; }
/* Working today: all boxes the width of the longest name of the day (set by Home) */
.hero .wt.even .wt-grid { display: grid; grid-template-columns: repeat(auto-fill, var(--wt-w)); }
.hero .wt.even .with-me-p.wt-p { width: var(--wt-w); justify-content: flex-start; }

/* Ops ▸ Treatments: today by default, or a month, a year, all time, a custom range */
.tx-range { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: -6px 0 14px; }
.tx-range .segmented { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.tx-range .segmented::-webkit-scrollbar { display: none; }
.tx-range .segmented button { white-space: nowrap; }
.tx-range .month-nav h2 { min-width: 110px; text-align: center; }
.tx-custom { gap: 6px; flex-wrap: wrap; }
.tx-custom .input { width: auto; min-width: 0; }

/* ---------- Printed receipts and patient invoices (A5) ---------- */
.a5-ov { position: fixed; inset: 0; z-index: 3500; background: rgba(20, 24, 22, .7); overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 0 0 30px; }
.a5-bar { position: sticky; top: 0; width: 100%; display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,.15); z-index: 1; }
.a5-stage { padding: 18px 10px; width: 100%; display: flex; justify-content: center; }
.a5doc { width: 148mm; min-height: 210mm; max-width: 100%; box-sizing: border-box; background: #fff; color: #1b1f1d; padding: 11mm 10mm 9mm; font: 9.5pt/1.4 Poppins, system-ui, sans-serif;
  box-shadow: 0 10px 40px rgba(0,0,0,.35); display: flex; flex-direction: column; }
.a5doc * { color: inherit; }
.a5-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 6mm; padding-bottom: 4mm; border-bottom: 1.5px solid #1b1f1d; }
.a5-brand img { height: 15mm; width: auto; display: block; }
.a5-name { font: 600 15pt Lora, serif; }
.a5-addr { text-align: right; font-size: 8pt; line-height: 1.45; max-width: 62mm; }
.a5-title { display: flex; justify-content: space-between; align-items: baseline; margin: 5mm 0 4mm; }
.a5-title h1 { font: 600 14pt Lora, serif; letter-spacing: .06em; margin: 0; }
.a5-title b { font-size: 10pt; font-variant-numeric: tabular-nums; }
.a5-copy { margin-left: 6px; font-size: 7pt; border: 1px solid #1b1f1d; padding: 1px 5px; border-radius: 3px; letter-spacing: .1em; }
.a5-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5mm 6mm; padding: 3mm 3.5mm; background: #f3f5f4; border-radius: 2mm; }
.a5-grid div, .a5-pay div, .a5-sign { display: flex; flex-direction: column; }
.a5-grid span, .a5-pay span, .a5-sign span { font-size: 7pt; text-transform: uppercase; letter-spacing: .06em; color: #5d6a64; }
.a5-grid b, .a5-pay b { font-weight: 600; }
.a5-lines { width: 100%; border-collapse: collapse; margin: 5mm 0 3mm; font-size: 9pt; }
.a5-lines th { font-size: 7pt; text-transform: uppercase; letter-spacing: .06em; color: #5d6a64; font-weight: 600; text-align: left; border-bottom: 1px solid #1b1f1d; padding: 1.5mm 1mm; }
.a5-lines td { padding: 2mm 1mm; border-bottom: .5px solid #d5dbd8; vertical-align: top; }
.a5-lines .c { text-align: center; } .a5-lines .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.a5-lines tr.ref td { color: #8a948f; text-decoration: line-through; }
.a5-lines tfoot td { border-bottom: 0; border-top: 1.5px solid #1b1f1d; font-weight: 700; font-size: 10.5pt; padding-top: 2.5mm; }
.a5-pay { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; margin-bottom: 4mm; }
.a5-foot { margin-top: auto; padding-top: 4mm; border-top: .5px solid #d5dbd8; display: flex; flex-wrap: wrap; gap: 3mm 8mm; }
.a5-foot p { flex-basis: 100%; margin: 0; font-size: 8pt; }
.a5-foot .a5-small { font-size: 6.5pt; color: #8a948f; }
.a5-sign b { font-weight: 600; } .a5-sign small { font-size: 7.5pt; color: #5d6a64; }
@media screen and (max-width: 600px) { .a5doc { width: 100%; min-height: 0; padding: 18px 16px; font-size: 11px; } .a5-brand img { height: 46px; } }
@page { size: A5 portrait; margin: 0; }
@media print {
  body.printing-doc > *:not(.a5-ov) { display: none !important; }
  body.printing-doc { background: #fff !important; }
  .a5-ov { position: static; background: none; padding: 0; overflow: visible; display: block; }
  .a5-ov .no-print { display: none !important; }
  .a5-stage { padding: 0; display: block; }
  .a5doc { width: 148mm; height: 210mm; min-height: 0; box-shadow: none; padding: 10mm 9mm 8mm; font-size: 9.5pt; }
  .a5-brand img { height: 15mm; }
  .a5-grid { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.tx-print { gap: 8px; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.pt-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; margin-bottom: 10px; }
.pt-head div { display: flex; flex-direction: column; gap: 2px; }

/* Privacy eye on payslip figures */
.priv-eye { display: inline-grid; place-items: center; width: 24px; height: 24px; margin: -3px 6px -3px -2px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-faint); cursor: pointer; vertical-align: middle; flex: none; }
.priv-eye:hover { background: var(--surface-2); color: var(--brand); }
.priv-eye[aria-pressed='true'] { color: var(--brand); }
.priv-eye svg { width: 15px; height: 15px; }
.priv-off .num, .priv-off .v.num { filter: blur(6px); user-select: none; transition: filter .2s; }
.priv-row .num { transition: filter .2s; }
.payslip .line > span:first-child { display: flex; align-items: center; flex-wrap: wrap; }
.payslip .nett { align-items: center; } .payslip .nett > .priv-eye { margin-right: 8px; }
.pay-table td:first-child { white-space: nowrap; }
@media print { .priv-eye { display: none !important; } .priv-off .num { filter: none !important; } }
.payslip .line > span:first-child .note { flex-basis: 100%; padding-left: 28px; }
.payslip .nett > .priv-eye + div { margin-right: auto; }
/* DRL — Dr locum slot needed: an empty box in the locum colour */
.shift.shift-blank { min-width: 2.6em; min-height: 1.6em; border: 1.5px dashed; box-sizing: border-box; display: inline-block; vertical-align: middle; }
/* Receipt lines: numbered, remarks, quantity before amount, amounts left-aligned */
.a5-lines .n { width: 7mm; text-align: left; color: #5d6a64; }
.a5-lines .amt { text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; width: 26mm; }
.a5-lines th.c, .a5-lines td.c { width: 10mm; }
.a5-foot .a5-disc { font-size: 6.8pt; line-height: 1.45; color: #5d6a64; }
.a5-addr .a5-bn { display: block; font-size: 9.5pt; }
.a5-addr .a5-sub { display: block; font-size: 8pt; font-weight: 600; color: #3b4844; margin-bottom: 1.5mm; }

/* Manage ▸ Branch Details */
.br-head { display: flex; align-items: center; gap: 12px; }
.br-logo { flex: none; display: inline-flex; }
.br-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: var(--fs-caption); color: var(--ink-soft); }
.br-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.br-status.on i { background: var(--ok); } .br-status.on { color: var(--ok); }
.br-rows { margin-top: 10px; }
.br-row { display: grid; grid-template-columns: 128px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: var(--fs-body-sm); }
.br-row > span { color: var(--ink-faint); font-size: var(--fs-caption); padding-top: 1px; }
@media (max-width: 640px) { .br-row { grid-template-columns: 96px 1fr; } }
.br-hours { display: grid; gap: 6px; margin-bottom: 8px; }
.br-hour { display: grid; grid-template-columns: 92px auto 1fr; align-items: center; gap: 8px; }
.br-times { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; min-width: 0; }
.br-times .input { min-width: 0; }
@media (max-width: 520px) { .br-hour { grid-template-columns: 1fr auto; row-gap: 4px; } .br-times { grid-column: 1 / -1; } }

/* Dashboard: today's sales / today's target */
.stat-v .stat-of { font-size: .62em; font-weight: 500; color: var(--ink-faint); }
/* Today's Target: sales and target the same size; the sales figure is coloured by how far along it is */
.stat-v .stat-of.same { font-size: inherit; font-weight: inherit; color: var(--ink); }
.stat-v.fit > span { white-space: nowrap; }
.pace-bad { color: var(--bad); }
.pace-zero { color: var(--bad); opacity: .45; }
.pace-amber { color: #c27a00; }
.pace-ok { color: var(--ok); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .pace-amber { color: #f0b44c; } }
:root[data-theme='dark'] .pace-amber { color: #f0b44c; }
/* Payment mix: shorter bars of one length; amount and % in their own left-aligned columns */
/* Bar lists: one shared grid, so every column lines up and the gaps are the same between all of them.
   The label column is as wide as the longest label (up to 40%); the bar takes the rest of the card. */
.hbars { grid-template-columns: fit-content(40%) minmax(60px, 1fr) max-content; column-gap: 20px; row-gap: 12px; align-items: center; }
.hbars.has-pc { grid-template-columns: fit-content(40%) minmax(60px, 1fr) max-content max-content; }
.hbars .hbar { display: contents; }
.hbars .hbar > span:first-child { min-width: 0; }
.hbars .hbar .num { text-align: left; min-width: 0; }
.hbars .hbar .pc { color: var(--ink-faint); text-align: right; min-width: 2.6em; }
@media (max-width: 640px) {
  /* Phones: name, amount and % on one line, the bar full width underneath — no squeezed bars or wrapped names. */
  .hbars.has-pc { display: grid; grid-template-columns: 1fr; row-gap: 14px; }
  .hbars.has-pc .hbar { display: grid; grid-template-columns: minmax(0, 1fr) 6.5em 2.8em; grid-template-areas: "l n p" "t t t"; column-gap: 12px; row-gap: 6px; }
  .hbars.has-pc .hbar > span:first-child { grid-area: l; }
  .hbars.has-pc .hbar .track { grid-area: t; height: 8px; }
  .hbars.has-pc .hbar .num { grid-area: n; }
  .hbars.has-pc .hbar .pc { grid-area: p; }
}
/* Photo slides: the whole photo always shows (never cropped), in the card and full screen */
.ann-card { display: block; }
.ann-card img { position: absolute; inset: 7px; width: calc(100% - 14px); height: calc(100% - 14px); object-fit: contain; }
.ann-viewer .ann-deck { max-width: none; width: auto; }
.ann-viewer .ann-stage { width: min(88vw, calc(78vh * var(--ar))); max-height: none; height: auto; aspect-ratio: var(--ar); }
.ann-viewer .ann-deck.multi .ann-stage { width: min(84vw, calc(78vh * var(--ar))); margin-right: 34px; }

/* Sign-in pop-ups: important announcements, roster changes, today's target */
.pop-ov { position: fixed; inset: 0; z-index: 3900; background: rgba(8, 18, 14, .6); display: grid; place-items: center; padding: 16px; animation: fade .2s ease; overflow-y: auto; }
.pop { width: 100%; max-width: 420px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.5); animation: pop .35s cubic-bezier(.2,1.2,.4,1); }
.pop.wide { max-width: 640px; }
.pop-body { padding: 20px 20px 6px; overflow-y: auto; }
.pop-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.pop-kicker { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.pop-title { font-size: 1.25rem; margin: 0 0 6px; }
.pop-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); margin-bottom: 10px; }
.pop-icon svg { width: 22px; height: 22px; }
.pop-icon.target { background: color-mix(in srgb, var(--brand) 14%, transparent); }
.pop-target { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; display: grid; gap: 6px; }
.pop .deck-wrap, .pop .ann-deck { max-width: 360px; }
/* Announcements: category and importance */
.ann-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 0; }
/* Payslip list: a lighter blur that stays inside each figure */
.priv-off .num { filter: blur(4px); }
.pay-table .priv-off td.num { overflow: hidden; }
.pop-title { font-family: var(--font-display, Lora, serif); font-weight: 600; }
.pop-today { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pop-today b.num { font-size: 1.25rem; }

/* ---------- branch counter ---------- */
.ok-txt { color: var(--ok); font-weight: 600; }
.sidebar button.me.counter-me { width: 100%; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.sidebar button.me.counter-me:hover { background: rgba(255,255,255,.12); }
button.menu-me { width: 100%; border: 0; font: inherit; text-align: left; cursor: pointer; }
.counter-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 220px; padding: 4px 10px 4px 4px; border: 0; border-radius: 999px;
  background: rgba(255,255,255,.14); color: #fff; font: inherit; font-size: var(--fs-label); font-weight: 600; cursor: pointer; }
.counter-chip > span:not(.avatar-ph) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.counter-chip svg { width: 14px; height: 14px; flex: none; opacity: .8; }
.counter-chip .avatar-img, .counter-chip .avatar-ph { flex: none; }
.counter-people { display: grid; gap: 8px; margin-top: 4px; }
.counter-person { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.counter-person:hover, .counter-person:focus-visible { border-color: var(--brand); background: var(--brand-tint); }
.counter-person > span:not(.avatar-ph) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.counter-person > svg { width: 16px; height: 16px; color: var(--ink-faint); flex: none; }
.counter-pw { margin: 8px 0; font: 600 1.3rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; user-select: all; }
.ic-ask { display: flex; gap: 14px; align-items: flex-start; }
.ic-ask-ic { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); }
.ic-ask-ic svg { width: 24px; height: 24px; }
label.btn.loading { opacity: .6; pointer-events: none; }
/* Patients list: everything left-aligned, a row number, sortable headers and pages */
table.data.pt-list { min-width: 860px; }
table.data.pt-list th, table.data.pt-list td { text-align: left; vertical-align: top; }
table.data.pt-list .pt-n { width: 44px; }
table.data.pt-list td.num { font-variant-numeric: tabular-nums; }
table.data.pt-list td .cell-note { white-space: normal; }
table.data.pt-list td .cell-note.nowrap { white-space: nowrap; }
.th-sort { all: unset; cursor: pointer; font: inherit; color: inherit; white-space: nowrap; }
.th-sort:hover, .th-sort.on { color: var(--ink); }
.th-sort:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; }
.pager-per { display: inline-flex; align-items: center; gap: 6px; }
.pager-per select { width: auto; }
.nowrap { white-space: nowrap; }
/* Above / below target: +% green, −% red (grey for the branch team's own views) */
.vs { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vs.up { color: var(--ok); }
.vs.down { color: var(--bad); }
.vs.soft { color: var(--ink-faint); }
.chart-tip .vs.up { color: #7ee2a8; }
.chart-tip .vs.down { color: #ff9b9b; }
.chart-tip .vs.soft { color: #c9d1d9; }
.cmd-line { display: flex; align-items: center; gap: 8px; margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.cmd-line code { flex: 1; min-width: 0; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; color: var(--ink); user-select: all; }
.shift.shift-blank.named { display: inline-grid; place-items: center; font-size: .72em; font-weight: 700; opacity: 1; }
/* Treatments list: print straight from the row */
table.data.visits col.pr-col { width: 104px; }
table.data.visits .print-btn { padding: 6px 8px; }
table.data.visits .print-btn svg { width: 18px; height: 18px; }
.print-menu { position: absolute; z-index: 60; display: flex; flex-direction: column; min-width: 150px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 28px rgba(0,0,0,.14); }
.print-menu button { all: unset; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: var(--fs-body-sm); color: var(--ink); }
.print-menu button:hover, .print-menu button:focus-visible { background: var(--surface-2); }
.print-menu svg { width: 16px; height: 16px; }
table.data.fin.cols-7.visits col.lab { width: 36%; }
/* "Can't save yet": a pop-up over the form saying what's missing; OK goes to the field, which is outlined in red */
.problem-ov { position: fixed; inset: 0; z-index: 4000; display: grid; place-items: center; padding: 16px; background: rgba(18, 24, 22, .45); animation: fade .15s ease; }
.problem { animation: pop .18s ease; width: min(380px, 100%); background: var(--surface); color: var(--ink); border-radius: 20px; padding: 22px 22px 18px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.problem-ic { width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--bad-bg, #f6e1df); color: var(--bad); }
.problem-ic svg { width: 26px; height: 26px; }
.problem-t { font-weight: 700; font-size: var(--fs-title, 1.15rem); }
.problem p { margin: 6px 0 16px; color: var(--ink-muted, var(--ink)); line-height: 1.45; }
.field.invalid > label { color: var(--bad); }
.field.invalid .input, .field.invalid select, .field.invalid textarea { border-color: var(--bad) !important; box-shadow: 0 0 0 3px rgba(179, 38, 30, .15); }
.cover-check { margin: 0 0 14px; }
.cover-days { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: var(--fs-label); }
.cover-day b { margin-right: 4px; }

/* Visit form: "New patient" tick and the branch note / Move button share one row, both lined up to the left edge of their column */
.tx-meta { align-items: center; margin: -4px 0 14px; }
.tx-meta > .check { margin: 0; min-height: 34px; }
.tx-branch-note { display: flex; align-items: center; justify-content: flex-start; min-height: 34px; text-align: left; }
.tx-branch-note .btn { margin: 0 !important; }
.tx-branch-note .hint { margin: 0; }
/* Edited / cross-checked trail on a visit */
.edit-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: var(--fs-caption); color: var(--ink-faint); }
.check-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, rgba(0,0,0,.03)); margin: 0 0 14px; font-size: var(--fs-body-sm); }
.check-box .spacer { flex: 1; }
/* Returning patient search on Add Patient Visit */
.pt-find { position: relative; padding: 12px; border: 1px dashed var(--line, rgba(0,0,0,.15)); border-radius: 12px; background: var(--surface-2, rgba(0,0,0,.02)); }
.pt-results { display: grid; gap: 2px; max-height: 300px; overflow: auto; border: 1px solid var(--line, rgba(0,0,0,.12)); border-radius: 10px; background: var(--surface, #fff); }
.pt-hit { display: grid; gap: 2px; text-align: left; padding: 9px 12px; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; }
.pt-hit:hover, .pt-hit:focus-visible { background: var(--brand-soft, rgba(0,0,0,.05)); outline: none; }
.pt-hit span { font-size: var(--fs-caption); color: var(--ink-faint); }
.pt-none { padding: 10px 12px; font-size: var(--fs-body-sm); color: var(--ink-soft); }
.pt-picked { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--fs-body-sm); color: var(--ok, #1d7a46); }
.pt-picked .btn { margin-left: auto; }

/* Patient flow: Waiting (amber) → In treatment (blue) → Completed (green) */
:root { --flow-wait: #b86e00; --flow-wait-bg: #fdf0d9; --flow-tx: #1f5fa8; --flow-tx-bg: #e2edfb; --flow-done: #2f7a55; --flow-done-bg: #e2f1e8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --flow-wait: #f0b44c; --flow-wait-bg: #3a2c12; --flow-tx: #8dbbf2; --flow-tx-bg: #1a2b40; --flow-done: #7cc9a0; --flow-done-bg: #1d3328; } }
:root[data-theme='dark'] { --flow-wait: #f0b44c; --flow-wait-bg: #3a2c12; --flow-tx: #8dbbf2; --flow-tx-bg: #1a2b40; --flow-done: #7cc9a0; --flow-done-bg: #1d3328; }
.flow-pill { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 5px 10px; border-radius: 10px; border: 1px solid transparent; font: 600 var(--fs-caption)/1.25 var(--font); white-space: nowrap; text-align: left; }
.flow-pill small { font-weight: 500; opacity: .85; font-size: 11px; }
.flow-pill.waiting { color: var(--flow-wait); background: var(--flow-wait-bg); border-color: color-mix(in srgb, var(--flow-wait) 30%, transparent); }
.flow-pill.started { color: var(--flow-tx); background: var(--flow-tx-bg); border-color: color-mix(in srgb, var(--flow-tx) 30%, transparent); }
.flow-pill.completed { color: var(--flow-done); background: var(--flow-done-bg); }
button.flow-pill { cursor: pointer; }
button.flow-pill:hover { filter: brightness(.97); box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 15%, transparent); }
button.flow-pill::after { content: ''; }
table.data.fin.cols-8.visits col.lab { width: 30%; }
table.data.visits col.st-col { width: 150px; }
.flow-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.flow-stats .fs { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.flow-stats .fs span { font-size: var(--fs-caption); color: var(--ink-soft); }
.flow-stats .fs b { font-size: 1.125rem; font-weight: 600; }
.flow-stats .fs.waiting { background: var(--flow-wait-bg); } .flow-stats .fs.waiting b { color: var(--flow-wait); }
.flow-stats .fs.started { background: var(--flow-tx-bg); } .flow-stats .fs.started b { color: var(--flow-tx); }
.flow-stats .fs.completed { background: var(--flow-done-bg); } .flow-stats .fs.completed b { color: var(--flow-done); }
.flow-banner { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 0 0 14px; border-radius: 12px; background: var(--surface-2); font-size: var(--fs-body-sm); color: var(--ink-soft); }
.tx-mode { margin: 0 0 6px; }
.tx-mode button svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 4px; }
.tx-mode-hint { margin: 0 0 14px; }

/* Branch counter ▸ Invoices & Claims */
.spend-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.spend-act { display: grid; gap: 4px; justify-items: start; align-content: start; text-align: left; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); }
.spend-act:hover { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.spend-act svg { width: 22px; height: 22px; color: var(--brand); }
.spend-act b { font-size: var(--fs-body); }
.spend-act span { font-size: var(--fs-caption); color: var(--ink-soft); }
/* Receipts: deposit / instalment plan box */
.a5-plan { border: 1px solid #c9d3ce; border-radius: 6px; padding: 7px 9px; margin: 8px 0; font-size: 8pt; }
.a5-plan-h { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.a5-plan-h span { font-weight: 700; color: #1d6b48; text-transform: uppercase; font-size: 7pt; letter-spacing: .06em; }
.a5-plan-g { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.a5-plan-g div { display: flex; flex-direction: column; }
.a5-plan-g span { font-size: 6.5pt; text-transform: uppercase; letter-spacing: .06em; color: #5d6a64; }
.a5-plan-s { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; padding-top: 5px; border-top: 1px dashed #c9d3ce; font-size: 7.5pt; }
/* Deposits, split payments and instalments */
.ok-txt { color: var(--ok); }
.form-grid.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
@media (max-width: 640px) { .form-grid.three { grid-template-columns: 1fr; } }
.split-box { display: grid; gap: 8px; margin: 0 0 14px; }
.split-rows { display: grid; gap: 8px; }
.split-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: 8px; align-items: center; }
.split-box .btn[data-split-add] { justify-self: start; }
.plan-fields { padding: 12px; margin: 0 0 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-strong, var(--line)); }
.plan-fields .plan-kind { margin: 0 0 12px; }
.plan-fields [data-plan-sum] { font-weight: 600; color: var(--ink); }
.plan-open { display: grid; gap: 8px; margin: 0 0 12px; }
.plan-open-row { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); }
.plan-open-pay { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.plan-open-pay .input.sm { height: 34px; width: auto; min-width: 110px; }
.plan-head { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.plan-head div { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.plan-head span { font-size: var(--fs-caption); color: var(--ink-soft); }
.plan-head b { font-size: 1.05rem; }
@media (max-width: 640px) { .plan-head { grid-template-columns: repeat(2, 1fr); } }
.plan-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 8px; }
.plan-bar i { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.plan-sum-box { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); margin-bottom: 14px; }
.plan-sum-box div:first-child { display: flex; justify-content: space-between; gap: 10px; }
/* ---------- Appointments calendar ---------- */
.appt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: -4px 0 14px; }
.appt-bar .month-nav h2 { min-width: 0; font-size: 1.05rem; }
.appt-wrap { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .appt-wrap { grid-template-columns: 1fr; } .appt-side { display: none; } }
.appt-side { position: sticky; top: 12px; display: grid; gap: 14px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.mini-h { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-body-sm); }
.mini-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: 12px; }
.mini-g .mini-dw { color: var(--ink-faint); font-size: 11px; padding: 4px 0; }
.mini-g button { all: unset; cursor: pointer; padding: 5px 0; border-radius: 8px; }
.mini-g button:hover { background: var(--surface-2); }
.mini-g button.in { background: var(--brand-tint, var(--surface-2)); }
.mini-g button.today { background: var(--brand); color: #fff; font-weight: 600; }
.appt-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.appt-stats div { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); font-size: var(--fs-caption); }
.appt-legend { display: grid; gap: 5px; font-size: var(--fs-caption); }
.appt-legend span:not(.label) { display: flex; align-items: center; gap: 8px; }
.appt-legend i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.appt-card { padding: 0; overflow: auto; max-height: calc(100vh - 210px); min-height: 420px; }
.appt-grid { display: grid; grid-template-rows: auto 1fr; min-width: calc(56px + var(--cols) * 104px); }
.appt-head { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); background: var(--surface); border-bottom: 1px solid var(--line); }
.appt-dh { all: unset; display: grid; gap: 1px; justify-items: center; padding: 9px 4px; font-size: var(--fs-caption); color: var(--ink-soft); text-align: center; border-left: 1px solid var(--line); }
button.appt-dh { cursor: pointer; } button.appt-dh:hover { background: var(--surface-2); }
.appt-dh b { color: var(--ink); font-size: var(--fs-body-sm); }
.appt-dh.today { background: color-mix(in srgb, var(--gold, #d8b56a) 18%, transparent); }
.appt-dh.today b { color: var(--brand); }
.appt-body { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); position: relative; }
.appt-axis { position: relative; }
.appt-axis span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--ink-faint); white-space: nowrap; }
.appt-axis span:first-child { transform: none; }
.appt-col { position: relative; border-left: 1px solid var(--line); cursor: copy; }
.appt-hr { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.appt-half { position: absolute; left: 0; right: 0; border-top: 1px dashed color-mix(in srgb, var(--line) 70%, transparent); }
.appt-now { position: absolute; left: -4px; right: 0; height: 2px; background: #e5484d; z-index: 3; }
.appt-now::before { content: ''; position: absolute; left: 0; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #e5484d; }
.appt-ev { position: absolute; z-index: 2; overflow: hidden; padding: 4px 7px; border-radius: 8px; background: var(--c); color: var(--fg); font-size: 11.5px; line-height: 1.3;
  box-shadow: 0 1px 2px rgba(0,0,0,.12); cursor: grab; border-left: 4px solid color-mix(in srgb, var(--c) 70%, #000); touch-action: none; user-select: none; }
.appt-ev:hover { z-index: 4; box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.appt-ev .ev-h { display: flex; justify-content: space-between; gap: 4px; }
.appt-ev .ev-h b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-ev .ev-ic { display: inline-flex; gap: 3px; align-items: center; flex: none; }
.appt-ev .ev-ic svg { width: 12px; height: 12px; }
.appt-ev .ev-b { font-style: normal; font-size: 9px; font-weight: 700; padding: 0 4px; border-radius: 4px; background: rgba(255,255,255,.28); }
.appt-ev .ev-t, .appt-ev .ev-s { opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-ev.st-confirmed { box-shadow: inset 0 0 0 2px rgba(255,255,255,.55), 0 1px 2px rgba(0,0,0,.12); }
.appt-ev.st-arrived { outline: 3px solid color-mix(in srgb, var(--c) 45%, #fff); }
.appt-ev.st-completed { opacity: .7; }
.appt-ev.st-no_show, .appt-ev.st-cancelled { opacity: .45; background: repeating-linear-gradient(135deg, var(--c) 0 6px, color-mix(in srgb, var(--c) 70%, #fff) 6px 12px); }
.appt-ev.st-no_show b, .appt-ev.st-cancelled b { text-decoration: line-through; }
.appt-ev.dragging { opacity: .35; }
.appt-ev.ghost { opacity: .9; box-shadow: 0 12px 30px rgba(0,0,0,.3); cursor: grabbing; }
.appt-list { padding: 14px 16px; display: grid; gap: 6px; }
.appt-lday { margin: 12px 0 2px; font-size: var(--fs-body-sm); } .appt-lday.today { color: var(--brand); }
.appt-li { all: unset; cursor: pointer; display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border-left: 5px solid var(--c); }
.appt-li:hover { background: color-mix(in srgb, var(--c) 10%, var(--surface-2)); }
.appt-li .li-t { display: grid; font-weight: 600; } .appt-li .li-t small { color: var(--ink-faint); font-weight: 400; }
.appt-li .li-b { display: grid; gap: 2px; min-width: 0; } .appt-li .li-b small { color: var(--ink-soft); }
.appt-li.st-cancelled, .appt-li.st-no_show { opacity: .55; }
.appt-dhead { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: color-mix(in srgb, var(--c) 12%, var(--surface)); margin-bottom: 12px; }
.appt-dhead i { width: 10px; align-self: stretch; border-radius: 6px; background: var(--c); }
.appt-dhead div { display: grid; gap: 2px; flex: 1; } .appt-dhead span { font-size: var(--fs-caption); color: var(--ink-soft); }
.appt-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 12px 0; }
.appt-info div { display: grid; gap: 2px; } .appt-info .wide { grid-column: 1 / -1; }
.appt-info span { font-size: var(--fs-caption); color: var(--ink-soft); }
.appt-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.appt-chip { display: inline-block; margin-top: 6px; padding: 5px 10px; border-radius: 8px; font-size: var(--fs-caption); font-weight: 600; color: #fff; }
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 8px; vertical-align: -1px; }
.color-in { width: 46px; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: none; }
/* Dashboard: upcoming patients */
.up-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.up-days button { all: unset; cursor: pointer; display: grid; gap: 1px; justify-items: center; padding: 8px 4px; border-radius: 12px; background: var(--surface-2); font-size: var(--fs-caption); color: var(--ink-soft); }
.up-days button b { font-size: 1.15rem; color: var(--ink); }
.up-days button.on { background: var(--brand); color: #fff; } .up-days button.on b { color: #fff; }
.up-bar { display: flex; gap: 2px; height: 5px; width: 80%; margin-top: 4px; font-style: normal; }
.up-bar em { flex: 1; border-radius: 3px; }
.up-list { display: grid; gap: 6px; margin-top: 12px; max-height: 360px; overflow: auto; }
.up-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border-left: 4px solid var(--c); text-decoration: none; color: inherit; }
.up-row .up-b { display: grid; min-width: 0; } .up-row small { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-row .up-t { font-weight: 600; font-size: var(--fs-body-sm); }
.up-row.st-no_show { opacity: .55; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.set-grid .card { margin: 0; }
/* ---------- Branch counter: its own grainy colour background ---------- */
:root[data-counter] {
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  --c-base: #2a1636; --c-1: #f2a65a; --c-2: #c2456e; --c-3: #5b2a86; --c-img: none; --c-active: rgba(255,255,255,.18);
}
:root[data-counter='lagoon'] { --c-base: #0d3b4c; --c-1: #3bc9b0; --c-2: #2b7bb9; --c-3: #0f5c6e; }
:root[data-counter='orchid'] { --c-base: #2a1f5c; --c-1: #e58fb7; --c-2: #8e6cef; --c-3: #3d2a80; }
:root[data-counter='ember'] { --c-base: #3a1410; --c-1: #ffb36b; --c-2: #e2553d; --c-3: #7a1f2b; }
:root[data-counter] { --c-shade: linear-gradient(transparent, transparent); }
/* Your photos: a soft dark tint so the white menu text stays easy to read */
:root[data-counter^='colourful'] { --c-base: #2a2238; --c-1: transparent; --c-2: transparent; --c-3: transparent; --c-shade: linear-gradient(180deg, rgba(22, 12, 34, .42), rgba(22, 12, 34, .58)); }
:root[data-counter='colourful1'] { --c-img: url('/img/bg/colourful1.jpg'); }
:root[data-counter='colourful2'] { --c-img: url('/img/bg/colourful2.jpg'); }
:root[data-counter='colourful3'] { --c-img: url('/img/bg/colourful3.jpg'); }
:root[data-counter='colourful4'] { --c-img: url('/img/bg/colourful4.jpg'); }
:root[data-counter='colourful5'] { --c-img: url('/img/bg/colourful5.jpg'); }
:root[data-counter] {
  --c-bg: var(--grain), radial-gradient(120% 80% at 10% 0%, var(--c-1) 0%, transparent 55%), radial-gradient(90% 70% at 100% 40%, var(--c-2) 0%, transparent 60%),
    radial-gradient(110% 90% at 30% 110%, var(--c-3) 0%, transparent 60%), var(--c-shade), var(--c-img) center / cover, var(--c-base);
}
[data-counter] .topbar, [data-counter] .auth, [data-counter] .hero { background: var(--c-bg) !important; background-blend-mode: overlay, normal, normal, normal, normal, normal, normal !important; }
@media (min-width: 900px) {
  [data-counter] .sidebar { background: var(--c-bg) !important; background-blend-mode: overlay, normal, normal, normal, normal, normal, normal !important; }
  [data-counter] .sidebar nav a[aria-current='page'] { background: var(--c-active); }
  [data-counter] .sidebar nav a .count { color: var(--c-base); }
}
.cbg-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.cbg-sw { all: unset; cursor: pointer; display: grid; gap: 4px; justify-items: center; padding: 6px; border-radius: 12px; border: 2px solid transparent; font-size: 11px; color: var(--ink-soft); }
.cbg-sw[aria-pressed='true'] { border-color: var(--brand); color: var(--ink); }
.cbg-sw i { width: 100%; height: 44px; border-radius: 9px; background-blend-mode: overlay, normal, normal, normal, normal; }
.cbg-sw[data-cbg-sw='dusk'] i { background: var(--grain), radial-gradient(120% 90% at 10% 0%, #f2a65a, transparent 60%), radial-gradient(90% 80% at 100% 40%, #c2456e, transparent 65%), #2a1636; }
.cbg-sw[data-cbg-sw='lagoon'] i { background: var(--grain), radial-gradient(120% 90% at 10% 0%, #3bc9b0, transparent 60%), radial-gradient(90% 80% at 100% 40%, #2b7bb9, transparent 65%), #0d3b4c; }
.cbg-sw[data-cbg-sw='orchid'] i { background: var(--grain), radial-gradient(120% 90% at 10% 0%, #e58fb7, transparent 60%), radial-gradient(90% 80% at 100% 40%, #8e6cef, transparent 65%), #2a1f5c; }
.cbg-sw[data-cbg-sw='ember'] i { background: var(--grain), radial-gradient(120% 90% at 10% 0%, #ffb36b, transparent 60%), radial-gradient(90% 80% at 100% 40%, #e2553d, transparent 65%), #3a1410; }
.cbg-sw[data-cbg-sw^='colourful'] i { background: var(--grain), var(--sw-img, none) center / cover, #3a3346; }
.cbg-sw[data-cbg-sw='colourful1'] i { --sw-img: url('/img/bg/colourful1.jpg'); } .cbg-sw[data-cbg-sw='colourful2'] i { --sw-img: url('/img/bg/colourful2.jpg'); }
.cbg-sw[data-cbg-sw='colourful3'] i { --sw-img: url('/img/bg/colourful3.jpg'); } .cbg-sw[data-cbg-sw='colourful4'] i { --sw-img: url('/img/bg/colourful4.jpg'); }
.cbg-sw[data-cbg-sw='colourful5'] i { --sw-img: url('/img/bg/colourful5.jpg'); }

/* Appointments: the date / calendar panel can be minimised */
.appt-wrap.side-off { grid-template-columns: minmax(0, 1fr); }
.appt-side { position: sticky; }
.appt-side .side-min { position: absolute; top: 8px; right: 8px; }
.appt-side .mini-cal { margin-top: 22px; }
.side-toggle svg { width: 15px; height: 15px; }
@media (max-width: 1000px) { .side-toggle { display: none; } }
/* Left-aligned money tables with a copy button next to the amount */
table.data.left-all th, table.data.left-all td { text-align: left !important; }
.amt-copy { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.copy-amt { all: unset; cursor: pointer; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; color: var(--ink-faint); }
.copy-amt:hover, .copy-amt:focus-visible { background: var(--surface-2); color: var(--brand); }
.copy-amt.done { color: var(--ok); }
.copy-amt svg { width: 14px; height: 14px; }
/* Full-screen pages (the appointment calendar): no width limit */
.app.wide-page .main { max-width: none; }
.app.wide-page .appt-card { max-height: calc(100vh - 170px); }

/* Appointments in soft, nude tones of each treatment's colour (the full colour stays as the edge and the dots) */
.appt-ev { background: color-mix(in srgb, var(--c) 20%, var(--surface)); color: var(--ink); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); border-left: 4px solid color-mix(in srgb, var(--c) 80%, var(--surface)); box-shadow: none; }
.appt-ev .ev-t, .appt-ev .ev-s { color: var(--ink-soft); opacity: 1; }
.appt-ev .ev-ic { color: color-mix(in srgb, var(--c) 75%, var(--ink)); }
.appt-ev .ev-b { background: color-mix(in srgb, var(--c) 28%, var(--surface)); color: var(--ink); }
.appt-ev:hover { background: color-mix(in srgb, var(--c) 30%, var(--surface)); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.appt-ev.st-confirmed { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 55%, transparent); }
.appt-ev.st-arrived { outline: 2px solid color-mix(in srgb, var(--c) 60%, transparent); }
.appt-ev.st-no_show, .appt-ev.st-cancelled { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 14%, var(--surface)) 0 6px, var(--surface) 6px 12px); }
.appt-li { background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.appt-li:hover { background: color-mix(in srgb, var(--c) 20%, var(--surface)); }
.up-row { background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.appt-dhead { background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.appt-chip { background: color-mix(in srgb, var(--chip, #888) 22%, var(--surface)) !important; color: var(--ink) !important; border-left: 4px solid var(--chip, #888); }
/* Calendar: doctors on duty and notes in the day headers */
.appt-dh { position: relative; padding: 8px 6px 6px; gap: 3px; }
.appt-dh .dh-day { all: unset; cursor: pointer; display: grid; justify-items: center; gap: 1px; padding: 2px 6px; border-radius: 8px; }
.appt-dh .dh-day:hover { background: var(--surface-2); }
.appt-dh .dh-drs { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.appt-dh .dh-drs span { font-size: 10.5px; padding: 1px 6px; border-radius: 99px; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--ink); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.appt-dh .dh-drs span.none { background: none; color: var(--ink-faint); }
.appt-dh .dh-note { all: unset; cursor: pointer; position: absolute; top: 6px; right: 6px; display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--ink-faint); padding: 2px 4px; border-radius: 6px; }
.appt-dh .dh-note svg { width: 12px; height: 12px; }
.appt-dh .dh-note.has { color: #8a5a00; background: var(--warn-bg); font-weight: 600; }
.appt-dh .dh-drnote { display: block; font-style: normal; font-size: 11px; color: #8a5a00; background: var(--warn-bg); border-radius: 6px; padding: 2px 6px; margin-top: 2px; }
.ev-b.ev-alert { background: #e5484d !important; color: #fff !important; }
.appt-ev .ev-b svg { width: 9px; height: 9px; vertical-align: -1px; }
.side-notes { display: grid; gap: 6px; }
.side-h { display: flex; align-items: center; justify-content: space-between; }
.side-note { display: flex; align-items: flex-start; gap: 6px; padding: 7px 8px; border-radius: 10px; background: var(--warn-bg); font-size: var(--fs-caption); }
.side-note span { flex: 1; display: grid; gap: 2px; } .side-note small { color: var(--ink-faint); }
.side-note.rem { background: var(--surface-2); } .side-note.rem.late { background: var(--bad-bg); }
/* Patient notes / reminders / alerts */
.pn-box { display: grid; gap: 6px; margin: 0 0 12px; }
.pn { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: var(--fs-body-sm); }
.pn .pn-k { flex: none; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); padding-top: 2px; min-width: 64px; }
.pn .pn-t { flex: 1; display: grid; gap: 2px; } .pn small { color: var(--ink-faint); font-size: var(--fs-caption); }
.pn-alert { background: var(--bad-bg); } .pn-alert .pn-k { color: var(--bad); }
.pn-reminder.due { background: var(--warn-bg); } .pn-reminder.due .pn-k { color: #8a5a00; }
.pn-add summary { cursor: pointer; font-size: var(--fs-caption); color: var(--brand); list-style: none; }
.pn-form { display: grid; gap: 8px; margin-top: 8px; }
.pn-form .btn { justify-self: start; }
/* Amount + copy button: the amount takes a fixed width (tabular figures), so every copy button lines up in one column */
.amt-copy { display: inline-grid; grid-template-columns: minmax(13ch, max-content) 26px; align-items: center; gap: 6px; }
.amt-copy > b, .amt-copy > span { font-variant-numeric: tabular-nums; white-space: nowrap; }
td .amt-copy { vertical-align: middle; }
td:has(> .amt-copy) { width: 1%; white-space: nowrap; padding-right: 18px; }
table.data col.amt-col { width: 170px; }
table.data col.st-col2 { width: 120px; }
/* Counter ▸ Patient reminders */
.rem-banner { display: block; text-decoration: none; margin: -4px 0 14px; }
.rem-list { display: grid; gap: 8px; }
.rem-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--c) 10%, var(--surface)); border-left: 4px solid color-mix(in srgb, var(--c) 75%, var(--surface)); }
.rem-row.sent { opacity: .72; }
.rem-t { display: grid; } .rem-t small { color: var(--ink-faint); }
.rem-b { display: grid; gap: 3px; min-width: 0; } .rem-b small { color: var(--ink-soft); }
.rem-b summary { cursor: pointer; font-size: var(--fs-caption); color: var(--brand); margin-top: 2px; }
.rem-msg { white-space: pre-wrap; font: 13px/1.5 var(--font); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 6px 0 0; }
.rem-a { display: grid; gap: 6px; justify-items: end; }
.segmented.sm button { padding: 4px 10px; font-size: var(--fs-caption); }
@media (max-width: 760px) { .rem-row { grid-template-columns: 56px 1fr; } .rem-a { grid-column: 1 / -1; justify-items: start; } }
/* "No response" to a WhatsApp reminder — softer than No-show, still asks for a call */
.pill.bad-soft { background: color-mix(in srgb, var(--bad-bg) 60%, transparent); color: var(--bad); border: 1px dashed color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.rem-conf { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
/* Hide / show calendar: a real, framed button so it reads as clickable */
.btn.side-toggle { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line));
  box-shadow: 0 1px 0 rgba(0,0,0,.04), inset 0 1px 0 rgba(255,255,255,.6); border-radius: 9px; padding: 6px 12px; font-weight: 600; }
.btn.side-toggle:hover { background: color-mix(in srgb, var(--brand) 15%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.btn.side-toggle[aria-pressed="false"] { background: var(--brand); color: var(--brand-ink, #fff); border-color: transparent; }
/* Hover box over a patient on the calendar */
.appt-tip { position: fixed; z-index: 90; width: 290px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(20,30,40,.18); padding: 10px 12px; font-size: 12.5px; pointer-events: none; }
.appt-tip .tip-h { display: flex; gap: 8px; align-items: flex-start; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.appt-tip .tip-h i { width: 4px; align-self: stretch; border-radius: 3px; background: var(--c); }
.appt-tip .tip-h b { display: block; font-size: 13.5px; }
.appt-tip small { color: var(--ink-soft); display: block; }
.appt-tip dl { display: grid; grid-template-columns: 72px 1fr; gap: 6px 8px; margin: 0; }
.appt-tip dt { color: var(--ink-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.appt-tip dd { margin: 0; }
.appt-tip .tip-rem { display: block; line-height: 1.35; } .appt-tip .tip-rem small { display: inline; }
@media (hover: none) { .appt-tip { display: none; } }
/* Viewing an uploaded file inside the portal */
body.doc-viewing { overflow: hidden; }
.doc-viewer { position: fixed; inset: 0; z-index: 4500; display: flex; flex-direction: column; background: var(--bg); }
.doc-viewer .dv-bar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); }
.doc-viewer .dv-back { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--brand); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px;
  padding: 6px 10px; margin-left: -10px; border-radius: 8px; white-space: nowrap; }
.doc-viewer .dv-back:hover, .doc-viewer .dv-back:focus-visible { background: color-mix(in srgb, var(--brand) 10%, transparent); text-decoration-color: currentColor; outline: none; }
.doc-viewer .dv-back svg { width: 18px; height: 18px; }
.doc-viewer .dv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); font-size: 13px; text-align: center; }
.doc-viewer .dv-acts { display: flex; gap: 8px; }
.doc-viewer .dv-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 16px; }
.doc-viewer .dv-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.15); background: #fff; }
.doc-viewer .dv-body iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; background: #fff; }
@media (max-width: 640px) { .doc-viewer .dv-name { display: none; } .doc-viewer .dv-acts .btn { padding: 6px 8px; font-size: 0; gap: 0; } .doc-viewer .dv-acts .btn svg { font-size: 14px; } .doc-viewer .dv-bar { justify-content: space-between; } }
/* Receipt / invoice ▸ Send on WhatsApp */
.a5-wa { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; }
.btn.wa-btn { background: #1f9d55; color: #fff; border-color: #1f9d55; }
.btn.wa-btn:hover { background: #188046; border-color: #188046; }
.a5-wa-pv { max-width: 560px; margin: 12px auto 0; padding: 12px 14px; background: #e7f8dc; color: #1d2824; border-radius: 10px 10px 10px 2px; font: 13px/1.45 var(--font, inherit); white-space: pre-wrap; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
@media (max-width: 640px) { .a5-bar { flex-wrap: wrap; } .a5-wa { order: 5; width: 100%; } }
/* WhatsApp send buttons (receipts / invoices) */
.wa-ico { width: 17px; height: 17px; flex: none; }
.btn.wa-icon-btn { color: #1f9d55; border-color: color-mix(in srgb, #1f9d55 35%, var(--line)); background: color-mix(in srgb, #1f9d55 7%, var(--surface)); }
.btn.wa-icon-btn:hover { background: #1f9d55; color: #fff; border-color: #1f9d55; }
.btn.wa-out { color: #17803f; border-color: color-mix(in srgb, #1f9d55 35%, var(--line)); }
.btn.wa-out .wa-ico { width: 15px; height: 15px; }
.btn.wa-out:hover { background: color-mix(in srgb, #1f9d55 10%, var(--surface)); }
.pr-send { display: inline-flex; gap: 6px; }
table.data.visits .wa-icon-btn { padding: 6px 8px; }
table.data.pt-list td.c { text-align: center; vertical-align: middle; }
.doc-pair { display: inline-flex; gap: 4px; }
.doc-pair .wa-icon-btn { padding: 5px 7px; }
.tx-sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 4px; }
.wa-send-bar { align-items: center; margin-bottom: 10px; }
.print-menu .wa-ico { color: #1f9d55; }
table.data.visits th:last-child { white-space: nowrap; }
.wa-send-bar { flex-wrap: nowrap; gap: 8px; }
.wa-send-bar .a5-wa { flex-wrap: wrap; }
/* ---------- Clinical notes ---------- */
.cn-pt { width: 100%; text-align: left; background: none; border: 0; font: inherit; color: inherit; }
.cn-pt-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin-bottom: 12px; }
.cn-staff { margin-bottom: 12px; } .cn-staff summary, .cn-hist summary, .pn-past summary { cursor: pointer; font-size: var(--fs-body-sm); color: var(--ink-soft); }
.cn-visit { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.cn-visit.mine { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.cn-visit h3 { margin: 0 0 8px; font-size: 15px; }
.cn-note { border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 0 10px 10px 0; padding: 10px 12px; margin: 8px 0; }
.cn-note.pending { border-left-color: var(--warn, #c98a1a); }
.cn-note.deleted { border-left-color: var(--bad); opacity: .85; }
.cn-note header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.cn-body { white-space: pre-wrap; font: inherit; margin: 8px 0 4px; line-height: 1.5; }
.cn-body.struck, .cn-old { text-decoration: line-through; color: var(--ink-soft); }
.cn-old { white-space: pre-wrap; font: inherit; font-size: 12.5px; margin: 4px 0 0; padding: 6px 8px; background: var(--surface); border-radius: 6px; }
.cn-del { color: var(--bad); font-size: 13px; margin: 8px 0 0; }
.cn-h { font-size: 12.5px; margin: 6px 0; }
.cn-acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.cn-acts:empty { display: none; }
.cn-plus { margin-top: 6px; }
.cn-form { display: grid; gap: 8px; margin: 8px 0; }
.cn-form textarea { min-height: 120px; resize: vertical; }
.cn-req { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.cn-req:first-of-type { border-top: 0; }
.cn-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.cn-diff pre, .cn-req .cn-body { white-space: pre-wrap; font: inherit; font-size: 13px; background: var(--surface-2); border-radius: 8px; padding: 8px; margin: 4px 0 0; }
@media (max-width: 640px) { .cn-req { flex-direction: column; } .cn-diff { grid-template-columns: 1fr; } }
/* ---------- Before / after photos ---------- */
.vp-box { margin-top: 10px; }
.vp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.vp-add { display: inline-flex; gap: 6px; } .vp-add label { cursor: pointer; }
.vp-strip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 4px; }
.vp-thumb { position: relative; margin: 0; flex: none; width: 120px; }
.vp-thumb img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; display: block; background: var(--surface-2); }
.vp-thumb figcaption { font-size: 11.5px; margin-top: 4px; line-height: 1.3; }
.vp-thumb figcaption small { display: block; color: var(--ink-faint); }
.vp-k { font-weight: 700; } .vp-before { color: var(--ink-soft); } .vp-after { color: var(--ok); }
.vp-del { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.vp-del svg { width: 13px; height: 13px; }
.pt-photos .vp-box { margin-top: 8px; }
/* ---------- staff notes ---------- */
.pn-acts { display: inline-flex; gap: 2px; align-items: center; }
.pn.done { opacity: .7; }
.pn-past { margin: 6px 0; }
.pn-editf { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; } .pn-editf .input { flex: 1; min-width: 180px; }
/* ---------- locum logins ---------- */
.cred { display: grid; gap: 10px; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.cred > div { display: flex; flex-direction: column; gap: 2px; } .cred .mono { font-family: ui-monospace, Menlo, monospace; font-size: 15px; }
/* Appointments: patient search bar, interactive hover box, drop on the little calendar */
.appt-search { position: relative; margin: 0 0 12px; max-width: 560px; }
.appt-search-in { position: relative; } .appt-search-in svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-faint); }
.appt-search-in .input { padding-left: 36px; }
.appt-search-res { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 70; }
.pt-hit.pt-new { border-top: 1px solid var(--line); color: var(--brand); }
.appt-tip { pointer-events: auto; }
.appt-tip .tip-acts { display: flex; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.appt-tip .tip-acts:empty { display: none; }
.mini-cal .drop { background: var(--brand) !important; color: var(--brand-ink, #fff) !important; border-radius: 8px; }
.pt-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
/* ---------- Dental chart ---------- */
.dc-chart { overflow-x: auto; padding: 4px 0 8px; }
.dc-row { display: flex; gap: 4px; justify-content: center; min-width: 660px; }
.dc-mid { width: 2px; background: var(--line); margin: 0 6px; }
.dc-sep { display: flex; justify-content: space-between; min-width: 660px; border-top: 1px dashed var(--line); margin: 8px 0; padding-top: 2px; font-size: 10.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }
.dc-t { width: 38px; display: grid; justify-items: center; gap: 2px; padding: 4px 2px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); }
.dc-t:hover { border-color: var(--brand); } .dc-t.on { outline: 2px solid var(--brand); outline-offset: 1px; }
.dc-t.has { background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.dc-t.gone .dc-ic { opacity: .25; }
.dc-n { font-size: 10.5px; font-weight: 700; color: var(--ink-soft); }
.dc-ic svg { width: 22px; height: 22px; }
.dc-b { display: flex; flex-wrap: wrap; gap: 1px; justify-content: center; min-height: 14px; }
.dc-b i, .dc-legend i { font-style: normal; font-size: 8.5px; font-weight: 700; color: #fff; background: var(--c); border-radius: 4px; padding: 0 3px; line-height: 13px; }
.dc-b em { font-style: normal; font-size: 8.5px; color: var(--ink-soft); }
.dc-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11.5px; color: var(--ink-soft); margin: 6px 0 4px; }
.dc-legend span { display: inline-flex; gap: 4px; align-items: center; }
.dc-form { display: grid; gap: 10px; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.dc-form h3 { margin: 0; font-size: 15px; }
.dc-conds, .dc-surf { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dc-c { display: inline-flex; cursor: pointer; } .dc-c input { position: absolute; opacity: 0; pointer-events: none; }
.dc-c span { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; }
.dc-c input:checked + span { background: var(--c, var(--brand)); border-color: var(--c, var(--brand)); color: #fff; }
.dc-c input:focus-visible + span { outline: 2px solid var(--brand); }
.dc-hist summary { cursor: pointer; font-size: 12.5px; color: var(--ink-soft); }
/* Appointments side panel: never wider than its column (large text / narrow windows) */
.appt-side, .appt-side > * { min-width: 0; }
.mini-g { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mini-g button { text-align: center; min-width: 0; }
.appt-stats { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
.appt-stats div { min-width: 0; }
.appt-stats .pill { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-h { gap: 6px; } .side-h .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt-legend span { overflow-wrap: anywhere; }
:root[data-text="large"] .appt-wrap:not(.side-off) { grid-template-columns: 272px minmax(0, 1fr); }
/* ---------- Reports ---------- */
.rep-wrap { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .rep-wrap { grid-template-columns: 1fr; } }
.rep-nav { position: sticky; top: 12px; padding: 10px; max-height: calc(100vh - 40px); overflow: auto; }
.rep-g { display: grid; gap: 1px; margin-bottom: 10px; } .rep-g .label { padding: 4px 8px; }
.rep-g button { all: unset; cursor: pointer; padding: 6px 10px; border-radius: 8px; font-size: var(--fs-body-sm); }
.rep-g button:hover { background: var(--surface-2); } .rep-g button.on { background: var(--brand); color: var(--brand-ink, #fff); }
.rep-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.rep-filters label { display: inline-flex; gap: 6px; align-items: center; font-size: var(--fs-body-sm); color: var(--ink-soft); }
.rep-filters .input.sm { padding: 5px 8px; width: auto; }
.card.rep-filters { margin-bottom: 14px; }
.rep-meta { margin-bottom: 8px; }
.rep-table tfoot td { border-top: 2px solid var(--line); }
.rep-chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding: 6px 0 22px; margin-bottom: 8px; overflow-x: auto; }
.rep-bar { flex: 1 0 18px; max-width: 46px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.rep-bar i { width: 100%; background: color-mix(in srgb, var(--brand) 70%, transparent); border-radius: 4px 4px 0 0; }
.rep-bar span { position: absolute; bottom: -18px; font-size: 9.5px; color: var(--ink-faint); white-space: nowrap; transform: rotate(-30deg); transform-origin: top left; left: 30%; }
@media print { .rep-nav, .rep-filters, .sidebar, .topbar, .tabbar { display: none !important; } .rep-wrap { display: block; } }
/* ---------- Statistics ---------- */
.st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.st-grid .card { margin: 0; } .st-wide { grid-column: 1 / -1; }
.st-hb { display: grid; gap: 7px; }
.st-hr { display: grid; grid-template-columns: minmax(80px, 38%) 1fr auto; gap: 8px; align-items: center; font-size: var(--fs-body-sm); }
.st-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; } .st-track i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.st-vb { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-bottom: 20px; overflow-x: auto; }
.st-vc { flex: 1 0 14px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.st-vc i { width: 100%; max-width: 34px; background: color-mix(in srgb, var(--brand) 75%, transparent); border-radius: 4px 4px 0 0; }
.st-vc span { position: absolute; bottom: -17px; font-size: 9.5px; color: var(--ink-faint); white-space: nowrap; }
/* ---------- Promotions ---------- */
.promo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.promo-card { all: unset; box-sizing: border-box; cursor: pointer; display: grid; gap: 6px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.promo-card:hover { border-color: var(--brand); } .promo-card.off { opacity: .6; }
.promo-h { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 15px; }
.promo-msg { margin: 4px 0; font-size: 13px; color: var(--ink-soft); white-space: pre-wrap; }
.promo-prev summary { cursor: pointer; font-size: var(--fs-body-sm); color: var(--ink-soft); }
/* Petty cash box tally in the daily report */
.box-rows { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; }
.box-r { display: grid; grid-template-columns: minmax(150px, 1fr) auto; align-items: center; gap: 2px 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: var(--fs-body-sm); }
.box-r:last-child { border-bottom: 0; }
.box-r > span:first-child { color: var(--ink-soft); }
.box-r b { text-align: right; font-variant-numeric: tabular-nums; }
.box-r small { grid-column: 1 / -1; color: var(--ink-faint); font-size: 11.5px; }
.box-r.total { border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }
.box-r.total b { font-size: 15px; }
.box-in { display: inline-flex; gap: 6px; justify-content: flex-end; } .box-in .input { width: 120px; }
/* Type to find a treatment / medication */
.ta-wrap { position: relative; margin-bottom: 6px; }
.ta-in { padding-left: 12px; }
.ta-list { position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 80; display: grid; max-height: 260px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 24px rgba(0,0,0,.12); }
.ta-hit { all: unset; display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; cursor: pointer; font-size: var(--fs-body-sm); }
.ta-hit small { color: var(--ink-faint); }
.ta-hit.on, .ta-hit:hover { background: var(--surface-2); }
.ta-none { padding: 8px 12px; font-size: 12.5px; color: var(--ink-faint); }
/* Patient Flow · Today — compact on phones (iOS / Android): three small boxes a row, same height */
@media (max-width: 640px) {
  .flow-card .card-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .flow-card .card-head .caption { text-align: left; }
  .flow-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .flow-stats .fs { padding: 7px 8px; border-radius: 10px; min-width: 0; align-content: start; }
  .flow-stats .fs span { font-size: 10.5px; line-height: 1.2; }
  .flow-stats .fs b { font-size: .95rem; }
}
.cn-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .cn-meta select { width: auto; min-width: 190px; }
.cn-flags { display: flex; flex-wrap: wrap; gap: 5px; }
.cn-flags .dc-c span { padding: 3px 9px; font-size: 12px; }
.cn-flagrow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.cc-wrap { display: flex; gap: 6px; } .cc-wrap .cc-sel { width: auto; flex: 0 0 auto; padding-right: 26px; } .cc-wrap > input { flex: 1; min-width: 0; }
/* Patients list: Last visit gets room; on phones each patient is a card */
table.data.pt-list td.pt-last .cell-note { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 760px) {
  table.data.pt-list { min-width: 0; table-layout: auto; }
  table.data.pt-list colgroup, table.data.pt-list thead { display: none; }
  table.data.pt-list tbody { display: grid; gap: 10px; }
  table.data.pt-list tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); position: relative; }
  table.data.pt-list td { display: block; padding: 0; border: 0; min-width: 0; text-align: left !important; }
  table.data.pt-list td.pt-n { display: none; }
  table.data.pt-list td:nth-child(2) { grid-column: 1 / -1; padding-right: 52px; }
  table.data.pt-list td[data-l]::before { content: attr(data-l); display: block; font-size: 10.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
  table.data.pt-list td.pt-last { grid-column: 1 / -1; }
  table.data.pt-list td.pt-ph:has(.faint) { display: none; }
  table.data.pt-list td:last-child { position: absolute; top: 10px; right: 10px; }
  table.data.pt-list td:last-child::before { content: none; }
}
.segmented button { display: inline-flex; align-items: center; gap: 6px; }
.segmented button svg { width: 16px; height: 16px; flex: none; }

/* ---------- patient avatar (MyKad photo or initials) and profile ---------- */
.pt-who { display: flex; align-items: flex-start; gap: 10px; }
.pt-av { flex: none; width: 40px; height: 48px; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; color: var(--ink-soft); font-size: 13px; }
.pt-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-av.sm { width: 32px; height: 38px; font-size: 12px; border-radius: 7px; }
.pt-av.lg { width: 96px; height: 120px; border-radius: 12px; font-size: 28px; }
.pt-av.ini { background: var(--brand-soft, var(--surface-2)); }
.pf-head { display: flex; gap: 16px; align-items: flex-start; padding: 4px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.pf-photo { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.pf-lock { font-size: 11px; font-weight: 600; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.pf-id { min-width: 0; flex: 1; }
.pf-name { margin: 0 0 2px; font-size: 1.35rem; line-height: 1.2; overflow-wrap: anywhere; }
.pf-sub { color: var(--ink-soft); font-size: var(--fs-caption, 13px); margin-bottom: 8px; }
.pf-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-facts > span { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; }
.pf-facts .pf-next { border-color: var(--ok); color: var(--ok); }
.pf-addr { margin-top: 8px; }
.pf-acts { margin-bottom: 12px; }
.pf-tabs { margin: 0 0 12px; max-width: 100%; }
.pf-n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--line); font-size: 11px; line-height: 18px; text-align: center; color: var(--ink-soft); }
.pf-n.warn { background: var(--warn, #c77c02); color: #fff; }
.pf-up { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.pf-up .field { margin: 0; flex: 1 1 150px; min-width: 0; }
.pf-up-btn { cursor: pointer; flex: none; }
.pf-filter { margin-bottom: 8px; }
.pf-gal { margin-bottom: 8px; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pf-grid .vp-thumb { width: auto; }
.pf-grid .vp-thumb img { width: 100%; height: 130px; }
.vp-radio img { background: #000; object-fit: contain; }
.vp-k.vp-xray, .vp-k.vp-bitewing, .vp-k.vp-opg, .vp-k.vp-ceph, .vp-k.vp-cbct { color: var(--info, #2b6cb0); }
.vp-kind-sel { width: auto; max-width: 170px; padding-top: 4px; padding-bottom: 4px; height: auto; font-size: 13px; }
.ic-photo { width: 60px; height: 75px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); float: right; margin-left: 10px; }
@media (max-width: 560px) {
  .pf-head { gap: 12px; }
  .pt-av.lg { width: 72px; height: 90px; font-size: 22px; }
  .pf-name { font-size: 1.15rem; }
  .pf-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .pf-tabs button { white-space: nowrap; }
  .pf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Appointments toolbar: the calendar toggle and the branch tabs the same height and text size */
.appt-bar > .segmented, .appt-bar .btn.side-toggle { height: 40px; box-sizing: border-box; }
.appt-bar > .segmented { align-items: stretch; flex-wrap: nowrap; }
.appt-bar > .segmented button { display: inline-flex; align-items: center; padding: 0 14px; white-space: nowrap; font-size: var(--fs-label); }
.appt-bar .btn.side-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-label); padding: 0 14px; border-radius: 12px; }
.appt-bar .appt-locs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.appt-bar .appt-locs::-webkit-scrollbar { display: none; }

/* Week view day header: doctors in one same-size, centred box; patients under each name; unassigned; total */
.appt-dh .dh-day b { letter-spacing: .04em; }
.appt-dh .dh-box { width: min(100%, var(--drw, 16ch)); box-sizing: border-box; margin: 2px auto 0; display: grid; border-radius: 10px; overflow: hidden;
  background: color-mix(in srgb, var(--brand) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line)); font-size: 11px; line-height: 1.25; }
.appt-dh .dh-dr { display: grid; justify-items: center; gap: 0; padding: 4px 6px; text-align: center; }
.appt-dh .dh-dr + .dh-dr { border-top: 1px solid color-mix(in srgb, var(--brand) 16%, var(--line)); }
.appt-dh .dh-n { font-weight: 600; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt-dh .dh-c { color: var(--ink-soft); font-size: 10.5px; }
.appt-dh .dh-dr.none .dh-n { font-weight: 500; color: var(--ink-faint); white-space: normal; }
.appt-dh .dh-dr.un { border-top: 1px dashed color-mix(in srgb, var(--warn, #c77c02) 55%, var(--line)) !important; background: color-mix(in srgb, var(--warn, #c77c02) 8%, transparent); }
.appt-dh .dh-dr.un .dh-n { color: #8a5a00; }
.appt-dh .dh-tot { padding: 3px 6px; text-align: center; border-top: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line)); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--ink-soft); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.appt-dh .dh-tot b { color: var(--ink); font-size: 11.5px; margin-left: 2px; }

/* Appointment sheet: every action the same size, coloured by what it does */
.act-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.act-grid:empty { display: none; }
.act-grid.act-foot { padding-top: 12px; border-top: 1px solid var(--line); }
.act-grid .btn.act { width: 100%; min-height: 46px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-align: center;
  padding: 8px 10px; border-radius: 12px; font-weight: 600; font-size: var(--fs-label); line-height: 1.2; border: 1px solid var(--act-bd, var(--line)); background: var(--act-bg, var(--surface)); color: var(--act-fg, var(--ink)); }
.act-grid .btn.act svg { width: 16px; height: 16px; flex: none; }
.act-grid .btn.act:hover { filter: brightness(.97); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.act-wa { --act-bg: #e7f7ee; --act-bd: #9ad8b4; --act-fg: #146c3a; }
.act-ok { --act-bg: #e6f4ea; --act-bd: #8fcca2; --act-fg: #1d6b38; }
.act-warn { --act-bg: #fff4dc; --act-bd: #f0c868; --act-fg: #8a5a00; }
.act-go { --act-bg: var(--brand); --act-bd: var(--brand); --act-fg: var(--brand-ink, #fff); }
.act-info { --act-bg: #e8f0fb; --act-bd: #a9c3ea; --act-fg: #1f4f8f; }
.act-bad { --act-bg: #fdecec; --act-bd: #f0a9a9; --act-fg: #a12828; }
.act-cancel { --act-bg: var(--surface); --act-bd: #e3a3a3; --act-fg: #a12828; }
.act-edit { --act-bg: #f0ecfb; --act-bd: #c4b5ea; --act-fg: #4b3a8c; }
.act-next { --act-bg: #e5f5f4; --act-bd: #98d3cd; --act-fg: #17655e; }
.act-plain { --act-bg: var(--surface-2); --act-bd: var(--line); --act-fg: var(--ink); }
:root[data-theme="dark"] .act-grid .btn.act:not(.act-go) { background: var(--surface-2); color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .act-grid .btn.act:not(.act-go) { background: var(--surface-2); color: var(--ink); } }
@media (max-width: 560px) { .act-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Reports: everything left-aligned; dates on one line with room to fit */
.rep-table th, .rep-table td { text-align: left; vertical-align: top; }
.rep-table .rep-date { white-space: nowrap; min-width: 92px; }
.rep-nav .rep-g button { text-transform: none; }
.act-grid .btn.act { white-space: normal; }
@media (max-width: 1000px) { .appt-bar .btn.side-toggle { display: none; } }
.appt-head .appt-dh { align-content: start; }

/* Pop-outs close with their × only */
.print-menu.has-x { padding-top: 30px; position: absolute; }
.print-menu .pm-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; padding: 0 !important; display: grid; place-items: center; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink-soft); cursor: pointer; }
.print-menu .pm-x svg { width: 14px; height: 14px; }
.menu-sheet { position: relative; }
.menu-sheet .menu-x { position: absolute; top: 10px; right: 12px; z-index: 2; }
.appt-tip { position: fixed; }
.appt-tip .tip-x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink-soft); display: grid; place-items: center; cursor: pointer; z-index: 1; }
.appt-tip .tip-x svg { width: 14px; height: 14px; }
.appt-tip .tip-h { padding-right: 26px; }

/* Appointments on phones: a strip of 7 days, then the day's list */
.ag { display: grid; gap: 12px; }
.ag-strip { display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px; align-items: center; gap: 4px; }
.ag-nav { all: unset; cursor: pointer; display: grid; place-items: center; height: 56px; border-radius: 10px; font-size: 22px; color: var(--ink-soft); }
.ag-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.ag-day { all: unset; cursor: pointer; display: grid; justify-items: center; gap: 1px; padding: 6px 0 5px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; }
.ag-day small { font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--ink-soft); }
.ag-day b { font-size: 17px; line-height: 1.1; color: var(--ink); }
.ag-day i { font-style: normal; font-size: 10.5px; min-height: 13px; color: var(--brand); font-weight: 700; }
.ag-day.today { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.ag-day.on { background: var(--brand); border-color: var(--brand); }
.ag-day.on small, .ag-day.on b, .ag-day.on i { color: var(--brand-ink, #fff); }
.ag-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ag-head > div { flex: 1; min-width: 0; font-size: 1.05rem; }
.ag-total { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.ag-total b { color: var(--ink); font-size: 14px; }
.ag-drs { display: flex; flex-wrap: wrap; gap: 6px; }
.ag-drs span { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--line)); }
.ag-drs span.un { background: var(--warn-bg); border-color: color-mix(in srgb, #c77c02 40%, var(--line)); color: #8a5a00; }
.ag-drs span.none { background: none; border: 0; color: var(--ink-faint); padding-left: 0; }
.ag-notes { display: grid; gap: 4px; font-size: 13px; background: var(--warn-bg); border-radius: 10px; padding: 8px 10px; }
.ag-list { display: grid; gap: 8px; }
.ag-empty { text-align: center; padding: 18px 8px; }
.ag-note { justify-self: start; }
@media (max-width: 760px) { .appt-card:has(.ag) { padding: 12px; } }

/* Editor portal bar */
.ed-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 120; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 24px); box-sizing: border-box; padding: 8px 10px 8px 14px; border-radius: 14px; background: #3b2a6b; color: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 13px; }
.ed-bar .btn { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); }
.ed-bar svg { width: 14px; height: 14px; }
@media (max-width: 760px) { .ed-bar { bottom: calc(76px + env(safe-area-inset-bottom)); } }
.ed-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.ed-role { all: unset; cursor: pointer; display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.ed-role small { color: var(--ink-soft); font-size: 12px; line-height: 1.3; }
.ed-role.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); }
.mini-g button.sel { background: var(--brand) !important; color: var(--brand-ink, #fff) !important; font-weight: 700; }
.ag-list .appt-lday { margin: 8px 0 0; font-size: 14px; }
.ag-list .appt-lday:first-child { margin-top: 0; }
@keyframes sheet-nudge { 0%, 100% { translate: 0 0; } 25% { translate: -6px 0; } 75% { translate: 6px 0; } }
.sheet.nudge { animation: sheet-nudge .25s ease 2; }
.draft-note { margin: 0 0 10px; }

/* Treatments: a deleted patient visit stays in the list, faded, unnumbered and not counted */
table.visits tr.del-row td { color: var(--ink-faint); background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--ink) 3%, transparent) 8px 16px); }
table.visits tr.del-row td b { color: var(--ink-faint); font-weight: 600; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-faint) 60%, transparent); }
table.visits tr.del-row .del-by b { text-decoration: none; color: var(--ink-soft); }
.pill.del-pill { background: var(--surface-2); color: var(--ink-faint); border: 1px dashed var(--line-strong, var(--line)); }
table.visits .q-at { font-weight: 600; color: var(--ink-soft); }
table.visits .q-all { font-weight: 600; font-size: .82em; color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); padding: 1px 6px; border-radius: 99px; white-space: nowrap; }

/* Roster: the staff column keeps long job titles inside it (cut with … instead of running over the shifts) */
table.team th.name, table.team td.name { width: 190px; max-width: 190px; overflow: hidden; box-sizing: border-box; }
table.team td.name .who-cell { min-width: 0; max-width: 100%; }
table.team td.name .who-cell > span:last-child { min-width: 0; overflow: hidden; display: block; white-space: nowrap; text-overflow: ellipsis; }
table.team td.name .t { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 640px) { table.team th.name, table.team td.name { width: 150px; min-width: 150px; max-width: 150px; padding: 6px 8px; } }
/* Phone appointments: the week / day heading and total at the same size as the branch tabs */
.ag-head > div, .ag-head > div b, .ag-head .muted { font-size: var(--fs-label); }
.ag-head > div b { font-weight: 700; }
.ag-total { font-size: var(--fs-label); text-transform: none; letter-spacing: 0; }
.ag-total b { font-size: var(--fs-label); }

/* Phone menu: the × sits on its own above the profile card (not on top of it); avatar stays round */
.menu-sheet .menu-x { position: absolute; top: 6px; right: 8px; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); z-index: 2; }
.menu-sheet .menu-x svg { width: 18px; height: 18px; }
.menu-sheet .grab + .menu-x + .menu-me { margin-top: 30px; }
.menu-me > .avatar-ph, .menu-me > .avatar-img { flex: none !important; border-radius: 50%; }
/* Pop-up windows on phones: a bigger, easier × */
@media (max-width: 760px) {
  .sheet-head [data-close] { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); flex: none; }
  .sheet-head [data-close] svg { width: 18px; height: 18px; }
}

/* Treatments list: numbers on one line, the name, then tags — every tag the same height and size */
table.visits .q-line { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
table.visits .q-tag, table.visits .v-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; box-sizing: border-box; font-style: normal; }
table.visits .q-tag { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
table.visits .q-tag.q-all { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 25%, var(--line)); }
table.visits .v-name { display: block; }
table.visits .v-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
table.visits .v-tag.brand { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); }
table.visits .v-tag.warn { background: var(--warn-bg); color: #8a5a00; }
table.visits .v-tag.bad { background: var(--bad-bg); color: var(--bad, #a12828); }
table.visits tr.del-row .pill.del-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; font-size: 12px; font-weight: 600; box-sizing: border-box; vertical-align: middle; }
/* × on phones: 40% smaller */
.menu-sheet .menu-x { width: 24px; height: 24px; top: 10px; right: 12px; }
.menu-sheet .menu-x svg { width: 12px; height: 12px; }
.menu-sheet .grab + .menu-x + .menu-me { margin-top: 18px; }
@media (max-width: 760px) {
  .sheet-head [data-close] { width: 24px; height: 24px; }
  .sheet-head [data-close] svg { width: 12px; height: 12px; }
}

/* Counter: waiting for a manager's approval; the manager's approve page */
.cw-wait { text-align: center; display: grid; justify-items: center; gap: 10px; margin: 6px 0 14px; }
.cw-ring, .cw-card .cw-ring { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); animation: cw-pulse 1.6s ease-in-out infinite; }
.cw-ring svg { width: 30px; height: 30px; }
@keyframes cw-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 35%, transparent); } 50% { box-shadow: 0 0 0 12px transparent; } }
.cw-pw summary { cursor: pointer; font-size: var(--fs-label); color: var(--ink-soft); }
.cw-card { max-width: 520px; margin: 24px auto; text-align: center; display: grid; justify-items: center; }
.cw-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.cw-acts .btn { min-height: 52px; justify-content: center; font-size: 1rem; }

/* Counter Portal login / who's-keying-in: the branch logo (or the group's) with a "Counter" tag */
.auth-ctr { display: grid; justify-items: center; gap: 10px; margin: 0 auto 20px; }
.auth-ctr .logo { width: 120px; margin: 0; }
.auth-ctr .logo-pair img, .auth-ctr > img { display: block; }
.auth-ctr-tag { font: 700 11px/1 var(--font); letter-spacing: .16em; text-transform: uppercase; padding: 6px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--c-2, var(--brand)) 18%, var(--surface)); color: var(--c-base, var(--brand)); }
/* Branch details ▸ counter login: address, login and password with copy buttons */
.ctr-cred { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin: 0 0 14px; }
.ctr-cred-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.ctr-cred-row > span:first-child { font-size: var(--fs-caption); color: var(--ink-soft); }
.ctr-cred-row code { font-size: 14px; font-weight: 600; letter-spacing: .02em; overflow-wrap: anywhere; background: var(--surface); padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); }
@media (max-width: 560px) { .ctr-cred-row { grid-template-columns: 1fr auto; } .ctr-cred-row > span:first-child { grid-column: 1 / -1; } }
/* Counter login / pick screens: buttons in the counter's colours */
[data-counter] .auth .btn.primary { background: var(--c-3); border-color: var(--c-3); color: #fff; }
[data-counter] .auth .btn.primary:hover { background: color-mix(in srgb, var(--c-3) 85%, #000); }

/* ---------- Patient profile (one window everywhere): header + actions, tabs, Overview cards ---------- */
.pt-av.md { width: 56px; height: 68px; border-radius: 10px; font-size: 20px; }
.pt-av.xl { width: 132px; height: 164px; border-radius: 12px; font-size: 36px; }
.pf2 { display: flex; flex-direction: column; gap: 14px; }
.pf2-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.pf2-who { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 320px; }
.pf2-id { min-width: 0; }
.pf2-crumb { font-size: var(--fs-caption, 12.5px); color: var(--brand); font-weight: 600; display: flex; align-items: center; gap: 4px; }
.pf2-name { margin: 2px 0 2px; font-size: 1.55rem; line-height: 1.2; overflow-wrap: anywhere; }
.pf2-sub { color: var(--ink-soft); font-size: var(--fs-body-sm, 14px); }
.pf2-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.pf2-alert { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); font-size: var(--fs-body-sm, 14px); }
.pf2-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin: 0 -2px; }
.pf2-tabs::-webkit-scrollbar { display: none; }
.pf2-tabs button { all: unset; cursor: pointer; white-space: nowrap; padding: 10px 12px 9px; font-size: var(--fs-body-sm, 14px); color: var(--ink-soft); border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 6px; }
.pf2-tabs button:hover { color: var(--ink); }
.pf2-tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.pf2-tabs button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 6px; }
.pf2-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: var(--surface); }
.pf2-card + .pf2-card { margin-top: 12px; }
.pf2-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 10px; }
.pf2-card-head h3 { margin: 0; font-size: var(--fs-sub, 16px); }
.pf2-sum { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
.pf2-kvs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; }
.pf2-kv { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 10px; padding: 6px 0; align-items: baseline; font-size: var(--fs-body-sm, 14px); }
.pf2-kv dt { color: var(--ink-soft); text-align: right; }
.pf2-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pf2-kv.warn dd { color: var(--warn); font-weight: 600; }
.pf2-photo { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.pf2-info { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.pf2-info dl { margin: 0; }
.pf2-info .pf2-kv { grid-template-columns: minmax(96px, 42%) 1fr; }
.pf2-wa { display: inline-flex; vertical-align: middle; color: #25a35a; }
.pf2-wa svg { width: 16px; height: 16px; }
.pf2-note { margin: 10px 0 0; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; }
.pf2-meta { margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); }
@media (max-width: 860px) {
  .pf2-info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .pf2-head { align-items: stretch; }
  .pf2-name { font-size: 1.25rem; }
  .pf2-acts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  .pf2-acts .btn { justify-content: center; padding-left: 4px; padding-right: 4px; font-size: 12.5px; }
  .pf2-sum { grid-template-columns: 1fr; }
  .pf2-photo { display: none; } /* the photo is in the header on a phone */
  .pf2-kvs, .pf2-info { grid-template-columns: 1fr; }
  .pf2-kv, .pf2-info .pf2-kv { grid-template-columns: 42% 1fr; }
  .pf2-card { padding: 14px; }
}

/* ---------- Add / Edit Patient form (and the visit form's sections in the same style) ---------- */
.pform-scan { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 14px; }
.pform-sec { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 4px; margin-bottom: 12px; }
.pform-sec h3, .pform .form-sec { margin: 0 0 10px; font-size: var(--fs-label, 13px); text-transform: uppercase; letter-spacing: .06em; color: var(--brand); font-weight: 700; }
.pform .form-sec { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.pform-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.pform-grid .span2 { grid-column: 1 / -1; }
.pform .req { color: var(--bad); font-weight: 700; }
.pform-found { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--info-bg); margin: 0 0 12px; font-size: var(--fs-body-sm, 14px); }
.pform-found span { flex: 1 1 240px; }
.pt-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); margin: 0 0 12px; }
.pt-picked .spacer, .pt-bar .spacer { flex: 1; }
.pt-prof { all: unset; cursor: pointer; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 6px; vertical-align: -5px; border-radius: 6px; color: var(--ink-soft); }
.pt-prof svg { width: 15px; height: 15px; }
.pt-prof:hover, .pt-prof:focus-visible { background: var(--brand-tint); color: var(--brand); }
@media (max-width: 640px) {
  .pform-grid { grid-template-columns: 1fr; }
  .pform-sec { padding: 12px 12px 2px; }
}
.pt-picked .btn + .btn { margin-left: 0; }
@media (min-width: 900px) { .sheet.wide .pform-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Appointments calendar: quarter-hour grid (hour line, half-hour line, dotted quarters), am/pm time column ---------- */
.appt-head, .appt-body { grid-template-columns: 64px repeat(var(--cols), minmax(0, 1fr)); }
.appt-grid { min-width: calc(64px + var(--cols) * 104px); }
.appt-axis { border-right: 1px solid var(--line); }
.appt-axis span, .appt-axis span:first-child { transform: none; right: 8px; line-height: 1; padding-top: 5px; }
.appt-axis .ax-h { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.appt-axis .ax-m { font-size: 10.5px; font-weight: 500; color: var(--ink-faint); }
.appt-axis::before { content: ''; }
.appt-hr { border-top: 1px solid var(--line-strong, var(--line)); }
.appt-half { border-top: 1px solid var(--line); }
.appt-q { position: absolute; left: 0; right: 0; border-top: 1px dotted color-mix(in srgb, var(--line) 85%, transparent); }
.appt-ev { padding: 3px 6px; font-size: 10.5px; line-height: 1.25; }
.appt-ev .ev-h b { font-size: 11px; }
.appt-ev .ev-t, .appt-ev .ev-s { font-size: 10px; }
.appt-ev .ev-ic svg { width: 11px; height: 11px; }
.appt-ev .ev-b { font-size: 8.5px; padding: 0 3px; }
