/* ============================================================
   ALBION INVOICE · styles
   ============================================================ */

/* ── Variables ── */
:root {
  --app-bg:      #111008;
  --form-bg:     #151209;
  --form-bord:   #2e2518;
  --gold:        #c9a227;
  --gold-dim:    #8a6e1a;
  --ink:         #e8d9b0;
  --ink-dim:     #8a7a5a;
  --input-bg:    #1a1610;
  --input-focus: rgba(201,162,39,0.2);

  /* Invoice — match the original design palette exactly */
  --inv-bg:      #111008;
  --inv-bg2:     #1a1610;
  --inv-bord:    #2a2215;
  --inv-gold:    #c9a227;
  --inv-silver:  #9db8d2;
  --inv-ink:     #e8d9b0;
  --inv-dim:     #8a7a5a;
  --inv-amber:   #e8a020;
  --inv-green:   #4a9e5c;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overscroll-behavior: none; }

body {
  background: var(--app-bg);
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
}

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 44px;
  background: var(--form-bg);
  border-bottom: 1px solid var(--form-bord);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 200;
  box-shadow: 0 2px 20px rgba(0,0,0,0.6);
}
.topbar-brand {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 2.5px;
}
.topbar-right { display: flex; gap: 4px; }

.lang-btn {
  background: none;
  border: 1px solid var(--form-bord);
  padding: 3px 5px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
}
.lang-btn svg { display: block; border-radius: 1.5px; }
.lang-btn.active { border-color: var(--gold); opacity: 1; box-shadow: 0 0 0 1px var(--gold), 0 0 10px rgba(201, 162, 39, 0.35); }
.lang-btn:hover:not(.active) { border-color: var(--gold-dim); opacity: 0.9; }

/* ── Layout ── */
.layout {
  display: flex;
  padding-top: 44px;
  min-height: 100vh;
}

/* ── Form Panel ── */
.form-panel {
  width: 400px;
  min-width: 380px;
  background: var(--form-bg);
  border-right: 1px solid var(--form-bord);
  height: calc(100vh - 44px);
  position: sticky;
  top: 44px;
  display: flex;
  flex-direction: column;
}

.form-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* bottom padding reserves clearance for the fixed family footer
     (≈64px tall) so the last item doesn't render behind it. */
  padding: 20px 18px 80px;
}
.form-scroll::-webkit-scrollbar { width: 4px; }
.form-scroll::-webkit-scrollbar-track { background: transparent; }

/* ══ 3-column layout on wide desktops ══
   Form panel splits into two asides, one on each side of the preview.
   Left keeps the parties (Emisor / Receptor / Datos de Factura). Right
   holds the content (Conceptos / Pagos / Notas / Pie) plus the Export
   bar. JS handles moving sections between them on resize. */
.form-panel-right {
  border-right: none;
  border-left: 1px solid var(--form-bord);
}
@media (max-width: 1499px) {
  /* Below breakpoint: right panel hidden, everything stays in left. */
  .form-panel-right { display: none; }
}
@media (min-width: 1500px) {
  .form-panel-left,
  .form-panel-right {
    width: 340px;
    min-width: 320px;
  }
}
.form-scroll::-webkit-scrollbar-thumb { background: var(--form-bord); border-radius: 2px; }

/* ── Form Sections ── */
.fs {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--form-bord);
}
.fs-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 10px;
  font-weight: 600;
  color: var(--gold-dim);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 12px;
}

/* ── Form Rows ── */
.fr {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 9px;
}
.fr:last-child { margin-bottom: 0; }
.fr > label {
  font-size: 10px;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-family: 'Cinzel', Georgia, serif;
}

.fr-check {
  margin-bottom: 9px;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-dim);
  user-select: none;
}
.check-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--gold);
  cursor: pointer;
}
.check-label:hover { color: var(--ink); }

/* ── Inputs ── */
input[type="text"],
input[type="date"],
select,
textarea {
  background: var(--input-bg);
  border: 1px solid var(--form-bord);
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 14px;
  padding: 7px 10px;
  border-radius: 3px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 2px var(--input-focus);
}
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a6a4a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-dim); opacity: 0.55; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.5); cursor: pointer; }

