/* ==========================================================================
   Propuestas ERP · Select Shop
   Identidad: negro y naranja Select Shop (#FD521A), Figtree.
   ========================================================================== */

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url("/fonts/figtree-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url("/fonts/figtree-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Marca */
  --brand: #fd521a;          /* naranja Select Shop: superficies, barras, acentos */
  --brand-ink: #c2410c;      /* naranja legible como texto sobre claro (≥4.5:1) */
  --brand-soft: #fff0e9;
  --brand-line: #ffd3c2;
  --ink: #0b0b0b;            /* negro Select Shop: botones primarios, paneles */
  --on-ink: #ffffff;

  /* Neutros cálidos */
  --bg: #f6f5f3;
  --surface: #ffffff;
  --surface-2: #f2f0ed;
  --border: #e6e2dd;
  --border-strong: #d3cdc6;
  --text: #141414;
  --muted: #5e5852;

  --ok: #157a4a;
  --ok-soft: #e4f4ec;
  --danger: #b42318;
  --danger-soft: #fdecea;

  --shadow-sm: 0 1px 2px rgb(20 14 8 / .05);
  --shadow: 0 1px 2px rgb(20 14 8 / .04), 0 4px 14px -6px rgb(20 14 8 / .10);
  --shadow-lg: 0 2px 4px rgb(20 14 8 / .04), 0 18px 40px -16px rgb(20 14 8 / .22);
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --font: "Figtree", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-ink: #ff7d52;
    --brand-soft: #2c1710;
    --brand-line: #5a2a18;
    --ink: #f3f1ee;
    --on-ink: #0b0b0b;
    --bg: #0e0e0f;
    --surface: #171718;
    --surface-2: #202022;
    --border: #2b2b2e;
    --border-strong: #3a3a3e;
    --text: #f3f1ee;
    --muted: #a7a19a;
    --ok: #4cc38a;
    --ok-soft: #12301f;
    --danger: #ff8a80;
    --danger-soft: #3a1917;
    --shadow-sm: none;
    --shadow: 0 1px 0 rgb(255 255 255 / .03);
    --shadow-lg: 0 18px 40px -16px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--border-strong) transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  font-feature-settings: "ss01" off;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--brand);
  accent-color: var(--brand);
}
::selection { background: rgb(253 82 26 / .22); color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: -0.02em; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--brand-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
.muted { color: var(--muted); }
.pequeno { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.ico { flex-shrink: 0; display: block; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- Botones y campos ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  background: var(--ink); color: var(--on-ink); font-weight: 650; cursor: pointer;
  transition: background-color .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.btn:hover { background: var(--brand); color: #0b0b0b; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; background: var(--ink); color: var(--on-ink); }
.btn-bloque { width: 100%; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); height: 38px; padding: 0 16px; font-weight: 550; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--text); }
.btn-ghost-peligro:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.btn-peligro { background: var(--danger); color: #fff; }
.btn-peligro:hover { background: #8f1c13; color: #fff; }
.btn-link { background: none; border: 0; color: var(--brand-ink); cursor: pointer; padding: 0; font-weight: 600; }
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn-link.peligro { color: var(--danger); }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 14px; }
.field input, .field select, .field textarea, td select, .buscar {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field input { height: 48px; padding: 0 14px; }
.field select { height: 48px; padding: 0 12px; }
.field textarea { padding: 12px 14px; resize: vertical; width: 100%; }
td select { height: 34px; padding: 0 8px; }
.field input::placeholder, .buscar::placeholder { color: var(--muted); opacity: .8; }
.field input:focus, .field select:focus, .field textarea:focus, .buscar:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgb(253 82 26 / .16);
}
.input-otp { font-variant-numeric: tabular-nums; font-size: 28px !important; font-weight: 700; letter-spacing: .35em; text-align: center; padding-left: .35em !important; }
.msg { font-size: 14px; border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 16px; }
.msg-error { background: var(--danger-soft); color: var(--danger); }
.msg-info { background: var(--brand-soft); color: var(--text); }

/* ---------- Acceso ---------- */
.pagina-login { background: var(--surface); }
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login-marca {
  position: relative; overflow: hidden;
  background: #0b0b0b; color: #f3f1ee;
  padding: clamp(28px, 5vw, 64px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
}
/* Franja naranja de marca */
.login-marca::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--brand);
}
.login-logo { height: 32px; width: auto; align-self: flex-start; }
.login-mensaje { max-width: 30ch; }
.login-mensaje h1 { font-size: clamp(34px, 4.6vw, 60px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.02; }
.login-mensaje h1::after { content: "."; color: var(--brand); }
.login-mensaje p { margin-top: 20px; font-size: 17px; color: #c9c3bc; max-width: 40ch; }
.login-legal { font-size: 13px; color: #9b958e; }
.login-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-form { width: 100%; max-width: 380px; }
.login-form h2 { font-size: 26px; font-weight: 750; }
.login-form .lead { color: var(--muted); margin: 8px 0 28px; }
.login-foot { display: flex; justify-content: space-between; margin-top: 18px; font-size: 14px; }
.login-note { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-marca { gap: 28px; padding: 28px 20px 34px; }
  .login-logo { height: 26px; }
  .login-mensaje h1 { font-size: 32px; }
  .login-mensaje p { font-size: 15px; margin-top: 12px; }
  .login-legal { display: none; }
  .login-panel { place-items: start center; padding: 32px 20px 48px; }
}

/* ---------- Estructura de la app ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-top: 3px solid var(--brand);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; min-width: 0; }
.brand img { height: 24px; width: auto; display: block; }
.brand-sep { width: 1px; height: 22px; background: var(--border-strong); }
.brand-nombre { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.user { display: flex; align-items: center; gap: 14px; font-size: 14px; min-width: 0; }
.user-email { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { max-width: 1240px; margin: 0 auto; padding: 0 20px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.nav a { position: relative; color: var(--muted); text-decoration: none; padding: 10px 2px 12px; margin-right: 18px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.nav a:hover { color: var(--text); }
.nav a.activo { color: var(--text); }
.nav a.activo::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }

main#app { max-width: 1240px; margin: 0 auto; padding: 36px 20px 72px; }
main#app section { margin-top: 48px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: 20px; font-weight: 700; }
.estado { text-align: center; padding: 96px 16px; color: var(--muted); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -0.03em; }
.page-head .sub { color: var(--muted); font-size: 16px; max-width: 62ch; margin-top: 8px; }
.acciones { display: flex; gap: 8px; }
.volver { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.volver:hover { color: var(--brand-ink); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.vacio { text-align: center; color: var(--muted); padding: 56px 20px; }

footer { max-width: 1240px; margin: 0 auto; padding: 28px 20px 44px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }
footer img { width: 20px; height: auto; opacity: .9; }

/* ---------- Proveedores ---------- */
.grid-prov { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.prov-card {
  color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: 10px; padding: 24px;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease), transform .3s var(--ease);
}
.prov-card:hover { border-color: var(--brand-line); box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.prov-card h2 { font-size: 20px; font-weight: 750; }
.prov-card .muted { font-size: 14px; }
.prov-mono {
  width: 48px; height: 48px; border-radius: 12px; margin-bottom: 6px;
  background: #0b0b0b; color: var(--brand); display: grid; place-items: center;
  font-weight: 800; font-size: 17px; letter-spacing: -0.02em;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.prov-card:hover .prov-mono { background: var(--brand); color: #0b0b0b; }
.prov-meta { font-size: 13px; color: var(--muted); margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }

/* ---------- Visor ---------- */
.visor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.visor { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); position: sticky; top: 124px; }
.medio { background: #000; display: grid; place-items: center; }
.medio video, .medio img { display: block; width: 100%; max-height: 72vh; object-fit: contain; background: #000; }
.medio-pdf, .medio-imagen { background: var(--surface-2); }
.medio-imagen img { background: transparent; }
.medio-pdf iframe { width: 100%; height: 75vh; border: 0; display: block; }
.visor-info { padding: 18px 22px 20px; display: grid; gap: 8px; }
.visor-info h2 { font-size: 19px; font-weight: 750; }
.visor-info p { max-width: 70ch; }
.visor-info a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.visor-vacio { padding: 80px 20px; text-align: center; color: var(--muted); }

.lista { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.lista-head { padding: 12px; border-bottom: 1px solid var(--border); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.chip:hover { border-color: var(--text); }
.chip span { color: var(--muted); margin-left: 3px; font-variant-numeric: tabular-nums; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip.on span { color: inherit; opacity: .7; }
.items { list-style: none; margin: 0; padding: 6px; max-height: 70vh; overflow-y: auto; }
.item { position: relative; display: flex; align-items: center; border-radius: var(--radius-sm); transition: background-color .2s var(--ease); }
.item a { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; padding: 10px; color: inherit; text-decoration: none; }
.item:hover { background: var(--surface-2); }
.item.activo { background: var(--brand-soft); }
.item.activo .item-titulo { color: var(--text); }
.miniatura {
  flex-shrink: 0; width: 60px; height: 42px; border-radius: 8px; display: grid; place-items: center; overflow: hidden;
  background: var(--surface-2); color: var(--muted);
}
.miniatura.tipo-video { background: #0b0b0b; color: var(--brand); }
.miniatura.tipo-video .ico { fill: currentColor; }
.miniatura.tipo-pdf { background: var(--brand-soft); color: var(--brand-ink); }
.miniatura img { width: 100%; height: 100%; object-fit: cover; }
.item-txt { min-width: 0; display: grid; gap: 3px; }
.item-titulo { font-size: 14px; font-weight: 650; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.visto { display: inline-flex; align-items: center; gap: 3px; color: var(--ok); font-weight: 650; vertical-align: -2px; }
.progreso { display: block; height: 3px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.progreso span { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 3px; }
.item-admin {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--surface-2);
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
}
.item.activo .item-admin { background: var(--brand-soft); }
.item:hover .item-admin, .item:focus-within .item-admin { pointer-events: auto; }
.item:hover .item-admin, .item:focus-within .item-admin { opacity: 1; }
.item-admin button { border: 0; background: none; color: var(--muted); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.item-admin button:hover { background: var(--surface); color: var(--text); }
.item-admin button[data-accion="borrar"]:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- Subida ---------- */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 22px 20px; text-align: center; margin-bottom: 22px;
  background: var(--surface); transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.dropzone:hover { border-color: var(--brand-line); }
.dropzone.sobre { border-color: var(--brand); background: var(--brand-soft); }
.dropzone-ico { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); vertical-align: middle; margin-right: 10px; }
.dropzone .pequeno { margin-top: 6px; color: var(--muted); }
.subidas { display: grid; gap: 8px; margin-top: 14px; text-align: left; }
.subidas:empty { display: none; }
.subida { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 13px; padding: 9px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.subida .progreso { grid-column: 1 / -1; }
.subida-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.subida-pct { font-variant-numeric: tabular-nums; }
.subida.ok .subida-pct { color: var(--ok); font-weight: 650; }
.subida.ok .progreso span { background: var(--ok); width: 100% !important; }
.subida.error .subida-pct { color: var(--danger); }
.subida.error .progreso span { background: var(--danger); }

/* ---------- Administración ---------- */
.form-linea { display: grid; grid-template-columns: 1.4fr 1.4fr 1fr auto; gap: 14px; align-items: end; }
.form-linea .field { margin: 0; }
.form-linea .btn { height: 48px; }
.nota { margin: 12px 0 16px; color: var(--muted); max-width: 80ch; }
.buscar { height: 38px; padding: 0 14px; min-width: 260px; }

.tabla-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.tabla-alta { max-height: 520px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { position: sticky; top: 0; font-size: 12px; color: var(--muted); font-weight: 650; letter-spacing: .02em; background: var(--surface-2); }
td.n, th.n { text-align: right; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }

.dialogo {
  border: 1px solid var(--border); border-radius: 18px; padding: 26px; width: min(460px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialogo::backdrop { background: rgb(11 11 11 / .5); backdrop-filter: blur(2px); }
.dialogo[open] { animation: entrar .35s var(--ease); }
.dialogo h3 { font-size: 19px; font-weight: 750; margin-bottom: 8px; }
.dialogo p { margin-bottom: 18px; }
.dialogo-acciones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.dialogo-acciones .btn { height: 40px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100;
  padding: 12px 18px 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600;
  background: #0b0b0b; color: #fff; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px);
  animation: subir .4s var(--ease);
}
.toast-error { background: var(--danger); }

@keyframes entrar { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes subir { from { opacity: 0; transform: translate(-50%, 10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1000px) {
  .visor-layout { grid-template-columns: 1fr; }
  .visor { position: static; }
  .items { max-height: none; }
  .item { flex-wrap: wrap; }
  .item a { flex-basis: 100%; }
  .item-admin { position: static; transform: none; opacity: 1; pointer-events: auto; background: none; width: 100%; justify-content: flex-end; padding: 0 8px 6px; margin-top: -6px; }
}
@media (max-width: 640px) {
  .topbar-inner { height: 58px; padding: 0 16px; }
  .brand img { height: 20px; }
  .brand-sep, .brand-nombre { display: none; }
  .user-email { display: none; }
  .nav { padding: 0 16px; }
  main#app { padding: 26px 16px 56px; }
  .grid-prov { grid-template-columns: 1fr; }
  .form-linea { grid-template-columns: 1fr; }
  .buscar { min-width: 0; width: 100%; }
  .medio-pdf iframe { height: 60vh; }
  .dropzone-ico { display: grid; margin: 0 auto 8px; }
  .miniatura { width: 52px; height: 38px; }
  footer { padding: 24px 16px 36px; align-items: flex-start; }
}
@media print {
  .topbar, .dropzone, .item-admin { display: none; }
  body { background: #fff; }
}
