/* Imprenta Salomé · Contratos y entregas
   Identidad: tinta, papel y magenta Salomé. Serif de imprenta para títulos, sans del sistema para el resto.
   Móvil primero: navegación inferior, botón flotante y fichas a pantalla completa. */

:root {
  --ink: #1b1d2a; --ink-2: #3a3d4f; --muted: #6c7080;
  --paper: #f6f3ec; --sheet: #ffffff; --line: #e3dfd6; --line-strong: #cfc9bd; --tint: #faf8f3;
  --rose: #d4267a; --rose-dark: #b31d66; --rose-soft: #fbe7f0; --rose-ink: #8a1650;
  --teal: #1f7a8c; --teal-soft: #e2f1f4;
  --amber: #9a5b06; --amber-soft: #fdf0d5; --green: #1b6b47; --green-soft: #dcf2e6; --red: #b3261e;
  --radius: 12px; --shadow: 0 1px 2px #1b1d2a0a, 0 8px 24px #1b1d2a0d;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: var(--font-body); color: var(--ink); background: var(--paper); font-size: 16px; line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

/* Tipografía */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; margin: 0 0 8px; line-height: 1.15; color: var(--ink); }
h1 { font-size: 34px; }
h2 { font-size: 26px; }
h3 { font-size: 18px; }
p { margin: 0 0 10px; }
.muted, .hint, small, .sectionhead p, .section > p { color: var(--muted); }
small { font-size: 13px; }
.hint { font-size: 13px; margin: 12px 0 0; }
.eyebrow { font-size: 11px; letter-spacing: .18em; font-weight: 700; color: var(--rose-ink); margin: 0 0 8px; text-transform: uppercase; }