/* ── Category Blocks ── */
.cat-block {
  background: #17140e;
  border: 1px solid var(--form-bord);
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 10px;
}
.cat-header {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}
.cat-name-in {
  flex: 1 !important;
  background: #0f0d08 !important;
  border-color: #3a3020 !important;
  color: var(--gold) !important;
  font-size: 13px !important;
  padding: 5px 8px !important;
}

/* ── Item Blocks ── */
.item-list { display: flex; flex-direction: column; gap: 6px; }
.item-block {
  background: #0f0d08;
  border: 1px solid var(--form-bord);
  border-radius: 3px;
  padding: 8px;
}
.item-row-a {
  display: grid;
  grid-template-columns: 1fr 90px auto;
  gap: 5px;
  margin-bottom: 5px;
  align-items: center;
}
.item-row-b {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 5px;
}
.item-block input {
  font-size: 13px !important;
  padding: 5px 8px !important;
}

/* ── Delete buttons ── */
.btn-del {
  background: none;
  border: 1px solid #3a1515;
  color: #7a3030;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
  transition: all 0.15s;
}
.btn-del:hover { background: #3a1515; color: #e05050; }

.btn-del-sm {
  background: none;
  border: 1px solid #3a1515;
  color: #7a3030;
  font-size: 11px;
  padding: 0 6px;
  height: 100%;
  min-height: 28px;
  border-radius: 2px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s;
}
.btn-del-sm:hover { background: #3a1515; color: #e05050; }

/* ── Add Item Button ── */
.btn-add-item {
  width: 100%;
  background: none;
  border: 1px dashed #2a2215;
  color: var(--ink-dim);
  font-size: 12px;
  padding: 5px;
  margin-top: 7px;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'EB Garamond', Georgia, serif;
  transition: all 0.15s;
}
.btn-add-item:hover { border-color: var(--gold-dim); color: var(--gold); }

/* ── Main Add Button ── */
.btn-main-add {
  width: 100%;
  background: none;
  border: 1px dashed #3a3020;
  color: var(--ink-dim);
  font-size: 13px;
  padding: 8px;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'EB Garamond', Georgia, serif;
  transition: all 0.15s;
  margin-top: 4px;
}
.btn-main-add:hover { border-color: var(--gold); color: var(--gold); }

/* ── Payment Blocks ── */
.pay-block {
  background: #17140e;
  border: 1px solid var(--form-bord);
  border-radius: 3px;
  padding: 10px;
  margin-bottom: 8px;
}
.pay-row-a {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  margin-bottom: 6px;
  align-items: center;
}
.pay-row-b {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.pay-block input {
  font-size: 13px !important;
  padding: 5px 8px !important;
}

/* Highlight toggle */
.hl-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border: 1px solid var(--form-bord);
  border-radius: 2px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-dim);
  user-select: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.hl-toggle.on { border-color: var(--gold-dim); color: var(--gold); }
.hl-toggle:hover { border-color: var(--gold-dim); color: var(--gold); }
.hl-toggle input { display: none; }

/* ── Export Bar ── */

/* ── Preview Panel ── */
.preview-panel {
  flex: 1;
  /* same rationale: inner padding-bottom clears the fixed footer. */
  padding: 40px 32px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--app-bg);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ════════════════════════════════════════
   INVOICE
   ════════════════════════════════════════ */
.invoice {
  width: 720px;
  max-width: 100%;
  background: var(--inv-bg);
  color: var(--inv-ink);
  font-family: 'EB Garamond', Georgia, serif;
  padding: 50px 56px;
  position: relative;
  border: 1px solid var(--inv-bord);
  box-shadow:
    0 0 0 1px #1a1608,
    0 24px 64px rgba(0,0,0,0.85),
    inset 0 0 100px rgba(0,0,0,0.2);
}
.invoice::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201,162,39,0.05) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(0,0,0,0.35) 0%, transparent 65%);
  pointer-events: none;
}

/* Corners */
.corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: var(--inv-gold);
  border-style: solid;
  opacity: 0.45;
}
.corner.tl { top: 14px; left: 14px;   border-width: 1.5px 0 0 1.5px; }
.corner.tr { top: 14px; right: 14px;  border-width: 1.5px 1.5px 0 0; }
.corner.bl { bottom: 14px; left: 14px;  border-width: 0 0 1.5px 1.5px; }
.corner.br { bottom: 14px; right: 14px; border-width: 0 1.5px 1.5px 0; }

