/* =====================================================================
   InvertSell · sistema de diseño
   Azul tinta para la marca, naranja para todo lo que es una oferta.
   Tipografías: Bricolage Grotesque (titulares) + Manrope (texto).
   ===================================================================== */
:root {
  --ink: #0F1B2D;
  --ink-2: #334155;
  --muted: #475569;
  --muted-2: #64748B;
  --line: #E3E7EE;
  --line-2: #CBD5E1;
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --brand: #1D4ED8;
  --brand-dark: #1E3A8A;
  --brand-soft: #EEF3FF;
  --brand-line: #BFD0FF;
  --offer: #EA580C;
  --offer-text: #C2410C;
  --offer-dark: #9A3412;
  --offer-soft: #FFF7F0;
  --offer-line: #FED7AA;
  --ok: #166534;
  --ok-soft: #DCFCE7;
  --warn: #9A3412;
  --warn-soft: #FFEDD5;
  --danger: #B91C1C;
  --danger-soft: #FEF2F2;
  --danger-line: #FECACA;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 24px 48px -28px rgba(15, 27, 45, .35);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', 'Manrope', system-ui, sans-serif;
}

/* ---------- base ---------- */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body.is-app { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; }
body.is-app * { font-family: inherit; }
body.is-app .fa, body.is-app .fas, body.is-app .far, body.is-app .fab { font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Brands'; }
body.is-app .fab { font-family: 'Font Awesome 6 Brands'; }
body.is-app a { color: var(--brand); }
body.is-app a:hover { color: var(--brand-dark); }
.is-display, .is-app h1, .is-app h2.is-display { font-family: var(--display); letter-spacing: -.02em; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand-line); outline-offset: 2px; }

