/* Self-hosted fonts (SIL Open Font License) — no external requests needed */
@font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:swap;src:url(../fonts/inter-latin-400-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:"IBM Plex Sans Arabic";font-style:normal;font-weight:400;font-display:swap;src:url(../fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format("woff2");unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC;}
@font-face{font-family:"Inter";font-style:normal;font-weight:500;font-display:swap;src:url(../fonts/inter-latin-500-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:"IBM Plex Sans Arabic";font-style:normal;font-weight:500;font-display:swap;src:url(../fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2) format("woff2");unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC;}
@font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:swap;src:url(../fonts/inter-latin-600-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:"IBM Plex Sans Arabic";font-style:normal;font-weight:600;font-display:swap;src:url(../fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format("woff2");unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC;}
@font-face{font-family:"Inter";font-style:normal;font-weight:700;font-display:swap;src:url(../fonts/inter-latin-700-normal.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:"IBM Plex Sans Arabic";font-style:normal;font-weight:700;font-display:swap;src:url(../fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2) format("woff2");unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC;}
@font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:swap;src:url(../fonts/inter-latin-ext-400-normal.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
@font-face{font-family:"Noto Sans Devanagari";font-style:normal;font-weight:400;font-display:swap;src:url(../fonts/noto-sans-devanagari-devanagari-400-normal.woff2) format("woff2");unicode-range:U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF;}
@font-face{font-family:"Noto Sans Malayalam";font-style:normal;font-weight:400;font-display:swap;src:url(../fonts/noto-sans-malayalam-malayalam-400-normal.woff2) format("woff2");unicode-range:U+0307,U+0323,U+0951-0952,U+0964-0965,U+0D00-0D7F,U+1CDA,U+1CF2,U+200C-200D,U+25CC,U+A830-A832;}
@font-face{font-family:"Inter";font-style:normal;font-weight:500;font-display:swap;src:url(../fonts/inter-latin-ext-500-normal.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
@font-face{font-family:"Noto Sans Devanagari";font-style:normal;font-weight:500;font-display:swap;src:url(../fonts/noto-sans-devanagari-devanagari-500-normal.woff2) format("woff2");unicode-range:U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF;}
@font-face{font-family:"Noto Sans Malayalam";font-style:normal;font-weight:500;font-display:swap;src:url(../fonts/noto-sans-malayalam-malayalam-500-normal.woff2) format("woff2");unicode-range:U+0307,U+0323,U+0951-0952,U+0964-0965,U+0D00-0D7F,U+1CDA,U+1CF2,U+200C-200D,U+25CC,U+A830-A832;}
@font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:swap;src:url(../fonts/inter-latin-ext-600-normal.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
@font-face{font-family:"Noto Sans Devanagari";font-style:normal;font-weight:600;font-display:swap;src:url(../fonts/noto-sans-devanagari-devanagari-600-normal.woff2) format("woff2");unicode-range:U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF;}
@font-face{font-family:"Noto Sans Malayalam";font-style:normal;font-weight:600;font-display:swap;src:url(../fonts/noto-sans-malayalam-malayalam-600-normal.woff2) format("woff2");unicode-range:U+0307,U+0323,U+0951-0952,U+0964-0965,U+0D00-0D7F,U+1CDA,U+1CF2,U+200C-200D,U+25CC,U+A830-A832;}
@font-face{font-family:"Inter";font-style:normal;font-weight:700;font-display:swap;src:url(../fonts/inter-latin-ext-700-normal.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
@font-face{font-family:"Noto Sans Devanagari";font-style:normal;font-weight:700;font-display:swap;src:url(../fonts/noto-sans-devanagari-devanagari-700-normal.woff2) format("woff2");unicode-range:U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF;}
@font-face{font-family:"Noto Sans Malayalam";font-style:normal;font-weight:700;font-display:swap;src:url(../fonts/noto-sans-malayalam-malayalam-700-normal.woff2) format("woff2");unicode-range:U+0307,U+0323,U+0951-0952,U+0964-0965,U+0D00-0D7F,U+1CDA,U+1CF2,U+200C-200D,U+25CC,U+A830-A832;}
/* =====================================================================
   Physiotherapy Clinic Management System — design system
   Logical properties throughout so Arabic (RTL) works without overrides.
   ===================================================================== */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --border: #e2e8ee;
  --border-strong: #cfd8e1;
  --text: #0f1c2b;
  --text-2: #3c4b5c;
  --muted: #677789;
  --primary: #0f766e;
  --primary-hover: #0b5f58;
  --primary-soft: #e6f4f2;
  --primary-ink: #064e48;
  --accent: #2563eb;
  --success: #15803d; --success-soft: #e8f6ec;
  --warning: #b45309; --warning-soft: #fdf3e2;
  --danger: #c2261f;  --danger-soft: #fdeceb;
  --info: #0369a1;    --info-soft: #e7f2fa;
  --neutral-soft: #eef1f4;
  --sidebar: #0c2230;
  --sidebar-2: #12303f;
  --sidebar-text: #b5c7d3;
  --sidebar-muted: #6f8a9a;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(15, 28, 43, .05);
  --shadow: 0 1px 3px rgba(15, 28, 43, .06), 0 6px 16px rgba(15, 28, 43, .05);
  --shadow-lg: 0 12px 40px rgba(15, 28, 43, .18);
  --font: "Inter", "IBM Plex Sans Arabic", "Noto Sans Devanagari", "Noto Sans Malayalam", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sidebar-w: 256px;
}
[dir="rtl"] { --font: "IBM Plex Sans Arabic", "Inter", system-ui, "Segoe UI", Tahoma, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); font-feature-settings: "cv11", "ss01"; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 620; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
small, .small { font-size: 12.5px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.text-end { text-align: end; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: -4px; }
.icon.sm { width: 15px; height: 15px; vertical-align: -3px; }
.icon.lg { width: 22px; height: 22px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------- Shell ---------------- */
.shell { min-height: 100vh; }
/* Fixed sidebar: never moves with the page; only the menu list scrolls, and its scroll never chains to the page */
.sidebar { background: var(--sidebar); color: var(--sidebar-text); position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); z-index: 40; display: flex; flex-direction: column; overflow: hidden; transition: width .18s ease; }
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.06); color: inherit; text-decoration: none; flex: none; min-height: 68px; }
.brand:hover { text-decoration: none; }
.brand-text { min-width: 0; }
.brand.logo-only { justify-content: center; }
.brand-mini { display: none; }
.brand-full { display: contents; }
.brand.has-logo { flex-direction: column; align-items: flex-start; gap: 8px; padding-block: 14px 12px; }
.brand.has-logo.logo-only { align-items: center; }
.brand.has-logo .brand-logo { height: auto; max-height: 48px; max-width: 100%; }
.brand.has-logo .brand-logo-wrap.on-dark { max-width: 100%; }
.brand.has-logo .brand-logo-wrap.on-dark .brand-logo { max-height: 40px; }
.brand.has-logo .brand-name { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.brand .brand-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.brand-icon { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; display: block; }
.brand-icon.contain { object-fit: contain; background: #fff; padding: 3px; }
.brand.logo-only .brand-logo-lg { max-width: 200px; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, #14b8a6, #0f766e); display: grid; place-items: center; color: #fff; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.brand-mark .icon { width: 20px; height: 20px; }
.brand-name { color: #fff; font-weight: 620; font-size: 14px; line-height: 1.2; }
.brand-sub { color: var(--sidebar-muted); font-size: 11.5px; }
.nav { padding: 6px 10px 24px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #2a4757 transparent; }
.nav::-webkit-scrollbar { width: 6px; } .nav::-webkit-scrollbar-thumb { background: #2a4757; border-radius: 6px; }
.nav-group { margin-top: 10px; }
.nav-label { all: unset; box-sizing: border-box; display: flex; align-items: center; width: 100%; cursor: pointer; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--sidebar-muted); padding: 6px 10px; font-weight: 600; border-radius: 6px; user-select: none; }
.nav-label:hover { color: #d7e3ea; background: rgba(255,255,255,.03); }
.nav-label:focus-visible { outline: 2px solid #2dd4bf; outline-offset: -2px; }
.nav-label .icon { margin-inline-start: auto; width: 14px; height: 14px; transition: transform .18s ease; opacity: .7; }
.nav-group.collapsed .nav-label .icon { transform: rotate(-90deg); }
[dir="rtl"] .nav-group.collapsed .nav-label .icon { transform: rotate(90deg); }
.nav-group.collapsed.has-active .nav-label { color: #5eead4; }
.nav-items { display: grid; grid-template-rows: 1fr; }
.nav-items > div { overflow: hidden; min-height: 0; }
.nav-group.collapsed .nav-items { grid-template-rows: 0fr; }
.nav.ready .nav-items { transition: grid-template-rows .2s ease; }
.nav a .nav-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--sidebar-text); font-size: 13.5px; text-decoration: none; position: relative; }
.nav a:hover { background: var(--sidebar-2); color: #fff; }
.nav a.active { background: rgba(45, 212, 191, .12); color: #fff; }
.nav a.active::before { content: ""; position: absolute; inset-inline-start: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: #2dd4bf; }
.nav a .count { margin-inline-start: auto; background: #f59e0b; color: #1f1300; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 99px; line-height: 18px; }
.nav .stage-tag { margin-inline-start: auto; font-size: 10px; color: var(--sidebar-muted); border: 1px solid #2a4757; border-radius: 4px; padding: 0 4px; }
.sidebar-foot { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 18px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11.5px; color: var(--sidebar-muted); }
.sidebar-foot .foot-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-mini-btn { margin-inline-start: auto; color: var(--sidebar-muted); width: 30px; height: 30px; }
.nav-mini-btn:hover { background: var(--sidebar-2); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; margin-inline-start: var(--sidebar-w); transition: margin .18s ease; }

/* Compact (icon-only) menu — desktop */
html.nav-mini { --sidebar-w: 72px; }
html.nav-mini .brand { justify-content: center; align-items: center; padding-inline: 8px; min-height: 68px; }
html.nav-mini .brand-full { display: none; }
html.nav-mini .brand-mini { display: block; }
html.nav-mini .brand-text, html.nav-mini .nav-text, html.nav-mini .foot-text, html.nav-mini .nav-label span, html.nav-mini .nav-label .icon { display: none; }
html.nav-mini .brand .brand-logo-wrap, html.nav-mini .brand .brand-logo { max-width: 48px; }
html.nav-mini .nav { padding-inline: 8px; }
html.nav-mini .nav-label { height: 1px; padding: 0; margin: 8px 6px; background: rgba(255,255,255,.08); cursor: default; pointer-events: none; }
html.nav-mini .nav-group.collapsed .nav-items { grid-template-rows: 1fr; }
html.nav-mini .nav a { justify-content: center; padding: 9px 0; }
html.nav-mini .nav a.active::before { inset-inline-start: -8px; }
html.nav-mini .nav a .count { position: absolute; top: 3px; inset-inline-end: 6px; min-width: 16px; line-height: 16px; font-size: 10px; padding: 0 4px; text-align: center; }
html.nav-mini .sidebar-foot { justify-content: center; padding-inline: 0; }
html.nav-mini .nav-mini-btn { margin: 0; transform: scaleX(-1); }

/* Logo */
.brand-logo { display: block; height: 36px; width: auto; max-width: 150px; object-fit: contain; }
.brand-logo-sm { height: 28px; } .brand-logo-md { height: 36px; } .brand-logo-lg { height: 56px; max-width: 220px; } .brand-logo-xl { height: 84px; max-width: 280px; }
.brand-logo-wrap { display: inline-flex; flex: none; align-items: center; justify-content: center; }
.brand-logo-wrap.on-dark { background: #fff; border-radius: 9px; padding: 4px 6px; box-shadow: 0 0 0 1px rgba(255,255,255,.2); }
.brand-logo-wrap.on-dark .brand-logo-md { height: 30px; max-width: 120px; }
.brand-mark { flex: none; }
.brand-mark-lg { width: 52px; height: 52px; border-radius: 12px; } .brand-mark-lg .icon { width: 28px; height: 28px; }
.brand-mark-xl { width: 76px; height: 76px; border-radius: 16px; } .brand-mark-xl .icon { width: 40px; height: 40px; }
.brand-mark-sm { width: 28px; height: 28px; border-radius: 7px; } .brand-mark-sm .icon { width: 16px; height: 16px; }

/* Letterhead (printed documents) */
.letterhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 2px solid var(--primary); }
.letterhead .lh-org { display: flex; gap: 14px; align-items: center; min-width: 0; }
.letterhead .lh-name { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.25; }
.letterhead .lh-second { font-size: 13.5px; color: var(--text-2); }
.letterhead .lh-meta { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.letterhead .lh-doc { text-align: end; flex: none; max-width: 45%; }
.letterhead .lh-title { font-size: 15px; font-weight: 700; letter-spacing: .03em; color: var(--text); }
.letterhead .lh-sub { font-size: 12px; color: var(--text-2); }
.letterhead.compact { padding-bottom: 8px; margin-bottom: 12px; }
.letterhead.compact .lh-name { font-size: 15.5px; }
.letterhead.compact .brand-logo { height: 44px; max-width: 170px; }
.letterhead .brand-logo-lg { max-width: 190px; }
@media (max-width: 640px) { .letterhead { flex-direction: column; } .letterhead .lh-doc { text-align: start; max-width: none; } .letterhead .lh-org { flex-wrap: wrap; } }
.print-letterhead { display: none; }

/* Settings — sections and logo upload */
.settings-section + .settings-section { border-top: 1px solid var(--border); }
.settings-section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 13px; font-weight: 650; color: var(--text); text-transform: uppercase; letter-spacing: .05em; }
.settings-section-title .icon { color: var(--primary); }
.logo-field { display: grid; gap: 8px; }
.logo-preview { height: 96px; border: 1px dashed var(--border-strong); border-radius: 10px; display: grid; place-items: center; padding: 10px; background: #fff; background-image: linear-gradient(45deg, #f4f6f8 25%, transparent 25%), linear-gradient(-45deg, #f4f6f8 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f4f6f8 75%), linear-gradient(-45deg, transparent 75%, #f4f6f8 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.logo-field.dark .logo-preview { background: var(--sidebar); border-color: #2a4757; }
.logo-field.dark .logo-preview .muted { color: var(--sidebar-muted); }
.logo-preview img { max-height: 76px; max-width: 100%; object-fit: contain; }
.logo-actions { display: flex; align-items: center; gap: 12px; }
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 30; }
.topbar .menu-btn { display: none; }
.search-box { position: relative; flex: 1; max-width: 460px; }
.search-box input[type=search] { width: 100%; padding: 8px 12px; padding-inline-start: 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font: inherit; }
.search-box input[type=search]:focus { background: #fff; }
.search-box .icon { position: absolute; inset-inline-start: 11px; top: 9px; color: var(--muted); }
.search-results { position: absolute; top: 42px; inset-inline: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; z-index: 50; }
.search-results a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:hover { background: var(--primary-soft); text-decoration: none; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: var(--text-2); background: none; border: 0; cursor: pointer; }
.icon-btn:hover { background: var(--neutral-soft); text-decoration: none; }
.icon-btn .dot { position: absolute; top: 5px; inset-inline-end: 5px; min-width: 16px; height: 16px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px; border-radius: 99px; border: 1px solid var(--border); cursor: pointer; background: #fff; font: inherit; color: var(--text); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); display: grid; place-items: center; font-weight: 650; font-size: 12px; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; }
.content { padding: 24px; max-width: 1480px; width: 100%; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 220px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; gap: 9px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; text-align: start; cursor: pointer; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--neutral-soft); text-decoration: none; }
.dropdown-menu .dd-head { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.notif-menu { width: 360px; max-height: 440px; overflow: auto; }
.notif-item { display: block !important; border-bottom: 1px solid var(--border); border-radius: 0 !important; }
.notif-item.unread { background: var(--primary-soft); }

/* ---------------- Page header ---------------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header .sub { color: var(--muted); margin-top: 4px; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.breadcrumb a { color: var(--muted); }

/* ---------------- Buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 550; font-size: 13.5px; line-height: 1.3; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--neutral-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a11f19; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #116430; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline-danger { background: #fff; color: var(--danger); border-color: #f1c2bf; }
.btn-outline-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 11px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.inline-form { display: inline; }

/* ---------------- Cards & layout ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.card + .card { margin-top: 16px; }
.grid > .card, .grid > * > .card:first-child, .row > .card { margin-top: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header h2, .card-header h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-sidebar-l { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-0 { margin-bottom: 0 !important; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }

/* Stat tiles */
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.stat-icon.warn { background: var(--warning-soft); color: var(--warning); }
.stat-icon.danger { background: var(--danger-soft); color: var(--danger); }
.stat-icon.info { background: var(--info-soft); color: var(--info); }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 680; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
a.stat:hover { text-decoration: none; background: var(--surface-2); }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: start; font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfd; }
.table .actions { text-align: end; white-space: nowrap; }
.table.compact td, .table.compact th { padding: 7px 10px; }
.table td.num, .table th.num { text-align: end; font-variant-numeric: tabular-nums; }
.table .sub { color: var(--muted); font-size: 12px; }
.table tfoot td { font-weight: 650; background: var(--surface-2); }
.row-link { color: var(--text); font-weight: 560; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; }
.pagination a, .pagination span.cur { min-width: 30px; height: 30px; padding: 0 8px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--border); color: var(--text-2); background: #fff; }
.pagination span.cur { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--neutral-soft); color: var(--text-2); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 5px; background: var(--neutral-soft); color: var(--text-2); font-size: 12px; font-weight: 500; }
.tag.primary { background: var(--primary-soft); color: var(--primary-ink); }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .col-full { grid-column: span 12; }
.form-grid .col-half { grid-column: span 6; }
.form-grid .col-third { grid-column: span 4; }
.form-grid .col-quarter { grid-column: span 3; }
.form-grid [hidden] { display: none !important; }
.field label, .label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field .req { color: var(--danger); }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.input, input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=tel], input[type=search], input[type=month], input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; font: inherit; color: var(--text); transition: border-color .12s, box-shadow .12s; }
input[type=file] { padding: 6px; background: var(--surface-2); }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, .14); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
input[readonly] { background: var(--surface-2); }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.input-group { display: flex; }
.input-group > * + * { margin-inline-start: -1px; }
.form-section { padding: 18px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { font-weight: 620; font-size: 14.5px; margin-bottom: 14px; display: flex; gap: 8px; align-items: center; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.filters input, .filters select { width: auto; min-width: 150px; padding: 6px 10px; }
.filters .grow { flex: 1; min-width: 200px; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: #fff; }
.segmented a, .segmented label { padding: 6px 12px; font-size: 13px; color: var(--text-2); border-inline-end: 1px solid var(--border); cursor: pointer; }
.segmented a:last-child, .segmented label:last-child { border-inline-end: 0; }
.segmented a.on, .segmented input:checked + span { background: var(--primary); color: #fff; }
.segmented a:hover { text-decoration: none; background: var(--surface-2); }
.scale { display: flex; gap: 4px; flex-wrap: wrap; }
.scale label { position: relative; }
.scale input { position: absolute; opacity: 0; }
.scale span { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 7px; font-weight: 600; font-size: 13px; cursor: pointer; background: #fff; }
.scale input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }
.scale input:focus-visible + span { outline: 2px solid var(--primary); }

/* ---------------- Alerts ---------------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 9px; border: 1px solid; font-size: 13.5px; margin-bottom: 14px; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--success-soft); border-color: #bfe5c9; color: #0f5a2b; }
.alert-error, .alert-danger { background: var(--danger-soft); border-color: #f3c1bd; color: #8a1a15; }
.alert-warning { background: var(--warning-soft); border-color: #f2d8a9; color: #7a3c06; }
.alert-info { background: var(--info-soft); border-color: #bcdcf0; color: #084c75; }
.alert .close { margin-inline-start: auto; background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 0 12px; scrollbar-width: none; }
.tabs a { padding: 11px 12px; color: var(--muted); font-weight: 550; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .n { background: var(--neutral-soft); color: var(--text-2); border-radius: 99px; font-size: 11px; padding: 0 6px; }

/* Key-value */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.kv.wide { grid-template-columns: 200px 1fr; }

/* Empty */
.empty { text-align: center; padding: 38px 20px; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; color: var(--border-strong); margin-bottom: 8px; }
.empty h3 { color: var(--text-2); margin-bottom: 4px; }

/* Progress */
.progress { height: 8px; background: var(--neutral-soft); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.progress.warn > span { background: #f59e0b; }
.progress.danger > span { background: var(--danger); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding-inline-start: 26px; padding-bottom: 16px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 7px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; inset-inline-start: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }
.timeline .dot.approve { border-color: var(--success); }
.timeline .dot.reject { border-color: var(--danger); }
.timeline .dot.request_info { border-color: var(--warning); }
.timeline .when { font-size: 12px; color: var(--muted); }

/* Steps (approval levels) */
.steps { display: flex; gap: 0; counter-reset: s; }
.step { flex: 1; position: relative; padding-top: 34px; text-align: center; font-size: 12.5px; color: var(--muted); }
.step::before { counter-increment: s; content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--border-strong); font-weight: 700; font-size: 12px; z-index: 1; }
.step::after { content: ""; position: absolute; top: 12px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--border-strong); }
.step:last-child::after { display: none; }
.step.done { color: var(--success); }
.step.done::before { content: "✓"; background: var(--success); border-color: var(--success); color: #fff; }
.step.done::after { background: var(--success); }
.step.current { color: var(--text); font-weight: 600; }
.step.current::before { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.step.failed::before { content: "✕"; background: var(--danger); border-color: var(--danger); color: #fff; }

/* Patient header */
.patient-head { display: flex; gap: 16px; align-items: center; padding: 18px; flex-wrap: wrap; }
.patient-head .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 4px; }
.alert-strip { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--border); background: #fffaf2; }
.alert-pill { display: inline-flex; gap: 6px; align-items: center; background: #fff; border: 1px solid #f2d8a9; color: #7a3c06; border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 550; }
.alert-pill.critical { border-color: #f3c1bd; color: #8a1a15; background: var(--danger-soft); }
.quota { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border-top: 1px solid var(--border); }
.quota > div { background: #fff; padding: 12px 18px; }
.quota .v { font-size: 20px; font-weight: 680; font-variant-numeric: tabular-nums; }
.quota .l { font-size: 12px; color: var(--muted); }

/* Schedule / calendar */
.cal { display: grid; border: 1px solid var(--border); border-radius: 10px; overflow: auto; background: #fff; }
.cal-head { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; font-size: 12.5px; padding: 10px; border-bottom: 1px solid var(--border); border-inline-start: 1px solid var(--border); z-index: 2; }
.cal-time { font-size: 11.5px; color: var(--muted); padding: 4px 8px; border-bottom: 1px dashed var(--border); text-align: end; }
.cal-cell { border-bottom: 1px dashed var(--border); border-inline-start: 1px solid var(--border); padding: 3px; min-height: 44px; }
.appt { display: block; border-radius: 7px; padding: 5px 8px; font-size: 12px; line-height: 1.35; border-inline-start: 3px solid var(--primary); background: var(--primary-soft); color: var(--text); margin-bottom: 3px; }
.appt:hover { text-decoration: none; filter: brightness(.97); }
.appt.st-checked_in, .appt.st-in_session { background: #fff4dc; border-color: #f59e0b; }
.appt.st-completed { background: var(--success-soft); border-color: var(--success); }
.appt.st-cancelled, .appt.st-no_show { background: #f6f6f6; border-color: #a3a3a3; color: var(--muted); text-decoration: line-through; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.slot { padding: 9px 6px; border: 1px solid var(--border-strong); border-radius: 8px; text-align: center; font-weight: 600; font-size: 13px; background: #fff; cursor: pointer; }
.slot:hover { border-color: var(--primary); color: var(--primary); }
.slot.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot.taken { background: var(--neutral-soft); color: #9aa7b4; cursor: not-allowed; text-decoration: line-through; border-style: dashed; }

/* Form builder */
.fb-section { border: 1px solid var(--border); border-radius: 10px; background: #fff; margin-bottom: 16px; }
.fb-section-head { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: 10px 10px 0 0; }
.fb-field { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #fff; }
.fb-field:last-child { border-bottom: 0; border-radius: 0 0 10px 10px; }
.fb-field.disabled { opacity: .55; background: repeating-linear-gradient(135deg, #fff, #fff 8px, #f7f8f9 8px, #f7f8f9 16px); }
.fb-field .handle { cursor: grab; color: var(--muted); }
.fb-field.dragging { opacity: .4; }
.fb-field .ftype { font-family: var(--mono); font-size: 11.5px; background: var(--neutral-soft); padding: 1px 7px; border-radius: 5px; color: var(--text-2); }

/* Permission matrix */
.matrix th, .matrix td { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: start; }
.matrix .module { font-weight: 600; }
.matrix input { width: 16px; height: 16px; accent-color: var(--primary); }
.perm-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 7px; padding: 5px 9px; margin: 3px; font-size: 12.5px; background: #fff; cursor: pointer; }
.perm-chip:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }

/* Chat (WhatsApp inbox) */
.chat { display: flex; flex-direction: column; gap: 8px; padding: 18px; background: #eef3f1; min-height: 360px; max-height: 60vh; overflow-y: auto; }
.bubble { max-width: 72%; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; white-space: pre-wrap; box-shadow: var(--shadow-sm); }
.bubble.in { background: #fff; align-self: flex-start; border-start-start-radius: 3px; }
.bubble.out { background: #d9fdd3; align-self: flex-end; border-start-end-radius: 3px; }
.bubble .t { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; text-align: end; }

/* Body chart */
.body-chart { position: relative; width: 100%; max-width: 420px; margin: 0 auto; }
.body-chart svg { width: 100%; height: auto; cursor: crosshair; }
.body-mark { cursor: pointer; }

/* Modal (native dialog) */
dialog { border: 0; border-radius: 14px; padding: 0; box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 32px)); color: var(--text); }
dialog::backdrop { background: rgba(12, 26, 38, .45); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }

/* Rating stars */
.stars { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.stars input { display: none; }
.stars label { font-size: 26px; color: #d7dde3; cursor: pointer; line-height: 1; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #f59e0b; }
.star-show { color: #f59e0b; letter-spacing: 1px; }

/* ---------------- Auth / public pages ---------------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: radial-gradient(circle at 20% 20%, rgba(45,212,191,.28), transparent 45%), radial-gradient(circle at 80% 90%, rgba(37,99,235,.25), transparent 50%), var(--sidebar); color: #d9e7ee; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h1 { color: #fff; font-size: 32px; line-height: 1.2; max-width: 460px; }
.auth-art .points { display: grid; gap: 12px; margin-top: 26px; max-width: 460px; }
.auth-art .points div { display: flex; gap: 10px; align-items: flex-start; }
.auth-art .points .icon { color: #5eead4; margin-top: 2px; }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 22px; margin-bottom: 4px; }
.public-top { background: #fff; border-bottom: 1px solid var(--border); }
.public-top .inner { max-width: 1040px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 12px; }
.public-main { max-width: 1040px; margin: 0 auto; padding: 28px 20px 60px; }
.hero { background: linear-gradient(135deg, #0c2230 0%, #0f4f4a 100%); color: #e6f4f2; border-radius: 16px; padding: 40px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: center; }
.hero h1 { color: #fff; font-size: 30px; }
.choice-cards { display: grid; gap: 12px; }
.choice { display: flex; gap: 14px; align-items: center; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 14px 16px; color: #fff; }
.choice:hover { background: rgba(255,255,255,.14); text-decoration: none; }
.choice .icon { width: 26px; height: 26px; color: #5eead4; }
.signature-pad { border: 1px dashed var(--border-strong); border-radius: 10px; background: #fff; width: 100%; height: 160px; touch-action: none; cursor: crosshair; }

/* Portal */
.portal-nav { display: flex; gap: 4px; overflow-x: auto; }
@media (min-width: 900px) { .portal-nav { flex-wrap: wrap; overflow: visible; } }
.portal-nav a { padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 550; white-space: nowrap; }
.portal-nav a.active, .portal-nav a:hover { background: var(--primary-soft); color: var(--primary-ink); text-decoration: none; }
.exercise-card { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }

/* ---------------- Responsive ---------------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-sidebar, .grid-sidebar-l { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  html.nav-mini { --sidebar-w: 256px; }
  .main { margin-inline-start: 0; }
  .sidebar { width: 272px; z-index: 80; transform: translateX(-100%); transition: transform .2s; }
  .nav-mini-btn { display: none; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 70; }
  .topbar .menu-btn { display: grid; }
  .content { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid .col-half, .form-grid .col-third, .form-grid .col-quarter { grid-column: span 12; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .hero { grid-template-columns: 1fr; padding: 26px; }
  .quota { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
  .user-chip .who { display: none; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .search-box { display: none; }
}

/* ---------------- Print ---------------- */
@media print {
  .sidebar, .topbar, .no-print, .page-header .actions, .tabs { display: none !important; }
  .shell { display: block; }
  .main { margin: 0 !important; }
  .print-letterhead { display: block; }
  .content:has(.doc-letterhead) .print-letterhead, .content:has(.letterhead.doc-letterhead) > .print-letterhead { display: none; }
  .letterhead { break-inside: avoid; }
  body { background: #fff; font-size: 12px; }
  .content { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
  a { color: inherit; }
}

/* Code samples (import help, integration docs) */
pre.code { background: var(--surface-2, #f6f7f9); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; overflow-x: auto; direction: ltr; text-align: left; }
.att-grid td, .att-grid th { white-space: nowrap; }
@media print { .payslip-actions, .sidebar, .topbar { display: none !important; } .payslip { box-shadow: none; border: 0; } }
/* Inline toolbars: keep inputs at natural width */
.row > input:not([type=checkbox]):not([type=radio]), .row > select { width: auto; min-width: 150px; }
.att-grid .badge::before { display: none; }

/* Country picker (login / portal / public) */
.country-picker { margin-bottom: 18px; }
.country-picker-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.country-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.country-option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; background: var(--surface); position: relative; transition: border-color .15s, background .15s; }
.country-option:hover { border-color: var(--primary); text-decoration: none; }
.country-option.on { border-color: var(--primary); background: var(--primary-soft); }
.country-option .flag { font-size: 24px; line-height: 1; }
.country-option small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.country-option strong { font-size: 13.5px; }
.country-option .tick { position: absolute; inset-inline-end: 8px; top: 8px; color: var(--primary); }
.country-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--neutral-soft); font-size: 12.5px; font-weight: 600; color: var(--text-2); text-decoration: none; }
.country-chip:hover { text-decoration: none; background: var(--primary-soft); }
.lang-menu a.on { font-weight: 700; color: var(--primary); }

/* ---------- Stage 4: accounts ---------- */
.doc-body { background: #eef1f4; }
.doc-toolbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; align-items: center; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--border); }
.doc-toolbar .spacer { flex: 1; }
.doc { max-width: 900px; margin: 18px auto; background: #fff; padding: 36px 42px; box-shadow: 0 1px 3px rgba(15,23,42,.08); border-radius: 8px; font-size: 13px; }
.doc.a5 { max-width: 720px; }
.doc h1 { font-size: 20px; margin: 0; } .doc h2 { font-size: 16px; margin: 18px 0 8px; } .doc h3 { font-size: 14px; margin: 14px 0 6px; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; border-bottom: 2px solid var(--primary); padding-bottom: 12px; margin-bottom: 16px; }
.doc .doc-head .brand-mark { width: 44px; height: 44px; }
.doc table.fs { width: 100%; border-collapse: collapse; margin: 6px 0 14px; }
.doc table.fs th, .doc table.fs td { padding: 5px 8px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
.doc table.fs th { text-align: start; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: #475569; background: #f8fafc; }
.doc table.fs td.num, .doc table.fs th.num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc table.fs tr.grp td { font-weight: 600; background: #fafafa; }
.doc table.fs tr.tot td { font-weight: 700; border-top: 2px solid #334155; border-bottom: 3px double #334155; }
.doc table.fs tr.sub td { font-weight: 600; border-top: 1px solid #94a3b8; }
.doc .sig-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 54px; text-align: center; font-size: 12px; }
.doc .sig-row div { border-top: 1px solid #334155; padding-top: 6px; }
.doc .page-break { break-after: page; page-break-after: always; }
.receipt-box { border: 1.5px solid var(--primary); border-radius: 10px; padding: 22px 26px; }
.receipt-amount { font-size: 24px; font-weight: 700; color: var(--primary-ink); }
.receipt-grid { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; margin: 14px 0; }
.receipt-grid dt { color: #64748b; } .receipt-grid dd { margin: 0; font-weight: 500; }
.stamp-cancelled { display: inline-block; border: 3px solid #dc2626; color: #dc2626; font-weight: 800; letter-spacing: .1em; padding: 4px 14px; transform: rotate(-6deg); border-radius: 6px; }
.progress { height: 10px; background: var(--neutral-soft, #eef2f6); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #14b8a6); border-radius: 99px; }
.progress.lg { height: 16px; }
.vlines td input, .vlines td select { width: 100%; min-width: 0; }
.vlines td.num input { text-align: end; }
.ledger-tree .grp td { font-weight: 600; background: var(--surface-2, #f8fafc); }
.ledger-tree .lvl-1 td:first-child { padding-inline-start: 26px; } .ledger-tree .lvl-2 td:first-child { padding-inline-start: 46px; } .ledger-tree .lvl-3 td:first-child { padding-inline-start: 66px; }
.give-hero { background: linear-gradient(135deg, #0f3d3a, #115e59); color: #fff; border-radius: 16px; padding: 28px; }
.give-hero .progress { background: rgba(255,255,255,.18); } .give-hero .progress > span { background: #5eead4; }
.leader li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.amount-pos { color: #047857; } .amount-neg { color: #b91c1c; }
@media print {
  .doc-body { background: #fff; } .doc { box-shadow: none; margin: 0; padding: 0; max-width: none; border-radius: 0; }
  .doc-toolbar { display: none !important; }
  @page { size: A4; margin: 14mm; }
}
@media (max-width: 700px) { .doc { padding: 18px; margin: 0; border-radius: 0; } .doc .sig-row { grid-template-columns: repeat(2, 1fr); } .receipt-grid { grid-template-columns: 1fr; } }
/* RTL: keep amounts, negative signs and codes in left-to-right order */
[dir="rtl"] .stat-value, [dir="rtl"] td.num, [dir="rtl"] .amount { direction: ltr; unicode-bidi: isolate; text-align: right; }
[dir="rtl"] .table td.num, [dir="rtl"] .doc table.fs td.num { text-align: left; }
[dir="rtl"] .mono { unicode-bidi: isolate; }
[dir="rtl"] .alert > div, [dir="rtl"] .stat .small, [dir="rtl"] .stat-sub { unicode-bidi: plaintext; }

/* Notification delivery status (WhatsApp-style ticks) and channel connection cards */
.dstatus { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; padding: 2px 9px 2px 7px; border-radius: 99px; white-space: nowrap; background: var(--surface-2, #f1f5f9); color: #475569; }
.dstatus .icon { width: 15px; height: 15px; stroke-width: 2.4; }
.ds-queued, .ds-sending { background: #fef3c7; color: #92400e; }
.ds-accepted { background: #eef2ff; color: #4338ca; }
.ds-sent { background: #f1f5f9; color: #334155; }
.ds-delivered { background: #f1f5f9; color: #334155; }
.ds-read { background: #dbeafe; color: #1d4ed8; }
.ds-read .icon { color: #2563eb; }
.ds-failed, .ds-cancelled { background: #fee2e2; color: #b91c1c; }
.ds-logged { background: #f3e8ff; color: #6b21a8; }
.conn-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.conn-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.conn-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 4px rgba(0,0,0,.05); }
.conn-connected .conn-dot { background: #16a34a; box-shadow: 0 0 0 4px rgba(22,163,74,.18); }
.conn-partial .conn-dot { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.2); }
.conn-not_connected .conn-dot { background: #dc2626; box-shadow: 0 0 0 4px rgba(220,38,38,.18); }
.conn-test_mode .conn-dot, .conn-unknown .conn-dot { background: #94a3b8; }
.conn-connected .conn-head { background: #f0fdf4; } .conn-partial .conn-head { background: #fffbeb; } .conn-not_connected .conn-head { background: #fef2f2; } .conn-test_mode .conn-head { background: #f8fafc; }
.conn-title { font-weight: 650; } .conn-state { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.conn-connected .conn-state { color: #15803d; } .conn-partial .conn-state { color: #b45309; } .conn-not_connected .conn-state { color: #b91c1c; } .conn-test_mode .conn-state, .conn-unknown .conn-state { color: #64748b; }
.conn-checks { list-style: none; margin: 0; padding: 6px 16px 12px; font-size: 12.5px; }
.conn-checks li { display: grid; grid-template-columns: 18px 1fr; gap: 6px; padding: 6px 0; border-top: 1px dashed var(--border); }
.conn-checks li:first-child { border-top: 0; }
.conn-checks .ok { color: #16a34a; } .conn-checks .bad { color: #dc2626; } .conn-checks .warn { color: #d97706; }
.conn-checks .icon { width: 15px; height: 15px; margin-top: 2px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 175px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); align-items: start; }
.timeline li:first-child { border-top: 0; }
.timeline li > .sub:first-child { white-space: nowrap; padding-top: 3px; }

.quick-reply { display: block; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-2); text-decoration: none; line-height: 1.45; }
.quick-reply:hover { border-color: var(--primary); background: var(--primary-soft); text-decoration: none; }

/* Meta template guide (Notification Center → Meta templates) */
.wt-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.wt-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wt-name { font-size: 14px; font-weight: 600; }
.wt-body-wrap { position: relative; }
.wt-body { white-space: pre-wrap; word-break: break-word; margin: 0; padding: 12px 14px 40px; border-radius: 10px; background: #e7f6ec; border: 1px solid #cdebd8; font: 13.5px/1.55 var(--font, system-ui), sans-serif; color: #102a1c; }
.wt-copy { position: absolute; right: 8px; bottom: 8px; }
.wt-params td, .wt-params th { font-size: 12.5px; }
.wt-grid { align-items: start; }