/* Header */
.inv-header { text-align: center; margin-bottom: 28px; position: relative; }
.inv-tag {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 10px;
  color: var(--inv-gold);
  letter-spacing: 5px;
  text-transform: uppercase;
  margin-bottom: 8px;
  opacity: 0.7;
}
.inv-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--inv-gold);
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(201,162,39,0.4);
  margin-bottom: 8px;
}
.inv-name.placeholder { opacity: 0.2; }
.inv-subtitle {
  font-size: 11px;
  color: var(--inv-dim);
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

/* Receptor */
.inv-receptor {
  text-align: center;
  margin-bottom: 20px;
  padding: 10px 20px;
  border: 1px solid #2a2215;
  background: rgba(201,162,39,0.025);
}
.inv-receptor-tag {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 9.5px;
  color: var(--inv-dim);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.inv-receptor-name { font-size: 16px; color: var(--inv-ink); letter-spacing: 1px; }

/* Meta */
.inv-meta {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
  padding: 14px 16px;
  background: var(--inv-bg2);
  border: 1px solid var(--inv-bord);
}
.inv-meta-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--inv-dim);
  margin-bottom: 4px;
}
.inv-meta-val { font-size: 14px; color: var(--inv-ink); letter-spacing: 0.5px; }
.status-pending { color: var(--inv-amber); }
.status-paid    { color: var(--inv-green); }

/* Section divider */
.inv-divider {
  text-align: center;
  margin: 22px 0 10px;
  position: relative;
}
.inv-divider::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--inv-gold) 25%, var(--inv-gold) 75%, transparent);
  opacity: 0.22;
}
.inv-divider span {
  position: relative;
  background: var(--inv-bg);
  padding: 0 18px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 10px;
  color: var(--inv-gold);
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* Table */
.inv-table-wrap { margin-bottom: 2px; }
.inv-table-wrap table { width: 100%; border-collapse: collapse; }
.inv-table-wrap thead tr { border-bottom: 1px solid var(--inv-bord); }
.inv-table-wrap th {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--inv-dim);
  padding: 6px 8px;
}
.inv-table-wrap td {
  padding: 9px 8px;
  border-bottom: 1px solid #1c1810;
  vertical-align: top;
}
.inv-item-name { font-size: 13px; color: var(--inv-ink); line-height: 1.3; }
.inv-item-note { font-size: 10.5px; color: var(--inv-dim); font-style: italic; margin-top: 2px; }
.inv-item-amount {
  text-align: right;
  font-size: 14px;
  color: var(--inv-silver);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.inv-badge {
  display: inline-block;
  background: rgba(201,162,39,0.1);
  border: 1px solid rgba(201,162,39,0.22);
  color: var(--inv-gold);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 8.5px;
  letter-spacing: 1px;
  padding: 1px 5px;
  border-radius: 2px;
  vertical-align: middle;
  margin-left: 7px;
  text-transform: uppercase;
}

/* Totals */
.inv-totals {
  margin-top: 24px;
  padding: 16px 18px;
  background: var(--inv-bg2);
  border: 1px solid var(--inv-bord);
}
.inv-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 0;
}
.inv-total-row + .inv-total-row { margin-top: 6px; }
.inv-total-label { font-size: 12px; color: var(--inv-dim); letter-spacing: 1px; }
.inv-total-val   { font-size: 18px; color: var(--inv-ink); letter-spacing: 1px; }
.inv-total-silver { color: var(--inv-silver); }
.inv-total-row.highlight .inv-total-label { color: var(--inv-ink); font-size: 13px; }
.inv-total-row.highlight .inv-total-val   { color: var(--inv-gold); font-size: 20px; }
.inv-currency { font-size: 11px; color: var(--inv-dim); margin-left: 3px; }

.inv-sword {
  text-align: center;
  color: var(--inv-gold);
  opacity: 0.3;
  font-size: 14px;
  margin: 10px 0;
  letter-spacing: 4px;
}

/* Notes */
.inv-notes {
  margin-top: 18px;
  padding: 12px 16px;
  border-left: 2px solid rgba(201,162,39,0.22);
  background: rgba(201,162,39,0.018);
}
.inv-notes p { font-size: 11.5px; color: var(--inv-dim); line-height: 1.75; font-style: italic; }

