/* =====================================================================
 * MEDIA HUB — Live Link de cotizacion (Fase 6)
 * ARF-Grid (Flexbox), sin anchos fijos en px para contenedores, sin
 * !important. Claro por defecto, oscuro por preferencia del sistema o
 * por el boton (Mandamiento 3). Impresion carta siempre en claro.
 * ===================================================================== */

:root {
  --mh-blue: #022d53;
  --mh-turquoise: #00bfb2;
  --mh-bg: #f4f7fa;
  --mh-surface: #ffffff;
  --mh-text: #203448;
  --mh-muted: #53677a;
  --mh-border: #ccd8e3;
  --mh-accent-soft: rgb(0 191 178 / 12%);
  --mh-radius: 1rem;
  --mh-shadow: 0 0.75rem 2rem rgb(2 45 83 / 7%);
  --mh-heading: #022d53;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mh-bg: #011a2e;
    --mh-surface: #01243f;
    --mh-text: #e6eef5;
    --mh-muted: #9fb4c6;
    --mh-border: rgb(0 191 178 / 22%);
    --mh-shadow: 0 0.75rem 2rem rgb(0 0 0 / 35%);
    --mh-heading: #ffffff;
  }
}

:root[data-theme="dark"] {
  --mh-bg: #011a2e;
  --mh-surface: #01243f;
  --mh-text: #e6eef5;
  --mh-muted: #9fb4c6;
  --mh-border: rgb(0 191 178 / 22%);
  --mh-shadow: 0 0.75rem 2rem rgb(0 0 0 / 35%);
  --mh-heading: #ffffff;
}

* { box-sizing: border-box; }

body.q-body {
  margin: 0;
  background: var(--mh-bg);
  color: var(--mh-text);
  font-family: "Roboto", system-ui, sans-serif;
  line-height: 1.6;
  padding-block-end: 5rem;
}

h1, h2, h3, h4, button, .q-btn { font-family: "Montserrat", system-ui, sans-serif; }
h1, h2, h3, h4 { color: var(--mh-heading); line-height: 1.25; margin-block: 0 0.6rem; }
a { color: var(--mh-turquoise); text-underline-offset: 0.2em; }

.q-shell { max-inline-size: 76rem; margin-inline: auto; padding: clamp(1rem, 3vw, 2.5rem); display: flex; flex-direction: column; gap: 1.5rem; }
.q-shell--narrow { max-inline-size: 40rem; min-block-size: 80vh; justify-content: center; }

/* ---------------- ARF-Grid ---------------- */
.arf-grid { display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: 1.25rem; }
.arf-grid > * { min-inline-size: 0; flex: 1 1 18rem; }

.q-card {
  background: var(--mh-surface);
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius);
  padding: clamp(1rem, 3vw, 2rem);
  box-shadow: var(--mh-shadow);
}
.q-center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }

/* ---------------- Cabecera ---------------- */
.q-hero {
  position: relative;
  background: var(--mh-blue);
  color: #ffffff;
  border-radius: var(--mh-radius);
  padding: clamp(1.25rem, 4vw, 2.75rem);
  box-shadow: var(--mh-shadow);
}
.q-hero h1 { color: #ffffff; }
.q-hero__brand { display: flex; align-items: center; gap: 0.9rem; margin-block-end: 1rem; }
.q-logo { block-size: 3.25rem; inline-size: auto; }
.q-logo-lg { block-size: 5rem; inline-size: auto; }
.q-eyebrow { margin: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; color: var(--mh-turquoise); }
.q-meta { margin: 0; font-size: 0.85rem; opacity: 0.85; }
.q-hero__dates { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-block-end: 1rem; }
.q-title { font-size: clamp(1.5rem, 4vw, 2.4rem); }
.q-client { margin: 0 0 0.5rem; opacity: 0.9; }
.q-intro { margin: 0.75rem 0 0; max-inline-size: 60ch; opacity: 0.95; }
.q-theme {
  position: absolute; inset-block-start: 1rem; inset-inline-end: 1rem;
  inline-size: 2.5rem; block-size: 2.5rem; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 30%); background: transparent; color: #ffffff; cursor: pointer; font-size: 1.1rem;
}

