/* ============================================================================
   BRIODENT FLOW ULTRA PREMIUM — Shared Design System (Directiva 18 · Opción D)
   Hybrid Master Visual Architecture: CLÍNICA LUMINOSA + PRECISION 3D STUDIO
   Owner: BrioDent S.A.S. · White Premium + Aqua Technology + Deep Petrol Teal
   Self-hosted WOFF2 Typography (0 external CDN dependencies)
   ============================================================================ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/fonts/inter-latin.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: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('/static/fonts/plus-jakarta-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('/static/fonts/plus-jakarta-sans-latin.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;
}

:root {
  /* Surfaces */
  --bf-canvas: #F3F7F8;
  --bf-surface: #FFFFFF;
  --bf-surface-alt: #F8FBFC;
  --bf-surface-tint: #EDF6F8;

  /* Signature Aqua Technology */
  --bf-aqua: #00C2B2;
  --bf-aqua-hover: #00A89B;
  --bf-aqua-deep: #0B8F87;
  --bf-aqua-soft: #E9F8F6;
  --bf-aqua-border: rgba(0, 194, 178, 0.30);

  /* Institutional Deep Petrol Teal */
  --bf-teal-950: #0C252E;
  --bf-teal-900: #133642;
  --bf-teal-800: #174352;
  --bf-teal-700: #1E5768;

  /* Typography & Borders */
  --bf-text: #0F2933;
  --bf-muted: #5F7A84;
  --bf-border: #E1ECEE;
  --bf-border-strong: #CBE0E4;

  /* Clinical Semantics */
  --bf-ok: #0E7C73;
  --bf-ok-bg: #E6F8F5;
  --bf-amber: #9A6200;
  --bf-amber-strong: #7C4D00;
  --bf-amber-bg: #FFF8EB;
  --bf-amber-border: #F3D9A4;
  --bf-danger: #B42318;
  --bf-danger-bg: #FEF3F2;
  --bf-danger-border: #FECACA;

  /* Geometry & Elevation */
  --bf-radius-sm: 10px;
  --bf-radius-md: 14px;
  --bf-radius-lg: 18px;
  --bf-radius-pill: 999px;
  --bf-shadow-xs: 0 1px 4px rgba(12, 37, 46, 0.04);
  --bf-shadow-sm: 0 2px 12px rgba(12, 37, 46, 0.045);
  --bf-shadow-md: 0 10px 26px rgba(12, 37, 46, 0.12);
  --bf-shadow-aqua: 0 6px 16px rgba(0, 194, 178, 0.24);

  /* Shell Metrics */
  --bf-sidebar-w: 232px;
  --bf-dira-w: 322px;
  --bf-topbar-h: 68px;

  /* Backward-compatible legacy variable aliases */
  --white: var(--bf-surface);
  --soft: var(--bf-canvas);
  --aqua: var(--bf-aqua);
  --aqua-hover: var(--bf-aqua-hover);
  --deep: var(--bf-teal-950);
  --tech: var(--bf-teal-700);
  --soft-aqua: var(--bf-aqua-soft);
  --border: var(--bf-border);
  --muted: var(--bf-muted);
  --warn-bg: var(--bf-amber-bg);
  --warn-text: var(--bf-amber);
  --danger-bg: var(--bf-danger-bg);
  --danger-text: var(--bf-danger);
  --ok-bg: var(--bf-ok-bg);
  --ok-text: var(--bf-ok);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bf-canvas);
  color: var(--bf-text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

h1, h2, h3, h4, .bf-brand-name, .bf-num, .brand-title, .tray-num {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  color: var(--bf-teal-950);
  letter-spacing: -0.02em;
}

code, .bf-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--bf-teal-700);
  background: var(--bf-surface-tint);
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 600;
}

button, input, select, textarea { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--bf-aqua);
  outline-offset: 2px;
}

.bf-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.bf-icon-sm { width: 15px; height: 15px; }
.bf-icon-lg { width: 22px; height: 22px; }

.muted { font-size: 13px; color: var(--bf-muted); line-height: 1.5; }
.err-msg { color: var(--bf-danger); font-size: 12.5px; font-weight: 500; min-height: 18px; }

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn, .bf-btn {
  border-radius: 11px;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
}
.btn:active:not(:disabled), .bf-btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled, .bf-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary, .bf-btn-primary {
  background: var(--bf-aqua);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 194, 178, 0.24);
}
.btn-primary:hover:not(:disabled), .bf-btn-primary:hover:not(:disabled) {
  background: var(--bf-aqua-hover);
  box-shadow: 0 6px 16px rgba(0, 194, 178, 0.30);
}

.btn-deep, .bf-btn-deep {
  background: var(--bf-teal-950);
  color: #FFFFFF;
  box-shadow: 0 6px 16px rgba(12, 37, 46, 0.16);
}
.btn-deep:hover:not(:disabled), .bf-btn-deep:hover:not(:disabled) {
  background: var(--bf-teal-900);
}

.btn-soft, .bf-btn-soft {
  background: var(--bf-aqua-soft);
  color: var(--bf-teal-950);
  border-color: var(--bf-aqua-border);
}
.btn-soft:hover:not(:disabled), .bf-btn-soft:hover:not(:disabled) {
  background: #DCF4F1;
  border-color: var(--bf-aqua);
}