/* Footer */
.inv-footer { margin-top: 28px; text-align: center; }
.inv-footer-brand {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 9px;
  color: var(--inv-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 8px;
  opacity: 0.65;
}

/* ════════════════════════════════════════
   PRINT
   ════════════════════════════════════════ */
@media print {
  .topbar,
  .form-panel { display: none !important; }

  body { background: #fff; margin: 0; }

  .layout { padding-top: 0; display: block; }

  .preview-panel {
    padding: 0;
    display: block;
    background: #fff;
  }

  .invoice {
    width: 100%;
    max-width: 100%;
    box-shadow: none;
    padding: 18px 30px;
    /* Preserve dark theme in PDF */
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  @page { margin: 10mm; size: A4; }
}

/* ══ Crintech family — sticky cross-promo al pie, siempre visible.
   Fixed al bottom para maximizar visibilidad. Hidden al imprimir
   para no ensuciar el PDF exportado. La app-layout añade padding
   inferior equivalente para que el contenido no quede oculto. */
.crintech-family {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 300 !important;
  transform: translateZ(0);
  will-change: transform;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
  border-top: 1px solid rgba(201, 162, 39, 0.45);
  background: linear-gradient(180deg, rgba(10, 8, 5, 0.85) 0%, rgba(10, 8, 5, 0.98) 100%);
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.55), 0 -1px 0 rgba(201, 162, 39, 0.15), 0 -18px 36px -18px rgba(201, 162, 39, 0.22);
  font-family: 'EB Garamond', serif;
  font-size: 14px;
  color: rgba(232, 217, 176, 0.9);
}

.crintech-family .family-side {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-self: start;
}

/* No body padding-bottom — that caused a rogue ~64px scroll at the
   bottom with nothing there. Footer clearance is handled inside each
   scroll container instead (.form-scroll / .preview-panel). On narrow
   screens the footer stacks and gets taller, so the scrollers give
   it a bigger clearance there. */
@media (max-width: 700px) {
  .form-scroll { padding-bottom: 180px; }
  .preview-panel { padding-bottom: 180px; }
}

/* ══ Mobile layout overhaul (≤720px) ════════════════════════════════
   The 3-pane desktop layout (sticky form-left + scrolling preview
   + sticky form-right above 1500px) breaks below ~720px because the
   form-panel keeps its 400px width and pushes the preview off-screen.
   Below this breakpoint we collapse everything into a single vertical
   scroll: form on top, preview below, fixed action footer at the
   bottom. Inputs bump to 16px min-font so iOS Safari stops auto-
   zooming on focus. */
@media (max-width: 720px) {
  .layout {
    flex-direction: column;
    padding-top: 44px;
  }

  .form-panel {
    position: static;
    width: 100%;
    min-width: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--form-bord);
  }

  .form-scroll {
    overflow: visible;
    padding: 16px 14px 28px;
  }

  .preview-panel {
    flex: 1 1 auto;
    overflow: visible;
    padding: 16px 12px 200px;
  }

  /* Invoice itself — rein in its desktop 50px/56px padding so the
     full sheet fits comfortably on a 360-414px viewport. */
  .invoice {
    width: 100%;
    padding: 24px 18px;
  }

  /* iOS Safari zooms in when an <input> font-size is below 16px on
     focus. Bumping every form control to 16px prevents the layout
     jumping each time the user taps a field. */
  .form-panel input,
  .form-panel select,
  .form-panel textarea {
    font-size: 16px;
  }
}

.crintech-family .family-label {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(201, 162, 39, 0.95);
  text-shadow: 0 0 14px rgba(201, 162, 39, 0.35);
}

.crintech-family .family-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.crintech-family .family-links a {
  color: rgba(232, 217, 176, 0.92);
  text-decoration: none;
  transition: color 0.15s ease, text-shadow 0.15s ease;
  white-space: nowrap;
  font-weight: 500;
}

.crintech-family .family-links a:hover {
  color: #e6c14f;
  text-shadow: 0 0 10px rgba(201, 162, 39, 0.45);
}

/* Central action group — three share buttons + the gold Print pill. */
.crintech-family .family-actions {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Secondary outlined pills (Copy code / Copy URL / Load). */
.crintech-family .family-share-btn {
  background: transparent;
  color: rgba(232, 217, 176, 0.9);
  border: 1px solid rgba(201, 162, 39, 0.55);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1.8px;
  padding: 8px 14px;
  border-radius: 3px;
  cursor: pointer;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.crintech-family .family-share-btn:hover {
  background: rgba(201, 162, 39, 0.14);
  color: #e6c14f;
  border-color: var(--gold);
  transform: translateY(-1px);
}
.crintech-family .family-share-btn:active {
  background: rgba(201, 162, 39, 0.22);
  transform: translateY(0);
}

/* Primary: Export / Print (gold pill). */
.crintech-family .family-export {
  background: var(--gold);
  color: #0c0a07;
  border: 1px solid rgba(232, 217, 176, 0.25);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 2.5px;
  padding: 9px 22px;
  border-radius: 3px;
  cursor: pointer;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 3px 12px rgba(201, 162, 39, 0.3), 0 0 0 1px rgba(201, 162, 39, 0.45);
}
.crintech-family .family-export:hover {
  background: #e8b82a;
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(201, 162, 39, 0.5), 0 0 0 1px rgba(232, 217, 176, 0.5);
}
.crintech-family .family-export:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(201, 162, 39, 0.25);
}

@media print {
  .crintech-family { display: none !important; }
}

@media (max-width: 700px) {
  /* Narrow: stack the footer — actions on top, family strip below. */
  .crintech-family {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 12px env(safe-area-inset-bottom, 12px);
  }
  .crintech-family .family-side {
    justify-self: center;
    justify-content: center;
    text-align: center;
  }
  .crintech-family .family-links {
    justify-content: center;
    gap: 4px 12px;
    font-size: 12px;
  }
  .crintech-family .family-actions {
    order: -1;
    width: 100%;
    justify-self: stretch;
    gap: 6px;
    flex-wrap: wrap;
  }
  /* Primary "📸 Copiar imagen" pops to a full row on top — main CTA
     for mobile users who came to share, not to fiddle with codes. */
  .crintech-family .family-export {
    flex: 1 1 100%;
    padding: 12px 18px;
    font-size: 13px;
    letter-spacing: 2px;
  }
  /* Three secondary buttons split equally on the row below. Tap
     targets stay above the 44px Apple HIG minimum. */
  .crintech-family .family-share-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 6px;
    font-size: 10px;
    letter-spacing: 1.2px;
    min-height: 44px;
  }
}

/* ══ Import modal + toast ══ */
.import-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 6, 4, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.import-modal.visible { opacity: 1; }
.import-modal[hidden] { display: none; }

.import-modal-inner {
  width: 100%;
  max-width: 540px;
  background: var(--form-bg);
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: 6px;
  padding: 22px 22px 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(201, 162, 39, 0.15);
  transform: translateY(6px);
  transition: transform 0.2s ease;
}
.import-modal.visible .import-modal-inner { transform: translateY(0); }

.import-modal-title {
  margin: 0 0 14px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold);
}

