/* Caudal — cotizador y agenda para gasfíteres. Tema oscuro (por defecto) y claro, con acento azul agua. */
:root {
  --bg: #080D12;
  --surface: #101820;
  --surface-2: #162029;
  --surface-3: #1F2B36;
  --line: #22303C;
  --line-strong: #33434F;
  --text: #EEF1F6;
  --muted: #A5ADBA;
  --faint: #6D7686;
  --accent: #38BDF8;
  --accent-2: #7DD3FC;
  --accent-ink: #04222E;
  --accent-text: #38BDF8;
  --alert: #FF6B5E;
  --ok: #4FD8A0;
  --warn: #FFB547;
  --info: #A99BFF;
  --violet: #A99BFF;
  --wa: #3DDC84;
  --topbar: rgba(8, 13, 18, .86);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, .8);
  --serif: 'Sora', system-ui, sans-serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --surface-2: #F1F3F7;
  --surface-3: #E6EAF0;
  --line: #E1E5EC;
  --line-strong: #CBD2DD;
  --text: #141820;
  --muted: #555E6D;
  --faint: #8A93A3;
  --accent: #0EA5E9;
  --accent-2: #38BDF8;
  --accent-ink: #FFFFFF;
  --accent-text: #0369A1;
  --alert: #D93B2B;
  --ok: #138A5A;
  --warn: #B26A00;
  --info: #5B47D6;
  --violet: #5B47D6;
  --wa: #128C4A;
  --topbar: rgba(243, 245, 248, .9);
  --shadow: 0 24px 60px -28px rgba(20, 30, 50, .3);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 450 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.r { text-align: right; }
