/* Cytocore LIMS – sistema de diseño del Rediseño (Clinical Cyan "modo día" + Biotech Dark).
   Los tokens se exponen como tripletes RGB para usarlos desde Tailwind (rgb(var(--t) / <alpha>)).
   El color primario en modo día viene de la marca de la empresa (--brand-primary, branding.js). */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --t-surface: 250 248 255;
    --t-surface-base: 242 243 255;
    --t-surface-card: 255 255 255;
    --t-surface-subtle: 234 237 255;
    --t-lowest: 255 255 255;
    --t-low: 242 243 255;
    --t-container: 234 237 255;
    --t-high: 226 231 255;
    --t-highest: 218 226 253;
    --t-on-surface: 19 27 46;
    --t-on-surface-variant: 61 73 75;
    --t-text-primary: 19 27 46;
    --t-text-secondary: 61 73 75;
    --t-text-muted: 109 121 123;
    --t-outline: 109 121 123;
    --t-outline-variant: 188 201 203;
    --t-primary: var(--brand-primary, 0 102 113);
    --t-on-primary: 255 255 255;
    --t-primary-container: var(--brand-primary, 0 129 143);
    --t-on-primary-container: 255 255 255;
    --t-primary-fixed: 151 240 255;
    --t-secondary: 113 42 226;
    --t-secondary-fixed: 234 221 255;
    --t-on-secondary-fixed: 37 0 90;
    --t-tertiary-container: 0 129 144;
    --t-error: 186 26 26;
    --t-error-container: 255 218 214;
    --t-status-approved: 5 150 105;
    --t-status-completed: 0 102 113;
    --t-status-pending: 180 83 9;
    --t-status-draft: 96 125 139;
    --t-status-rejected: 186 26 26;

    /* Variables heredadas (las usa forms/form.html) */
    --cy-canvas: #FAF8FF;
    --cy-panel: #FFFFFF;
    --cy-inset: #F2F3FF;
    --cy-border: #DAE2FD;
    --cy-border-strong: #BCC9CB;
    --cy-text: #131B2E;
    --cy-text-2: #131B2E;
    --cy-text-3: #3D494B;
    --cy-muted: #6D797B;
    --cy-cyan: #006671;
    --cy-cyan-hi: #00818F;
    --cy-glow: #00E5FF;
    --cy-magenta: #C026D3;
    --cy-violet: #712AE2;
    --cy-ok: #059669;
    --cy-warn: #B45309;
    --cy-bad: #BA1A1A;
    --cy-shadow: 0 1px 3px rgba(19, 27, 46, .04), 0 4px 12px -2px rgba(19, 27, 46, .05);
    color-scheme: light;
}

html.dark {
    --t-surface: 8 20 34;
    --t-surface-base: 11 19 29;
    --t-surface-card: 19 34 53;
    --t-surface-subtle: 27 47 72;
    --t-lowest: 3 15 28;
    --t-low: 16 28 42;
    --t-container: 21 32 47;
    --t-high: 31 43 57;
    --t-highest: 42 54 69;
    --t-on-surface: 215 227 247;
    --t-on-surface-variant: 186 201 204;
    --t-text-primary: 240 246 252;
    --t-text-secondary: 148 163 184;
    --t-text-muted: 100 116 139;
    --t-outline: 132 147 150;
    --t-outline-variant: 59 73 76;
    --t-primary: 0 229 255;
    --t-on-primary: 0 54 61;
    --t-primary-container: 0 229 255;
    --t-on-primary-container: 0 54 61;
    --t-primary-fixed: 156 240 255;
    --t-secondary: 250 171 255;
    --t-secondary-fixed: 87 0 102;
    --t-on-secondary-fixed: 255 214 254;
    --t-tertiary-container: 113 224 241;
    --t-error: 255 180 171;
    --t-error-container: 147 0 10;
    --t-status-approved: 0 230 118;
    --t-status-completed: 0 229 255;
    --t-status-pending: 255 179 0;
    --t-status-draft: 144 164 174;
    --t-status-rejected: 255 82 82;

    --cy-canvas: #081422;
    --cy-panel: #132235;
    --cy-inset: #1B2F48;
    --cy-border: rgba(96, 125, 139, .28);
    --cy-border-strong: #3b494c;
    --cy-text: #F0F6FC;
    --cy-text-2: #D7E3F7;
    --cy-text-3: #94A3B8;
    --cy-muted: #64748B;
    --cy-shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
}

