/* MiFarmaciaData Design System 2.1 — tokens.
   Shared visual language with MiConsultorio (same owners, sister products): Roboto, slate neutrals,
   action blue #1a6fe0, institutional navy #1f4e79, radii 8/10/14, navy-tinted soft shadows, one easing
   curve; dark theme with the same navy-violet planes and salmon accent. See docs/design/DESIGN_SYSTEM.md. */
@font-face {
  font-family: "Roboto"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/roboto-var-latin.woff2") format("woff2-variations"), url("../fonts/roboto-var-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;
  /* ---- Neutrals (slate, as MiConsultorio) ---- */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e8eef5;
  --surface-raised: #ffffff;
  --line: #e2e8f0;                /* decorative hairlines */
  --line-strong: #cbd5e1;
  --control-border: #8496ab;      /* 3.0:1 on white — WCAG 1.4.11 */
  --control-border-hover: #6b7f97;
  --text: #0f172a;                /* 17.9:1 */
  --text-2: #475569;              /* 7.6:1 */
  --text-3: #5b6b82;              /* 5.6:1 (5.0:1 on surface-2) */
  --text-disabled: #94a3b8;
  /* ---- Brand & action ---- */
  --brand: #1f4e79;               /* identity: titles */
  --brand-deep: #173f67;
  --primary: #1a6fe0;             /* everything actionable; white text 4.6:1 */
  --primary-hover: #155bbd;
  --primary-press: #124fa3;
  --primary-soft: #e8f0fc;        /* selection, chips, hover */
  --primary-soft-2: #d6e5fa;
  --primary-ink: #155bbd;         /* text on primary-soft: 5.6:1 */
  --on-primary: #ffffff;
  --link: var(--primary-ink);
  --link-hover: var(--primary-hover);
  --accent-teal: #0f8a80;         /* secondary accent used in MiConsultorio headings/lines */
  --focus: #0b57a4;               /* focus ring: 7.2:1 */
  /* Rail (MiConsultorio "riel") */
  --rail-bg: var(--primary);
  --rail-icon: #ffffff;             /* labels in the expanded rail: 4.8:1 on --primary */
  --rail-hover: rgba(255, 255, 255, .16);
  --rail-active-bg: #ffffff;
  --rail-active-icon: var(--primary);
  --rail-sep: rgba(255, 255, 255, .28);
  /* ---- Semantic (text on its tint ≥ 5.4:1) ---- */
  --success: #1c7c3d;  --success-soft: #eafaf0;  --success-line: #a7dcb9;
  --warning: #7a4d0b;  --warning-soft: #fef6e7;  --warning-line: #f1cf8f;
  --danger:  #b42318;  --danger-soft:  #fef2f2;  --danger-line:  #f5b5ae;
  --info:    #1f4e79;  --info-soft:    #eef4fa;  --info-line:    #bcd2e8;
  --neutral: #475569;  --neutral-soft: #f1f5f9;  --neutral-line: #cbd5e1;
  --mark: #fde68a;
  /* ---- Atmosphere (MiConsultorio page wash; very subtle, page background only) ---- */
  --wash-1: rgba(26, 111, 224, .07);
  --wash-2: rgba(15, 138, 128, .05);

  /* ---- Typography ---- */
  --font: "Roboto", -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --fs-2xs: .75rem;      /* 12 — tags, column labels */
  --fs-xs: .8125rem;     /* 13 — meta, help text */
  --fs-sm: .875rem;      /* 14 — data, tables, controls */
  --fs-md: .9375rem;     /* 15 — body */
  --fs-lg: 1rem;         /* 16 — product names, inputs on touch */
  --fs-xl: 1.125rem;     /* 18 — section titles */
  --fs-2xl: clamp(1.25rem, 1.05rem + .6vw, 1.5rem);    /* 20–24 — page titles */
  --fs-3xl: clamp(1.375rem, 1.1rem + .9vw, 1.75rem);   /* 22–28 — ficha brand */
  --fw-regular: 400; --fw-medium: 500; --fw-semi: 600; --fw-bold: 700;
  --lh: 1.5; --lh-tight: 1.3; --lh-title: 1.2;
  --tracking-label: .06em;

  /* ---- Space (4 px grid, compact like MiConsultorio v19) ---- */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 56px;
  --gutter: clamp(12px, 2.2vw, 32px);

  /* ---- Shape & elevation ---- */
  --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-pill: 999px;
  --shadow-color: 212 45% 20%;
  --shadow-xs: 0 1px 2px hsl(var(--shadow-color) / .06);
  --shadow-sm: 0 1px 2px hsl(var(--shadow-color) / .05), 0 6px 16px -8px hsl(var(--shadow-color) / .16);
  --shadow-float: 0 2px 6px hsl(var(--shadow-color) / .08), 0 16px 40px -18px hsl(var(--shadow-color) / .32);
  --shadow-modal: 0 4px 12px hsl(var(--shadow-color) / .10), 0 32px 80px -24px hsl(var(--shadow-color) / .45);
  --shadow-primary: 0 6px 18px -6px rgba(26, 111, 224, .55);

  /* ---- Controls ---- */
  --control-h: 40px;
  --control-h-sm: 34px;
  --control-h-lg: 48px;
  --icon: 18px;

  /* ---- Layout ---- */
  --rail-w: 76px;
  --rail-w-open: 244px;
  --topbar-h: 60px;
  --content-max: 1680px;
  --reading-max: 1200px;

  /* ---- Motion (docs/design/MOTION_GUIDELINES.md) ---- */
  --ease: cubic-bezier(.25, 0, .3, 1);          /* MiConsultorio ease-3 */
  --ease-out: cubic-bezier(0, 0, .3, 1);
  --ease-in: cubic-bezier(.5, 0, 1, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --d-1: 120ms;   /* feedback */
  --d-2: 200ms;   /* components */
  --d-3: 300ms;   /* panels, drawers */

  /* ---- Layers ---- */
  --z-sticky: 20; --z-rail: 40; --z-topbar: 45; --z-menu: 60; --z-tray: 70; --z-drawer: 80; --z-toast: 90; --z-tooltip: 95;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  /* MiConsultorio dark planes: background → panel → panel-2 */
  --bg: #0d0e1a;
  --surface: #181a2d;
  --surface-2: #212439;
  --surface-3: #2a2e47;
  --surface-raised: #1d2035;
  --line: #2e3250;
  --line-strong: #3c4166;
  --control-border: #7a6ea0;      /* 3.7:1 on panel */
  --control-border-hover: #9488bb;
  --text: #f7f3f7;
  --text-2: #cfcadc;
  --text-3: #9a95ad;              /* 6.1:1 on panel */
  --text-disabled: #6b6785;
  --brand: #e8a6a7;
  --brand-deep: #d78f91;
  --primary: #e8a6a7;             /* salmon accent; dark text on it 9.9:1 */
  --primary-hover: #f0b9ba;
  --primary-press: #d78f91;
  --primary-soft: rgba(232, 166, 167, .14);
  --primary-soft-2: rgba(232, 166, 167, .24);
  --primary-ink: #f0b9ba;
  --on-primary: #141414;
  --link: #f0b9ba;
  --link-hover: #f7d3d4;
  --accent-teal: #63d2c6;
  --focus: #7fb2e5;
  --rail-bg: #181a2d;
  --rail-icon: #cfcadc;
  --rail-hover: rgba(255, 255, 255, .07);
  --rail-active-bg: #e8a6a7;
  --rail-active-icon: #141414;
  --rail-sep: #2e3250;
  --success: #74d69c;  --success-soft: rgba(116, 214, 156, .12);  --success-line: rgba(116, 214, 156, .35);
  --warning: #f2c46d;  --warning-soft: rgba(242, 196, 109, .12);  --warning-line: rgba(242, 196, 109, .35);
  --danger:  #ff9c92;  --danger-soft:  rgba(255, 156, 146, .12);  --danger-line:  rgba(255, 156, 146, .35);
  --info:    #9cc4ef;  --info-soft:    rgba(156, 196, 239, .12);  --info-line:    rgba(156, 196, 239, .35);
  --neutral: #cfcadc;  --neutral-soft: rgba(207, 202, 220, .10);  --neutral-line: rgba(207, 202, 220, .30);
  --mark: #6b4e00;
  --wash-1: rgba(212, 93, 159, .10);
  --wash-2: rgba(70, 90, 200, .12);
  --shadow-color: 230 40% 3%;
  --shadow-xs: 0 1px 2px hsl(var(--shadow-color) / .35);
  --shadow-sm: 0 1px 2px hsl(var(--shadow-color) / .3), 0 8px 18px -8px hsl(var(--shadow-color) / .6);
  --shadow-float: 0 2px 6px hsl(var(--shadow-color) / .4), 0 18px 40px -16px hsl(var(--shadow-color) / .8);
  --shadow-modal: 0 4px 12px hsl(var(--shadow-color) / .5), 0 32px 80px -24px hsl(var(--shadow-color) / .9);
  --shadow-primary: 0 6px 18px -6px rgba(232, 166, 167, .45);
}

@media (pointer: coarse) {
  :root { --control-h: 44px; --control-h-sm: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  :root { --d-1: 0ms; --d-2: 0ms; --d-3: 0ms; }
}
