/* ============================================================
   Toma de pedidos con IA — Demo
   Tema: dashboard oscuro, acentos cyan/neón. Estilo SNL.
   ============================================================ */

:root {
    --bg: #0a0e14;
    --bg-2: #0f1620;
    --panel: #121a26;
    --panel-2: #16202e;
    --border: #1e2a3a;
    --border-soft: #243246;
    --text: #e6edf3;
    --text-dim: #8b9bb0;
    --text-faint: #5b6b80;
    --cyan: #22d3ee;
    --cyan-soft: #0e7490;
    --green: #34d399;
    --amber: #fbbf24;
    --red: #f87171;
    --shadow: 0 10px 40px rgba(0, 0, 0, .45);
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(34, 211, 238, .08), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, rgba(52, 211, 153, .05), transparent 55%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

.app-shell { max-width: 1180px; margin: 0 auto; padding: 22px 22px 60px; }

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; margin-bottom: 22px;
    background: linear-gradient(180deg, var(--panel), var(--bg-2));
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo-shine {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    overflow: hidden; border-radius: 50%; filter: drop-shadow(0 0 10px rgba(34, 211, 238, .28));
}
.brand-logo { width: 40px; height: 40px; display: block; border-radius: 50%; }
.brand-name { font-weight: 700; letter-spacing: .3px; }
.brand-sub { font-size: 12px; color: var(--text-dim); }
.topbar-right { font-size: 13px; color: var(--text-dim); }

/* ---------- Flash ---------- */
.flash {
    padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px;
    border: 1px solid var(--border-soft);
}
.flash-ok { background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .4); color: var(--green); }
.flash-err { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .4); color: var(--red); }

/* ---------- Layout grids ---------- */
.intro { margin-bottom: 22px; }
.intro h1 { font-size: 26px; margin: 0 0 6px; }
.intro p { margin: 0; color: var(--text-dim); max-width: 760px; }
.badge-mock, .badge-live {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
    text-transform: uppercase; letter-spacing: .5px; margin-top: 10px;
}
.badge-mock { background: rgba(251, 191, 36, .12); color: var(--amber); border: 1px solid rgba(251, 191, 36, .35); }
.badge-live { background: rgba(52, 211, 153, .12); color: var(--green); border: 1px solid rgba(52, 211, 153, .35); }

.grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