.ok-t { color: var(--ok); } .alert-t { color: var(--alert); } .warn-t { color: var(--warn); } .accent-t { color: var(--accent-text); }
h1, h2, h3 { font-weight: 500; }
.linky { cursor: pointer; }
.linky:hover { color: var(--accent-text); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .92em; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none !important; }
.brand-mark { width: 38px; height: 38px; flex: none; color: var(--accent-text); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name { font: 700 21px/1 var(--serif); letter-spacing: -.6px; }
.brand-sub { display: block; font: 500 10.5px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-top: 5px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 14px; border-right: 1px solid var(--line); background: radial-gradient(120% 40% at 0 0, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%), var(--surface); display: flex; flex-direction: column; gap: 22px; overflow-y: auto; }
.side .brand { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 8.5px 12px; border-radius: 11px; color: var(--muted); text-decoration: none; position: relative; white-space: nowrap; font-weight: 500; }
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--surface-3); color: var(--text); }
.nav a.on::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav .badge { margin-left: auto; }
.nav-sep { height: 1px; background: var(--line); margin: 8px 10px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.me-chip .who { font-weight: 600; line-height: 1.2; }
.me-chip .role { font-size: 12px; color: var(--faint); }
.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px clamp(16px, 3vw, 32px); border-bottom: 1px solid var(--line); background: var(--topbar); backdrop-filter: blur(12px); min-height: 60px; }
.topbar .clock { font: 600 17px/1 var(--sans); font-variant-numeric: tabular-nums; }
.topbar .date { color: var(--faint); font-size: 13px; }
.topbar .mobile-brand { display: none; }
.main { min-width: 0; padding: 24px clamp(16px, 3vw, 32px) 90px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font: 600 clamp(26px, 2.8vw, 34px)/1.12 var(--serif); margin: 0; letter-spacing: -1px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mobile-nav { display: none; }

/* ---------- Componentes ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 15px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14.5px; white-space: nowrap; transition: background .15s, border-color .15s, transform .08s; text-decoration: none !important; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 40%, transparent); background: color-mix(in srgb, var(--alert) 7%, transparent); }
.btn.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.btn.wa { color: var(--wa); border-color: color-mix(in srgb, var(--wa) 40%, transparent); background: color-mix(in srgb, var(--wa) 8%, transparent); }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: 13.5px; border-radius: 9px; }
.btn.lg { min-height: 54px; padding: 12px 22px; font-size: 17px; border-radius: 14px; }
.btn.block { width: 100%; }
.icon-btn { width: 40px; padding: 0; }
.btn.sm.icon-btn { width: 32px; }
.kbd { font: 600 10.5px/1 var(--sans); padding: 3px 5px; border-radius: 5px; border: 1px solid currentColor; opacity: .6; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.badge.alert { background: var(--alert); color: #fff; }
.badge.gold { background: var(--accent); color: var(--accent-ink); }
.badge.ok { background: var(--ok); color: #06200F; }
.badge.warn { background: var(--warn); color: #2A1B00; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill.gold { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill.alert { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 45%, transparent); }
.pill.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.pill.violet { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 45%, transparent); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; color: #16110C; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar.lg { width: 46px; height: 46px; font-size: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card h2 { font: 600 17px/1.25 var(--serif); letter-spacing: -.3px; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card h2 .spacer { flex: 1; }
.card h2 small { font: 500 13px var(--sans); color: var(--faint); }
.card.flush { padding: 6px 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.span2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px; position: relative; overflow: hidden; min-width: 0; }
.kpi .label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.kpi .value { font: 600 clamp(21px, 1.8vw, 26px)/1.15 var(--serif); letter-spacing: -.6px; margin-top: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .value small { font: 500 14px var(--sans); color: var(--faint); }
.kpi .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.kpi.hl { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%), var(--surface); }
.kpi.bad .value { color: var(--alert); }
.kpi.link { cursor: pointer; }
.kpi.link:hover { border-color: var(--line-strong); }
.up { color: var(--ok); } .down { color: var(--alert); }
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.row:last-child { border-bottom: 0; }
.row.link { cursor: pointer; border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.row.link:hover { background: var(--surface-2); }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.row .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.row .ico.alert { color: var(--alert); background: color-mix(in srgb, var(--alert) 12%, transparent); }
.row .ico.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.row .ico.info { color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); }
.row .ico.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.row .ico.gold { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.empty { padding: 28px 12px; text-align: center; color: var(--faint); }
.note { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); color: var(--text); font-size: 14px; }
.note.warn { background: color-mix(in srgb, var(--warn) 9%, transparent); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.note.alert { background: color-mix(in srgb, var(--alert) 8%, transparent); border-color: color-mix(in srgb, var(--alert) 32%, transparent); }
.note.info { background: color-mix(in srgb, var(--info) 8%, transparent); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select { width: auto; max-width: 220px; }
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 460px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-box input { padding-left: 38px !important; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 13px; border-radius: 99px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { font-size: 11.5px; opacity: .7; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 13px; border-radius: 9px; font-size: 13.5px; font-weight: 600; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 16px; overflow-x: auto; }
.tabs-line button { border: 0; background: transparent; color: var(--muted); padding: 10px 14px; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; display: inline-flex; gap: 7px; align-items: center; }
.tabs-line button.on { color: var(--text); border-color: var(--accent); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .c { text-align: center; }
.tbl tr.link { cursor: pointer; }
.tbl tr.link:hover td { background: var(--surface-2); }
.tbl tr.sel td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.tbl .nm { font-weight: 600; }
.tbl .sub { font-size: 12.5px; color: var(--faint); }
.tbl input, .tbl select { min-height: 36px; padding: 6px 10px; }
.tbl td.num-in { width: 120px; }
.tbl input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }
.table-wrap { overflow-x: auto; }
.bar-track { height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.bar-track i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.level { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.level .bar-track { flex: 1; height: 6px; position: relative; overflow: visible; }
.level .bar-track i { background: var(--ok); }
.level.warn .bar-track i { background: var(--warn); }
.level.alert .bar-track i { background: var(--alert); }
.level .bar-track b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--warn); border-radius: 1px; }
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line-strong); transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked + span { background: color-mix(in srgb, var(--ok) 25%, transparent); border-color: var(--ok); }
.switch input:checked + span::before { transform: translateX(17px); background: var(--ok); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; margin: 0; }
.dl dt { color: var(--faint); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.big-num { font: 500 34px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- Formularios ---------- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form.g3f { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full, .check.full, .form .full { grid-column: 1 / -1; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field small { color: var(--faint); font-size: 12.5px; }
.form-sec { grid-column: 1 / -1; font: 700 11.5px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); outline: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 2px; flex: none; }
.check small { display: block; color: var(--faint); font-size: 12.5px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches input { display: none; }
.swatches span { display: block; width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatches input:checked + span { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 11px; overflow: hidden; background: var(--bg); }
.stepper button { width: 34px; height: 36px; border: 0; background: var(--surface-2); font-size: 18px; color: var(--muted); display: grid; place-items: center; }
.stepper button:hover { background: var(--surface-3); color: var(--text); }
.stepper input { width: 64px !important; min-height: 36px !important; border: 0 !important; border-radius: 0 !important; text-align: center; padding: 4px !important; box-shadow: none !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); max-height: 320px; overflow-y: auto; }
.picker-list button { display: flex; width: 100%; text-align: left; gap: 10px; align-items: center; padding: 9px 12px; border: 0; background: transparent; border-bottom: 1px solid var(--line); }
.picker-list button:last-child { border-bottom: 0; }
.picker-list button:hover, .picker-list button.hi { background: var(--surface-2); }

/* ---------- Modales y avisos ---------- */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(8, 6, 4, .66); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px 16px; overflow-y: auto; animation: fade .15s; }
.modal { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow); animation: pop .18s; }
.modal.wide { width: min(880px, 100%); }
.modal.xwide { width: min(1120px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 0; }
.modal-head h2 { flex: 1; margin: 0; font: 600 20px/1.2 var(--serif); letter-spacing: -.4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.modal-foot .left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90; padding: 12px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--shadow); animation: pop .2s; max-width: calc(100% - 32px); }
.toast.err { background: var(--alert); color: #fff; }

/* ---------- Ingreso con PIN ---------- */
.lock { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(70% 50% at 50% 0, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%), var(--bg); }
.lock-box { width: min(380px, 100%); text-align: center; }
.lock-box .brand-mark { width: 64px; height: 64px; margin: 0 auto; }
.lock-title { font: 700 36px/1.1 var(--serif); margin: 16px 0 4px; letter-spacing: -1.2px; }
.lock-sub { color: var(--muted); margin: 0 0 26px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin-bottom: 26px; height: 16px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.keypad button { height: 66px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font: 500 26px var(--sans); transition: background .1s; }
.keypad button:hover { background: var(--surface-2); }
.keypad button:active { background: var(--surface-3); }
.keypad button.fn { font-size: 15px; color: var(--muted); background: transparent; border-color: transparent; }
.demo-pins { margin-top: 24px; font-size: 13px; color: var(--faint); line-height: 1.8; }
.demo-pins b { color: var(--muted); font-weight: 600; }

/* ---------- Vender ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 16px; align-items: start; }
.pos-search { position: sticky; top: 72px; z-index: 5; background: var(--bg); padding-bottom: 10px; }
.pos-search .search-box { max-width: none; }
.pos-search input { min-height: 54px !important; font-size: 17px; border-radius: 14px !important; }
.pos-search .search-box svg { width: 20px; height: 20px; }
.pos-hint { font-size: 12.5px; color: var(--faint); margin-top: 7px; display: flex; gap: 14px; flex-wrap: wrap; }
.results { display: flex; flex-direction: column; gap: 6px; }
.res { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 10px 14px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); text-align: left; transition: border-color .12s, background .12s; }
.res:hover, .res.hi { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--surface-2); }
.res .nm { font-weight: 600; line-height: 1.3; }
.res .meta { font-size: 12.5px; color: var(--faint); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.res .st { text-align: right; font-size: 13px; white-space: nowrap; }
.res .pr { text-align: right; font: 600 16px var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 84px; }
.res .pr small { display: block; font-size: 11.5px; font-weight: 500; color: var(--ok); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 9px; }
.tile { text-align: left; padding: 11px 12px; min-height: 86px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, background .15s, transform .08s; }
.tile:hover { border-color: var(--line-strong); background: var(--surface-2); }
.tile:active { transform: scale(.97); }
.tile .nm { font-weight: 600; line-height: 1.25; font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .pr { margin-top: auto; color: var(--accent-text); font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 700; }
.ticket { position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 92px); }
.ticket-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.ticket-head .top { display: flex; align-items: center; gap: 8px; }
.ticket-head h2 { margin: 0; font: 500 22px/1.1 var(--serif); flex: 1; }
.cust-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 11px; border: 1px dashed var(--line-strong); background: transparent; text-align: left; }
.cust-btn.set { border-style: solid; background: var(--surface-2); }
.cust-btn .nm { font-weight: 600; }
.cust-btn .meta { font-size: 12.5px; color: var(--muted); }
.ticket-body { overflow-y: auto; flex: 1; min-height: 120px; }
.tline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.tline .nm { font-weight: 600; line-height: 1.3; font-size: 14px; }
.tline .meta { font-size: 12px; color: var(--faint); }
.tline .tot { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tline .ctl { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tline .price-btn { border: 0; background: transparent; color: var(--muted); font-size: 13px; padding: 4px 6px; border-radius: 7px; font-variant-numeric: tabular-nums; }
.tline .price-btn:hover { background: var(--surface-2); color: var(--text); }
.tline .price-btn.disc { color: var(--ok); }
.tline .warn-stock { font-size: 12px; color: var(--warn); }
.ticket-foot { border-top: 1px solid var(--line); padding: 12px 16px 14px; }
.tot-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); padding: 2px 0; font-variant-numeric: tabular-nums; }
.tot-row.big { font: 500 30px/1.2 var(--serif); color: var(--text); margin-top: 4px; align-items: baseline; }
.tot-row.big span:first-child { font: 600 15px var(--sans); color: var(--muted); }
.ticket-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.ticket-actions .full { grid-column: 1 / -1; }
.pos-mbar { display: none; }
.parked { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay-grid button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 13px; border: 1px solid var(--line-strong); background: var(--surface-2); font-weight: 600; font-size: 13.5px; }
.pay-grid button svg { width: 22px; height: 22px; color: var(--muted); }
.pay-grid button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pay-grid button.on svg { color: var(--accent); }
.pay-grid button:disabled { opacity: .35; }
.pay-total { text-align: center; padding: 6px 0 16px; }
.pay-total .big-num { font-size: 44px; }
.pay-lines .row { padding: 8px 4px; }
.quick-cash { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.change-box { margin-top: 14px; padding: 14px; border-radius: 14px; text-align: center; background: color-mix(in srgb, var(--ok) 10%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.change-box.due { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.change-box b { display: block; font: 500 32px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.done-box { text-align: center; padding: 10px 0 4px; }
.done-box .ok-circle { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.done-box .ok-circle svg { width: 32px; height: 32px; }

/* ---------- Fichas ---------- */
.sheet-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.sheet-head .grow > .muted { font-size: 13.5px; }
.stat-strip { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 16px; background: var(--surface); }
.stat-strip > div { flex: 1 1 130px; padding: 11px 13px; min-width: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.stat-strip .l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.stat-strip .v { font: 600 17px/1.3 var(--sans); font-variant-numeric: tabular-nums; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lines-editor .ln { display: grid; grid-template-columns: minmax(0, 1fr) 110px 120px 110px 34px; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.lines-editor .ln .nm { font-weight: 600; font-size: 14px; line-height: 1.3; }
.lines-editor .ln .sub { font-size: 12px; color: var(--faint); }
.lines-editor .ln .c { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; }
.lines-editor .ln.head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 0 0 6px; }
.count-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 130px; gap: 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.count-row .nm { font-weight: 600; }
.count-row .th { color: var(--faint); font-size: 13px; text-align: right; }
.count-row input { text-align: right; font-size: 17px; min-height: 46px; }
.count-row.done .nm::before { content: '✓ '; color: var(--ok); }
.area-h { font: 700 12px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 20px 4px 6px; }
.denoms { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.denoms label { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; font-weight: 600; font-variant-numeric: tabular-nums; }
.denoms input { text-align: right; }
.alert-list .row .title { white-space: normal; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 28px; text-align: center; color: var(--muted); cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); }
.label-preview { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Gráficos ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--faint); font-size: 11px; font-family: var(--sans); }
.chart .bar { fill: var(--accent); }
.chart .bar.dim { fill: var(--accent); opacity: .42; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; font-size: 14px; }
.hbar > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .bar-track { grid-column: 1 / -1; margin-bottom: 8px; }
.hbar b { font-weight: 600; }
.heat { display: grid; grid-template-columns: repeat(auto-fit, minmax(28px, 1fr)); gap: 4px; }
.heat div { border-radius: 6px; padding: 8px 0 6px; text-align: center; font-size: 11px; color: var(--faint); background: var(--surface-2); }
.heat div b { display: block; height: 42px; margin: 0 5px 5px; border-radius: 4px; background: var(--accent); }

/* ---------- Impresión ---------- */
#print { display: none; }
@media print {
  body > *:not(#print) { display: none !important; }
  body { background: #fff !important; }
  #print { display: block; color: #000; background: #fff; }
  #print.ticket { font: 11.5px/1.35 'Courier New', monospace; width: 72mm; margin: 0 auto; }
  #print.ticket h1 { font: 700 15px/1.2 'Courier New', monospace; text-align: center; margin: 0; }
  #print.ticket .biz { text-align: center; margin-bottom: 6px; }
  #print.ticket .biz b { font-size: 14px; display: block; }
  #print .c { text-align: center; }
  #print hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
  #print .l { display: flex; justify-content: space-between; gap: 8px; }
  #print .b { font-weight: 700; }
  #print .big { font-size: 15px; font-weight: 700; }
  #print.sheet { font: 12px/1.45 Helvetica, Arial, sans-serif; width: auto; }
  #print.sheet .doc-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 14px; }
  #print.sheet .biz b { font-size: 17px; display: block; }
  #print.sheet .doc-box { border: 2px solid #000; padding: 8px 14px; text-align: center; min-width: 190px; }
  #print.sheet .doc-box b { display: block; font-size: 16px; }
  #print.sheet table { width: 100%; border-collapse: collapse; margin: 12px 0; }
  #print.sheet th { text-align: left; border-bottom: 1.5px solid #000; padding: 5px 6px; font-size: 11px; text-transform: uppercase; }
  #print.sheet td { border-bottom: 1px solid #ccc; padding: 5px 6px; vertical-align: top; }
  #print.sheet .r { text-align: right; }
  #print.sheet .totals { margin-left: auto; width: 280px; }
  #print.sheet .totals .l { padding: 3px 0; }
  #print.sheet .totals .l.b { border-top: 1.5px solid #000; font-size: 15px; padding-top: 6px; }
  #print.sheet .meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 20px; }
  #print.sheet .terms { margin-top: 18px; font-size: 11px; color: #333; }
  #print.labels { width: auto; font-family: Helvetica, Arial, sans-serif; }
  #print.labels .sheet-labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
  #print.labels .lab { border: 1px dashed #999; padding: 3mm 3.5mm; height: 33mm; overflow: hidden; break-inside: avoid; display: flex; flex-direction: column; }
  #print.labels .lab .n { font-size: 9.5pt; font-weight: 700; line-height: 1.15; max-height: 2.4em; overflow: hidden; }
  #print.labels .lab .s { font-size: 7.5pt; color: #333; }
  #print.labels .lab .p { font-size: 17pt; font-weight: 800; margin-top: auto; }
  #print.labels .lab svg { height: 9mm; width: 100%; }
  #print.labels .thermal .lab { width: 50mm; height: 25mm; border: 0; page-break-after: always; padding: 1.5mm 2mm; }
  #print.labels .thermal .lab .p { font-size: 13pt; }
  #print.labels .thermal .lab svg { height: 7mm; }
  @page { margin: 8mm; }
  body[data-print="ticket"] { width: 80mm; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1240px) {
  .pos { grid-template-columns: minmax(0, 1fr) 380px; }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar .mobile-brand { display: flex; }
  .topbar .clock, .topbar .date { display: none; }
  .mobile-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--topbar); backdrop-filter: blur(12px); border-top: 1px solid var(--line); overflow-x: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 2px; }
  .mobile-nav a { flex: 1 0 62px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; border-radius: 10px; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; position: relative; white-space: nowrap; }
  .mobile-nav a.on { color: var(--accent-text); background: var(--surface-2); }
  .mobile-nav a svg { width: 21px; height: 21px; }
  .mobile-nav .badge { position: absolute; top: 1px; right: calc(50% - 22px); min-width: 17px; height: 17px; font-size: 10px; padding: 0 4px; }
  .pos { grid-template-columns: minmax(0, 1fr); }
  .ticket { position: static; max-height: none; }
  .pos-search { top: 60px; }
  .pos-hint { display: none; }
  .search-box { min-width: 0; }
  .topbar .nowrap { display: none; }
  .pos-mbar:not([hidden]) { display: flex; align-items: center; gap: 10px; position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 25; padding: 13px 16px; border-radius: 14px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px; box-shadow: var(--shadow); }
  .g2, .g3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .form, .form.g3f { grid-template-columns: 1fr; }
  .lines-editor .ln { grid-template-columns: minmax(0, 1fr) 90px 34px; }
  .lines-editor .ln .c, .lines-editor .ln .hide-m { display: none; }
  .count-row { grid-template-columns: minmax(0, 1fr) 110px; }
  .count-row .th { display: none; }
  .hide-m { display: none !important; }
}
@media (max-width: 560px) {
  .main { padding-top: 16px; }
  .kpi .value { font-size: 22px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .res { grid-template-columns: minmax(0, 1fr) auto; }
  .res .st { display: none; }
  .modal-back { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; border: 0; }
  .pay-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Caudal ---------- */
.bell { position: relative; }
.bell .dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--alert); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; padding: 0 3px; }
.notes-pop { position: fixed; top: 64px; right: 16px; z-index: 70; width: min(420px, calc(100% - 32px)); max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: var(--shadow); animation: pop .15s; }
.notes-pop .row { padding: 12px 14px; }
.notes-pop .row.unread { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.flash { animation: flash 1.2s; }
@keyframes flash { 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); } }

/* Agenda */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-head .range { font: 600 18px var(--serif); letter-spacing: -.4px; min-width: 190px; }
.week { display: grid; grid-template-columns: 54px repeat(var(--days, 7), minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.week .dh { position: sticky; top: 60px; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: 9px 8px; text-align: center; font-size: 12.5px; color: var(--muted); font-weight: 600; cursor: pointer; }
.week .dh b { display: block; font: 700 19px/1.1 var(--serif); color: var(--text); }
.week .dh.today b { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); margin-top: 2px; }
.week .dh.closed { color: var(--faint); }
.week .corner { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 60px; z-index: 3; }
.week .times { position: relative; }
.week .times span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.week .col { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hh) - 1px), var(--line) calc(var(--hh) - 1px), var(--line) var(--hh)); }
.week .col.off { background-color: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.week .col .work { position: absolute; left: 0; right: 0; background: var(--surface); }
.week .now-line { position: absolute; left: -1px; right: 0; height: 2px; background: var(--alert); z-index: 2; }
.week .now-line::before { content: ''; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--alert); }
.ev { position: absolute; left: 3px; right: 3px; border-radius: 9px; padding: 5px 7px; font-size: 12px; line-height: 1.25; overflow: hidden; cursor: pointer; border: 1px solid transparent; border-left-width: 3px; z-index: 1; transition: transform .08s; }
.ev:hover { z-index: 4; transform: scale(1.02); }
.ev b { display: block; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.visita { background: color-mix(in srgb, var(--info) 16%, var(--surface)); border-color: color-mix(in srgb, var(--info) 35%, transparent); border-left-color: var(--info); }
.ev.trabajo { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 40%, transparent); border-left-color: var(--accent); }
.ev.bloqueo { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface-3) 6px 12px); border-color: var(--line-strong); border-left-color: var(--faint); }
.ev.solicitada { border-style: dashed; border-left-style: solid; border-left-color: var(--warn); }
.ev.confirmada::after { content: '✓'; position: absolute; top: 4px; right: 6px; color: var(--ok); font-weight: 800; }
.ev.terminada { opacity: .55; }
.ev.en_curso, .ev.en_camino { box-shadow: 0 0 0 2px var(--accent); }
.day-list .row { align-items: flex-start; }
.day-list .time { width: 64px; flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-list .time small { display: block; font-weight: 500; color: var(--faint); font-size: 12px; }
.slot-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-grid button { padding: 7px 11px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface-2); font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.slot-grid button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.steps .btn { flex: 1 1 140px; }
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline .ti { position: relative; padding: 0 0 12px; font-size: 13.5px; }
.timeline .ti::before { content: ''; position: absolute; left: -17px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--line-strong); }
.timeline .ti.ok::before { background: var(--ok); border-color: var(--ok); }
.timeline .ti.warn::before { background: var(--warn); border-color: var(--warn); }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos img { width: 92px; height: 92px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }
.sigpad { width: 100%; height: 170px; border: 1.5px dashed var(--line-strong); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; }