/* Controles */
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--sheet); color: var(--ink); padding: 10px 16px; font-weight: 600; min-height: 42px; transition: background .15s, border-color .15s, transform .05s; }
button:hover { background: var(--tint); border-color: var(--ink-2); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: wait; }
button.primary { background: var(--rose); border-color: var(--rose); color: #fff; }
button.primary:hover { background: var(--rose-dark); border-color: var(--rose-dark); }
button.danger { color: var(--red); }
button.small { padding: 7px 12px; min-height: 36px; font-size: 14px; }
button.icon { border: 0; background: transparent; font-size: 28px; line-height: 1; padding: 2px 10px; min-height: 0; color: var(--ink-2); }
button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -5px; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--sheet); min-height: 44px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, .drop:focus { outline: 3px solid #f5b9d4; outline-offset: 2px; }
label { display: block; font-size: 14px; font-weight: 600; }
label input, label select, label textarea { margin-top: 7px; }
form > label { margin-bottom: 18px; }
#loginError, #saveError, #collectionError { color: var(--red); font-size: 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

/* Marca */
.mark { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--ink); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 26px; position: relative; flex-shrink: 0; }
.mark::before { content: ""; position: absolute; left: 6px; right: 6px; bottom: 6px; height: 3px; border-radius: 2px; background: var(--rose); }
.mark span { transform: translateY(-2px); }
.mark-lg { width: 72px; height: 72px; font-size: 44px; border-radius: 16px; margin-bottom: 26px; background: #fff; color: var(--ink); }
.mark-lg::before { height: 4px; left: 12px; right: 12px; bottom: 10px; }

/* Inicio de sesión */
.login { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.loginbrand { padding: 12vh 10%; background: var(--ink); color: #fff; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.loginbrand::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 50%; border: 48px solid #ffffff10; }
.loginbrand .eyebrow { color: #f3a8cb; }
.loginbrand h1 { font-size: 52px; line-height: 1.08; margin: 10px 0 20px; color: #fff; }
.loginbrand p { color: #c9cad6; font-size: 17px; max-width: 420px; }
.loginform { width: 100%; max-width: 440px; padding: 40px; margin: auto; }
.loginform h2 { margin-bottom: 24px; }
.loginform button { width: 100%; margin: 6px 0 16px; min-height: 48px; }

/* Cabecera */
.topbar { position: sticky; top: 0; z-index: 20; min-height: 72px; padding: 0 28px; background: var(--sheet); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 28px; }
.topbar::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--rose); }
.brand { text-decoration: none; color: var(--ink); display: flex; gap: 11px; align-items: center; }
.brandtext { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1; }
.brandtext small { display: block; font-family: var(--font-body); font-size: 9px; letter-spacing: .18em; font-weight: 700; color: var(--muted); margin-top: 5px; }
.mainnav { display: flex; gap: 4px; margin-left: 8px; }
.mainnav button { border: 0; background: transparent; color: var(--ink-2); padding: 9px 14px; display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; }
.mainnav button svg { width: 18px; height: 18px; }
.mainnav button:hover { background: var(--tint); }
.mainnav button.selected { background: var(--ink); color: #fff; }
.account { display: flex; gap: 12px; align-items: center; margin-left: auto; font-size: 14px; }
.identity { color: var(--muted); font-weight: 600; }
.account button { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; }

/* Aviso de instalación */
.installbanner { display: flex; align-items: center; gap: 12px; padding: 10px 28px; background: var(--rose-soft); color: var(--rose-ink); font-size: 14px; border-bottom: 1px solid #f3c6db; }
.installbanner span { flex: 1; }
.installbanner .icon { font-size: 24px; color: var(--rose-ink); }
.installbox { padding: 16px; background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 22px; }
.installbox h3 { font-size: 16px; }
.installbox .primary { width: 100%; margin-bottom: 10px; }
.installbox .hint { margin-top: 6px; }
.logout { width: 100%; }
.buttonlink { display: block; text-align: center; text-decoration: none; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--sheet); color: var(--ink); padding: 10px 16px; font-weight: 600; min-height: 42px; margin-top: 8px; }
.buttonlink:hover { background: var(--tint); border-color: var(--ink); }

/* Contenido */
main { padding: 30px 28px 48px; max-width: 1500px; margin: auto; }
.heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.heading h1 { margin-bottom: 4px; }
.heading p:last-child { margin: 0; font-size: 14px; }
.fab { display: inline-flex; align-items: center; gap: 8px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.weeknav, .filters { display: flex; align-items: center; gap: 8px; }
.weeknav strong { font-family: var(--font-display); font-size: 18px; margin-left: 8px; }
.filters { flex: 1; justify-content: flex-end; }
.filters input { width: min(480px, 100%); min-width: 220px; }
.filters select { width: 200px; }
.technicalfilters { display: flex; gap: 14px; align-items: end; margin: 0 0 18px; flex-wrap: wrap; }
.technicalfilters label { min-width: 180px; flex: 1; }
.summary { display: flex; gap: 10px 24px; margin-bottom: 18px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.summary strong { color: var(--ink); font-family: var(--font-display); font-size: 18px; }
.footnote { font-size: 12px; color: var(--muted); margin-top: 16px; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); background: var(--sheet); border: 1px dashed var(--line-strong); border-radius: var(--radius); display: grid; gap: 6px; }
.empty strong { color: var(--ink); font-family: var(--font-display); font-size: 20px; }

/* Estado del pedido (sello) */
.orderstatus { display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; padding: 4px 8px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; line-height: 1.3; border: 1px solid currentColor; }
.orderstatus.pending { color: var(--amber); background: var(--amber-soft); }
.orderstatus.done { color: var(--green); background: var(--green-soft); }
.orderstatus.design { color: #fff; background: var(--red); border-color: var(--red); }
.card .orderstatus.design { display: inline-flex; margin: 6px 0 2px; font-size: 10px; }
.card.needsdesign { border-left-color: var(--red); box-shadow: inset 0 0 0 1px #f3c4c0; }
.technicalcard.needsdesign { outline: 2px solid var(--red); outline-offset: -2px; }
.alertcount { color: var(--red); font-weight: 700; }
.alertcount strong { color: var(--red); }
.techbadges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.design-tile.empty.missing, .overviewimage.empty.missing { border: 2px dashed var(--red); color: var(--red); background: #fdf1f0; flex-direction: column; gap: 4px; text-align: center; }
.design-tile.empty.missing strong { font-size: 18px; letter-spacing: .04em; text-transform: uppercase; }
.design-tile.empty.missing span { font-size: 13px; color: #8a2a24; }
.designmode label { flex-direction: column; align-items: flex-start; gap: 4px; }
.designmode label small { color: var(--muted); font-weight: 400; font-size: 12px; padding-left: 22px; }
.designmode label:has(input:checked) small { color: var(--rose-ink); }
.designmode label input { margin-right: 6px; }
.designnotice { margin: 0 0 16px; padding: 14px 16px; border-radius: 10px; background: #fdf1f0; border: 1px solid #f3c4c0; color: #8a2a24; font-size: 14px; line-height: 1.5; }
.designnotice strong { display: block; color: var(--red); margin-bottom: 4px; }
.helpnotice { margin-bottom: 18px; padding: 12px 16px; border-radius: 10px; background: var(--teal-soft); border: 1px solid #bcdbe2; color: var(--teal); font-size: 14px; }

/* Agenda semanal */
.calendarwrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; background: var(--sheet); box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: 52px repeat(6, minmax(0, 1fr)); min-width: 0; }
.dayhead { padding: 12px 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); font-size: 12px; color: var(--muted); text-transform: capitalize; }
.dayhead strong { display: block; font-family: var(--font-display); font-size: 22px; color: var(--ink); margin-top: 2px; }
.dayhead.today { background: var(--rose-soft); }
.dayhead.today strong { color: var(--rose); }
.hour { font-size: 11px; color: var(--muted); padding: 10px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.cell { min-height: 62px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px; }
.mobileagenda { display: none; }

/* Tarjeta de contrato */
.card { width: 100%; text-align: left; font-weight: 400; display: block; margin: 0 0 6px; padding: 10px; background: var(--sheet); border: 1px solid var(--line); border-left: 4px solid var(--rose); border-radius: 8px; color: var(--ink-2); min-height: 0; overflow: hidden; }
.card:hover { border-color: var(--line-strong); border-left-color: var(--rose-dark); background: var(--sheet); box-shadow: var(--shadow); }
.card.physical { border-left-color: var(--teal); }
.card.done { border-left-color: var(--green); opacity: .85; }
.card strong { display: block; font-family: var(--font-display); font-size: 15px; margin: 5px 0; color: var(--ink); overflow-wrap: anywhere; }
.card .meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); font-weight: 600; }
.card .orderstatus { font-size: 9px; padding: 2px 5px; }
.cardbalance { color: var(--rose-ink); font-weight: 700; }
.cardhead { display: flex; gap: 8px; align-items: center; margin: 5px 0 2px; min-width: 0; }
.cardhead > span { min-width: 0; }
.cardhead strong { margin: 0; }
.cardthumb { width: 34px; height: 34px; flex-shrink: 0; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.cardlogo { display: block; font-size: 11px; color: var(--rose-ink); font-weight: 600; overflow-wrap: anywhere; margin-top: 1px; }
.printtag { display: inline-block; font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--teal); background: var(--teal-soft); border: 1px solid #bcdbe2; border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: 1px; }
.agendaquantity { display: block; font-size: 11px; font-weight: 600; color: var(--ink-2); margin: 2px 0 6px; }
.agendaproducts { display: grid; gap: 4px; font-size: 11px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.agendaproducts b { color: var(--ink); }
.listgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.listgrid .card { padding: 18px; margin: 0; border-radius: var(--radius); }
.listgrid .card strong { font-size: 19px; }
.listgrid .card .meta, .listgrid .agendaquantity, .listgrid .agendaproducts { font-size: 13px; }
.listgrid .cardthumb { width: 48px; height: 48px; }
.listgrid .cardlogo { font-size: 13px; }
.listgrid .printtag { font-size: 11px; }
.listgrid .card .orderstatus { font-size: 10px; }

/* Contratos: conmutador tarjetas / fichas y ficha resumida */
.listmodebar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; font-size: 13px; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px; background: var(--sheet); }
.segmented button { border: 0; background: transparent; border-radius: 999px; padding: 7px 16px; min-height: 36px; font-size: 14px; color: var(--ink-2); }
.segmented button.selected { background: var(--ink); color: #fff; }
.sheetlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.contractsheet { width: 100%; text-align: left; font-weight: 400; padding: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); overflow: hidden; min-height: 0; display: block; }
.contractsheet:hover { border-color: var(--line-strong); box-shadow: var(--shadow); background: var(--sheet); }
.contractsheet.needsdesign { box-shadow: inset 0 0 0 2px var(--red); }
.contractsheet.done { opacity: .85; }
.sheethead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--tint); }
.sheethead > div { min-width: 0; }
.sheetnumber { display: block; font-size: 11px; letter-spacing: .12em; font-weight: 700; color: var(--rose-ink); text-transform: uppercase; margin-bottom: 4px; overflow-wrap: anywhere; }
.sheethead strong { font-family: var(--font-display); font-size: 20px; color: var(--ink); display: block; overflow-wrap: anywhere; }
.sheetbadges { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }
.sheetgrid { padding: 8px 16px; }
.sheetrow { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.sheetrow:last-child { border-bottom: 0; }
.sheetrow span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding-top: 2px; }
.sheetrow b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.sheetmoney { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.sheetmoney > div { padding: 10px 16px; border-right: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.sheetmoney > div:last-child { border-right: 0; }
.sheetmoney b { display: block; font-family: var(--font-display); font-size: 18px; color: var(--ink); margin-top: 2px; }
.sheetmoney .owed b { color: var(--rose-ink); }

/* Diálogos */
dialog { padding: 0; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 80px #1b1d2a55; width: min(960px, 96vw); max-height: 94dvh; color: inherit; background: var(--sheet); }
dialog::backdrop { background: #1b1d2aa6; backdrop-filter: blur(2px); }
.dialoghead { padding: 20px 26px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--sheet); }
.dialoghead .eyebrow { margin-bottom: 4px; }
.dialoghead h2 { margin: 0; font-size: 24px; }
.dialogbody { padding: 24px 26px; overflow: auto; max-height: calc(94dvh - 170px); overscroll-behavior: contain; }
.dialogfoot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--tint); flex-wrap: wrap; }
.dialogfoot span { margin-right: auto; font-size: 13px; max-width: 62%; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

/* Editor */
.mode { display: flex; gap: 10px; margin-bottom: 22px; }
.mode label { padding: 13px; background: var(--tint); border: 1px solid var(--line); border-radius: 10px; flex: 1; display: flex; align-items: center; gap: 9px; cursor: pointer; }
.mode label:has(input:checked) { border-color: var(--rose); background: var(--rose-soft); }
.mode input { width: auto; margin: 0; min-height: 0; accent-color: var(--rose); }
.mode:has(input:disabled) { opacity: .8; }
.identitygroup { padding: 0 0 18px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.identitygroup h3 { font-size: 16px; margin-bottom: 12px; }
.identitygroup .hint { margin-bottom: 0; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.formgrid label small { font-weight: 400; float: right; }
.section { padding: 22px 0 0; border-top: 1px solid var(--line); margin-top: 22px; }
.sectionhead { display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.sectionhead p, .section > p { font-size: 14px; margin-bottom: 14px; }
#logo_name { margin: 8px 0 16px; }
#sellerPhone, #collectionAmount:read-only { background: var(--tint); color: var(--ink-2); }
.addproduct { width: 100%; border-style: dashed; margin-top: 4px; }
.emptyproducts { font-size: 14px; color: var(--muted); padding: 14px; background: var(--tint); border-radius: 10px; }
.product { padding: 16px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; background: var(--sheet); }
.producthead { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.producthead b { font-family: var(--font-display); color: var(--rose); font-size: 18px; }
.producthead h3 { margin: 0; flex: 1; font-size: 17px; }
.productstats { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0; font-size: 14px; flex-wrap: wrap; }
.productsummary { font-size: 14px; color: var(--ink-2); white-space: pre-line; line-height: 1.6; margin: 8px 0 14px; }
.productactions { display: flex; gap: 8px; margin-bottom: 12px; }
.productactions button { font-size: 13px; min-height: 38px; }
#originalDialog { width: min(1200px, 98vw); }
#originalDialog .dialoghead { padding: 12px 20px; }
#originalFrame { border: 0; width: 100%; height: 80dvh; display: block; background: var(--paper); }
#originalDialog.loading #originalFrame { visibility: hidden; }
#originalDialog.loading::after { content: 'Cargando formulario…'; position: absolute; left: 0; right: 0; top: 50%; text-align: center; color: var(--muted); font-size: 15px; }

/* Imágenes */
.drop { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 14px; background: var(--tint); }
.drop.selected, .drop:focus-within { border-color: var(--rose); background: var(--rose-soft); box-shadow: 0 0 0 2px #f5b9d4; }
.dropbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dropbar span { font-size: 13px; color: var(--muted); margin-right: auto; }
.dropbar button, .filebutton { font-size: 13px; padding: 8px 12px; background: var(--sheet); border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; }
.filebutton input { display: none; }
.previews { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.preview { position: relative; }
.preview img { width: 96px; height: 90px; object-fit: contain; background: var(--sheet); border: 1px solid var(--line); border-radius: 8px; display: block; }
.preview > .image-open { display: block; cursor: zoom-in; }
.preview.uploading img { opacity: .45; }
.preview.uploading::after { content: 'Subiendo…'; position: absolute; inset: auto 0 6px; text-align: center; font-size: 12px; font-weight: 700; color: var(--rose-ink); }
.preview > button { position: absolute; right: -8px; top: -8px; border-radius: 100%; padding: 0; width: 26px; height: 26px; min-height: 0; font-size: 16px; line-height: 1; z-index: 1; background: var(--sheet); }
a.image-open { cursor: zoom-in; }
.imageviewer { width: min(1250px, 97vw); background: #15161f; color: #fff; }
.imageviewer .dialoghead, .imageviewer .dialogfoot { background: #15161f; color: #fff; border-color: #2f3140; }
.imageviewer .dialoghead h2 { color: #fff; }
.imageviewer .icon { color: #fff; }
.imageviewer .dialogfoot button { background: transparent; color: #fff; border-color: #4a4d60; }
.imagecanvas { height: 70dvh; padding: 12px; overflow: auto; display: grid; place-items: center; background: #0f1017; }
.imagecanvas img { max-width: 100%; max-height: 100%; object-fit: contain; }
.imageviewer #imageCounter { margin: 0 auto; }

/* Dinero */
.moneygrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.moneygrid > div { padding: 14px 16px; background: var(--tint); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; color: var(--muted); }
.moneygrid strong { display: block; font-family: var(--font-display); font-size: 23px; margin-top: 4px; color: var(--ink); }
.moneygrid > div:last-child { background: var(--ink); border-color: var(--ink); color: #c9cad6; }
.moneygrid > div:last-child strong { color: #fff; }
#paymentSection h3 { font-size: 19px; }
#advance { font-size: 22px; font-weight: 700; }
.initialreceipt { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 14px 16px; background: var(--green-soft); border: 1px solid #bfe3cf; border-radius: 10px; margin-top: 16px; }
.initialreceipt span { display: block; font-size: 13px; color: var(--green); margin-bottom: 5px; }
.initialreceipt strong { font-size: 18px; color: var(--green); }
.paymentslog { margin-top: 20px; font-size: 13px; }
.paymentrow { display: flex; justify-content: space-between; gap: 15px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.paymentrow span { display: block; color: var(--muted); margin-top: 4px; }
.deliverednotice { padding: 14px; background: var(--green-soft); color: var(--green); border-radius: 10px; margin-top: 14px; font-size: 14px; }
.collectionhelp { font-size: 13px; color: var(--muted); }

/* Cobro y entrega */
#settleDialog { width: min(1280px, 97vw); }
.settlementlayout { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(360px, 1.1fr); gap: 26px; }
.settlementreference { background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; align-self: start; min-width: 0; overflow-wrap: anywhere; }
.settlementreference h3 { font-size: 24px; margin: 0 0 8px; }
.referencehead > p:last-child { font-size: 15px; line-height: 1.5; }
.contractphotos { display: grid; gap: 10px; }
.contractphotos button { padding: 6px; width: 100%; cursor: zoom-in; }
.contractphotos img { width: 100%; max-height: 420px; object-fit: contain; }
.receiptdigital h4 { font-size: 16px; margin: 20px 0 8px; }
.receiptproduct { display: flex; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 15px; line-height: 1.45; }
.receiptproduct span { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.receiptproduct strong { white-space: nowrap; }
.receipttotal { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 15px; }
.receipttotal strong { white-space: nowrap; }
.receipttotal.balance { border-top: 2px solid var(--line-strong); font-size: 18px; font-weight: 700; color: var(--ink); }
.settlementcontrols { min-width: 0; }
.settlementcontrols input, .settlementcontrols select { min-width: 0; max-width: 100%; }
#settleClient { font-size: 16px; line-height: 1.5; margin-bottom: 8px; }
#settleDialog .moneygrid { margin-top: 10px; }
.collectionmodes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.collectionmodes button { text-align: left; padding: 16px; border: 2px solid var(--line); background: var(--sheet); border-radius: 12px; min-width: 0; }
.collectionmodes button.selected { border-color: var(--rose); background: var(--rose-soft); }
.collectionmodes b { font-size: 16px; display: block; }
.collectionmodes small { display: block; font-size: 13px; margin-top: 5px; font-weight: 400; color: var(--muted); }
#collectionModeHelp { line-height: 1.5; color: var(--ink-2); font-size: 14px; margin: 12px 0 0; }
.collectionfields { margin-top: 18px; }
#collectionAmount { font-size: 30px; font-weight: 700; padding: 12px; font-family: var(--font-display); }
#collectionMethod { min-height: 54px; }
#payFullBalance { margin-top: 12px; font-size: 13px; }
.deliverycheck { display: flex; gap: 10px; align-items: center; margin: 22px 0 10px; }
.deliverycheck input { width: 20px; height: 20px; min-height: 0; margin: 0; }
#collectionPreview { background: var(--green-soft); border: 1px solid #bfe3cf; border-radius: 12px; padding: 16px; display: grid; gap: 6px; font-size: 14px; color: var(--green); margin-top: 16px; }
#collectionPreview strong { font-family: var(--font-display); font-size: 30px; }
#collectionPreview small { font-size: 14px; color: inherit; }
#settleDialog .dialogfoot .primary { width: 100%; padding: 16px; font-size: 17px; }

/* Pedidos y diseños (producción) */
.technicalgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); align-items: start; gap: 20px; }
.technicalcard { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.technicalcardheader { background: var(--ink); color: #fff; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 84px; }
.technicalcardheader > div { min-width: 0; }
.technicalcardheader h3 { font-size: 24px; margin: 0; color: #fff; }
.technicalcardheader small { color: #c9cad6; display: block; overflow-wrap: anywhere; margin-top: 4px; letter-spacing: .06em; }
.technicalcardheader button { font-size: 14px; padding: 8px 12px; flex-shrink: 0; background: transparent; color: #fff; border-color: #ffffff55; }
.technicalcardheader button:hover { background: #ffffff18; }
.techmeta { padding: 16px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 13px; background: var(--tint); border-bottom: 1px solid var(--line); }
.techmeta > span { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.techmeta b { font-size: 15px; color: var(--ink); }
.techmeta .orderstatus { align-self: center; justify-self: start; flex-direction: row; }
.orderoverview { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 16px; padding: 18px 20px; align-items: center; }
.overviewimage { height: 100px; width: 100%; background: var(--tint); border: 1px solid var(--line); padding: 5px; border-radius: 9px; cursor: zoom-in; min-height: 0; }
.overviewimage img { height: 100%; width: 100%; object-fit: contain; }
.overviewimage.empty { font-size: 12px; display: grid; place-items: center; color: var(--muted); cursor: default; }
.orderoverview h3 { font-size: 20px; margin: 0 0 6px; overflow-wrap: anywhere; }
.orderoverview .eyebrow { font-size: 10px; margin-bottom: 6px; display: block; }
.orderoverview p { font-size: 14px; margin: 0 0 6px; }
.orderoverview small { font-size: 12px; }
#technicalDialog { width: min(1180px, 96vw); }
#technicalDialog .dialogbody { max-height: calc(94dvh - 90px); }
.sheetbrand { font-size: 15px; margin-bottom: 14px; }
.techdetail .techmeta { padding: 16px; border-radius: 10px; border: 1px solid var(--line); grid-template-columns: repeat(4, 1fr); }
.techproduct { padding: 26px 0; display: grid; grid-template-columns: minmax(250px, .85fr) 1.15fr; gap: 28px; border-bottom: 1px solid var(--line); align-items: start; }
.techproduct:last-child { border: 0; }
.techproduct h3 { font-size: 21px; line-height: 1.35; margin: 0 0 10px; }
.design-column { position: sticky; top: 0; }
.design-tile { width: 100%; height: 340px; display: flex; align-items: center; justify-content: center; padding: 8px; background: #fafafa; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: zoom-in; min-height: 0; }
.design-tile img { max-width: 100%; max-height: 100%; object-fit: contain; }
.design-tile.empty { font-size: 13px; border-style: dashed; color: var(--muted); cursor: default; }
.design-caption { display: block; font-size: 13px; margin: 8px 0; color: var(--muted); }
.design-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.design-strip button { width: 56px; height: 56px; padding: 2px; min-height: 0; }
.design-strip img { width: 100%; height: 100%; object-fit: contain; }
.qtybadge { display: inline-block; background: var(--tint); color: var(--ink); border: 1px solid var(--line-strong); padding: 8px 12px; border-radius: 6px; font-size: 16px; font-weight: 700; }
.techitemcode { font-size: 11px; letter-spacing: .14em; color: var(--muted); margin: 0 0 6px; }
.featuregroups { display: grid; gap: 12px; margin-top: 18px; }
.featuregroup { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.featuregroup h4 { padding: 10px 14px; margin: 0; font-size: 14px; font-family: var(--font-body); letter-spacing: .04em; text-transform: uppercase; background: var(--tint); color: var(--ink-2); border-bottom: 1px solid var(--line); }
.featuregrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; margin: 0; }
.featureblock { min-width: 0; }
.featureblock span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.featureblock strong { display: block; font-size: 15px; font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; color: var(--ink); }
.feature-notes { margin-top: 12px; padding: 14px; border-left: 3px solid var(--amber); background: var(--amber-soft); border-radius: 8px; }
.feature-notes p { font-size: 15px; line-height: 1.6; margin: 0; white-space: pre-wrap; }

/* Aviso flotante */
#toast { position: fixed; bottom: calc(24px + var(--safe-b)); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 10px; padding: 13px 20px; z-index: 10000; box-shadow: 0 8px 30px #1b1d2a55; max-width: min(92vw, 520px); font-size: 14px; }

/* Demo */
.demobar { background: var(--amber-soft); border-bottom: 1px solid #ecddb6; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.demobar > span { font-size: 12px; color: var(--amber); }
.demoprofiles { display: flex; gap: 6px; flex-wrap: wrap; }
.demoprofiles button { font-size: 14px; padding: 9px 14px; }
.demoprofiles button.selected { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Pantallas medianas */
@media (max-width: 1100px) {
  .topbar { padding: 0 18px; gap: 16px; }
  .identity { display: none; }
  .mainnav button span { display: none; }
  .mainnav button { padding: 10px 12px; }
  .mainnav button.selected span { display: inline; }
  main { padding: 24px 18px 48px; }
  .calendarwrap { overflow: auto; }
  .grid { min-width: 900px; }
  .filters input { min-width: 0; }
}

/* Móvil: navegación inferior, botón flotante y fichas a pantalla completa */
@media (max-width: 760px) {
  :root { font-size: 15px; }
  .login { display: block; }
  .loginbrand { padding: 34px 24px 28px; min-height: 38dvh; justify-content: flex-end; }
  .loginbrand h1 { font-size: 30px; margin: 6px 0 10px; }
  .loginbrand p { font-size: 15px; }
  .mark-lg { width: 52px; height: 52px; font-size: 32px; margin-bottom: 18px; }
  .loginform { padding: 28px 22px 40px; }
  .topbar { min-height: 60px; padding: 4px 14px 0; gap: 10px; }
  .brandtext { font-size: 21px; }
  .brandtext small { display: none; }
  .account button span { display: none; }
  .account button { padding: 8px 10px; }
  .mainnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; gap: 0; height: calc(var(--nav-h) + var(--safe-b)); padding: 6px 6px calc(6px + var(--safe-b)); background: var(--sheet); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px #1b1d2a14; }
  .mainnav button { flex: 1; flex-direction: column; gap: 3px; padding: 6px 4px; border-radius: 10px; font-size: 11px; font-weight: 700; letter-spacing: .02em; min-height: 0; }
  .mainnav button svg { width: 22px; height: 22px; }
  .mainnav button span { display: inline; }
  .mainnav button.selected { background: var(--rose-soft); color: var(--rose-ink); }
  .mainnav button.selected svg { stroke: var(--rose); }
  #shell main { padding: 18px 16px calc(var(--nav-h) + var(--safe-b) + 90px); }
  .installbanner { padding: 10px 14px; font-size: 13px; }
  .heading { align-items: flex-start; gap: 12px; margin-bottom: 14px; }
  .heading h1 { font-size: 26px; }
  .fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 25; border-radius: 999px; padding: 14px 20px; box-shadow: 0 10px 28px #d4267a66; min-height: 52px; font-size: 15px; }
  .fab svg { width: 22px; height: 22px; }
  .toolbar { align-items: stretch; flex-direction: column; gap: 10px; }
  .weeknav { justify-content: space-between; }
  .weeknav strong { flex: 1; text-align: right; font-size: 16px; margin: 0; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters input, .filters select { width: 100%; }
  .summary { gap: 8px 16px; font-size: 13px; }
  .summary strong { font-size: 16px; }
  .calendarwrap { display: none; }
  .mobileagenda { display: block; }
  .mobileday { margin-bottom: 20px; }
  .mobileday h3 { font-size: 15px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; text-transform: capitalize; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .mobileday.today h3 { color: var(--rose-ink); border-bottom-color: var(--rose); }
  .mobileday h3 em { font-style: normal; font-family: var(--font-body); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; background: var(--rose); color: #fff; border-radius: 4px; padding: 2px 6px; margin-left: 6px; vertical-align: 2px; }
  .mobileday .emptyday { padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); font-size: 13px; }
  .mobileday .card { padding: 14px; margin-bottom: 8px; border-radius: 10px; }
  .mobileday .card strong { font-size: 18px; }
  .mobileday .card .meta, .mobileday .agendaquantity, .mobileday .agendaproducts { font-size: 13px; }
  .mobileday .cardthumb { width: 44px; height: 44px; }
  .mobileday .cardlogo { font-size: 12px; }
  .mobileday .printtag { font-size: 11px; }
  .mobileday .card .orderstatus { font-size: 10px; }
  .listgrid { grid-template-columns: 1fr; gap: 10px; }
  .sheetlist { grid-template-columns: 1fr; gap: 10px; }
  .sheetrow { grid-template-columns: 96px minmax(0, 1fr); }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .technicalgrid { grid-template-columns: 1fr; gap: 14px; }
  .technicalcardheader { padding: 14px 16px; min-height: 0; }
  .technicalcardheader h3 { font-size: 20px; }
  .techmeta { padding: 14px 16px; gap: 10px; }
  .orderoverview { grid-template-columns: 84px minmax(0, 1fr); padding: 14px 16px; gap: 12px; }
  .overviewimage { height: 84px; }
  .technicalfilters label { min-width: 120px; }
  .technicalfilters button { width: 100%; }
  dialog.sheet, #accountDialog, .imageviewer { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; margin: 0; }
  dialog.sheet[open] { display: flex; flex-direction: column; }
  dialog.sheet form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
  .dialoghead { padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); }
  .dialoghead h2 { font-size: 20px; }
  .dialogbody { padding: 16px; max-height: none; flex: 1; min-height: 0; }
  .dialogfoot { padding: 12px 14px calc(12px + var(--safe-b)); gap: 8px; }
  .dialogfoot button { flex: 1 1 auto; }
  .dialogfoot span { flex-basis: 100%; max-width: 100%; font-size: 12px; }
  #originalFrame { height: auto; flex: 1; }
  .imagecanvas { flex: 1; height: auto; }
  .formgrid { grid-template-columns: 1fr; }
  .mode { gap: 7px; }
  .mode label { font-size: 13px; padding: 12px 9px; }
  .sectionhead { flex-direction: column; align-items: stretch; }
  .product { padding: 12px; }
  .producthead { flex-wrap: wrap; align-items: flex-start; }
  .moneygrid { grid-template-columns: 1fr; }
  .moneygrid > div { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; }
  .moneygrid strong { margin: 0; font-size: 20px; }
  .initialreceipt { grid-template-columns: 1fr; gap: 12px; }
  .settlementlayout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .settlementreference { padding: 14px; }
  .contractphotos img { max-height: 280px; }
  .receiptproduct { flex-wrap: wrap; }
  .collectionmodes { gap: 8px; }
  .collectionmodes button { padding: 12px; }
  .collectionmodes b { font-size: 15px; }
  .collectionmodes small { font-size: 12px; }
  .techdetail .techmeta { grid-template-columns: 1fr 1fr; }
  .techproduct { grid-template-columns: 1fr; gap: 14px; padding: 18px 0; }
  .design-column { position: static; }
  .design-tile { height: 240px; }
  .featuregrid { grid-template-columns: 1fr 1fr; }
  .demobar { padding: 12px 16px; }
  .demoprofiles { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
  .demoprofiles button { padding: 10px 6px; font-size: 12px; }
}

@media (max-width: 420px) {
  .featuregrid { grid-template-columns: 1fr; }
  .techdetail .techmeta { grid-template-columns: 1fr; }
}

/* Modo instalado: sin barra de direcciones, el aviso de instalación no hace falta. */
@media (display-mode: standalone) {
  .installbanner { display: none !important; }
}

/* Pantalla de carga mientras se comprueba la sesión guardada */
.splash { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--paper); color: var(--muted); font-size: 14px; }

/* Panel de administración: accesos */
.userstable { overflow-x: auto; }
.userstable table { width: 100%; border-collapse: collapse; font-size: 13px; }
.userstable th, .userstable td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.userstable th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.userstable code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--tint); padding: 2px 6px; border-radius: 6px; }

/* Resumen del contrato en móvil */
.summarysheet { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--sheet); }
.summaryproducts { margin: 18px 0 8px; font-size: 15px; }
.summarylist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.summarylist li { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--sheet); font-size: 14px; }