/* ---------- Panels ---------- */
.panel {
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-head .step {
    width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
    background: rgba(34, 211, 238, .12); color: var(--cyan);
    font-size: 13px; font-weight: 700; border: 1px solid rgba(34, 211, 238, .3);
}
.panel-head h2 { font-size: 16px; margin: 0; }
.panel-hint { font-size: 13px; color: var(--text-faint); margin: -6px 0 14px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    font-family: inherit; font-size: 14px; font-weight: 600;
    padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border-soft);
    background: var(--panel-2); color: var(--text); transition: all .15s ease;
}
.btn:hover:not(:disabled) { border-color: var(--cyan-soft); transform: translateY(-1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(180deg, #22d3ee, #0891b2); color: #04141a;
    border-color: transparent; box-shadow: 0 6px 18px rgba(34, 211, 238, .25);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 8px 22px rgba(34, 211, 238, .4); }
.btn-ok { background: linear-gradient(180deg, #34d399, #059669); color: #042016; border-color: transparent; }
.btn-danger { background: rgba(248, 113, 113, .12); color: var(--red); border-color: rgba(248, 113, 113, .35); }
.btn-ghost { background: transparent; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Recorder ---------- */
.recorder { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.rec-indicator {
    display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-dim);
}
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--text-faint); }
.rec-dot.live { background: var(--red); box-shadow: 0 0 12px var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.rec-timer { font-family: 'JetBrains Mono', monospace; font-size: 15px; color: var(--cyan); }
audio { width: 100%; margin-top: 14px; filter: invert(.9) hue-rotate(170deg); }

/* ---------- Textarea / inputs ---------- */
.field { display: block; margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
textarea, input[type="text"], input[type="number"], select {
    width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
    background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 10px;
    padding: 10px 12px; transition: border-color .15s;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--cyan); }
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }

.transcription-box {
    background: var(--bg-2); border: 1px dashed var(--border-soft); border-radius: 10px;
    padding: 14px; min-height: 60px; color: var(--text-dim); font-size: 14px;
}

/* ---------- Structured order / items ---------- */
.review-banner {
    display: flex; gap: 10px; align-items: flex-start;
    background: rgba(251, 191, 36, .08); border: 1px solid rgba(251, 191, 36, .3);
    border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 13px; color: #f3d27a;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

.item-card {
    background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 12px;
    padding: 14px; margin-bottom: 12px; position: relative;
}
.item-card .item-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.item-grid { display: grid; grid-template-columns: 2fr .7fr 1fr; gap: 10px; }
@media (max-width: 560px) { .item-grid { grid-template-columns: 1fr; } }

.conf { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.conf-high { background: rgba(52, 211, 153, .15); color: var(--green); }
.conf-medium { background: rgba(251, 191, 36, .15); color: var(--amber); }
.conf-low { background: rgba(248, 113, 113, .15); color: var(--red); }

.chip-remove {
    background: rgba(248, 113, 113, .12); color: var(--red); border: 1px solid rgba(248, 113, 113, .3);
    border-radius: 8px; width: 28px; height: 28px; cursor: pointer; font-size: 16px; line-height: 1;
}
.missing-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.missing-tag { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(248,113,113,.12); color: var(--red); border: 1px solid rgba(248,113,113,.3); }

.empty-hint { color: var(--text-faint); font-size: 14px; text-align: center; padding: 20px; }
.hidden { display: none !important; }

/* ---------- Flow status (sidebar) ---------- */
.flow-step { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.flow-step:last-child { border-bottom: none; }
.flow-num {
    width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
    font-size: 12px; font-weight: 700; background: var(--bg-2); color: var(--text-faint); border: 1px solid var(--border-soft);
}
.flow-step.done .flow-num { background: rgba(52,211,153,.15); color: var(--green); border-color: rgba(52,211,153,.4); }
.flow-step.active .flow-num { background: rgba(34,211,238,.15); color: var(--cyan); border-color: rgba(34,211,238,.5); }
.flow-label { font-size: 14px; }
.flow-step.done .flow-label { color: var(--text); }
.flow-step:not(.done):not(.active) .flow-label { color: var(--text-faint); }
.flow-sub { font-size: 12px; color: var(--text-faint); }

/* ---------- Audit log ---------- */
.audit-log { font-family: 'JetBrains Mono', monospace; font-size: 12px; max-height: 200px; overflow-y: auto; }
.audit-entry { padding: 6px 0; border-bottom: 1px dashed var(--border); color: var(--text-dim); }
.audit-entry .t { color: var(--cyan); }

/* ---------- Receipt ---------- */
.receipt {
    max-width: 560px; margin: 0 auto; background: var(--panel);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden;
}
.receipt-head { padding: 22px; text-align: center; border-bottom: 1px dashed var(--border-soft); }
.receipt-folio { font-family: 'JetBrains Mono', monospace; font-size: 18px; color: var(--cyan); letter-spacing: 1px; }
.receipt-date { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.receipt-body { padding: 22px; }
.receipt-meta { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.receipt-meta .k { color: var(--text-dim); }
.receipt-items { margin: 18px 0; }
.receipt-item { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.receipt-item .name { font-weight: 600; }
.receipt-item .meta { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.receipt-legend { text-align: center; font-size: 13px; color: var(--green); padding: 14px; background: rgba(52,211,153,.07); }
.receipt-actions { padding: 18px 22px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; border-top: 1px solid var(--border); }
.send-result { margin: 14px 0; padding: 12px 14px; border-radius: 10px; font-size: 13px; }
.send-ok { background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.4); color: var(--green); }

/* ---------- Footer (igual que systems-network-labs.net) ---------- */
.footer {
    margin-top: 40px; padding: 30px 12px 12px;
    background: transparent; border: none; border-top: 1px solid var(--border);
}
.footer-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 22px; flex-wrap: wrap; padding-bottom: 20px;
}
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-logo { width: 42px; height: 42px; display: block; border-radius: 50%; }
.footer-brand-text {
    font-weight: 800; font-size: 1.45rem; color: var(--cyan);
    text-shadow: 0 0 18px rgba(34, 211, 238, .45); letter-spacing: .3px; line-height: 1.1;
}
.footer-brand-sub { font-size: 14px; color: var(--text-dim); margin-top: 4px; }

.footer-social { display: flex; gap: 10px; }
.social-btn {
    width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
    color: var(--text); background: var(--bg-2); border: 1px solid var(--border-soft);
    font-size: 18px; text-decoration: none; transition: all .15s ease;
}
.social-btn:hover { transform: translateY(-2px); border-color: var(--cyan-soft); }
.social-btn.fb:hover { color: #1877f2; }
.social-btn.wa:hover { color: #25d366; }

.footer-contact { text-align: right; }
.footer-contact-label { font-size: 12px; color: var(--text-dim); }
.footer-phone { color: var(--cyan); font-weight: 600; text-decoration: none; }
.footer-phone:hover { text-decoration: underline; }

.footer-copy {
    text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 12px;
    color: var(--text-faint); margin: 16px 0; line-height: 1.7;
}
.footer-badges { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.footer-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: 'JetBrains Mono', monospace; font-size: .7rem; font-weight: 600; letter-spacing: .03em;
    padding: 6px 12px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border-soft);
}
.footer-badge.cf { color: #f6821f; }
.footer-badge.oci { color: #C8102E; }
.footer-demo-note {
    text-align: center; font-size: 12px; color: var(--text-faint);
    margin: 18px auto 0; max-width: 780px; line-height: 1.6;
}
@media (max-width: 640px) {
    .footer-top { justify-content: center; text-align: center; }
    .footer-contact { text-align: center; }
}

/* ---------- Preguntas para el cajero ---------- */
.cashier-questions { list-style: none; margin: 0; padding: 0; }
.cashier-questions li {
    position: relative; padding: 8px 0 8px 22px; font-size: 14px;
    color: var(--text-dim); border-bottom: 1px solid var(--border);
}
.cashier-questions li:last-child { border-bottom: none; }
.cashier-questions li::before {
    content: '›'; position: absolute; left: 4px; top: 8px; color: var(--cyan); font-weight: 700;
}
.cashier-questions.alert li { color: var(--text); }
.cashier-questions.alert li::before { content: '!'; color: var(--amber); }

.questions-alert-head {
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
    color: var(--amber); margin-bottom: 6px;
}
#dynamicQuestions {
    background: rgba(251, 191, 36, .07); border: 1px solid rgba(251, 191, 36, .3);
    border-radius: 10px; padding: 10px 12px; margin-bottom: 14px;
}
#dynamicQuestions:empty { display: none; }
.questions-ok { font-size: 13px; color: var(--green); }

/* ---------- Navegación entre demos (pestañas) ---------- */
.demo-nav { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.demo-tab {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border-radius: 10px; text-decoration: none;
    font-size: 14px; font-weight: 600; color: var(--text-dim);
    background: var(--panel-2); border: 1px solid var(--border-soft); transition: all .15s ease;
}
.demo-tab:hover { color: var(--text); border-color: var(--cyan-soft); }
.demo-tab.active {
    color: #04141a; background: linear-gradient(180deg, #22d3ee, #0891b2);
    border-color: transparent; box-shadow: 0 6px 18px rgba(34, 211, 238, .25);
}

/* ---------- Tarjeta de paciente demo ---------- */
.patient-card {
    display: flex; align-items: center; gap: 16px; margin-bottom: 18px;
    padding: 16px 20px; border-radius: var(--radius);
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border); box-shadow: var(--shadow);
}
.patient-avatar {
    width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
    background: rgba(34, 211, 238, .12); color: var(--cyan);
    font-size: 24px; border: 1px solid rgba(34, 211, 238, .3); flex-shrink: 0;
}
.patient-name { font-weight: 700; font-size: 16px; }
.patient-id { font-size: 12px; color: var(--cyan); margin-left: 6px; }
.patient-meta { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

/* ---------- Rejillas clínicas ---------- */
.vitals-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 10px; }
.soap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) {
    .vitals-grid { grid-template-columns: 1fr 1fr; }
    .soap-grid { grid-template-columns: 1fr; }
}

/* ---------- Resumen clínico ---------- */
.clin-h3 {
    font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: var(--cyan);
    margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.clin-field { margin-bottom: 12px; }
.clin-field .k { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; }
.clin-field p { margin: 3px 0 0; font-size: 14px; color: var(--text); white-space: pre-wrap; }
.json-view {
    background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 10px;
    padding: 14px; font-family: 'JetBrains Mono', monospace; font-size: 12px;
    color: var(--text-dim); overflow-x: auto; line-height: 1.5; max-height: 360px;
}

.mono { font-family: 'JetBrains Mono', monospace; }
.muted { color: var(--text-dim); }

/* ---------- Impresión / PDF (paso 5) ---------- */
@media print {
    /* Fondo blanco, texto negro para imprimir/guardar como PDF */
    body { background: #fff !important; }
    .app-shell { max-width: 100%; margin: 0; padding: 0; }

    /* Ocultar todo lo que no es el recibo/resumen */
    .topbar, .footer, .demo-nav, .flash, .receipt-actions, .no-print { display: none !important; }

    /* El recibo/resumen ocupa toda la hoja, sin sombras ni fondo oscuro */
    .receipt {
        max-width: 100% !important; box-shadow: none !important;
        border: 1px solid #ccc !important; background: #fff !important;
    }
    .receipt, .receipt * { color: #111 !important; }
    .receipt-head, .receipt-body { border-color: #ccc !important; }
    .receipt-folio { color: #0a6c84 !important; }
    .receipt-legend { background: #f3f7f5 !important; color: #166534 !important; }
    .badge-live { background: #eaf7f0 !important; color: #166534 !important; border-color: #9bd6b4 !important; }
    .patient-card { background: #f7f9fb !important; border-color: #ddd !important; box-shadow: none !important; }
    .patient-avatar { background: #e6f6fb !important; color: #0a6c84 !important; border-color: #bfe6f0 !important; }
    .transcription-box { background: #f7f9fb !important; border-color: #ccc !important; color: #111 !important; }
    .json-view { background: #f5f5f5 !important; border-color: #ccc !important; color: #111 !important; }
    .clin-h3 { color: #0a6c84 !important; border-color: #ccc !important; }
    .send-result { display: none !important; }
}
