/*
 * ProPakit RPMpro - Design tokens · direction 3a "Ledger Signal" (Owner chot 2026-10-26)
 * Hop dong (Master muc 6.1): ten bien goc GIU NGUYEN, chi dien gia tri.
 * Bien bo sung (danh dau [CR-2]) de xuat trong design/CR.md, cho Owner duyet.
 * Premium tenant chi override nhom --brand-*. KHONG BAO GIO override --color-severity-*.
 * v2 "Calm" (2026-10-26, CR-5): vien mem slate-200, chu slate-800, khong vien den, bo 800.
 * Day la file DUY NHAT duoc chua hex/px (CI kiem).
 *
 * 3 tang: Primitive (--slate-*, --petrol-*) -> Semantic (--color-*, --font-*, --radius-*...) -> Brand (--brand-*)
 */

/* Font tu host (OFL 1.1). Claude Code: dat file vao /assets/fonts/public-sans/ */
@font-face {
  font-family: "Public Sans";
  src: url("../fonts/public-sans/PublicSans-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("../fonts/public-sans/PublicSans-Italic-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* ---------- PRIMITIVE [CR-2] ---------- */
  --slate-50: #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-400: #94A3B8;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;
  --white: #FFFFFF;

  --petrol-50: #E6F2F4;
  --mist-100: #DCEFF1; /* avatar */
  --sand-100: #F3E8D6;
  --iris-100: #E4E9F6;
  --sand-700: #7A4A00;
  --iris-700: #3D4A8C;
  --petrol-600: #126A7E;
  --petrol-700: #0E5767;
  --petrol-800: #0A4450;

  /* ---------- SEMANTIC · core (hop dong) ---------- */
  --color-bg: var(--white);              /* card, modal, input */
  --color-surface: #EFF5F6; /* CR-7 "Mist": canvas anh petrol rat nhe (staff + patient) */
  --color-text: var(--slate-800); /* 14.6:1 - mem hon den thuan */
  --color-text-muted: var(--slate-600); /* 7.6:1 bg, 7.0:1 surface */
  --color-border: #E1E9EC; /* card, divider - mem, hop voi mist */
  --color-primary: var(--petrol-600); /* white 6.2:1 */

  /* SEMANTIC · core bo sung [CR-2] */
  --color-border-subtle: #EAF0F2;
  --color-border-strong: #7C8899; /* CHI vien o nhap (>=3:1, 3.6:1) */
  --color-control-bg: var(--white);
  --color-control-bg-hover: var(--slate-50);
  --color-control-shadow: var(--slate-300); /* day nut secondary - mem, khong den */
  --color-disabled-bg: var(--slate-100);
  --color-disabled-text: var(--slate-600);
  --color-overlay: rgba(15, 23, 42, 0.40);
  --color-error: #A3243B;                    /* loi form - KHONG phai severity, cung hue nhung khac nghia */

  /* ---------- SEMANTIC · severity (hop dong, brand KHONG override) ---------- */
  /* -text dung cho chu VA cham mau trong pill. -bg chi dung o vi tri "do dac" liet ke trong BRIEF. */
  --color-severity-urgent-bg: #FDECEE;
  --color-severity-urgent-text: #A3243B;     /* 6.6:1 tren -bg, 7.5:1 tren white */
  --color-severity-attention-bg: #FBF0DB;
  --color-severity-attention-text: #8A5A12;  /* 6.9:1 tren -bg */
  --color-severity-stable-bg: #E3F1EC;
  --color-severity-stable-text: #2A6B5A;     /* 6.9:1 tren -bg */

  /* ---------- Spacing (hop dong) ---------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* ---------- Typography (hop dong) ---------- */
  --font-family-base: "Public Sans", Arial, sans-serif;
  /* Owner khong dung monospace. Giu ten bien; so lieu dung font-variant-numeric: tabular-nums. */
  --font-family-mono: var(--font-family-base);
  --font-size-sm: 0.875rem;   /* 14 - bang day, label */
  --font-size-base: 1rem;     /* 16 - body staff */
  --font-size-lg: 1.0625rem; /* 17 */
  --font-size-xl: 1.25rem; /* 20 - title */
  --font-size-2xl: 1.625rem; /* 26 - page title */

  /* Typography bo sung [CR-2] */
  --font-size-xs: 0.8125rem;  /* 13 - SAN toan he thong (meta, eyebrow) */
  --font-weight-regular: 400;
  --font-weight-medium: 500;  /* chi dung cho so lieu trong bang */
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-heavy: 700; /* v2: khong dung 800 */
  --line-height-tight: 1.2;
  --line-height-snug: 1.35;
  --line-height-base: 1.5;
  --letter-spacing-display: -0.01em;
  --letter-spacing-eyebrow: 0.08em;

  /* ---------- Radius (hop dong) - staff mac dinh, shell khac override ben duoi ---------- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;

  /* ---------- Shadow (hop dong) - phan lop bang VIEN, shadow chi cho lop noi ---------- */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.14);

  /* ---------- Size / stroke / motion [CR-2] ---------- */
  --border-width-1: 1px;
  --border-width-2: 2px;
  --border-width-rail: 3px;
  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;
  --press-depth: 2px;           /* bottom shadow button; patient 3px */
  --size-dot: 8px;
  --size-icon: 18px;
  --size-icon-lg: 24px;
  --control-height-sm: 32px;
  --control-height: 40px;
  --control-height-lg: 48px;
  --touch-min: 44px;
  --input-height: 40px;
  --sidebar-width: 240px;
  --container-max: 1200px;
  --patient-max: 480px;
  --public-max: 640px;
  --modal-max: 480px;
  --slideover-width: 440px;
  --chart-min-height: 240px;
  --col-badge: 112px;
  --col-time: 128px;
  --col-action: 150px;
  --size-avatar: 36px;
  --size-avatar-lg: 48px;
  --icon-stroke: 1.75;
  --col-min-sm: 100px;
  --col-min: 200px;
  --col-min-lg: 180px;
  --col-min-xl: 260px;
  --duration-fast: 140ms;
  --duration-base: 240ms;
  --duration-slow: 320ms;
  --duration-reduced: 80ms;
  --easing-standard: cubic-bezier(0.2, 0, 0, 1);

  /* ---------- BRAND (hop dong: primary/bg/logo-url; con lai sinh tu primary) ---------- */
  --brand-primary: var(--color-primary);
  --brand-bg: var(--color-bg);
  --brand-logo-url: none;

  /* Brand sinh tu dong [CR-2]. Server kiem WCAG khi tenant luu mau:
     white tren --brand-primary >= 4.5:1, --brand-control tren bg >= 3:1; khong dat -> lui 8% ve den den khi dat. */
  --brand-hover: color-mix(in oklab, var(--brand-primary), #000 18%);
  --brand-700: color-mix(in oklab, var(--brand-primary), #000 40%);   /* pressed, vien + bottom shadow nut */
  --brand-tint: color-mix(in oklab, var(--brand-primary) 10%, #fff);  /* nen selected */
  --brand-text: var(--brand-primary);    /* link/chu mau brand tren bg */
  --brand-control: var(--brand-primary); /* checkbox/radio/segmented active */
  --brand-focus: var(--brand-primary);   /* focus ring */
  --brand-on-primary: var(--white);
}

/* ---------- Shell overrides (cung token, khac gia tri) ---------- */
.l-shell-patient {
  --font-size-xs: 0.875rem;    /* 14 */
  --font-size-sm: 1rem;        /* 16 */
  --font-size-base: 1.1875rem; /* 19 - Large, mac dinh */
  --font-size-lg: 1.375rem;    /* 22 */
  --font-size-xl: 1.625rem;    /* 26 */
  --font-size-2xl: 2rem;       /* 32 */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --press-depth: 3px;
  --control-height: 56px;
  --control-height-lg: 56px;
  --input-height: 52px;
}
.l-shell-patient[data-text-size="medium"] {
  --font-size-base: 1rem; --font-size-lg: 1.25rem; --font-size-xl: 1.5rem; --font-size-2xl: 1.75rem;
}
.l-shell-patient[data-text-size="x-large"] {
  --font-size-sm: 1.125rem; --font-size-base: 1.375rem; --font-size-lg: 1.625rem; --font-size-xl: 1.875rem; --font-size-2xl: 2.25rem;
}
.l-shell-public {
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --control-height: 44px;
  --input-height: 44px;
}

/* ---------- Preset vung: chi tang brand ---------- */
[data-region="eu"] { --brand-primary: #126A7E; --brand-bg: #FFFFFF; }
[data-region="au"] { --brand-primary: #0E6377; --brand-bg: #EEF4F6; }

/* ---------- Demo skin "Warm Hearth" (1b) - chi tang brand, dung cho demo/ban hang ---------- */
[data-skin="warm-hearth"] { --brand-primary: #3D3A8C; --brand-bg: #FAF8F5; }
