/*
 * orden-nueva.css — estilos dedicados de orden-nueva.html
 * Movido del bloque <style> inline (Tier D refactor 2026-05-26).
 * Mantenibilidad: 762 lineas extraidas del HTML.
 */

    /* =================================================================
       ORDEN NUEVA V2 — Perfiles + Sectores + Buscar + Preview tubos
       Ola 16-B · Research: Epic Beaker + NBU + IDAC + Centro Rossi
       ================================================================= */

    .on-wrap {
      display: grid;
      grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
      gap: var(--h-space-4);
      align-items: start;
    }
    @media (max-width: 1100px) {
      .on-wrap { grid-template-columns: 1fr; }
    }

    .on-card {
      background: var(--h-surface);
      border: 1px solid var(--h-hairline);
      border-radius: var(--h-radius-md);
      padding: var(--h-space-4);
    }

    .on-section-title {
      font-size: var(--h-text-xs);
      text-transform: uppercase;
      letter-spacing: 0.08em;
      font-weight: 600;
      color: var(--h-muted);
      margin: var(--h-space-4) 0 var(--h-space-2);
      padding-bottom: var(--h-space-1);
      border-bottom: 1px solid var(--h-hairline);
    }
    .on-section-title:first-child { margin-top: 0; }
    .on-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: var(--h-space-3);
    }
    .on-grid .col-2 { grid-column: span 2; }

    /* Picker paciente (igual a turno-nuevo) */
    .picker-paciente { position: relative; }
    .picker-results {
      position: absolute; top: 100%; left: 0; right: 0;
      background: var(--h-surface);
      border: 1px solid var(--h-hairline);
      border-radius: var(--h-radius-md);
      box-shadow: var(--h-shadow-md);
      max-height: 280px; overflow-y: auto;
      z-index: 10; margin-top: 4px;
    }
    .picker-row {
      padding: var(--h-space-2) var(--h-space-3);
      cursor: pointer; font-size: var(--h-text-sm);
      display: flex; gap: var(--h-space-2); align-items: center;
    }
    .picker-row:hover { background: var(--h-nest); }
    .picker-row-add {
      border-top: 1px solid var(--h-hairline);
      color: var(--h-brand-primary);
      font-weight: 500;
      background: var(--h-brand-primary-soft);
    }
    .picker-row-add:hover { background: var(--h-brand-primary); color: white; }

    /* Tabs Perfiles / Sectores / Buscar */
    .modo-tabs {
      display: flex;
      gap: var(--h-space-1);
      border-bottom: 1px solid var(--h-hairline);
      margin-bottom: var(--h-space-3);
    }
    .modo-tab {
      padding: var(--h-space-2) var(--h-space-3);
      background: transparent;
      border: none;
      border-bottom: 2px solid transparent;
      cursor: pointer;
      font-size: var(--h-text-sm);
      color: var(--h-ink-soft);
      font-weight: 500;
      transition: all var(--h-transition-fast);
    }
    .modo-tab:hover { color: var(--h-ink); background: var(--h-nest); }
    .modo-tab.is-active {
      color: var(--h-brand-primary);
      border-bottom-color: var(--h-brand-primary);
      font-weight: 600;
    }

    /* Perfiles preset (chips grandes con conteo) */
    .perfiles-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: var(--h-space-2);
    }
    .perfil-chip {
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: var(--h-space-3);
      background: var(--h-nest);
      border: 1.5px solid var(--h-hairline);
      border-radius: var(--h-radius-md);
      cursor: pointer;
      text-align: left;
      font-family: inherit;
      transition: all var(--h-transition-fast);
    }
    .perfil-chip:hover {
      border-color: var(--h-brand-primary);
      background: var(--h-brand-primary-soft);
    }
    .perfil-chip.is-applied {
      border-color: var(--h-ok);
      background: var(--h-ok-soft);
    }
    .perfil-chip-nombre {
      font-weight: 600;
      font-size: var(--h-text-sm);
      color: var(--h-ink);
    }
    .perfil-chip-meta {
      font-size: var(--h-text-xs);
      color: var(--h-muted);
    }
    .perfil-chip-cant {
      display: inline-block;
      padding: 1px 6px;
      background: var(--h-brand-primary);
      color: white;
      border-radius: var(--h-radius-pill);
      font-size: var(--h-text-xs);
      font-weight: 600;
    }
    .perfil-chip.is-applied .perfil-chip-cant { background: var(--h-ok); }

    /* Sectores acordeón */
    .sector-bloque {
      margin-bottom: var(--h-space-3);
      border: 1px solid var(--h-hairline);
      border-radius: var(--h-radius-md);
      overflow: hidden;
    }
    .sector-header {
      padding: var(--h-space-2) var(--h-space-3);
      background: var(--h-nest);
      display: flex;
      justify-content: space-between;
      align-items: center;
      cursor: pointer;
      font-size: var(--h-text-sm);
      font-weight: 600;
      color: var(--h-ink);
    }
    .sector-header:hover { background: var(--h-hairline); }
    .sector-pill {
      padding: 1px 6px;
      border-radius: var(--h-radius-pill);
      font-size: var(--h-text-xs);
      font-weight: 600;
    }
    .sector-pill.s-1 { background: #EFE4F5; color: #8B5CB8; }  /* Hematología */
    .sector-pill.s-2 { background: var(--h-warn-soft); color: var(--h-warn); }  /* Química */
    .sector-pill.s-3 { background: var(--h-info-soft); color: var(--h-info); }  /* Inmunología */
    .sector-pill.s-4 { background: #FCE7CD; color: #C9700E; }  /* Microbiología */
    .sector-pill.s-5 { background: var(--h-ok-soft); color: var(--h-ok); }  /* Endocrinología */
    .sector-pill.s-6 { background: #DCEDF7; color: #1F6F9C; }  /* Coagulación */
    .sector-pill.s-7 { background: #FFF4B8; color: #8B6914; }  /* Orina */
    .sector-pill.s-8 { background: #F5E6D8; color: var(--h-accent-ai); } /* Parasitología */

    /* Lista de prácticas (común para sectores + buscar) */
    .practica-row {
      display: flex;
      align-items: center;
      gap: var(--h-space-3);
      padding: var(--h-space-2) var(--h-space-3);
      cursor: pointer;
      transition: background var(--h-transition-fast);
      font-size: var(--h-text-sm);
      border-bottom: 1px solid var(--h-hairline);
    }
    .practica-row:last-child { border-bottom: none; }
    .practica-row:hover { background: var(--h-nest); }
    .practica-row.is-selected {
      background: var(--h-brand-primary-soft);
      color: var(--h-ink);
    }
    .practica-checkbox {
      width: 18px; height: 18px;
      border: 1.5px solid var(--h-border-soft);
      border-radius: 4px;
      flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      background: var(--h-surface);
    }
    .practica-row.is-selected .practica-checkbox {
      background: var(--h-brand-primary);
      border-color: var(--h-brand-primary);
      color: white;
    }
    .practica-codigo {
      font-family: var(--h-font-mono);
      font-size: var(--h-text-xs);
      background: var(--h-hairline);
      color: var(--h-ink-soft);
      padding: 2px 6px;
      border-radius: var(--h-radius-sm);
      flex-shrink: 0;
    }
    .practica-nombre { flex: 1; }
    .practica-precio {
      font-variant-numeric: tabular-nums;
      color: var(--h-muted);
      font-size: var(--h-text-xs);
      flex-shrink: 0;
    }
    .practica-ayuno-dot {
      width: 10px; height: 10px;
      border-radius: 50%;
      background: var(--h-warn);
      flex-shrink: 0;
    }

    /* Sticky derecha — resumen + tubos preview + ayuno */
    .sticky-col {
      position: sticky;
      top: var(--h-space-4);
      display: flex;
      flex-direction: column;
      gap: var(--h-space-3);
    }

    .ayuno-banner {
      background: var(--h-warn-soft);
      border-left: 3px solid var(--h-warn);
      padding: var(--h-space-3);
      border-radius: var(--h-radius-md);
      font-size: var(--h-text-sm);
      color: var(--h-ink);
      display: flex;
      gap: var(--h-space-2);
      align-items: flex-start;
    }
    .ayuno-banner-icon {
      width: 28px; height: 28px;
      border-radius: 50%;
      background: var(--h-warn);
      color: white;
      display: flex; align-items: center; justify-content: center;
      font-weight: 600; font-size: var(--h-text-sm);
      flex-shrink: 0;
    }
    .ayuno-banner-title { font-weight: 600; color: var(--h-warn); }

    /* Preview de tubos */
    .tubos-list {
      display: flex;
      flex-direction: column;
      gap: var(--h-space-2);
    }
    .tubo-row {
      display: grid;
      grid-template-columns: auto 1fr auto;
      gap: var(--h-space-3);
      align-items: center;
      padding: var(--h-space-2) var(--h-space-3);
      background: var(--h-nest);
      border-radius: var(--h-radius-sm);
    }
    .tubo-visual {
      width: 18px; height: 32px;
      border-radius: 0 0 6px 6px;
      border: 1px solid var(--h-border-soft);
      position: relative;
    }
    .tubo-visual::before {
      content: '';
      position: absolute;
      top: 0; left: -2px; right: -2px;
      height: 6px;
      border-radius: 3px;
      background: inherit;
      filter: brightness(0.85);
    }
    .tubo-amarillo { background: #FFE066; }
    .tubo-rojo     { background: #C92A2A; }
    .tubo-lila     { background: #B197FC; }
    .tubo-celeste  { background: #74C0FC; }
    .tubo-gris     { background: #ADB5BD; }
    .tubo-verde    { background: #51CF66; }
    .tubo-naranja  { background: #FF922B; }
    .tubo-default  { background: #DEE2E6; }
    .tubo-nombre { font-size: var(--h-text-sm); font-weight: 500; }
    .tubo-meta { font-size: var(--h-text-xs); color: var(--h-muted); }
    .tubo-count {
      padding: 2px 8px;
      background: var(--h-brand-primary);
      color: white;
      border-radius: var(--h-radius-pill);
      font-weight: 600;
      font-size: var(--h-text-xs);
    }

    /* Resumen ítems */
    .resumen-items {
      max-height: 280px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .resumen-item {
      display: grid;
      grid-template-columns: 1fr auto auto;
      gap: var(--h-space-2);
      align-items: center;
      padding: var(--h-space-2);
      background: var(--h-nest);
      border-radius: var(--h-radius-sm);
      font-size: var(--h-text-xs);
    }
    .resumen-item-quitar {
      background: transparent;
      border: none;
      color: var(--h-danger);
      cursor: pointer;
      font-size: 16px;
      padding: 0 4px;
      line-height: 1;
    }
    .total-line {
      display: flex;
      justify-content: space-between;
      padding: var(--h-space-3) 0 0;
      border-top: 1px solid var(--h-hairline);
      margin-top: var(--h-space-3);
      font-weight: 700;
      font-size: var(--h-text-md);
    }

    /* Turno vinculado */
    .turno-vinculado {
      padding: var(--h-space-2) var(--h-space-3);
      background: var(--h-brand-primary-soft);
      border-radius: var(--h-radius-sm);
      font-size: var(--h-text-sm);
      color: var(--h-brand-primary);
      margin-bottom: var(--h-space-2);
      display: flex;
      gap: var(--h-space-2);
      align-items: center;
    }

    /* ═══════ WIZARD DE 4 PASOS ═══════ */
    .wizard-stepper {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0;
      background: var(--h-surface);
      border: 1px solid var(--h-hairline);
      border-radius: var(--h-radius-lg);
      padding: var(--h-space-2);
      margin-bottom: var(--h-space-4);
    }
    .wizard-step {
      display: flex;
      align-items: center;
      gap: var(--h-space-2);
      padding: var(--h-space-3) var(--h-space-4);
      cursor: pointer;
      border-radius: var(--h-radius-md);
      background: transparent;
      border: none;
      text-align: left;
      font-family: inherit;
      transition: background 140ms ease;
      position: relative;
    }
    .wizard-step:hover { background: var(--h-nest); }
    .wizard-step.is-current { background: var(--h-brand-primary-soft); }
    .wizard-step-num {
      width: 28px; height: 28px; border-radius: 50%;
      background: var(--h-nest);
      color: var(--h-muted);
      display: flex; align-items: center; justify-content: center;
      font-family: var(--h-font-mono);
      font-size: 13px;
      font-weight: 600;
      flex-shrink: 0;
      transition: background 140ms ease, color 140ms ease;
    }
    .wizard-step.is-current .wizard-step-num {
      background: var(--h-brand-primary);
      color: #FFF;
    }
    .wizard-step.is-done .wizard-step-num {
      background: var(--hx-sage);
      color: #FFF;
    }
    .wizard-step-text {
      display: flex; flex-direction: column;
      min-width: 0;
    }
    .wizard-step-titulo {
      font-size: var(--h-text-sm);
      font-weight: 600;
      color: var(--h-ink);
      line-height: 1.2;
    }
    .wizard-step.is-current .wizard-step-titulo { color: var(--h-brand-primary-hover); }
    .wizard-step-help {
      font-size: var(--h-text-xs);
      color: var(--h-muted);
      line-height: 1.2;
    }
    /* Línea conectora entre pasos */
    .wizard-step:not(:last-child)::after {
      content: '';
      position: absolute;
      right: -2px; top: 50%;
      width: 4px; height: 2px;
      background: var(--h-hairline);
    }
    @media (max-width: 720px) {
      .wizard-stepper { grid-template-columns: 1fr; gap: 4px; }
      .wizard-step-help { display: none; }
      .wizard-step:not(:last-child)::after { display: none; }
    }

    /* Barra de navegación del wizard (atrás / siguiente) */
    .wizard-nav {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: var(--h-space-3);
      padding: var(--h-space-4) 0 0;
      margin-top: var(--h-space-3);
      border-top: 1px solid var(--h-hairline);
    }
    .wizard-nav-spacer { flex: 1; }

    /* Combobox custom (estilo picker-paciente) */
    .combobox {
      position: relative;
      width: 100%;
    }
    .combobox-input {
      padding-right: 32px;
    }
    .combobox-clear {
      position: absolute;
      right: 8px; top: 50%;
      transform: translateY(-50%);
      width: 22px; height: 22px;
      border-radius: 50%;
      background: var(--h-nest);
      border: none;
      color: var(--h-muted);
      cursor: pointer;
      font-size: 14px;
      line-height: 1;
      display: flex; align-items: center; justify-content: center;
    }
    .combobox-clear:hover { background: var(--h-hairline); color: var(--h-ink); }
    .combobox-results {
      position: absolute;
      top: calc(100% + 4px); left: 0; right: 0;
      background: var(--h-surface);
      border: 1px solid var(--h-border-soft);
      border-radius: var(--h-radius-md);
      box-shadow: var(--h-shadow-md);
      z-index: var(--h-z-dropdown);
      max-height: 280px;
      overflow-y: auto;
      padding: 4px;
    }
    .combobox-row {
      padding: 9px 12px;
      border-radius: var(--h-radius-sm);
      cursor: pointer;
      font-size: var(--h-text-sm);
      color: var(--h-ink);
      display: flex;
      flex-direction: column;
      gap: 2px;
      transition: background 100ms ease;
    }
    .combobox-row:hover {
      background: var(--h-brand-primary-soft);
    }
    .combobox-row strong { font-weight: 600; }
    .combobox-row-meta {
      font-size: var(--h-text-xs);
      color: var(--h-muted);
    }
    .combobox-row-empty {
      color: var(--h-muted);
      font-style: italic;
      cursor: default;
    }
    .combobox-row-empty:hover { background: transparent; }
    .combobox-row-add {
      color: var(--h-brand-primary);
      font-weight: 600;
      border-top: 1px solid var(--h-hairline);
      margin-top: 2px;
      padding-top: 10px;
    }
    .combobox-row-add:hover { background: var(--h-brand-primary-soft); }

    /* CTA Repetir orden anterior */
    .repetir-orden-cta {
      display: flex;
      align-items: center;
      gap: var(--h-space-3);
      padding: var(--h-space-4);
      background: linear-gradient(135deg, rgba(155,141,201,0.10), rgba(123,168,138,0.08));
      border: 1px solid var(--hx-periwinkle);
      border-radius: var(--h-radius-lg);
      margin-bottom: var(--h-space-4);
      cursor: pointer;
      transition: transform 140ms ease, box-shadow 200ms ease;
    }
    .repetir-orden-cta:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 16px rgba(155,141,201,0.18);
    }
    .repetir-orden-icon {
      width: 40px; height: 40px;
      border-radius: 50%;
      background: var(--hx-periwinkle);
      color: #FFF;
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
    }
    .repetir-orden-text { flex: 1; min-width: 0; }
    .repetir-orden-titulo {
      font-weight: 600;
      font-size: var(--h-text-sm);
      color: var(--h-ink);
    }
    .repetir-orden-sub {
      font-size: var(--h-text-xs);
      color: var(--h-muted);
      margin-top: 2px;
    }
    .repetir-orden-arrow {
      color: var(--hx-periwinkle);
      font-size: 20px;
      font-weight: 600;
    }

    /* Botón IA Interpretar */
    .btn-ia-interpretar {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 10px 16px;
      background: linear-gradient(135deg, var(--hx-periwinkle), var(--hx-coral));
      color: #FFF;
      border: none;
      border-radius: var(--h-radius-md);
      font-family: inherit;
      font-size: var(--h-text-sm);
      font-weight: 600;
      cursor: pointer;
      box-shadow: 0 1px 2px rgba(0,0,0,0.06);
      transition: opacity 140ms ease, transform 80ms ease;
    }
    .btn-ia-interpretar:hover:not(:disabled) { opacity: 0.92; }
    .btn-ia-interpretar:active:not(:disabled) { transform: scale(0.97); }
    .btn-ia-interpretar:disabled { opacity: 0.5; cursor: not-allowed; }

    /* Filas de confirmación (paso 4) */
    .confirm-row {
      display: grid;
      grid-template-columns: 140px 1fr auto;
      gap: var(--h-space-3);
      align-items: baseline;
      padding: var(--h-space-3) 0;
      border-bottom: 1px solid var(--h-hairline);
    }
    .confirm-row:last-child { border-bottom: none; }
    .confirm-label {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 1.4px;
      text-transform: uppercase;
      color: var(--h-muted);
    }
    .confirm-value {
      font-size: var(--h-text-sm);
      color: var(--h-ink);
      font-weight: 500;
    }
    .confirm-edit {
      font-size: var(--h-text-xs);
      color: var(--h-brand-primary);
      text-decoration: none;
      font-weight: 600;
    }
    .confirm-edit:hover { text-decoration: underline; }
    @media (max-width: 600px) {
      .confirm-row { grid-template-columns: 1fr; gap: 4px; }
    }

    /* Buscador central de prácticas */
    .practicas-search-wrap {
      position: relative;
      margin-bottom: var(--h-space-5);
    }
    .practicas-search-icon {
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--h-muted);
      pointer-events: none;
    }
    .practicas-search {
      width: 100%;
      padding: 14px 40px 14px 44px;
      font-family: var(--h-font-sans);
      font-size: var(--h-text-md);
      border: 1.5px solid var(--h-border-soft);
      border-radius: var(--h-radius-lg);
      background: var(--h-surface);
      color: var(--h-ink);
      transition: border-color 140ms ease, box-shadow 140ms ease;
    }
    .practicas-search:focus {
      outline: none;
      border-color: var(--h-brand-primary);
      box-shadow: 0 0 0 4px var(--h-brand-primary-soft);
    }
    .practicas-search::placeholder { color: var(--h-faint); }
    .practicas-search-clear {
      position: absolute;
      right: 12px;
      top: 50%;
      transform: translateY(-50%);
      width: 22px; height: 22px;
      border-radius: 50%;
      background: var(--h-nest);
      border: none;
      color: var(--h-muted);
      cursor: pointer;
      font-size: 16px;
      line-height: 1;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .practicas-search-clear:hover { background: var(--h-hairline); color: var(--h-ink); }

    .practicas-section-label {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 1.4px;
      text-transform: uppercase;
      color: var(--h-muted);
      margin-bottom: var(--h-space-3);
      padding-bottom: var(--h-space-2);
      border-bottom: 1px solid var(--h-hairline);
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: var(--h-space-3);
    }
    .practicas-section-help {
      font-size: 11px;
      font-weight: 400;
      letter-spacing: 0.2px;
      text-transform: none;
      color: var(--h-faint);
    }
    .practicas-empty {
      padding: var(--h-space-5);
      text-align: center;
      color: var(--h-muted);
      font-size: var(--h-text-sm);
      background: var(--h-nest);
      border-radius: var(--h-radius-md);
    }
    .practicas-empty strong { color: var(--h-ink-soft); font-weight: 600; }
    .practicas-resultados-list {
      max-height: 460px;
      overflow-y: auto;
    }

    /* Adjunto orden */
    .adjunto-acciones {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: var(--h-space-3);
      align-items: stretch;
    }
    @media (max-width: 720px) {
      .adjunto-acciones { grid-template-columns: 1fr; }
    }
    .adjunto-box {
      padding: var(--h-space-5) var(--h-space-4);
      border: 1.5px dashed var(--h-border-soft);
      border-radius: var(--h-radius-lg);
      text-align: center;
      cursor: pointer;
      background: var(--h-surface);
      transition: border-color 150ms ease, background 150ms ease;
    }
    .adjunto-box:hover {
      border-color: var(--h-brand-primary);
      background: var(--h-brand-primary-soft);
    }
    .adjunto-box.is-loaded {
      border-style: solid;
      border-color: var(--h-ok);
      background: var(--h-ok-soft);
    }
    .adjunto-icon {
      display: block;
      width: 36px; height: 36px;
      margin: 0 auto var(--h-space-2);
      color: var(--h-brand-primary);
    }
    .adjunto-box.is-loaded .adjunto-icon { color: var(--h-ok); }
    .adjunto-titulo {
      font-size: var(--h-text-sm);
      font-weight: 600;
      color: var(--h-ink);
    }
    .adjunto-help {
      font-size: var(--h-text-xs);
      color: var(--h-muted);
      margin-top: 4px;
    }
    /* Botón QR — alternativa moderna al upload manual */
    .adjunto-qr-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: var(--h-space-4);
      border: 1.5px solid var(--h-border-soft);
      border-radius: var(--h-radius-lg);
      background: var(--h-surface);
      color: var(--h-ink-soft);
      cursor: pointer;
      font-family: inherit;
      font-size: var(--h-text-xs);
      font-weight: 600;
      text-align: center;
      min-width: 140px;
      transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
    }
    .adjunto-qr-btn:hover {
      border-color: var(--hx-periwinkle);
      background: rgba(155,141,201,0.06);
      color: var(--hx-periwinkle);
    }
    .adjunto-qr-btn svg { color: var(--hx-periwinkle); }
