/* APM Cotizaciones – estilos del panel */
:root {
	--main: #22384F;
	--accent: #C2541F;
	--ink: #1C2430;
	--ink-2: #2A3442;
	--muted: #535D6B;
	--line: #E3E5E9;
	--line-2: #D3D7DD;
	--bg: #F6F4F0;
	--card: #FFFFFF;
	--soft: #EEF3F8;
	--soft-ink: #24507F;
	--radius: 14px;
	--font: Figtree, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.apm-app { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.45; color: var(--ink); background: var(--bg); }
a { color: #2C5A8C; }
a:hover { color: #1C3D63; }
h1, h2 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 700; }
.muted { color: var(--muted); }
.strong { font-weight: 700; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hint { font-size: 13px; }
[hidden] { display: none !important; }

/* Inputs */
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=search], input[type=password], input[type=number], select, textarea {
	width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--ink);
	background: #fff; border: 1px solid var(--line-2); border-radius: 8px; appearance: none; -webkit-appearance: none;
}
select { padding-right: 36px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23535D6B' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
textarea { resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--main) 35%, transparent); outline-offset: 1px; border-color: var(--main); }
input.readonly, input[readonly] { background: #F3F5F8; border-color: var(--line); font-weight: 700; }
input[type=checkbox] { width: 20px; height: 20px; margin: 0; accent-color: var(--main); flex: 0 0 auto; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > label, .label, legend.label { font-size: 15px; font-weight: 700; color: var(--ink-2); padding: 0; }
.label-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; }
.label-row label, .label-row .label { font-size: 18px; font-weight: 700; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; color: var(--ink-2); cursor: pointer; }
.check.small { font-size: 14px; min-height: 36px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; font: inherit; font-size: 15px; font-weight: 600; color: var(--ink-2); background: #fff; border: 1px solid #C9CED6; border-radius: 10px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #F7F8FA; color: var(--ink); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn-accent:hover { background: var(--accent); color: #fff; filter: brightness(0.93); }
.btn-outline-main { border-color: var(--main); color: var(--main); font-weight: 700; }
.btn-soft { background: var(--soft); border-color: var(--soft); color: var(--soft-ink); font-weight: 700; }
.btn-soft:hover { background: #E2EBF4; color: var(--soft-ink); }
.btn-dashed { border-style: dashed; border-color: #9AA3AF; align-self: flex-start; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn-lg { min-height: 54px; font-size: 17px; }
.btn-block { width: 100%; }
.btn-paid { border-color: #9CCDB0; color: #1C6B43; font-weight: 700; }
.btn-danger-soft { color: #8E2B17; border-color: #E2B7AB; }
.btn:disabled { opacity: 0.6; cursor: default; }
.link-btn { background: none; border: 0; padding: 6px 2px; font: inherit; font-size: 14px; font-weight: 600; color: #2C5A8C; cursor: pointer; }
.link-btn.danger { color: #8E2B17; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; border-radius: 8px; color: #6B7482; cursor: pointer; }
.icon-btn:hover { background: #F1F3F5; color: var(--ink); }

/* Layout */
.app { min-height: 100vh; display: flex; }
.side { flex: 0 0 248px; background: var(--main); color: #fff; padding: 28px 18px; display: flex; flex-direction: column; gap: 32px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-logo { width: 48px; height: 48px; border-radius: 50%; object-fit: contain; padding: 4px; background: #fff; border: 2px solid rgba(255,255,255,0.2); flex: 0 0 auto; }
.brand-initial { display: flex; align-items: center; justify-content: center; color: var(--main); font-weight: 700; font-size: 20px; }
.brand-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brand-name { font-weight: 700; font-size: 18px; line-height: 1.15; overflow-wrap: break-word; word-break: normal; hyphens: none; }
.brand-name.is-long { font-size: 15px; }
.brand-name.is-xlong { font-size: 13px; }
.brand-sub { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.72); }
.nav-links { display: flex; flex-direction: column; gap: 4px; }
.nav-links a { min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 10px; color: rgba(255,255,255,0.86); text-decoration: none; font-weight: 500; }
.nav-links a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-links a.is-active { background: rgba(255,255,255,0.14); color: #fff; font-weight: 700; }
.me { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 14px 6px 0; border-top: 1px solid rgba(255,255,255,0.14); }
.me-avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.14); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.me-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.me-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-sub { font-size: 13px; color: rgba(255,255,255,0.72); text-decoration: none; }
a.me-sub:hover { color: #fff; text-decoration: underline; }
.me-out { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.86); border-radius: 8px; flex: 0 0 auto; }
.me-out:hover { background: rgba(255,255,255,0.1); color: #fff; }
.main { flex: 1 1 auto; min-width: 0; padding: 32px 40px 40px; display: flex; flex-direction: column; gap: 24px; }
.credit { margin: auto 0 0; padding-top: 12px; font-size: 13px; color: #6B7482; text-align: center; }
.credit a { color: inherit; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 6px; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--muted); }
.crumbs a { font-weight: 600; text-decoration: none; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-flush { padding: 0; gap: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid #ECEEF1; }
.card-head a { font-weight: 600; text-decoration: none; }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split-main { flex: 999 1 600px; min-width: 0; }
.split-side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.narrow { max-width: 760px; width: 100%; }
.narrow-wide { max-width: 920px; width: 100%; }
.form-card { gap: 20px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.danger-zone { display: flex; justify-content: flex-end; }

.flash { padding: 12px 16px; border-radius: 10px; font-size: 15px; font-weight: 600; }
.flash-success { background: #E2F1E8; color: #145536; }
.flash-error { background: #FBE5DE; color: #7A2414; }
.flash-info { background: var(--soft); color: var(--soft-ink); }

/* Search + filters */
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 14px; color: #6B7482; pointer-events: none; }
.search input { padding-left: 42px; width: 300px; max-width: 100%; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filters .search { flex: 1 1 280px; }
.filters .search input { width: 100%; }
.filters select { width: auto; min-width: 170px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.kpi-label i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.kpi strong { font-size: 28px; font-variant-numeric: tabular-nums; }
.kpi .muted { font-size: 14px; }

/* Tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; padding: 12px 14px; font-size: 13px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.table th.num { text-align: right; }
.c-check { width: 48px; }
.table th.c-check, .table td.c-check { padding-right: 0; }
.table tr.is-selected td { background: #FFF6F2; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 10px 22px; background: #FBEFEB; border-bottom: 1px solid #F0D3C9; font-size: 15px; color: #7A2414; }
.table td { padding: 12px 14px; border-top: 1px solid #ECEEF1; vertical-align: middle; }
.table td a.strong { text-decoration: none; color: var(--ink); }
.table td a.strong:hover { color: #2C5A8C; text-decoration: underline; }
.row-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.row-actions.left { justify-content: flex-start; align-items: center; gap: 12px; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill-draft { background: #ECEEF1; color: #46505E; }
.pill-issued { background: #FFF1D6; color: #7A4B00; }
.pill-sent { background: #E3ECF6; color: #24507F; }
.pill-paid { background: #E2F1E8; color: #1C6B43; }
.pill-void { background: #F2E3E0; color: #7A2414; text-decoration: line-through; }
.empty { padding: 40px 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty p { margin: 0; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pager a { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; text-decoration: none; font-weight: 600; }
.pager a.is-active { background: var(--main); border-color: var(--main); color: #fff; }

.attn { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: #F3F6FA; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 15px; }
.attn:hover { background: #EAF0F6; color: var(--ink); }
.attn .muted { font-size: 14px; }
.quick { min-height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: #F3F5F8; border-radius: 10px; color: var(--ink); font-weight: 600; text-decoration: none; }
.quick svg { color: var(--main); }
.quick:hover { background: #EBEEF2; color: var(--ink); }

/* Hoja del documento */
.invoice-sheet { padding: 34px 38px; gap: 28px; }
.sheet-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 30px; }
.sheet-fieldset:disabled { opacity: 0.75; }
.sheet-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; align-items: flex-start; }
.company { display: flex; align-items: center; gap: 18px; min-width: 0; }
.company-logo { width: 96px; height: 96px; border-radius: 50%; object-fit: contain; padding: 6px; border: 1px solid var(--line); background: #fff; flex: 0 0 auto; }
.company-text { display: flex; flex-direction: column; gap: 2px; font-size: 15px; color: var(--muted); min-width: 0; }
.company-name { font-size: 24px; font-weight: 700; color: var(--ink); }
.sheet-meta { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.sheet-title { font-size: 40px; font-weight: 700; color: var(--main); line-height: 1; }
.meta-grid { display: grid; grid-template-columns: auto 200px; gap: 10px 14px; align-items: center; }
.meta-grid label { font-size: 15px; font-weight: 600; text-align: right; color: var(--ink-2); }
.parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 32px; }
.party { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.party-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.party-head legend { float: left; font-size: 18px; font-weight: 700; padding: 0; }
.party-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.party-fields { display: flex; flex-direction: column; gap: 8px; }
.party-fields input { min-height: 44px; font-size: 15px; }
.same-note { margin: 0; font-size: 14px; }

.items { display: flex; flex-direction: column; gap: 12px; }
.items-scroll { border: 1px solid var(--line); border-radius: 12px; }
.items-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 15px; }
.items-table th { background: var(--main); color: #fff; text-align: left; padding: 12px; font-size: 14px; font-weight: 700; }
.items-table td { padding: 8px; border-top: 1px solid #ECEEF1; vertical-align: top; }
.items-table input, .items-table textarea { min-height: 42px; font-size: 15px; padding: 9px 10px; }
.items-table textarea { resize: none; overflow: hidden; display: block; }
.c-qty { width: 96px; }
.c-price { width: 140px; }
.c-amount { width: 130px; }
.items-table th.c-amount { text-align: right; }
td.c-amount { padding-top: 18px !important; padding-right: 14px !important; }
.c-del { width: 52px; text-align: center; }
.labor-row td { background: #F7F8FA; }
.labor-row textarea::placeholder { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; color: #A3AAB4; }
.labor-tag { display: inline-block; padding: 3px 6px; border-radius: 6px; background: #ECEEF1; color: #46505E; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tax-note { grid-column: 1 / -1; margin-top: -6px; font-size: 13px; }
.btn-danger { background: #B0381E; border-color: #B0381E; color: #fff; font-weight: 700; }
.btn-danger:hover { background: #962F19; color: #fff; }
.delete-dialog p { margin: 0; }
.small-text { font-size: 13px; }
.table td.reason { min-width: 200px; max-width: 360px; white-space: normal; }

.dropzone { min-height: 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 16px; border: 1px dashed #9AA3AF; border-radius: 12px; background: #FAFAFB; color: var(--ink-2); text-align: center; cursor: pointer; }
.dropzone.is-over { background: var(--soft); border-color: var(--main); }
.dropzone .muted { font-size: 13px; }
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-list:empty { display: none; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.file-row.selectable { cursor: pointer; }
.file-row.is-new { border-style: dashed; }
.file-ext { width: 42px; height: 42px; border-radius: 8px; background: var(--soft); color: var(--soft-ink); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex: 0 0 auto; overflow: hidden; }
.file-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-info .strong { overflow-wrap: anywhere; color: var(--ink); text-decoration: none; }
.file-info a.strong:hover { text-decoration: underline; }
.file-info .muted { font-size: 13px; }
.remove-check { color: #8E2B17; }

.sheet-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; align-items: flex-end; }
.signature { flex: 1 1 280px; display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: 420px; }
.sig-pad { position: relative; height: 130px; border: 1px dashed #9AA3AF; border-radius: 10px; background: #FAFAFB; touch-action: none; }
.sig-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.sig-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #6B7482; font-size: 15px; pointer-events: none; }
.signature .link-btn { align-self: flex-start; }
.totals { flex: 0 1 400px; display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 10px 14px; align-items: center; font-size: 16px; }
.totals input { min-height: 42px; }
.tax-label { display: flex; align-items: center; gap: 8px; }
.tax-label input { width: 76px; text-align: right; }
.total-label, .total-value { padding-top: 12px; border-top: 2px solid var(--ink); font-weight: 700; }
.total-label { font-size: 19px; }
.total-value { font-size: 22px; color: var(--main); }
.sheet-footer { margin: 0; padding-top: 20px; border-top: 1px solid #ECEEF1; text-align: center; font-size: 17px; font-weight: 600; color: var(--ink-2); }

.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; color: var(--ink-2); }
.details { margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.details div { display: flex; justify-content: space-between; gap: 12px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; text-align: right; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; font-size: 15px; }
.history li { position: relative; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.history li::before { content: ""; position: absolute; left: 0; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--main); }
.history li.is-error::before { background: #B0381E; }
.h-what { font-weight: 700; }
.h-detail { overflow-wrap: anywhere; }
.history .muted { font-size: 13px; }

/* Address Book dialog */
.book { width: min(560px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 48px)); padding: 20px; border: 0; border-radius: 16px; box-shadow: 0 20px 60px rgba(20, 30, 45, 0.3); }
.book[open] { display: flex; flex-direction: column; gap: 12px; }
.book::backdrop { background: rgba(20, 30, 45, 0.45); }
.book-head { display: flex; align-items: center; justify-content: space-between; }
.book-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.book-item { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; color: var(--ink); cursor: pointer; }
.book-item:hover, .book-item:focus-visible { background: var(--soft); border-color: #C9D8E8; }
.book-item .muted { font-size: 14px; }
.book-empty { margin: 0; }

/* Settings */
.logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.logo-preview { width: 96px; height: 96px; border-radius: 50%; object-fit: contain; padding: 6px; border: 1px solid var(--line); background: #fff; }
.logo-empty { display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); }

/* Login */
.login { min-height: 100vh; display: flex; flex-wrap: wrap; }
.login-brand { flex: 1 1 420px; background: var(--main); color: #fff; padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.login-kicker { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.8); }
.login-kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.login-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; }
.login-logo { width: 148px; height: 148px; border-radius: 50%; object-fit: contain; padding: 10px; border: 4px solid rgba(255,255,255,0.18); background: #fff; }
.login-hero h1 { font-size: 52px; line-height: 1.05; font-weight: 700; }
.login-hero p { margin: 0; font-size: 20px; color: rgba(255,255,255,0.86); max-width: 400px; }
.login-site { font-weight: 600; }
.login-form-wrap { flex: 1 1 460px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-form { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; }
.login-form h2 { font-size: 34px; }
.login-form p { margin: 6px 0 0; }
.login-url { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.login-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.login-row a { font-weight: 600; text-decoration: none; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 52px; }
.pass-toggle { position: absolute; right: 2px; top: 1px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: 8px; }
.login-credit { text-align: center; font-size: 13px; color: #6B7482; }


/* Nombre del documento, firma y hojas de dibujo */
.sheet-title { max-width: 360px; overflow-wrap: anywhere; text-align: right; }
.doc-name-field { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 314px; padding: 8px 10px; border: 1px solid var(--soft-ink); border-radius: 10px; background: var(--soft); }
.doc-name-field label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--soft-ink); }
.doc-name-field input { min-height: 40px; font-size: 16px; font-weight: 600; background: #fff; }
.doc-tag { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--soft-ink); font-size: 12px; font-weight: 700; vertical-align: middle; }
.sheet-bottom.has-client { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: ". totals" "sig csig"; gap: 28px 40px; align-items: end; }
.sheet-bottom.has-client .totals { grid-area: totals; justify-self: end; width: 100%; max-width: 400px; }
.sheet-bottom.has-client .signature { grid-area: sig; justify-self: start; width: 100%; }
.sheet-bottom.has-client .signature-client { grid-area: csig; justify-self: end; }
.signature-client .link-btn { align-self: flex-end; }
.draw-sheets { display: flex; flex-direction: column; gap: 12px; padding-top: 22px; border-top: 1px solid var(--line); }

/* Tablet & phone */
@media (max-width: 980px) {
	.app { flex-direction: column; }
	.side { position: sticky; top: 0; z-index: 20; height: auto; flex: 0 0 auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; overflow-x: auto; }
	.brand { padding: 0; }
	.brand-logo { width: 38px; height: 38px; }
	.brand-text { display: none; }
	.nav-links { flex-direction: row; gap: 2px; }
	.nav-links a { min-height: 44px; padding: 0 12px; white-space: nowrap; }
	.me { margin: 0 0 0 auto; padding: 0; border: 0; }
	.me-avatar, .me-text { display: none; }
	.main { padding: 20px 16px 28px; gap: 18px; }
	h1 { font-size: 26px; }
	.invoice-sheet { padding: 22px 18px; }
	.search input { width: 100%; }
	.head-actions { width: 100%; }
	.head-actions .search { flex: 1 1 220px; }
}
@media (max-width: 640px) {
	.nav-links a span { display: none; }
	.nav-links a { padding: 0 12px; }
	.page-head { align-items: stretch; }
	.head-actions .btn { flex: 1 1 auto; }
	.sheet-meta { align-items: stretch; width: 100%; }
	.sheet-title { font-size: 32px; }
	.meta-grid { grid-template-columns: auto minmax(0, 1fr); }
	.meta-grid label { text-align: left; }
	.company-logo { width: 64px; height: 64px; }
	.totals { flex-basis: 100%; grid-template-columns: minmax(0, 1fr) 120px; }
	.signature { max-width: none; }
	.sheet-bottom.has-client { grid-template-columns: minmax(0, 1fr); grid-template-areas: "totals" "sig" "csig"; }
	.sheet-bottom.has-client .totals { max-width: none; }
	.sheet-bottom.has-client .signature-client { justify-self: stretch; }
	.signature-client .link-btn { align-self: flex-start; }
	.sheet-title { text-align: left; max-width: none; }
	.doc-name-field { max-width: none; }
	.login-brand { padding: 32px 24px; flex-basis: 100%; }
	.login-hero h1 { font-size: 36px; }
	.login-logo { width: 96px; height: 96px; }
	.login-hero p { font-size: 17px; }
	.form-actions .btn { flex: 1 1 auto; }
	/* Line items as cards */
	.items-scroll { border: 0; border-radius: 0; overflow: visible; }
	.items-table { min-width: 0; display: block; }
	.items-table thead { display: none; }
	.items-table tbody { display: flex; flex-direction: column; gap: 10px; }
	.items-table tr { display: grid; grid-template-columns: 58px minmax(96px, 1fr) auto 36px; grid-template-areas: "desc desc desc desc" "qty price amount del"; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
	.items-table td { border: 0; padding: 0 !important; }
	.items-table td.c-desc { grid-area: desc; }
	.items-table td.c-qty { grid-area: qty; width: auto; }
	.items-table td.c-price { grid-area: price; width: auto; }
	.items-table td.c-amount { grid-area: amount; width: auto; min-width: 84px; padding-bottom: 11px !important; }
	.items-table td.c-del { grid-area: del; width: auto; }
	.items-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; }
	.items-table td.c-amount::before { text-align: right; }
	.items-table tr.labor-row { background: #F7F8FA; }
	.items-table tr.labor-row td { background: transparent; }
	.labor-tag { font-size: 10px; padding: 2px 4px; }
}
@media print {
	.side, .head-actions, .credit { display: none; }
}

/* APM Cotizaciones: cliente, condiciones, IGV y moneda */
.pill-rejected { background: #F6E6E1; color: #8A3A1F; }
.kpi-usd { font-size: 15px; font-weight: 600; color: var(--ink-2); margin-top: -6px; }
.meta-grid select { min-height: 42px; }
.party-cot { gap: 14px; }
.cli-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.cli-grid .field > label { font-size: 13px; font-weight: 700; color: var(--soft-ink); }
.cli-grid input, .cli-grid select { min-height: 44px; font-size: 15px; }
.cli-wide { grid-column: 1 / -1; }
.doc-pair { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px; }
.totals-cot { grid-template-columns: minmax(0, 1fr) 180px; }
.totals-cot select { min-height: 42px; font-size: 14px; }
.igv-modo-lbl { font-size: 14px; color: var(--muted); }
.totals-cot input[readonly] { background: #F3F4F6; color: var(--muted); }
.en-letras { grid-column: 1 / -1; font-size: 12px; font-weight: 600; letter-spacing: 0.01em; text-align: right; }
.cond-box { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: #FBFBFC; display: flex; flex-direction: column; gap: 12px; }
.cond-title { font-size: 18px; margin: 0; }
.cond-title .muted { font-size: 13px; font-weight: 500; }
.cond-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.cond-grid .field > label { font-size: 13px; font-weight: 700; color: var(--soft-ink); }
.cond-wide { grid-column: 1 / -1; }
@media (max-width: 640px) {
	.cli-grid, .cond-grid { grid-template-columns: minmax(0, 1fr); }
	.totals-cot { grid-template-columns: minmax(0, 1fr) 140px; }
	.en-letras { text-align: left; }
}

/* ================================================================
   V1.1 · Celular primero (celular y tablet, luego computadora)
   ================================================================ */
.solo-movil, .qty-btns, .barra-acc, .nav-abajo, .fab, .cli-mas-btn, .hojas-abrir, .paso-head, .paso-ayuda, .paso-sig { display: none; }
.paso, .paso-body, .cli-mas { display: contents; }
/* En la computadora: firma a la izquierda, totales a la derecha y condiciones debajo (como antes). */
.sheet-bottom-cot .signature { order: 1; }
.sheet-bottom-cot .totals { order: 2; }
.sheet-bottom-cot .cond-box { order: 3; flex-basis: 100%; }

/* Hoja inferior "Más" y recorrido de bienvenida */
.hoja-abajo, .tour { border: 0; padding: 0; box-shadow: 0 20px 60px rgba(20, 30, 45, 0.3); color: var(--ink); }
.hoja-abajo::backdrop, .tour::backdrop { background: rgba(20, 30, 45, 0.5); }
.hoja-abajo { width: min(480px, 100vw); max-width: 100vw; margin: auto auto 0; border-radius: 18px 18px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); }
.hoja-abajo[open] { display: flex; flex-direction: column; gap: 6px; }
.hoja-abajo-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hoja-abajo-head h2 { margin: 0; font-size: 18px; }
.mas-lista { display: flex; flex-direction: column; }
.mas-lista a, .mas-lista button { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 0 8px; border: 0; border-top: 1px solid var(--line); background: none; font: inherit; font-size: 16px; font-weight: 600; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; }
.mas-lista svg { color: var(--main); }
.mas-lista .mas-salir, .mas-lista .mas-salir svg { color: #8E2B17; }
.tour { width: min(420px, calc(100vw - 32px)); border-radius: 20px; padding: 28px 24px 22px; }
.tour[open] { display: flex; flex-direction: column; gap: 18px; }
.tour-slide { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.tour-slide[hidden] { display: none; }
.tour-slide h2 { margin: 4px 0 0; font-size: 22px; }
.tour-slide p { margin: 0; font-size: 16px; color: var(--ink-2); }
.tour-ico { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--soft); color: var(--main); }
.tour-puntos { display: flex; justify-content: center; gap: 8px; }
.tour-puntos span { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); transition: width .2s; }
.tour-puntos span.is-on { width: 22px; border-radius: 4px; background: var(--accent); }
.tour-btns { display: flex; gap: 10px; }
.tour-btns .btn { flex: 1 1 0; min-height: 50px; }

/* ---------- Tablet y celular: barra de acciones fija ---------- */
@media (max-width: 1024px) {
	.barra-acc { display: flex; align-items: center; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(20, 30, 45, 0.10); }
	.barra-total { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.1; }
	.barra-lbl { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
	.barra-total strong { font-size: 20px; color: var(--main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.barra-btns { display: flex; gap: 6px; flex: 0 0 auto; }
	.barra-btn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 62px; min-height: 54px; padding: 4px 8px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 700; text-decoration: none; cursor: pointer; }
	.barra-btn.barra-main { background: var(--accent); border-color: var(--accent); color: #fff; min-width: 76px; }
	.view-invoice-edit .page-head .head-actions { display: none; }
	.view-invoice-edit .main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (min-width: 761px) and (max-width: 1024px) {
	.barra-acc { padding-left: 20px; padding-right: 20px; }
	.barra-btn { flex-direction: row; gap: 8px; font-size: 15px; padding: 0 16px; }
	.barra-total strong { font-size: 24px; }
}

/* ---------- Celular ---------- */
@media (max-width: 760px) {
	.solo-movil { display: inline; }
	body.apm-app { background: #F2F4F7; }
	/* Barra superior simple: logo y nombre. El menú pasa abajo. */
	.side { padding: 10px 16px; gap: 10px; overflow: visible; }
	.side .brand-text { display: flex; min-width: 0; }
	.side .brand-sub { display: none; }
	.side .brand-name { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.side .nav-links, .side .me { display: none; }
	.main { padding: 16px 16px calc(150px + env(safe-area-inset-bottom)); }
	.credit { text-align: center; }

	.nav-abajo { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #fff; border-top: 1px solid var(--line); padding: 4px 4px env(safe-area-inset-bottom); box-shadow: 0 -4px 18px rgba(20, 30, 45, 0.08); }
	.nav-abajo a, .nav-abajo button { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 700; color: var(--muted); text-decoration: none; cursor: pointer; border-radius: 12px; }
	.nav-abajo .is-active { color: var(--main); }
	.nav-abajo .is-active svg { background: var(--soft); border-radius: 999px; padding: 3px 14px; box-sizing: content-box; }
	.view-invoice-edit .nav-abajo { display: none; }

	.fab { display: inline-flex; align-items: center; gap: 8px; position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 55; min-height: 56px; padding: 0 22px 0 18px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 700; text-decoration: none; box-shadow: 0 8px 22px rgba(194, 84, 31, 0.38); }
	.fab:hover { color: #fff; }

	/* Encabezado de la cotización más compacto */
	.view-invoice-edit .page-head h1 { font-size: 22px; }
	.view-invoice-edit .crumbs { font-size: 13px; }

	/* La hoja se vuelve una lista de pasos */
	.invoice-sheet { padding: 0; background: transparent; border: 0; box-shadow: none; }
	.sheet-fieldset { gap: 12px; }
	.sheet-top, .sheet-bottom, .sheet-bottom-cot { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
	.sheet-top .company, .sheet-meta .sheet-title { display: none; }
	.sheet-footer { display: none; }
	.paso { display: block; min-width: 0; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
	.paso-head { display: flex; align-items: center; gap: 4px; padding-right: 8px; }
	.paso-toggle { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 6px 10px 14px; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
	.paso-num { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--soft); color: var(--main); font-weight: 800; font-size: 15px; }
	.paso.is-open .paso-num { background: var(--main); color: #fff; }
	.paso-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
	.paso-tit { font-size: 17px; font-weight: 700; }
	.paso-res { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.paso-res:empty { display: none; }
	.paso-ok { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; display: none; align-items: center; justify-content: center; background: #1F7A4D; color: #fff; font-size: 13px; font-weight: 800; }
	.paso.is-ok .paso-ok { display: flex; }
	.paso-chev { flex: 0 0 auto; color: var(--muted); transition: transform .2s; }
	.paso.is-open .paso-chev { transform: rotate(180deg); }
	.paso-help { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: #fff; color: var(--main); font: inherit; font-weight: 800; font-size: 17px; cursor: pointer; }
	.paso-help[aria-expanded="true"] { background: var(--main); border-color: var(--main); color: #fff; }
	.paso-ayuda { display: block; margin: 0 14px 12px; padding: 12px 14px; border-radius: 12px; background: #FFF6EC; color: #5A3A16; font-size: 15px; }
	.paso-ayuda[hidden] { display: none; }
	.paso-body { display: none; }
	.paso.is-open .paso-body { display: flex; flex-direction: column; gap: 16px; padding: 4px 14px 16px; }
	.paso-sig { display: inline-flex; min-height: 52px; font-size: 16px; font-weight: 700; color: var(--main); border-color: var(--main); }

	/* Paso 1 */
	.sheet-meta { gap: 14px; }
	.paso .doc-name-field { padding: 0; border: 0; background: none; }
	.paso .meta-grid { grid-template-columns: minmax(0, 1fr); gap: 6px; }
	.paso .meta-grid label { font-size: 14px; font-weight: 700; color: var(--soft-ink); margin-top: 6px; }
	/* Paso 2: buscar primero */
	.party-cot .party-head legend { display: none; }
	.party-cot .party-head, .party-cot .party-tools { width: 100%; }
	.party-cot [data-book] { width: 100%; min-height: 56px; font-size: 17px; border-radius: 12px; }
	.party-cot [data-book] svg { width: 22px; height: 22px; }
	.cli-mas-btn { display: block; text-align: left; min-height: 44px; font-size: 15px; }
	.cli-mas { display: none; }
	.cli-mas.is-open { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
	/* Paso 3: líneas como tarjetas con − y + */
	.items-table tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; grid-template-areas: "desc desc del" "qty price price" "amount amount amount"; gap: 10px; align-items: end; background: #fff; }
	.items-table td.c-del { align-self: start; }
	.items-table td.c-qty { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 4px; align-items: center; }
	.items-table td.c-qty::before { grid-column: 1 / -1; }
	.items-table td.c-qty input { grid-column: 2; grid-row: 2; text-align: center; min-height: 46px; padding: 6px 2px; }
	.qty-btns { display: contents; }
	.qty-btn { grid-row: 2; height: 46px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--soft); color: var(--main); font: inherit; font-size: 22px; font-weight: 700; cursor: pointer; padding: 0; }
	.qty-btn[data-qty-step="-1"] { grid-column: 1; }
	.qty-btn[data-qty-step="1"] { grid-column: 3; }
	.items-table td.c-price input { min-height: 46px; }
	.items-table td.c-amount { display: flex; justify-content: space-between; align-items: baseline; padding-top: 8px !important; border-top: 1px dashed var(--line) !important; font-size: 17px; }
	.items-table td.c-amount::before { margin: 0; font-size: 14px; }
	[data-add-item] { width: 100%; min-height: 52px; }
	/* Paso 4 */
	.paso .totals { width: 100%; max-width: none; }
	.paso .cond-box { padding: 0; border: 0; background: none; }
	.paso .cond-title { display: none; }
	/* Paso 6: hojas en pantalla completa */
	.draw-sheets { padding-top: 0; border-top: 0; }
	.draw-sheets .label-row .muted { display: none; }
	.draw-sheets .sx:not(.is-full) { display: none; }
	.hojas-abrir { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 12px 16px; border: 1px dashed var(--main); border-radius: 14px; background: var(--soft); color: var(--main); font: inherit; text-align: left; cursor: pointer; }
	.hojas-abrir span { display: flex; flex-direction: column; gap: 2px; }
	.hojas-abrir strong { font-size: 16px; }
	.hojas-abrir small { font-size: 13px; color: var(--muted); }

	/* Listas como tarjetas */
	.table-scroll { overflow: visible; }
	.tabla-cards { min-width: 0; display: block; }
	.tabla-cards thead { display: none; }
	.tabla-cards tbody { display: flex; flex-direction: column; gap: 10px; }
	.tabla-cards tr { display: grid; gap: 6px 12px; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
	.tabla-cards td, .tabla-cards td:first-child, .tabla-cards td:last-child { padding: 0; border: 0; text-align: left; }
	.tabla-cards td:empty { display: none; }
	.tabla-cot tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "num estado" "cli cli" "fecha total" "acc acc"; align-items: center; }
	.tabla-cot.has-check tr { grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "chk num estado" "chk cli cli" "chk fecha total" "acc acc acc"; }
	.tabla-cot td.c-check { grid-area: chk; align-self: start; padding-top: 2px; }
	.tabla-cot td.c-num { grid-area: num; font-size: 17px; }
	.tabla-cot td.c-estado { grid-area: estado; justify-self: end; }
	.tabla-cot td.c-cli { grid-area: cli; font-size: 15px; }
	.tabla-cot td.c-fecha { grid-area: fecha; font-size: 14px; }
	.tabla-cot td.c-total { grid-area: total; font-size: 18px; text-align: right; }
	.tabla-cot td.c-acc { grid-area: acc; padding-top: 8px; border-top: 1px solid #ECEEF1; }
	.tabla-cot .row-actions { display: flex; gap: 8px; justify-content: stretch; }
	.tabla-cot .row-actions .btn { flex: 1 1 0; min-height: 44px; }
	.tabla-cli tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "code ver" "nom nom" "doc doc" "contacto contacto" "tel tel" "mail mail"; }
	.tabla-cli td.c-code { grid-area: code; } .tabla-cli td.c-ver { grid-area: ver; justify-self: end; }
	.tabla-cli td.c-nom { grid-area: nom; font-size: 17px; font-weight: 700; } .tabla-cli td.c-nom a { color: var(--ink); text-decoration: none; }
	.tabla-cli td.c-doc { grid-area: doc; } .tabla-cli td.c-contacto { grid-area: contacto; }
	.tabla-cli td.c-tel { grid-area: tel; } .tabla-cli td.c-mail { grid-area: mail; overflow-wrap: anywhere; }
	.tabla-gen tr { grid-template-columns: minmax(0, 1fr); }
	.tabla-gen td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
	.card:has(> .table-scroll), .card:has(form > .table-scroll), .card:has(> form[data-bulk-form]) { background: transparent; border: 0; padding: 0; }
	/* Evitar que el contenido quede bajo los botones flotantes */
	.view-invoice-edit .main { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
}
@media print {
	.barra-acc, .nav-abajo, .fab { display: none !important; }
}

/* ================================================================
   V1.3 · Tarjetas de Inicio tocables, filtros y seguimiento
   ================================================================ */
a.kpi { color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .1s; }
a.kpi:hover { border-color: #C9D3DE; box-shadow: 0 6px 18px rgba(20, 30, 45, 0.08); color: var(--ink); }
a.kpi:active { transform: scale(0.98); }
.kpi-cifras { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .kpi-monto { font-size: 28px; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-pie { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; font-size: 14px; color: var(--muted); }
.kpi-flecha { flex: 0 0 auto; color: var(--muted); }
a.kpi:hover .kpi-flecha { color: var(--main); }
.kpi .kpi-usd { margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filtro-activo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 14px; border-radius: 12px; background: var(--soft); color: var(--soft-ink); font-size: 15px; }
.filtro-x { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; background: #fff; border: 1px solid #C9D8E8; color: var(--main); font-weight: 700; font-size: 14px; text-decoration: none; }
.filtro-mes { width: auto; min-width: 170px; }
.seguimiento .seg-item[hidden] { display: none; }
.seg-top { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.seg-top .pill { font-size: 11px; padding: 2px 9px; letter-spacing: .04em; text-transform: uppercase; }
.seg-accion { font-size: 13px; font-weight: 700; color: var(--soft-ink); }
.seg-dias.is-alerta { color: #B4510E; font-weight: 700; }
.seg-buscar { font-size: 14px; font-weight: 600; }
.top-volver, .top-inicio { display: none; }

@media (min-width: 761px) and (max-width: 1024px) {
	.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
	.kpi { padding: 14px 16px; }
	.kpi-label { min-height: 2.5em; align-items: flex-start; font-size: 13px; }
	.kpi-label i { margin-top: 5px; }
	.kpi .kpi-monto { font-size: clamp(17px, 2.3vw, 22px); }
	.kpi .kpi-monto.is-largo { font-size: clamp(15px, 1.9vw, 19px); }
	.kpi .kpi-monto.is-xlargo { font-size: clamp(13px, 1.6vw, 17px); }
}
@media (max-width: 760px) {
	.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 10px; }
	.kpi { padding: 12px 12px 10px; gap: 6px; border-radius: 14px; min-width: 0; }
	.kpi-label { align-items: flex-start; gap: 6px; min-height: 2.5em; font-size: 13px; line-height: 1.25; }
	.kpi-label i { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 5px; }
	.kpi .kpi-monto { font-size: clamp(16px, 5.4vw, 22px); }
	.kpi .kpi-monto.is-largo { font-size: clamp(14px, 4.4vw, 19px); }
	.kpi .kpi-monto.is-xlargo { font-size: clamp(12px, 3.7vw, 16px); }
	.kpi .kpi-usd { font-size: 12px; }
	.kpi-pie { font-size: 13px; }
	.filters select, .filtro-mes { flex: 1 1 140px; min-width: 0; }
	.filters .btn { flex: 1 1 100%; }
	.filtro-activo { font-size: 14px; }
	/* Dentro de una cotización: volver y casita de Inicio arriba */
	.view-invoice-edit .top-volver { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 44px; margin-left: -8px; color: #fff; border-radius: 10px; }
	.view-invoice-edit .top-inicio { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; margin-left: auto; min-width: 54px; min-height: 48px; padding: 2px 6px; color: #fff; text-decoration: none; font-size: 11px; font-weight: 700; border-radius: 10px; }
	.view-invoice-edit .top-volver:active, .view-invoice-edit .top-inicio:active { background: rgba(255, 255, 255, 0.14); }
}

/* ================================================================
   V1.4 · WhatsApp
   ================================================================ */
.btn-wa { background: #fff; border-color: #1FA855; color: #168A45; font-weight: 700; }
.btn-wa:hover { background: #F1FBF4; border-color: #168A45; color: #12733A; }
.btn-wa-lleno { background: #1FA855; border-color: #1FA855; color: #fff; font-weight: 700; }
.btn-wa-lleno:hover { background: #1A944A; border-color: #1A944A; color: #fff; }
.btn-wa svg { flex: 0 0 auto; }
.barra-btn.barra-wa { color: #168A45; border-color: #1FA855; background: #fff; }
.wa-dialog[open] { gap: 14px; }
.wa-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 20px; }
.wa-ico { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #1FA855; color: #fff; }
.wa-doc { margin: -4px 0 0; font-weight: 600; }
.wa-dialog textarea { min-height: 120px; font-size: 15px; }
.wa-nota { margin: 0; }
@media (max-width: 760px) {
	/* Barra de abajo: el total en una línea y los 5 botones debajo, parejos */
	.barra-acc { flex-wrap: wrap; gap: 6px; padding-top: 6px; }
	.barra-total { flex: 1 1 100%; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 2px; }
	.barra-total strong { font-size: 18px; }
	.barra-btns { flex: 1 1 100%; }
	.barra-btn { flex: 1 1 0; min-width: 0; padding: 4px 2px; font-size: 11px; }
	.barra-btn.barra-main { min-width: 0; }
	.view-invoice-edit .main { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
	.wa-dialog { width: 100vw; max-width: 100vw; margin: auto auto 0; border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
	.tabla-cot .row-actions .btn { padding: 0 6px; font-size: 14px; }
}
@media (max-width: 760px) {
	/* Al bajar, el botón flotante se achica a un círculo para no tapar las tarjetas */
	.fab { transition: padding .2s, gap .2s; }
	.fab span { transition: max-width .2s, opacity .2s; max-width: 200px; overflow: hidden; white-space: nowrap; }
	.fab.is-mini { padding: 0 16px; gap: 0; }
	.fab.is-mini span { max-width: 0; opacity: 0; }
}

/* ================================================================
   V1.6
   ================================================================ */
/* Lista: en la computadora, botones de ícono en una fila (el nombre sale al pasar el mouse) */
.row-actions .ra-ico { display: none; }
@media (min-width: 761px) {
	.tabla-cot td.c-num, .tabla-cot td.c-total, .tabla-cot td.c-fecha { white-space: nowrap; }
	.tabla-cot .row-actions { display: flex; flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
	.tabla-cot .row-actions .btn { position: relative; width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 10px; }
	.tabla-cot .row-actions .ra-ico { display: block; }
	.tabla-cot .row-actions .ra-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	.tabla-cot .row-actions .btn[data-tip]::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); padding: 5px 9px; border-radius: 7px; background: #1C2430; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 5; }
	.tabla-cot .row-actions .btn[data-tip]:hover::after, .tabla-cot .row-actions .btn[data-tip]:focus-visible::after { opacity: 1; }
}
/* Campos con error y contador de RUC/DNI */
.is-error, input.is-error, textarea.is-error, select.is-error { border-color: #C0392B !important; box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.14); }
.campo-error { display: block; margin-top: 4px; font-size: 13px; font-weight: 600; color: #B03A2E; line-height: 1.3; }
td .campo-error { font-size: 12px; }
.doc-cont { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.doc-cont.is-ok { color: #1F7A4D; }
.doc-cont.is-ok::before { content: "✓ "; }
/* Avisos que salen solos */
.apm-toast { position: fixed; left: 50%; bottom: 28px; z-index: 100001; max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 12px; background: #1C2430; color: #fff; font-size: 15px; font-weight: 600; line-height: 1.35; box-shadow: 0 10px 30px rgba(20, 30, 45, 0.3); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; text-align: center; }
.apm-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.apm-toast.is-ok { background: #1F7A4D; }
.apm-toast.is-error { background: #B03A2E; }
.apm-toast.is-info { background: #22384F; }
@media (max-width: 1024px) {
	.view-invoice-edit .apm-toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) {
	.apm-toast { bottom: calc(84px + env(safe-area-inset-bottom)); width: calc(100vw - 32px); }
	.view-invoice-edit .apm-toast { bottom: calc(132px + env(safe-area-inset-bottom)); }
	.items-table td.c-desc textarea { min-height: 46px; }
}
/* Espacio vacío para que los íconos queden alineados en columna (borradores y anuladas) */
.ra-hueco { display: none; }
@media (min-width: 761px) {
	.tabla-cot .row-actions .ra-hueco { display: inline-block; visibility: hidden; }
}

/* ================================================================
   V1.7 · Productos, stock y movimientos
   ================================================================ */
.tabs { display: flex; gap: 6px; padding: 4px; background: #E9ECF0; border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 42px; padding: 0 18px; border-radius: 9px; color: var(--ink-2); font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; }
.tabs a:hover { background: rgba(255, 255, 255, 0.6); color: var(--ink); }
.tabs a.is-active { background: #fff; color: var(--main); box-shadow: 0 1px 3px rgba(20, 30, 45, 0.12); }
.th-sub { display: block; font-size: 11px; font-weight: 600; opacity: .8; text-transform: none; }
.req { color: #B03A2E; }
.lista-total { margin: 0; text-align: right; }
.empty-acc { justify-content: center; }
.card-head-in { padding: 0 0 10px; border: 0; }
.card-head-in h2 { margin: 0; }

/* Estado del stock */
.stock-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; background: #E8F5EE; color: #1F7A4D; }
.stock-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stock-chip.is-bajo { background: #FDF0E3; color: #B4510E; }
.stock-chip.is-sin { background: #FBE9E7; color: #B03A2E; }
.stock-chip.is-na { background: #EEF0F3; color: var(--muted); }
.stock-chip.is-na::before { display: none; }
.stock-chip-lg { font-size: 17px; padding: 6px 14px; }
.stock-num { font-size: 17px; }
.stock-num.is-bajo { color: #B4510E; }
.stock-num.is-sin { color: #B03A2E; }
.stock-actual { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }

/* Lista de productos */
.tabla-prod .c-foto { width: 56px; }
.tabla-prod .c-foto img, .foto-vacia { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; display: block; background: var(--soft); }
.foto-vacia { display: flex; align-items: center; justify-content: center; color: #8FA3B8; }
.tabla-prod .c-nom a { color: var(--ink); font-weight: 600; text-decoration: none; }
.tabla-prod .c-nom a:hover { color: var(--main); text-decoration: underline; }
.prod-desc { display: block; font-size: 13px; margin-top: 2px; }
.tabla-prod td.num, .tabla-stock td.num, .tabla-mov td.num { white-space: nowrap; }
tr.is-inactive td { opacity: .62; }
.tabla-stock .c-nom .strong, .tabla-mov .c-nom a { display: block; }
.tabla-stock .c-nom .muted, .tabla-mov .c-nom .muted, .tabla-mov .c-motivo .muted { display: block; font-size: 13px; }
.tabla-stock .row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.tabla-mov .c-nom a { color: var(--ink); font-weight: 600; text-decoration: none; }
.tabla-mov .c-fecha { white-space: nowrap; font-size: 14px; }

/* Movimientos */
.mov-qty { font-variant-numeric: tabular-nums; }
.mov-qty.is-in { color: #1F7A4D; }
.mov-qty.is-out { color: #B03A2E; }
.mov-tipo { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #EEF0F3; color: var(--ink-2); white-space: nowrap; }
.mov-ingreso, .mov-inicial { background: #E8F5EE; color: #1F7A4D; }
.mov-salida, .mov-venta_web { background: #FBE9E7; color: #B03A2E; }
.mov-devolucion, .mov-devolucion_web { background: #EAF1FA; color: #24507F; }
.mov-ajuste, .mov-importacion { background: #FDF0E3; color: #B4510E; }
.fecha-filtro { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.fecha-filtro input { width: auto; min-width: 150px; }

/* Resumen de stock */
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi.is-on { border-color: var(--main); box-shadow: 0 0 0 2px rgba(34, 56, 79, 0.15); }
.stock-alerta .attn { gap: 4px; }

/* Ventana de ingreso o ajuste */
.mover-dialog[open] { gap: 14px; }
.mover-dialog .book-head { align-items: flex-start; gap: 10px; }
.mover-dialog .book-head h2 { margin: 0 0 2px; font-size: 19px; }
.seg-tipo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.seg-tipo-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 6px 0 4px; }
.seg-opt { position: relative; display: block; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt > span { display: flex; flex-direction: column; gap: 3px; height: 100%; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; }
.seg-opt strong { font-size: 15px; }
.seg-opt small { font-size: 13px; color: var(--muted); line-height: 1.3; }
.seg-opt input:checked + span { border-color: var(--main); background: var(--soft); box-shadow: 0 0 0 2px rgba(34, 56, 79, 0.12); }
.seg-opt input:focus-visible + span { outline: 3px solid rgba(44, 90, 140, 0.35); outline-offset: 2px; }
.mover-prev { display: block; margin-top: 6px; font-size: 14px; font-weight: 700; color: var(--muted); }
.mover-prev.is-in { color: #1F7A4D; }
.mover-prev.is-out { color: #B03A2E; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { min-height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.chip:hover { background: var(--soft); border-color: #C9D8E8; }

/* Importar */
.import-pasos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.ip { position: relative; display: flex; flex-direction: column; gap: 10px; padding-top: 22px; }
.ip h2 { margin: 0; }
.ip p { margin: 0; }
.ip-num { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-weight: 700; font-size: 17px; }
.ip-alt { font-size: 14px; text-align: center; }
.ip-cols { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--ink-2); }
.dropzone-sm { min-height: 92px; }
.dropzone.is-ready { border-style: solid; border-color: #1F7A4D; background: #F1FBF4; color: #1F7A4D; }
.import-res { display: flex; flex-direction: column; gap: 12px; border-left: 4px solid #1F7A4D; }
.import-res h2, .import-res h3, .import-res p { margin: 0; }
.import-res h3 { font-size: 16px; }
.import-cifras { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ic { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 12px; background: #F4F6F8; }
.ic strong { font-size: 26px; line-height: 1.1; }
.ic span { font-size: 13px; color: var(--muted); font-weight: 600; }
.ic-ok strong { color: #1F7A4D; }
.ic-up strong { color: #24507F; }
.ic-err { background: #FBE9E7; }
.ic-err strong { color: #B03A2E; }
.import-err { margin: 0; padding-left: 20px; max-height: 260px; overflow: auto; font-size: 14px; color: #8E2B17; display: flex; flex-direction: column; gap: 4px; }

/* Foto del producto */
.prod-foto { object-fit: cover; }

/* Cotización: agregar productos */
.items-add { display: flex; flex-wrap: wrap; gap: 10px; }
.items-add .btn { flex: 1 1 200px; min-height: 48px; }
.items-table td.c-desc { position: relative; }
.prod-link { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--soft-ink); }
.prod-link > svg { flex: 0 0 auto; }
.prod-link [data-prod-chip-txt], .prod-stock { white-space: nowrap; }
.prod-link [data-prod-chip-txt] { padding: 2px 8px; border-radius: 6px; background: var(--soft); }
.prod-stock { color: #1F7A4D; }
.prod-link.is-short .prod-stock { color: #B03A2E; padding: 2px 8px; border-radius: 6px; background: #FBE9E7; }
.prod-unlink { margin-left: auto; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.prod-unlink:hover { background: #F1F2F4; color: var(--ink); }

/* Lista de productos (ventana y sugerencias al escribir) */
.prod-item, .prod-sug-item { flex-direction: row; align-items: center; gap: 12px; text-align: left; width: 100%; }
.pi-foto { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238FA3B8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8l-9-5-9 5 9 5 9-5zM3 8v8l9 5 9-5V8M12 13v8'/%3E%3C/svg%3E") center no-repeat; }
.pi-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pi-txt strong { overflow-wrap: anywhere; }
.pi-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.pi-side strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pi-stock { font-size: 13px; color: #1F7A4D; font-weight: 600; white-space: nowrap; }
.pi-stock.is-sin { color: #B03A2E; }
.prod-dialog { width: min(640px, calc(100vw - 32px)); height: min(720px, calc(100vh - 48px)); max-height: none; }
.prod-dialog .prod-list { flex: 1 1 auto; min-height: 0; }
.prod-list.is-loading { opacity: .55; }
.prod-tip { margin: -4px 0 0; }
.prod-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.prod-foot .btn { min-width: 120px; min-height: 48px; }
.prod-item.is-added { animation: prodOk .9s ease; }
@keyframes prodOk { 0% { background: #DDF3E6; border-color: #1F7A4D; } 100% { background: #fff; } }
.prod-sug { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% - 4px); max-height: 320px; overflow-y: auto; padding: 6px; background: #fff; border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 14px 36px rgba(20, 30, 45, 0.18); }
.prod-sug.is-float { position: fixed; right: auto; top: 0; z-index: 90; max-height: 340px; }
.prod-sug-head { padding: 4px 8px 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.prod-sug-item { display: flex; padding: 8px; border: 0; border-radius: 10px; background: none; font: inherit; color: var(--ink); cursor: pointer; }
.prod-sug-item + .prod-sug-item { border-top: 1px solid #F0F1F3; border-radius: 0; }
.prod-sug-item:hover, .prod-sug-item.is-sel { background: var(--soft); border-radius: 10px; }
.prod-sug-item .pi-foto { width: 38px; height: 38px; }
.prod-sug-item .muted { font-size: 13px; }

/* Tablet */
@media (max-width: 1024px) {
	.import-pasos { grid-template-columns: minmax(0, 1fr); }
	.ip { padding-top: 18px; }
}

/* Celular */
@media (max-width: 760px) {
	.tabs { width: 100%; }
	.tabs a { flex: 1 0 auto; justify-content: center; padding: 0 14px; font-size: 14px; }
	.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: auto; }
	.kpis-3 .kpi-label { min-height: 0; }
	.kpis-3 .kpi .kpi-monto { font-size: 24px; }
	.fecha-filtro { flex: 1 1 140px; }
	.fecha-filtro input { min-width: 0; flex: 1 1 auto; }
	.seg-tipo-3 { grid-template-columns: minmax(0, 1fr); }
	.import-cifras { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.items-add .btn { flex: 1 1 100%; }

	.tabla-prod tr { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "foto code stock" "foto nom nom" "unit pen usd"; align-items: start; }
	.tabla-prod td.c-foto { grid-area: foto; }
	.tabla-prod td.c-code { grid-area: code; font-size: 14px; }
	.tabla-prod td.c-stock { grid-area: stock; justify-self: end; }
	.tabla-prod td.c-nom { grid-area: nom; font-size: 16px; }
	.tabla-prod td.c-unit { grid-area: unit; }
	.tabla-prod td.c-pen { grid-area: pen; }
	.tabla-prod td.c-usd { grid-area: usd; text-align: right; }
	.tabla-prod td.c-unit, .tabla-prod td.c-pen, .tabla-prod td.c-usd { padding-top: 8px !important; border-top: 1px solid #ECEEF1 !important; font-weight: 700; }
	.tabla-prod td[data-label]::before, .tabla-stock td[data-label]::before, .tabla-mov td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

	.tabla-stock tr { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "nom nom estado" "stock min min" "acc acc acc"; align-items: center; }
	.tabla-stock td.c-nom { grid-area: nom; font-size: 16px; }
	.tabla-stock td.c-estado { grid-area: estado; justify-self: end; align-self: start; }
	.tabla-stock td.c-stock { grid-area: stock; }
	.tabla-stock td.c-min { grid-area: min; text-align: right; }
	.tabla-stock td.c-acc { grid-area: acc; padding-top: 8px !important; border-top: 1px solid #ECEEF1 !important; }
	.tabla-stock .row-actions { justify-content: stretch; }
	.tabla-stock .row-actions .btn { flex: 1 1 0; min-height: 46px; }

	.tabla-mov tr { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "tipo cant saldo" "nom nom nom" "doc doc doc" "motivo motivo fecha"; align-items: center; gap: 6px 14px; }
	.tabla-mov td.c-tipo { grid-area: tipo; }
	.tabla-mov td.c-cant { grid-area: cant; text-align: right; }
	.tabla-mov td.c-saldo { grid-area: saldo; text-align: right; }
	.tabla-mov td.c-nom { grid-area: nom; font-size: 16px; }
	.tabla-mov td.c-doc { grid-area: doc; font-size: 14px; }
	.tabla-mov td.c-motivo { grid-area: motivo; font-size: 14px; }
	.tabla-mov td.c-fecha { grid-area: fecha; text-align: right; align-self: end; font-size: 13px; }
	.tabla-mov .mov-qty { font-size: 18px; }

	.prod-dialog, .mover-dialog { width: 100vw; max-width: 100vw; margin: auto auto 0; border-radius: 18px 18px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
	.prod-dialog { height: 88vh; }
	.mover-dialog { max-height: 92vh; overflow-y: auto; }
	.prod-sug { position: static; margin-top: 6px; max-height: 280px; box-shadow: 0 6px 18px rgba(20, 30, 45, 0.12); }
	.pi-side strong { font-size: 15px; }
	.items-table tr.is-prod { border-color: #C9D8E8; }
}
@media (max-width: 760px) {
	.view-products .head-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
	.view-products .head-actions .btn { min-height: 46px; padding: 0 8px; font-size: 14px; }
	.view-products .head-actions .btn-accent { display: none; }
	.prod-sug .prod-sug-item { flex-wrap: wrap; row-gap: 4px; }
	.prod-sug .pi-txt { flex: 1 1 calc(100% - 52px); }
	.prod-sug .pi-side { flex: 1 1 100%; flex-direction: row; justify-content: space-between; align-items: baseline; padding-left: 50px; }
	.items-table td.c-desc textarea { width: 100%; }
	.tabla-mov .mov-tipo { white-space: normal; }
	.tabla-mov td.c-tipo { align-self: end; }
}
.tabla-prod td.c-code { white-space: nowrap; }

/* ================================================================
   V2.0 · Vista previa, fotos, descuentos, vencimiento, paquetes
   ================================================================ */
.pill-expired { background: #FDF0E3; color: #9A4A0C; }
.venc-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #EEF3F8; color: var(--soft-ink); white-space: nowrap; }
.venc-chip.is-alerta { background: #FDF0E3; color: #B4510E; }
.venc-nota { margin: 0 0 4px; font-size: 14px; color: #9A4A0C; }
.venc-link { font-weight: 700; font-size: 14px; color: #9A4A0C; }
.sub-h { margin: 18px 0 6px; font-size: 16px; color: var(--main); }
.sub-h:first-of-type { margin-top: 4px; }
.check-top { margin-top: 26px; }

/* Botón Vista previa */
.btn-preview { border-color: var(--main); color: var(--main); font-weight: 700; }
.btn-preview:hover { background: var(--soft); }
.barra-btn.barra-prev { color: var(--main); border-color: var(--main); }

/* Ventana de vista previa */
.preview-dlg { width: min(980px, calc(100vw - 32px)); height: calc(100vh - 32px); max-height: none; padding: 0; border: 0; border-radius: 16px; overflow: hidden; background: #E9ECF0; box-shadow: 0 20px 60px rgba(20, 30, 45, 0.35); }
.preview-dlg[open] { display: flex; flex-direction: column; }
.preview-dlg::backdrop { background: rgba(20, 30, 45, 0.6); }
.prev-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--main); color: #fff; }
.prev-back { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.12); color: #fff; cursor: pointer; }
.prev-tit { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.prev-tit h2 { margin: 0; font-size: 18px; color: #fff; }
.prev-tit .muted { color: rgba(255, 255, 255, 0.78); font-size: 13px; }
.prev-zoom { display: flex; gap: 6px; }
.prev-zoom .icon-btn { width: 44px; height: 44px; border-radius: 10px; background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 22px; font-weight: 700; }
.prev-body { flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; padding: 14px 12px; position: relative; }
.prev-pages { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.prev-page { display: block; background: #fff; box-shadow: 0 2px 12px rgba(20, 30, 45, 0.18); border-radius: 2px; max-width: none; }
.prev-frame { width: 100%; height: calc(100vh - 200px); border: 0; background: #fff; }
.prev-error { padding: 30px 10px; text-align: center; color: #8E2B17; font-weight: 600; }
.prev-load { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-weight: 600; }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #CBD3DD; border-top-color: var(--main); animation: apmSpin .8s linear infinite; }
@keyframes apmSpin { to { transform: rotate(360deg); } }
.prev-foot { display: flex; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
.prev-foot .btn { flex: 1 1 0; min-height: 50px; justify-content: center; }
html.prev-abierta, html.prev-abierta body { overflow: hidden; }

/* Fotos en la línea */
.desc-wrap { display: flex; gap: 10px; align-items: flex-start; }
.desc-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.line-photo { flex: 0 0 auto; width: 64px; height: 64px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; cursor: zoom-in; }
.line-photo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.line-extra { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 6px; }
.items-table .line-extra input { min-height: 36px; padding: 6px 8px; font-size: 13px; color: var(--ink-2); }
.items-table th.c-disc, .items-table td.c-disc { width: 92px; }
.items-table td.c-disc input { text-align: right; }
.fotos-pdf { margin-bottom: 8px; }
.photo-dlg { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0; background: rgba(10, 14, 20, 0.92); }
.photo-dlg[open] { display: flex; align-items: center; justify-content: center; }
.photo-dlg img { max-width: calc(100vw - 24px); max-height: calc(100vh - 90px); object-fit: contain; background: #fff; border-radius: 8px; }
.photo-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }

/* Fotos sin recortes en listas */
.tabla-prod .c-foto img, .foto-vacia, .pi-foto { object-fit: contain !important; background-color: #fff; border: 1px solid var(--line); }
.pi-foto { width: 56px; height: 56px; }
.prod-sug-item .pi-foto { width: 48px; height: 48px; }
.tabla-prod .c-foto, .tabla-pkg .c-foto { width: 68px; }
.tabla-prod .c-foto img, .tabla-pkg .c-foto img, .tabla-pkg .foto-vacia { width: 56px; height: 56px; border-radius: 10px; display: block; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.tabla-pkg .foto-vacia { display: flex; align-items: center; justify-content: center; color: #8FA3B8; }
.tabla-pkg .c-nom a { color: var(--ink); font-weight: 600; text-decoration: none; }
.prod-foto { object-fit: contain; background: #fff; }

/* Descuento general y validez */
.disc-label input { width: 92px; text-align: right; }
.disc-ayuda { grid-column: 1 / -1; font-size: 12px; line-height: 1.35; margin-top: -4px; }
.dias-pair { display: flex; align-items: center; gap: 10px; }
.dias-pair input { width: 96px; flex: 0 0 auto; }
.dias-pair .muted { font-size: 14px; font-weight: 600; }

/* Firma: subir imagen */
.sig-acc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.sig-ajustes { max-width: 440px; }

/* Pie de página (Ajustes) */
.pie-imgs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.pie-img { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pie-img img { width: 84px; height: 56px; object-fit: contain; }
.pie-banner { display: block; width: 100%; max-height: 90px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 8px; }

/* Paquetes */
.prod-item.is-pkg { border-color: #C9D8E8; background: #F7FAFD; }
.pkg-pick { display: flex; flex-direction: column; gap: 0; border: 1px solid #C9D8E8; border-radius: 10px; overflow: hidden; }
.pkg-pick .prod-item { border: 0; border-radius: 0; }
.pkg-veces { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 6px 10px; background: #EEF3F8; font-size: 14px; font-weight: 600; color: var(--soft-ink); }
.pkg-veces button { width: 40px; height: 40px; border: 1px solid #C9D8E8; border-radius: 10px; background: #fff; color: var(--main); font-size: 20px; font-weight: 700; cursor: pointer; }
.pkg-veces input { width: 56px; min-height: 40px; text-align: center; }
.pkg-buscar { position: relative; }
.pkg-res { max-height: 300px; overflow-y: auto; margin-top: 6px; }
.pkg-add { color: var(--accent); font-size: 14px; }
.pkg-comps { display: flex; flex-direction: column; gap: 8px; }
.pkg-comp { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pkg-comp .pi-txt { flex: 1 1 auto; }
.pkg-qty { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.pkg-qty input { width: 72px; min-height: 42px; text-align: center; }
.pkg-vacio { margin: 4px 0 0; }
.pkg-suma { margin: 6px 0 0; font-weight: 700; color: var(--main); }
.detr-pct input { max-width: 140px; }

@media (max-width: 1024px) {
	.preview-dlg { width: 100vw; height: 100vh; max-width: 100vw; margin: 0; border-radius: 0; }
	.barra-btn.barra-prev { min-width: 70px; }
}
@media (max-width: 760px) {
	.prev-foot { flex-wrap: wrap; gap: 6px; }
	.prev-foot .btn { flex: 1 1 calc(50% - 6px); min-height: 48px; font-size: 15px; padding: 0 8px; }
	.prev-foot .btn-accent { flex-basis: 100%; order: -1; }
	.prev-body { padding: 10px 6px; }
	.prev-tit h2 { font-size: 17px; }
	.items-table tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; grid-template-areas: "desc desc del" "qty price price" "disc amount amount"; }
	.items-table td.c-disc { grid-area: disc; width: auto; }
	.items-table td.c-disc input { min-height: 46px; text-align: right; }
	.items-table td.c-amount { align-self: end; }
	.line-photo { width: 72px; height: 72px; }
	.line-extra { grid-template-columns: minmax(0, 1fr) 88px; }
	.items-table .line-extra input { min-height: 40px; font-size: 14px; }
	.disc-label input { width: 100px; }
	.pkg-comp { flex-wrap: wrap; }
	.pkg-comp .pi-txt { flex-basis: calc(100% - 120px); }
	.tabla-pkg tr { grid-template-columns: 60px minmax(0, 1fr) auto; grid-template-areas: "foto code pen" "foto nom nom" "modo modo cant"; align-items: start; }
	.tabla-pkg td.c-foto { grid-area: foto; } .tabla-pkg td.c-code { grid-area: code; }
	.tabla-pkg td.c-nom { grid-area: nom; font-size: 16px; } .tabla-pkg td.c-pen { grid-area: pen; text-align: right; font-weight: 700; }
	.tabla-pkg td.c-modo { grid-area: modo; font-size: 14px; } .tabla-pkg td.c-cant { grid-area: cant; text-align: right; }
	.tabla-pkg td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
	.tabla-prod tr { grid-template-columns: 64px minmax(0, 1fr) auto; }
	.tabla-prod .c-foto img, .tabla-prod .foto-vacia { width: 60px; height: 60px; }
	.view-invoice-edit .barra-btn { padding: 4px 1px; }
}
.book-list > * { flex-shrink: 0; }

/* Tablet y PC angosta: la descripción tiene poco ancho, foto más chica y código/unidad a partes iguales. */
@media (min-width: 761px) and (max-width: 1280px) {
	.line-photo { width: 48px; height: 48px; }
	.desc-wrap { gap: 8px; }
	.line-extra { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
	.items-table .line-extra input { padding: 6px; }
}

/* Cuando el detalle queda angosto (PC con panel lateral, tablet), cada línea pasa a 2 filas:
   arriba la descripción a todo lo ancho; abajo cantidad, precio, descuento e importe. */
@media (min-width: 761px) {
	.items-scroll { container-type: inline-size; }
	@container (max-width: 900px) {
		.items-table { min-width: 0; display: block; }
		.items-table thead { display: none; }
		.items-table tbody { display: block; }
		.items-table tr { display: grid; grid-template-columns: 110px minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1fr) 44px; grid-template-areas: "desc desc desc desc del" "qty price disc amount ."; gap: 8px 10px; align-items: end; padding: 12px; border-top: 1px solid #ECEEF1; }
		.items-table tbody tr:first-child { border-top: 0; }
		.items-table td { border: 0; padding: 0 !important; width: auto !important; }
		.items-table td.c-desc { grid-area: desc; }
		.items-table td.c-qty { grid-area: qty; }
		.items-table td.c-price { grid-area: price; }
		.items-table td.c-disc { grid-area: disc; }
		.items-table td.c-amount { grid-area: amount; text-align: right; padding-bottom: 11px !important; }
		.items-table td.c-del { grid-area: del; align-self: start; }
		.items-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; }
		.items-table td.c-amount::before { text-align: right; }
		.items-table td.c-qty { display: block; }
		.line-photo { width: 64px; height: 64px; }
		.line-extra { grid-template-columns: minmax(0, 1fr) 120px; }
	}
}

/* V2.2: texto debajo de la firma y WhatsApp */
.sig-textos { display: grid; gap: 10px; margin-top: 14px; }
.sig-textos .field { margin: 0; }
.wa-listo { padding: 14px; border: 1px solid #BFE3CB; border-radius: 12px; background: #F1FAF4; }
.wa-listo p { margin: 0; }
.wa-listo-tit { color: #14652F; font-size: 16px; }
.wa-pasos { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); font-size: 15px; }
.wa-extra { display: grid; gap: 4px; padding-top: 10px; border-top: 1px dashed var(--line); }
.wa-extra p { margin: 0; }

/* V2.6: campana de avisos, número en el menú, etiquetas y franja de vencimiento */
.campana { position: relative; flex: 0 0 auto; width: 42px; height: 42px; margin: -4px 8px 0 auto; border: 0; border-radius: 12px; background: rgba(255,255,255,0.1); color: #fff; display: grid; place-items: center; cursor: pointer; }
.campana:hover { background: rgba(255,255,255,0.18); }
.campana.tiene svg { animation: campana-mueve 2.4s ease-in-out 1s 2; transform-origin: 50% 10%; }
@keyframes campana-mueve { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-14deg); } }
.campana-num { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #E5372B; color: #fff; font-size: 12px; font-weight: 800; line-height: 18px; text-align: center; border: 2px solid var(--main); box-sizing: border-box; }
.side { position: relative; }
@media (min-width: 761px) and (min-width: 1025px) {
	.side > .campana { position: absolute; top: 24px; right: 14px; margin: 0; }
	.side .brand { padding-right: 52px; }
}
.nav-num { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #E5372B; color: #fff; font-size: 12px; font-weight: 800; line-height: 22px; text-align: center; }
.nav-abajo a { position: relative; }
.nav-abajo .nav-num { position: absolute; top: 4px; left: 50%; margin-left: 6px; height: 18px; min-width: 18px; line-height: 18px; font-size: 11px; padding: 0 5px; }
.venc-chip.is-rojo { background: #FDE8E6; color: #B42318; }
.pill-expired { background: #FDE8E6; color: #B42318; }
.c-estado .venc-chip { margin-top: 4px; }
.campana-lista { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 12px; max-height: 60vh; overflow-y: auto; }
.campana-item { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: inherit; }
.campana-item:hover { border-color: var(--line-2); background: var(--soft); }
.campana-item .venc-chip { justify-self: start; }
.campana-pie { display: flex; gap: 16px; padding-top: 8px; border-top: 1px solid var(--line); font-weight: 700; }
.campana-vacia { padding: 12px 0 20px; margin: 0; }
.venc-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 16px; border-radius: 12px; border: 1px solid; }
.venc-banner > svg { flex: 0 0 auto; }
.venc-banner-txt { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.venc-banner-txt span { font-size: 14px; }
.venc-banner form { margin: 0; }
.venc-banner.is-rojo { background: #FEF1F0; border-color: #F5B7B1; color: #8F1D14; }
.venc-banner.is-alerta { background: #FFF6EC; border-color: #F6CFA4; color: #8A420B; }
.venc-banner-btn { white-space: nowrap; background: #fff; }
.venc-banner.is-rojo .venc-banner-btn { background: #C8321F; border-color: #C8321F; color: #fff; }
@media (max-width: 760px) {
	.venc-banner { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; }
	.venc-banner > form, .venc-banner > .venc-banner-btn { grid-column: 1 / -1; }
	.venc-banner-btn { width: 100%; min-height: 44px; }
}

/* V2.7: cantidad en su propia fila en el celular */
@media (max-width: 760px) {
	.items-table tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; grid-template-areas: "desc desc del" "qty qty qty" "price disc disc" "amount amount amount"; }
	.items-table td.c-qty { grid-template-columns: 56px minmax(0, 1fr) 56px; gap: 8px; }
	.items-table td.c-qty input { font-size: 19px; font-weight: 700; min-height: 50px; }
	.qty-btn { height: 50px; font-size: 26px; }
	.items-table td.c-price, .items-table td.c-disc { grid-area: auto; }
	.items-table td.c-price { grid-area: price; }
	.items-table td.c-disc { grid-area: disc; }
	.items-table td.c-amount { grid-area: amount; align-self: auto; }
}

/* V2.7: sugerencias de clientes, repetir última cotización, usados recientemente */
.cli-sug { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 32px rgba(20, 30, 45, 0.18); overflow: hidden; max-height: 50vh; overflow-y: auto; }
.cli-sug-head { padding: 8px 12px; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--soft); }
.cli-sug-item { display: grid; gap: 2px; width: 100%; padding: 11px 12px; border: 0; border-top: 1px solid #ECEEF1; background: #fff; text-align: left; font: inherit; cursor: pointer; min-height: 52px; }
.cli-sug-item:hover, .cli-sug-item:focus { background: #F3F7FB; }
.cli-sug-item span { font-size: 13px; color: var(--muted); }
.repetir { display: grid; gap: 10px; padding: 14px; margin: 4px 0 8px; border: 1px solid #BFD6EC; border-radius: 12px; background: #F1F7FD; }
.repetir p { margin: 0; color: #1F3F63; }
.repetir-acc { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
@media (max-width: 760px) { .repetir-acc .btn { flex: 1 1 100%; min-height: 46px; } }
.pick-tit { padding: 10px 4px 2px; font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); flex-shrink: 0; }
@media (max-width: 760px) {
	.line-photo { width: 60px; height: 60px; }
	.line-extra { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
}
@media (max-width: 760px) {
	.items-table tr.has-photo .desc-wrap { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px 10px; align-items: start; }
	.items-table tr.has-photo .desc-main { display: contents; }
	.items-table tr.has-photo .line-photo { width: 64px; height: 64px; grid-column: 1; grid-row: 1; }
	.items-table tr.has-photo .prod-link { grid-column: 2; grid-row: 1; align-self: center; }
	.items-table tr.has-photo .desc-main > textarea, .items-table tr.has-photo .line-extra { grid-column: 1 / -1; }
	.line-extra { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
}

/* Sistema y Mi cuenta */
.sys-users { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.sys-user { border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.sys-user > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; min-height: 64px; }
.sys-user > summary::-webkit-details-marker { display: none; }
.sys-user[open] > summary { border-bottom: 1px solid var(--line); }
.sys-user.is-off { opacity: .75; }
.sys-av { width: 40px; height: 40px; border-radius: 50%; background: var(--soft); color: var(--soft-ink); display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.sys-u-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sys-u-txt strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sys-u-txt .muted { font-size: 14px; }
.sys-pill { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: #E7F5EC; color: #166534; flex: 0 0 auto; }
.sys-pill.is-off { background: #FDECEC; color: #912018; }
.sys-u-form { padding: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.sys-u-form:first-of-type { border-top: 0; }
.sys-u-form .grid-2, .sys-u-form .field { width: 100%; }
.sys-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.sys-inline .field { flex: 1 1 220px; margin: 0; }
.sys-bk { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.sys-bk-row { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.sys-bk-row > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.sys-bk-row .muted { font-size: 13px; word-break: break-all; }
.sys-bk-act { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.sys-bk-act form { margin: 0; }
.sys-restore { flex: 1 1 100%; order: 3; }
.sys-restore > summary { list-style: none; display: inline-flex; }
.sys-restore > summary::-webkit-details-marker { display: none; }
.sys-restore[open] form { margin-top: 10px; padding: 12px; background: #FFF7ED; border-radius: 12px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.sys-restore .check { align-items: flex-start; }
@media (min-width: 760px) {
	.sys-bk-row { flex-direction: row; align-items: center; justify-content: space-between; }
	.sys-restore { flex: 0 0 auto; order: 0; }
}
.me-name { color: inherit; text-decoration: none; }
.me-name:hover { text-decoration: underline; }
@media (max-width: 520px) { .view-system .tabs a { padding: 0 12px; font-size: 14px; } }

/* Formato corto / largo, tipo y columnas opcionales */
.fmt-box { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; background: #FAFBFC; display: flex; flex-direction: column; gap: 10px; }
.fmt-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.fmt-row .label { font-weight: 700; font-size: 15px; }
.fmt-ayuda { margin: -4px 0 0; }
.fmt-cols { display: flex; flex-wrap: wrap; gap: 0 18px; }
.seg-mini { display: inline-flex; background: #E9ECF0; border-radius: 11px; padding: 3px; gap: 3px; }
.seg-mini label, .seg-mini button { position: relative; margin: 0; }
.seg-mini input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-mini span, .seg-mini button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border-radius: 9px; font: inherit; font-weight: 700; font-size: 15px; color: var(--ink-2); border: 0; background: transparent; cursor: pointer; }
.seg-mini input:checked + span, .seg-mini button[aria-pressed="true"] { background: #fff; color: var(--main); box-shadow: 0 1px 3px rgba(20, 30, 45, .14); }
.seg-mini input:focus-visible + span, .seg-mini button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.seg-xs button { min-height: 32px; padding: 0 12px; font-size: 13px; }
.line-fmt { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.line-long textarea { margin-top: 6px; font-size: 13.5px; line-height: 1.45; min-height: 90px; }
.line-brand, .line-entrega { display: none; }
.items.show-marca .line-brand, .items.show-entrega .line-entrega { display: block; }
.items-table .line-extra { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
tr.is-larga .desc-wrap .line-photo { width: 76px; height: 76px; }
.cond-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.cond-chip { position: relative; }
.cond-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cond-chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 99px; background: #fff; font-weight: 600; font-size: 15px; color: var(--ink-2); }
.cond-chip input:checked + span { background: var(--main); border-color: var(--main); color: #fff; }
.cond-chip input:checked + span::before { content: "✓"; font-weight: 800; }
.cond-chip input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.items-table tr.has-photo .line-fmt, .items-table tr.has-photo .line-long { grid-column: 1 / -1; }
.line-long textarea { width: 100%; }
@media (max-width: 760px) { tr.is-larga .desc-wrap .line-photo { width: 64px; height: 64px; } }
.brand-logo.is-wide { width: auto; max-width: 150px; height: 40px; border-radius: 8px; padding: 4px 8px; }
@media (max-width: 760px) { .brand-logo.is-wide { max-width: 110px; height: 34px; } .brand-logo.is-wide + .brand-text { display: none; } }

/* V1.2: con logo, el menú muestra solo el logo (sin el nombre de la empresa al lado) */
.brand.has-logo { flex-direction: column; align-items: flex-start; gap: 10px; }
.brand.has-logo .brand-logo.is-wide { width: auto; max-width: 100%; height: auto; max-height: 64px; }
.brand.has-logo .brand-sub { padding-left: 2px; }
@media (max-width: 980px) {
	.brand.has-logo { flex-direction: row; align-items: center; flex: 0 0 auto; }
	.brand.has-logo .brand-sub { display: none; }
	.brand.has-logo .brand-logo.is-wide { max-width: 150px; height: 38px; max-height: none; }
}
@media (max-width: 760px) {
	.brand.has-logo .brand-logo.is-wide { max-width: 140px; height: 36px; }
}