.btn-outline, .bf-btn-outline {
  background: var(--bf-surface);
  color: var(--bf-teal-900);
  border-color: var(--bf-border);
}
.btn-outline:hover:not(:disabled), .bf-btn-outline:hover:not(:disabled) {
  background: var(--bf-surface-alt);
  border-color: var(--bf-aqua);
  color: var(--bf-teal-950);
}

.btn-ghost {
  background: transparent;
  color: var(--bf-muted);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bf-canvas);
  color: var(--bf-teal-950);
}

.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 9px; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 10px; }

/* ============================================================================
   PILLS & STATUS BADGES
   ============================================================================ */
.pill, .bf-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--bf-radius-pill);
  font-size: 11.2px;
  font-weight: 700;
  border: 1px solid var(--bf-border);
  white-space: nowrap;
}
.pill-ok { background: var(--bf-ok-bg); color: var(--bf-ok); border-color: rgba(0, 194, 178, 0.30); }
.pill-tech { background: #EAF5F8; color: var(--bf-teal-700); border-color: #C7E2EA; }
.pill-warn { background: var(--bf-amber-bg); color: var(--bf-amber); border-color: var(--bf-amber-border); }
.pill-danger { background: var(--bf-danger-bg); color: var(--bf-danger); border-color: var(--bf-danger-border); }
.pill-muted { background: var(--bf-canvas); color: var(--bf-muted); border-color: var(--bf-border); }

/* ============================================================================
   CARDS, GRIDS, FORMS & TABLES
   ============================================================================ */
.card, .bf-card {
  background: var(--bf-surface);
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius-lg);
  padding: 18px 20px;
  box-shadow: var(--bf-shadow-sm);
}
.card-soft, .bf-card-soft {
  background: var(--bf-aqua-soft);
  border: 1px solid var(--bf-aqua-border);
  border-radius: var(--bf-radius-md);
  padding: 15px 16px;
}
.bf-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.bf-card-hd h3 { font-size: 14.5px; font-weight: 700; color: var(--bf-teal-950); }
.bf-card-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--bf-aqua-deep);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
}
.bf-card-link:hover { color: var(--bf-teal-950); text-decoration: underline; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12.2px; font-weight: 600; color: var(--bf-teal-900); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius-sm);
  font-size: 13.5px;
  color: var(--bf-text);
  background: var(--bf-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--bf-aqua);
  box-shadow: 0 0 0 3px rgba(0, 194, 178, 0.14);
}

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
th, td {
  padding: 10px 10px;
  border-bottom: 1px solid #EEF4F6;
  text-align: left;
  vertical-align: middle;
}
th {
  background: #F6FAFA;
  color: var(--bf-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tbody tr:hover { background: #FAFDFD; }

.bf-code-badge {
  display: inline-block;
  white-space: nowrap;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--bf-teal-700);
  background: var(--bf-surface-tint);
  padding: 3px 8px;
  border-radius: 7px;
  border: 1px solid #D7EAEF;
}

.tray-card {
  background: var(--bf-surface);
  border: 1px solid var(--bf-border);
  border-radius: var(--bf-radius-md);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s;
}
.tray-card:hover { border-color: var(--bf-aqua); background: var(--bf-surface-alt); }
.tray-card.active { border: 2px solid var(--bf-aqua); background: var(--bf-aqua-soft); }
.tray-lbl { font-size: 11px; font-weight: 700; color: var(--bf-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tray-num { font-size: 24px; font-weight: 800; color: var(--bf-teal-950); }

.progress-track { width: 100%; height: 6px; background: #E9F1F3; border-radius: var(--bf-radius-pill); overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; border-radius: var(--bf-radius-pill); background: linear-gradient(90deg, var(--bf-aqua), var(--bf-teal-700)); transition: width 0.25s ease; }

/* ============================================================================
   SELECTIVE DARK-TEAL CLINICAL MEDIA PRIMITIVES (Precision 3D Studio)
   Reserved exclusively for DIRA Operational Hero & Clinical 3D/STL Media Views
   ============================================================================ */
.bf-studio-dark {
  background: radial-gradient(circle at 46% 38%, #194A59 0%, #0D2731 72%, #091B22 100%);
  border-radius: var(--bf-radius-lg);
  padding: 18px 20px;
  color: #FFFFFF;
  box-shadow: var(--bf-shadow-md);
}
.bf-tag-aq {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 194, 178, 0.16);
  border: 1px solid rgba(103, 242, 228, 0.35);
  color: #79F4E8;
  font-size: 10.8px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--bf-radius-pill);
}

/* ============================================================================
   TOAST, MODAL & EMPTY STATE
   ============================================================================ */
.bf-empty-state {
  text-align: center;
  padding: 28px 18px;
  background: var(--bf-surface-alt);
  border: 1px dashed var(--bf-border-strong);
  border-radius: var(--bf-radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.bf-empty-state h4 { font-size: 14px; font-weight: 700; color: var(--bf-teal-950); }
.bf-empty-state p { font-size: 12.5px; color: var(--bf-muted); max-width: 420px; }

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--bf-teal-950);
  color: #FFFFFF;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--bf-shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 120;
}
.toast.show { opacity: 1; }

.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12, 37, 46, 0.48);
  backdrop-filter: blur(2px);
  place-items: center;
  padding: 16px;
  z-index: 110;
}
.modal-bg.open { display: grid; }
.modal {
  background: var(--bf-surface);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--bf-border);
  box-shadow: var(--bf-shadow-md);
}
.modal-lg { max-width: 820px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