/* ---------- cabecera ---------- */
.is-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.is-header.is-dark { background: var(--ink); border-bottom-color: #1E2D45; color: #fff; }
.is-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.is-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none !important; color: var(--ink) !important; }
.is-dark .is-brand { color: #fff !important; }
.is-brand-name { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -.5px; }
.is-brand-name b { color: var(--brand); font-weight: 800; }
.is-dark .is-brand-name b { color: #93B4FF; }
.is-brand-tag { font-size: 11px; font-weight: 800; color: #FDBA74; letter-spacing: .5px; margin-left: 4px; }
.is-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.is-nav a.is-navlink { text-decoration: none; color: var(--ink-2); font-weight: 700; font-size: 15px; padding: 10px 14px; border-radius: 10px; }
.is-nav a.is-navlink:hover { background: var(--bg); color: var(--ink); }
.is-nav a.is-navlink.is-active { background: var(--brand-soft); color: var(--brand); }
.is-dark .is-nav a.is-navlink { color: #CBD5E1; }
.is-dark .is-nav a.is-navlink:hover { background: #1E2D45; color: #fff; }
.is-dark .is-nav a.is-navlink.is-active { background: #1E2D45; color: #fff; }
.is-user { position: relative; }
.is-user > button { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 0; cursor: pointer; padding: 4px; border-radius: 999px; color: inherit; font-weight: 700; }
.is-avatar { width: 40px; height: 40px; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; object-fit: cover; flex: none; }
.is-dark .is-avatar { background: #FB923C; color: var(--ink); }
.is-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; display: none; z-index: 60; }
.is-menu.is-open { display: block; }
.is-menu .is-menu-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.is-menu .is-menu-head small { display: block; color: var(--muted); font-weight: 500; }
.is-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2) !important; text-decoration: none; font-weight: 600; }
.is-menu a:hover { background: var(--bg); }
.is-menu a.is-danger { color: var(--danger) !important; }
.btn.is-menu-toggle { display: none; }
@media (max-width: 760px) {
  .btn.is-menu-toggle { display: inline-flex; }
  .is-nav.is-collapsible { display: none; width: 100%; flex-direction: column; align-items: stretch; }
  .is-nav.is-collapsible.is-open { display: flex; }
}

/* ---------- botones ---------- */
.btn { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 11px 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 700; font-size: 15px; line-height: 1.2; cursor: pointer; text-decoration: none !important; transition: background .15s, box-shadow .15s, transform .05s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff !important; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-offer { background: var(--offer); color: #fff !important; }
.btn-offer:hover { background: var(--offer-text); }
.btn-dark { background: var(--ink); color: #fff !important; }
.btn-secondary { background: #fff; color: var(--ink) !important; border-color: var(--line-2); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--muted) !important; border-color: var(--line); }
.btn-danger { background: #fff; color: var(--danger) !important; border-color: var(--danger-line); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-lg { min-height: 54px; padding: 15px 24px; font-size: 17px; border-radius: 12px; }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-only { width: 44px; padding: 0; }

/* ---------- tarjetas, chips ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card-pad { padding: 24px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #F1F5F9; color: var(--ink-2); white-space: nowrap; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-brand { background: var(--brand-soft); color: var(--brand); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-offer { background: #FFEDD5; color: var(--offer-dark); }
.chip-muted { background: #F1F5F9; color: var(--muted); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.badge-count { background: var(--offer); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; }
.price { font-family: var(--display); font-weight: 800; color: var(--offer-text); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--muted); }
.meta b { color: var(--ink); }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.split { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.layout { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.layout > .main { flex: 999 1 560px; min-width: 0; }
.layout > .side { flex: 1 1 360px; min-width: 0; }
.page-title { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(28px, 4vw, 36px); letter-spacing: -1px; line-height: 1.1; }
.section-title { margin: 0; font-size: 20px; font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.stat-label { font-size: 14px; font-weight: 700; color: var(--muted); }
.stat-value { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1.1; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }
.segmented { align-self: flex-start; display: inline-flex; flex-wrap: wrap; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.segmented button { border: 0; background: transparent; color: var(--ink-2); font-weight: 700; font-size: 14px; padding: 9px 14px; border-radius: 9px; cursor: pointer; min-height: 38px; }
.segmented button.is-on { background: var(--ink); color: #fff; }
.segmented a { color: var(--ink-2) !important; font-weight: 700; font-size: 14px; padding: 9px 14px; border-radius: 9px; text-decoration: none; min-height: 38px; box-sizing: border-box; display: inline-flex; align-items: center; }
.segmented a.is-on { background: var(--ink); color: #fff !important; }

/* ---------- formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; color: var(--ink); }
.field .hint { font-weight: 500; font-size: 13px; color: var(--muted); }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel], .field input[type=url], .field input[type=number], .field input[type=datetime-local], .field input[type=date], .field select, .field textarea {
  font: inherit; font-weight: 500; font-size: 16px; color: var(--ink); background: #fff; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; width: 100%; box-sizing: border-box; min-height: 46px;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.choice { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: 14px; background: #fff; border: 1px solid var(--line-2); cursor: pointer; font-weight: 500; }
.choice input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.choice b { display: block; font-size: 17px; }
.choice span { color: var(--muted); }
.choice:has(input:checked) { border: 2px solid var(--brand); padding: 17px; background: var(--brand-soft); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { font-weight: 600; font-size: 14px; background: #fff; color: var(--ink-2); border: 1px solid var(--line-2); padding: 8px 14px; border-radius: 999px; cursor: pointer; min-height: 38px; }
.pill.is-on { background: var(--brand-soft); color: var(--brand); border: 2px solid var(--brand); padding: 7px 13px; font-weight: 800; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.steps span { height: 6px; border-radius: 99px; background: var(--line); }
.steps span.is-on { background: var(--brand); }
.alert { padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.alert-info { background: var(--bg); color: var(--muted); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- ventanas (modal y panel lateral) ---------- */
.is-modal { position: fixed; inset: 0; z-index: 80; background: rgba(15, 27, 45, .55); display: none; align-items: flex-start; justify-content: center; padding: 32px 16px; overflow-y: auto; }
.is-modal.is-open { display: flex; }
.is-modal-box { background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 640px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.is-modal-box.is-wide { max-width: 1080px; }
.is-modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.is-modal-head h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 22px; }
.is-modal-body { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.is-modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
body.is-locked { overflow: hidden; }

/* ---------- tablas ---------- */
.table-box { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 760px; }
.table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; padding: 14px 14px; border-bottom: 1px solid var(--line); background: #FBFCFD; }
.table td { padding: 16px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-best td { background: var(--offer-soft); }

/* ---------- notificaciones ---------- */
.is-bell { position: relative; }
.is-bell .badge-count { position: absolute; top: -6px; right: -6px; }
.is-notifs { position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, 92vw); max-height: 440px; overflow-y: auto; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: none; z-index: 60; }
.is-notifs.is-open { display: block; }
.is-notifs .head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.is-notifs a.item { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink) !important; }
.is-notifs a.item:hover { background: var(--bg); }
.is-notifs a.item small { color: var(--muted); display: block; }

/* ---------- avisos (toast) ---------- */
.is-toast { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.is-toast div { background: var(--ink); color: #fff; padding: 14px 18px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; }
.is-toast div.is-error { background: var(--danger); }
.is-toast div.is-ok { background: var(--ok); }

/* ---------- SweetAlert con la identidad ---------- */
.swal2-popup { font-family: var(--font) !important; border-radius: 20px !important; }
.swal2-title { font-family: var(--display) !important; color: var(--ink) !important; }
.swal2-confirm { background: var(--brand) !important; border-radius: 10px !important; font-weight: 700 !important; }
.swal2-cancel { background: #fff !important; color: var(--ink) !important; border: 1px solid var(--line-2) !important; border-radius: 10px !important; font-weight: 700 !important; }

/* ---------- pie ---------- */
.is-footer { border-top: 1px solid var(--line); margin-top: 56px; }
.is-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding-top: 28px; padding-bottom: 28px; font-size: 14px; color: var(--muted-2); }
.is-footer nav { display: flex; flex-wrap: wrap; gap: 18px; }
.is-footer a { color: var(--muted) !important; }

/* ---------- móvil y tablet ---------- */
@media (max-width: 760px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .is-header .wrap { padding-top: 10px; padding-bottom: 10px; }
  .is-brand-name { font-size: 20px; }
  .is-brand-tag { display: none; }
  /* Paneles de la cabecera: ocupan el ancho de la pantalla y nunca se salen */
  .is-notifs, .is-menu { position: fixed; left: 10px; right: 10px; top: 64px; width: auto; min-width: 0; max-height: calc(100vh - 80px); overflow-y: auto; }
  .is-modal { padding: 10px; }
  .is-modal-head, .is-modal-body, .is-modal-foot { padding-left: 16px; padding-right: 16px; }
  .is-modal-foot .btn { flex: 1; }
  .card-pad { padding: 18px; }
  .segmented { width: 100%; box-sizing: border-box; }
  .segmented button { flex: 1 1 auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 28px; }
  .row > .btn:not(.icon-only) { flex: 1 1 auto; }
  .is-toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
@media (max-width: 380px) { .stats { grid-template-columns: minmax(0, 1fr); } }
/* Comparador de ofertas en formato tarjeta en pantallas estrechas */
@media (max-width: 820px) {
  .table-box { overflow: visible; border: 0; background: transparent; }
  .table.is-cards { min-width: 0; }
  .table.is-cards thead { display: none; }
  .table.is-cards, .table.is-cards tbody, .table.is-cards tr, .table.is-cards td { display: block; width: 100%; box-sizing: border-box; }
  .table.is-cards tr { background: #fff; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 12px; padding: 6px 0; }
  .table.is-cards tr.is-best { border-color: var(--offer-line); }
  .table.is-cards tr.is-best td { background: transparent; }
  .table.is-cards tr.is-best { background: var(--offer-soft); }
  .table.is-cards td { border: 0; padding: 8px 16px; }
  .table.is-cards td[data-label] { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
  .table.is-cards td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
  .table.is-cards td.td-acc { text-align: left; }
  .table.is-cards .acciones-of { flex-direction: row; justify-content: flex-start; align-items: center; flex-wrap: wrap; }
}