.q-chip {
  display: inline-flex; align-items: center; padding: 0.2rem 0.65rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap;
  background: var(--mh-accent-soft); color: var(--mh-turquoise); border: 1px solid rgb(0 191 178 / 35%);
}
.q-hero .q-chip { background: rgb(255 255 255 / 10%); color: #ffffff; border-color: rgb(255 255 255 / 25%); }
.q-hero .q-chip--accent { background: var(--mh-turquoise); color: var(--mh-blue); border-color: var(--mh-turquoise); }

/* ---------------- Conceptos ---------------- */
.q-section-title { font-size: 1.35rem; }
.q-category { font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mh-muted); margin-block: 1rem 0.75rem; }
.q-item { display: flex; flex-direction: column; gap: 0.5rem; }
.q-item__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.q-item__head h4 { margin: 0; font-size: 1.05rem; }
.q-outcome { margin: 0; font-weight: 500; color: var(--mh-turquoise); }
.q-desc { margin: 0; color: var(--mh-muted); font-size: 0.92rem; }
.q-item__price {
  margin-block-start: auto; padding-block-start: 0.75rem; border-block-start: 1px dashed var(--mh-border);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; font-size: 0.9rem; color: var(--mh-muted);
}
.q-item__price strong { color: var(--mh-heading); font-size: 1.05rem; }
.q-item__price small { font-weight: 400; color: var(--mh-muted); }

/* ---------------- Inversion ---------------- */
.q-sum { margin: 0.5rem 0 1.25rem; }
.q-sum > div { display: flex; justify-content: space-between; gap: 1rem; padding-block: 0.4rem; border-block-end: 1px solid var(--mh-border); }
.q-sum dt { color: var(--mh-muted); }
.q-sum dd { margin: 0; font-weight: 500; text-align: end; }
.q-sum__discount dd { color: var(--mh-turquoise); }
.q-sum__total { border-block-end: 0; }
.q-sum__total dt, .q-sum__total dd { color: var(--mh-heading); font-weight: 700; font-size: 1.15rem; }
.q-note { font-size: 0.85rem; color: var(--mh-muted); }
.q-terms h3 { font-size: 0.95rem; margin-block-start: 1rem; }
.q-terms p { margin: 0; color: var(--mh-muted); }