.import-modal-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 130px;
  font-family: Consolas, Menlo, Monaco, 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  background: rgba(8, 6, 4, 0.6);
  border: 1px solid rgba(201, 162, 39, 0.3);
  border-radius: 3px;
  color: var(--ink);
  padding: 11px 13px;
  resize: vertical;
  word-break: break-all;
}
.import-modal-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.35);
}

.import-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.import-modal-btn-cancel,
.import-modal-btn-confirm {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.2px;
  padding: 9px 18px;
  border-radius: 3px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.15s ease;
}
.import-modal-btn-cancel {
  background: transparent;
  color: rgba(232, 217, 176, 0.75);
  border: 1px solid rgba(201, 162, 39, 0.35);
}
.import-modal-btn-cancel:hover {
  color: var(--ink);
  border-color: var(--gold-dim);
}
.import-modal-btn-confirm {
  background: var(--gold);
  color: #0c0a07;
  border: 1px solid rgba(232, 217, 176, 0.3);
  box-shadow: 0 3px 12px rgba(201, 162, 39, 0.3);
}
.import-modal-btn-confirm:hover { background: #e8b82a; }

/* Toast: floating pill that announces share-action results. */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 400;
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(10, 8, 5, 0.96);
  border: 1px solid rgba(201, 162, 39, 0.55);
  color: var(--gold);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(201, 162, 39, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast[hidden] { display: none; }

@media print {
  .import-modal,
  .toast { display: none !important; }
}