/* ---------- Tipografía ---------- */
body { font-family: 'Inter', system-ui, sans-serif; background: var(--cy-canvas); color: var(--cy-text-2); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .font-display { font-family: 'Space Grotesk', 'Inter', sans-serif; }
.cy-mono, code, kbd { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
td { font-variant-numeric: tabular-nums; }

/* ---------- Componentes compartidos ---------- */
.cy-card { background: var(--cy-panel); border: 1px solid var(--cy-border); border-radius: .5rem; box-shadow: var(--cy-shadow); }
.cy-chip { display: inline-flex; align-items: center; gap: .35rem; height: 22px; padding: 0 .5rem; border-radius: .25rem;
    font: 600 11px/1 'JetBrains Mono', monospace; letter-spacing: .04em; text-transform: uppercase;
    background: rgb(var(--t-primary) / .08); color: rgb(var(--t-primary)); }
.cy-pip { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.cy-barcode { display: inline-block; height: 14px; background-repeat: no-repeat; }
.cy-theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: .5rem;
    background: transparent; color: rgb(var(--t-text-secondary)); cursor: pointer; }
.cy-theme-toggle:hover { color: rgb(var(--t-text-primary)); background: rgb(var(--t-high)); }

input:focus, select:focus, textarea:focus { outline: none !important; box-shadow: 0 0 0 2px rgb(var(--t-primary) / .3) !important; border-color: transparent !important; }
:focus-visible { outline: 2px solid rgb(var(--t-primary)); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: rgb(var(--t-highest)) transparent; }

/* ---------- Compatibilidad: remapeo oscuro de utilidades Tailwind (forms/form.html) ---------- */
html.dark .bg-white, html.dark .bg-white\/60, html.dark .bg-white\/80, html.dark .bg-white\/90 { background-color: var(--cy-panel) !important; }
html.dark .bg-slate-50, html.dark .bg-gray-50, html.dark .bg-slate-50\/50 { background-color: var(--cy-canvas) !important; }
html.dark .bg-slate-100, html.dark .bg-gray-100, html.dark .bg-slate-200 { background-color: var(--cy-inset) !important; }
html.dark .text-navy, html.dark .text-slate-900, html.dark .text-slate-800, html.dark .text-gray-900, html.dark .text-gray-800 { color: var(--cy-text) !important; }
html.dark .text-slate-700, html.dark .text-slate-600, html.dark .text-gray-700, html.dark .text-gray-600 { color: var(--cy-text-2) !important; }
html.dark .text-slate-500, html.dark .text-slate-400, html.dark .text-gray-500 { color: var(--cy-text-3) !important; }
html.dark .border-slate-100, html.dark .border-slate-200, html.dark .border-slate-300, html.dark .border-gray-200 { border-color: var(--cy-border) !important; }
html.dark .hover\:bg-slate-50:hover, html.dark .hover\:bg-slate-100:hover, html.dark .hover\:bg-slate-200:hover { background-color: #1f3350 !important; }
html.dark input:not([type=checkbox]):not([type=radio]):not([type=color]), html.dark select, html.dark textarea { color-scheme: dark; background-color: var(--cy-inset); color: var(--cy-text); }
html.dark .shadow-sm, html.dark .shadow-md, html.dark .shadow-lg { box-shadow: var(--cy-shadow); }
html.dark .bg-navy { background-color: #081422 !important; }
html.dark .bg-emerald-50 { background-color: rgba(5, 150, 105, .12) !important; }
html.dark .bg-amber-50 { background-color: rgba(217, 119, 6, .12) !important; }
html.dark .bg-red-50 { background-color: rgba(225, 29, 72, .12) !important; }
html.dark .bg-blue-50, html.dark .bg-cyan-50 { background-color: rgba(0, 229, 255, .08) !important; }

@media print { html.dark { color-scheme: light; } }