/* ---------------- Formularios ---------------- */
.q-form label { display: block; margin-block: 1rem 0.4rem; font-weight: 700; font-size: 0.92rem; }
.q-form input:not([type="checkbox"]), .q-form select, .q-form textarea {
  inline-size: 100%; min-block-size: 3rem; padding: 0.75rem; border: 1px solid var(--mh-border);
  border-radius: 0.5rem; background: var(--mh-surface); color: var(--mh-text); font: inherit;
}
.q-form textarea { min-block-size: 6rem; resize: vertical; }
fieldset { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.q-help { font-size: 0.85rem; color: var(--mh-muted); margin: 0.5rem 0; }
.q-lead { color: var(--mh-muted); }
.q-signature-frame { overflow: hidden; border: 2px dashed var(--mh-border); border-radius: 0.75rem; margin-block: 0.75rem; }
#signature { display: block; inline-size: 100%; block-size: 13rem; background: #ffffff; touch-action: none; cursor: crosshair; }
.q-code { margin-block-start: 1rem; padding: 1rem; border-radius: 0.75rem; background: var(--mh-accent-soft); }
.q-code input { letter-spacing: 0.5em; font-size: 1.25rem; text-align: center; }
.q-consent { display: flex; align-items: flex-start; gap: 0.75rem; margin-block: 1.5rem; font-weight: 400; }
.q-consent input { flex-shrink: 0; inline-size: 1.25rem; block-size: 1.25rem; margin-block-start: 0.2rem; accent-color: var(--mh-turquoise); }
.q-status { min-block-size: 1.5rem; overflow-wrap: anywhere; font-weight: 500; }
.q-status[data-tone="error"] { color: #d64545; }
.q-status[data-tone="ok"] { color: var(--mh-turquoise); }
.q-aside hr { border: 0; border-block-start: 1px solid var(--mh-border); margin-block: 1.25rem; }
.q-steps-title { font-size: 0.95rem; margin-block-start: 1.25rem; }
.q-steps { margin: 0; padding-inline-start: 1.25rem; color: var(--mh-muted); font-size: 0.9rem; display: flex; flex-direction: column; gap: 0.4rem; }
.q-steps strong { color: var(--mh-heading); }

/* ---------------- Botones ---------------- */
.q-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-block-size: 3rem; padding: 0.85rem 1.25rem; border-radius: 0.6rem; border: 1px solid transparent;
  font-weight: 700; font-size: 0.95rem; cursor: pointer; text-decoration: none; transition: filter 0.15s ease;
}
.q-btn:hover { filter: brightness(1.06); }
.q-btn:disabled { opacity: 0.65; cursor: wait; }
.q-btn--primary { background: var(--mh-turquoise); color: var(--mh-blue); }
.q-btn--ghost { background: transparent; color: var(--mh-heading); border-color: var(--mh-border); }
.q-btn--sm { min-block-size: 2.5rem; padding: 0.5rem 0.9rem; font-size: 0.85rem; }
.q-btn--block { inline-size: 100%; }
:where(a, button, input, select, textarea):focus-visible { outline: 3px solid var(--mh-turquoise); outline-offset: 3px; }

/* ---------------- Constancia ---------------- */
.q-accepted { border-color: var(--mh-turquoise); border-width: 2px; }
.q-facts { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; margin: 1rem 0; }
.q-facts > div { flex: 1 1 14rem; }
.q-facts__wide { flex-basis: 100%; }
.q-facts dt { font-size: 0.78rem; color: var(--mh-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.q-facts dd { margin: 0.15rem 0 0; font-weight: 700; }
.q-hash { font-family: ui-monospace, Consolas, monospace; font-size: 0.78rem; word-break: break-all; font-weight: 400; }
.q-signature-img { display: block; max-inline-size: 100%; inline-size: 24rem; background: #ffffff; border: 1px solid var(--mh-border); border-radius: 0.5rem; }

/* ---------------- Pie y barra de accion ---------------- */
.q-footer { font-size: 0.82rem; color: var(--mh-muted); text-align: center; padding-block: 1rem 2rem; }
.q-footer p { margin: 0.35rem 0; }
.q-actionbar {
  position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 20;
  display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem clamp(0.75rem, 3vw, 2rem);
  background: var(--mh-surface); border-block-start: 1px solid var(--mh-border); box-shadow: 0 -0.5rem 1.5rem rgb(2 45 83 / 10%);
}
.q-actionbar__total { margin-inline-end: auto; display: flex; flex-direction: column; line-height: 1.2; }
.q-actionbar__total span { font-size: 0.72rem; color: var(--mh-muted); }
.q-actionbar__total strong { color: var(--mh-heading); font-size: 1.05rem; }
.q-preview-banner { background: #f5b301; color: #1e1e1e; text-align: center; font-weight: 700; padding: 0.5rem 1rem; font-size: 0.9rem; }

.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none; scroll-behavior: auto; } }

/* ---------------- Impresion / PDF (carta) ---------------- */
@page { size: letter; margin: 14mm; }
/* ============ MOD_COTIZACIONES v1.0.0 (2026-11-06) ============ */
:root { --mh-ok: #0f7a4a; --mh-ok-soft: rgb(15 122 74 / 12%); --mh-warn: #a4540a; --mh-warn-soft: rgb(196 108 16 / 14%); --mh-annual: #6b3fb5; --mh-annual-soft: rgb(107 63 181 / 12%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --mh-ok: #4fd39a; --mh-warn: #f2b066; --mh-annual: #c7a6ff; }
}
:root[data-theme="dark"] { --mh-ok: #4fd39a; --mh-warn: #f2b066; --mh-annual: #c7a6ff; }

.q-tagline { margin: 0; font-size: 0.85rem; opacity: 0.85; }

/* Validacion al escanear el QR (F-12) */
.q-validate { border-inline-start: 0.4rem solid var(--mh-ok); }
.q-validate--ok { background: var(--mh-ok-soft); }
.q-validate--ok h2 { color: var(--mh-ok); }
.q-validate--warn { background: var(--mh-warn-soft); border-inline-start-color: var(--mh-warn); }
.q-validate--warn h2, p.q-validate--warn { color: var(--mh-warn); }
p.q-validate { padding: 0.75rem 1rem; border-radius: 0.6rem; }

/* Resumen por area (F-05) */
.q-areas { display: flex; flex-wrap: wrap; gap: 1rem; }
.q-area { flex: 1 1 15rem; min-inline-size: 0; }
.q-area h3 { font-size: 1.05rem; }
.q-area__meta { margin: 0; color: var(--mh-muted); font-size: 0.85rem; }
.q-area__total { margin: 0.25rem 0 0.5rem; font-family: "Montserrat", system-ui, sans-serif; font-weight: 800; font-size: 1.3rem; color: var(--mh-heading); white-space: nowrap; }
.q-area__total small { font-size: 0.7rem; font-weight: 600; color: var(--mh-muted); }
.q-area__top { margin: 0; padding-inline-start: 1.1rem; font-size: 0.88rem; color: var(--mh-muted); }

/* Firmante, contacto, QR y sello (F-06 / F-11) */
.q-seal { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; justify-content: space-between; }
.q-seal__signer { flex: 1 1 18rem; min-inline-size: 0; }
.q-seal__name { margin: 0.2rem 0 0; font-family: "Montserrat", system-ui, sans-serif; font-weight: 800; font-size: 1.15rem; color: var(--mh-heading); }
.q-seal__signer p { margin: 0.1rem 0; }
.q-contact { list-style: none; margin: 0.6rem 0 0; padding: 0; font-size: 0.88rem; color: var(--mh-muted); overflow-wrap: anywhere; }
.q-seal__qr { flex: 0 1 16rem; min-inline-size: 0; text-align: center; }
.q-seal__title { font-size: 0.85rem; margin: 0.4rem 0 0.1rem; text-transform: uppercase; letter-spacing: 0.08em; }
.q-qr { inline-size: 9.5rem; max-inline-size: 100%; margin-inline: auto; background: #ffffff; padding: 0.35rem; border-radius: 0.5rem; }
.q-qr svg { display: block; inline-size: 100%; block-size: auto; }
.q-seal__qr .q-hash { word-break: normal; overflow-wrap: anywhere; font-size: 0.74rem; }

/* Anexo: desglose completo (F-05) */
.q-lines { display: flex; flex-direction: column; border: 1px solid var(--mh-border); border-radius: 0.75rem; overflow: hidden; background: var(--mh-surface); margin-block-end: 1rem; }
.q-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.25rem 1rem; padding: 0.6rem 0.9rem; border-block-start: 1px solid var(--mh-border); align-items: baseline; break-inside: avoid; }
.q-line:first-child { border-block-start: 0; }
.q-line--head { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mh-muted); background: var(--mh-accent-soft); }
.q-line__name { min-inline-size: 0; overflow-wrap: anywhere; }
.q-line__name small { display: block; color: var(--mh-muted); font-size: 0.82rem; }
.q-line__qty { color: var(--mh-muted); font-size: 0.88rem; white-space: nowrap; text-align: end; }
.q-line__amount { font-weight: 700; white-space: nowrap; text-align: end; }
.q-line--recurring { background: var(--mh-annual-soft); }
.q-chip--annual { background: var(--mh-annual-soft); color: var(--mh-annual); border-color: var(--mh-annual); font-weight: 700; }

@media (max-width: 34rem) {
  .q-line { grid-template-columns: minmax(0, 1fr) auto; }
  .q-line__name { grid-column: 1 / -1; }
  .q-line__qty { text-align: start; }
  .q-line--head span:nth-child(2) { display: none; }
}

@media print {
  :root { --mh-bg: #ffffff; --mh-surface: #ffffff; --mh-text: #203448; --mh-muted: #53677a; --mh-border: #ccd8e3; --mh-heading: #022d53; --mh-shadow: none; }
  body.q-body { padding: 0; background: #ffffff; }
  .q-shell { padding: 0; gap: 0.8rem; }
  .q-actionbar, .q-theme, #aceptar, .q-preview-banner { display: none; }
  .q-hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none; }
  .q-card { box-shadow: none; break-inside: avoid; }
  .q-chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
  /* MOD_COTIZACIONES F-17: carta, margenes parejos con holgura a la derecha, anexo en pagina nueva */
  .q-shell { max-inline-size: none; margin: 0; }
  .q-annex { break-before: page; }
  .q-seal, .q-area, .q-line, .q-totals, .q-validate { break-inside: avoid; }
  .q-line, .q-line--head, .q-line--recurring, .q-chip--annual, .q-validate, .q-qr { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .q-areas { gap: 0.6rem; }
  .q-area { flex-basis: 12rem; }
  .q-qr { inline-size: 3.6cm; }
  .q-note a[href^="#"] { text-decoration: none; }
  .q-footer { break-inside: avoid; font-size: 0.75rem; }
  .q-section-title, .q-category { break-after: avoid; }
  .q-footer p { margin-block: 0.2rem; }
  .q-footer p:last-child { display: none; }
}
@page { size: letter; margin: 14mm 17mm 14mm 14mm; }