/* Mensajes */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; height: calc(100vh - 170px); min-height: 520px; background: var(--surface); }
.conv-list { border-right: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.conv-list .tools { padding: 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.conv { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv:hover, .conv.on { background: var(--surface-2); }
.conv .nm { font-weight: 700; display: flex; gap: 6px; align-items: center; }
.conv .pv { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .tm { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.conv.unread .pv { color: var(--text); font-weight: 600; }
.ch-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--muted); }
.ch-ic.whatsapp { background: color-mix(in srgb, var(--wa) 16%, transparent); color: var(--wa); }
.ch-ic.web { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }
.ch-ic.llamada { background: color-mix(in srgb, var(--violet) 16%, transparent); color: var(--violet); }
.chat { display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chat-head > .grow { flex: 1 1 220px; }
.chat-head .btn.sm { flex: none; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; background: radial-gradient(circle at 20% 10%, color-mix(in srgb, var(--accent) 4%, transparent), transparent 40%), var(--bg); }
.bubble { max-width: 76%; padding: 9px 13px 6px; border-radius: 15px; white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; }
.bubble.in { background: var(--surface-2); align-self: flex-start; border-top-left-radius: 4px; }
.bubble.out { background: color-mix(in srgb, var(--wa) 18%, var(--surface)); align-self: flex-end; border-top-right-radius: 4px; }
.bubble.note { align-self: center; max-width: 88%; background: color-mix(in srgb, var(--violet) 12%, var(--surface)); border: 1px dashed color-mix(in srgb, var(--violet) 40%, transparent); font-size: 13.5px; }
.bubble .tm { display: block; font-size: 11px; color: var(--faint); text-align: right; margin-top: 3px; }
.bubble .photos img { width: 120px; height: 120px; }
.day-sep { align-self: center; font-size: 11.5px; color: var(--faint); background: var(--surface-2); padding: 3px 10px; border-radius: 99px; margin: 6px 0; }
.compose { border-top: 1px solid var(--line); padding: 10px 12px; }
.compose textarea { min-height: 46px; max-height: 160px; }
.quick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
.quick button { flex: none; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--faint); text-align: center; padding: 20px; }

/* Cotizador */
.qedit { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.qside { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 12px; }
.qsec { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); margin-bottom: 12px; }
.qsec-h { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.qsec-h input { font-weight: 700; border-color: transparent !important; background: transparent !important; }
.qsec-h input:focus { border-color: var(--accent) !important; }
.qline { display: grid; grid-template-columns: 22px minmax(0, 1fr) 84px 70px 110px 110px 32px; gap: 8px; align-items: center; padding: 7px 12px; border-bottom: 1px solid var(--line); }
.qline:last-child { border-bottom: 0; }
.qline input { min-height: 36px !important; padding: 6px 9px !important; }
.qline .t { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.qline .kind { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; cursor: pointer; }
.qline .kind.mano_obra { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-text); }
.qline .kind.material { background: color-mix(in srgb, var(--info) 20%, transparent); color: var(--info); }
.qline .kind.otro { background: var(--surface-3); color: var(--muted); }
.qline.head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding-top: 9px; padding-bottom: 5px; }
.qadd { padding: 10px 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qadd .picker { flex: 1; min-width: 220px; }
.sum-row { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; font-variant-numeric: tabular-nums; }
.sum-row.big { font: 700 26px/1.3 var(--serif); letter-spacing: -.6px; margin-top: 6px; }
.sum-row.muted { color: var(--muted); }
.margin-bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; display: flex; margin: 8px 0 4px; }
.margin-bar i { display: block; height: 100%; }

/* Documento de cotización (app, enlace público e impresión) */
.qdoc { background: #fff; color: #1b1f27; border-radius: 18px; padding: clamp(20px, 4vw, 44px); font: 14px/1.5 var(--sans); max-width: 860px; margin: 0 auto; box-shadow: 0 30px 80px -40px rgba(0,0,0,.5); }
.qdoc .qd-top { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 3px solid #1b1f27; }
.qdoc .qd-brand { display: flex; gap: 14px; align-items: center; }
.qdoc .qd-logo { width: 54px; height: 54px; border-radius: 14px; background: #0B1B26; color: #38BDF8; display: grid; place-items: center; flex: none; }
.qdoc .qd-logo svg { width: 30px; height: 30px; }
.qdoc .qd-name { font: 700 22px/1.1 'Sora', sans-serif; letter-spacing: -.6px; }
.qdoc .qd-sub { font-size: 12.5px; color: #5b6472; }
.qdoc .qd-num { text-align: right; }
.qdoc .qd-num .k { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #5b6472; font-weight: 700; }
.qdoc .qd-num .n { font: 700 26px/1.1 'Sora', sans-serif; }
.qdoc .qd-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 20px; margin: 20px 0; }
.qdoc .qd-meta .k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #8a93a3; font-weight: 700; }
.qdoc .qd-title { font: 700 20px/1.25 'Sora', sans-serif; letter-spacing: -.4px; margin: 6px 0 8px; }
.qdoc .qd-intro { color: #394150; margin: 0 0 18px; }
.qdoc table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.qdoc th { text-align: left; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #8a93a3; font-weight: 700; padding: 8px 6px; border-bottom: 1.5px solid #1b1f27; }
.qdoc td { padding: 9px 6px; border-bottom: 1px solid #e6e9ef; vertical-align: top; }
.qdoc .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qdoc .sec td { font-weight: 700; background: #f5f7fa; font-size: 13px; padding: 7px 6px; }
.qdoc .det { font-size: 12px; color: #6b7482; }
.qdoc .qd-tot { margin: 16px 0 0 auto; width: min(340px, 100%); }
.qdoc .qd-tot .l { display: flex; justify-content: space-between; padding: 4px 0; font-variant-numeric: tabular-nums; }
.qdoc .qd-tot .l.b { border-top: 2px solid #1b1f27; margin-top: 6px; padding-top: 10px; font: 700 22px 'Sora', sans-serif; }
.qdoc .qd-tot .l.dep { background: #E0F2FE; border-radius: 10px; padding: 8px 10px; margin-top: 8px; font-weight: 700; }
.qdoc .qd-box { margin-top: 22px; padding: 14px 16px; border-radius: 12px; background: #f5f7fa; font-size: 13px; color: #394150; white-space: pre-line; }
.qdoc .qd-box b { display: block; color: #1b1f27; margin-bottom: 4px; }
.qdoc .qd-foot { margin-top: 24px; padding-top: 14px; border-top: 1px solid #e6e9ef; font-size: 12px; color: #6b7482; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.qdoc .stamp { display: inline-block; padding: 6px 14px; border: 2px solid #138A5A; color: #138A5A; border-radius: 8px; font-weight: 800; letter-spacing: .1em; transform: rotate(-3deg); }
@media print {
  body[data-print="sheet"] #print { width: auto; }
  #print .qdoc { box-shadow: none; border-radius: 0; padding: 0; max-width: none; }
}
@media (max-width: 1100px) { .qedit { grid-template-columns: 1fr; } .qside { position: static; } }
@media (max-width: 1240px) { .inbox { grid-template-columns: 280px minmax(0, 1fr); } }
@media (max-width: 960px) {
  .inbox { grid-template-columns: 1fr !important; height: auto; min-height: 0; }
  .inbox.has-chat .conv-list { display: none; }
  .inbox:not(.has-chat) .chat { display: none; }
  .chat-msgs { min-height: 55vh; max-height: 62vh; }
  .week { --days: 1 !important; }
  .qline { grid-template-columns: 22px minmax(0, 1fr) 70px 32px; }
  .qline .hide-q { display: none; }
}
