/* Global GT sales system. Same look as the approved panel: navy brand bar + tab strip, cool neutral ground,
   cards only where they hold data. Mobile-first: the owners use phones. */
:root {
  --bg: #f3f6fb; --surface: #fcfdff; --ink: #0f1a2b; --muted: #556074; --line: #dde3ec;
  --brand: #075ee8; --brand-soft: rgba(7, 94, 232, 0.09); --accent: #d85d1a;
  --good: #11795a; --good-soft: rgba(17, 121, 90, 0.11); --warn: #9a5508; --warn-soft: rgba(196, 117, 18, 0.13);
  --bad: #b8322a; --bad-soft: rgba(184, 50, 42, 0.10); --bar: #000096; --bar-ink: #f3f5ff; --bar-muted: #c3c9f2; --yellow: #fbea61;
  --display: "Archivo", "Arial Narrow", Arial, sans-serif; --body: "Public Sans", "Segoe UI", Arial, sans-serif; --mono: "IBM Plex Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0b111b; --surface: #111a28; --ink: #e6ebf3; --muted: #9ca8bb; --line: #233047;
  --brand: #5b97ff; --brand-soft: rgba(91, 151, 255, 0.15); --accent: #ff8b4f;
  --good: #46c595; --good-soft: rgba(70, 197, 149, 0.14); --warn: #e9a640; --warn-soft: rgba(233, 166, 64, 0.15);
  --bad: #f2756a; --bad-soft: rgba(242, 117, 106, 0.14); --bar: #00006e; --bar-ink: #f3f5ff; --bar-muted: #b4bbe8; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0b111b; --surface: #111a28; --ink: #e6ebf3; --muted: #9ca8bb; --line: #233047;
  --brand: #5b97ff; --brand-soft: rgba(91, 151, 255, 0.15); --accent: #ff8b4f;
  --good: #46c595; --good-soft: rgba(70, 197, 149, 0.14); --warn: #e9a640; --warn-soft: rgba(233, 166, 64, 0.15);
  --bad: #f2756a; --bad-soft: rgba(242, 117, 106, 0.14); --bar: #00006e; --bar-ink: #f3f5ff; --bar-muted: #b4bbe8; color-scheme: dark }

* { box-sizing: border-box }
[hidden] { display: none !important }
html { -webkit-text-size-adjust: 100% }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bar) }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; letter-spacing: -0.01em }
h2 { font-size: 26px; font-weight: 700; line-height: 1.15 }
h3 { font-size: 17px; font-weight: 600 }
p { margin: 0 }
a { color: var(--brand) }
img { max-width: 100% }
.num { font-variant-numeric: tabular-nums }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.01em }
.muted { color: var(--muted) }
.small { font-size: 13px }
.mb4 { margin-bottom: 4px } .mb8 { margin-bottom: 8px } .mb12 { margin-bottom: 12px }
.eyebrow { font: 600 11.5px/1.2 var(--body); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted) }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }

/* top bar */
.top { background: var(--bar); color: var(--bar-ink) }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-block: 14px 12px }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; text-decoration: none; color: inherit }
.brand img { height: 30px; width: auto }
.brand .sys { border-left: 1px solid rgba(255,255,255,0.22); padding-left: 14px }
.brand .sys b { display: block; font: 700 17px/1.15 var(--display); color: var(--bar-ink) }
.brand .sys span { font-size: 12px; color: var(--bar-muted) }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px }
.who a { color: var(--bar-ink); text-decoration: none; text-align: right; line-height: 1.2 }
.who a b { display: block; font-size: 13.5px; font-weight: 600 }
.who a span { font-size: 11.5px; color: var(--bar-muted) }
.who form { margin: 0 }
.salir { font: 600 12.5px/1 var(--body); color: var(--bar-ink); background: transparent; border: 1px solid rgba(255,255,255,0.3); border-radius: 999px; padding: 7px 12px; cursor: pointer }
.salir:hover { border-color: var(--yellow) }
.tabs { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bar); border-top: 1px solid rgba(255,255,255,0.08) }
.tabs .wrap { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch }
.tabs .wrap::-webkit-scrollbar { display: none }
.tabs a { color: var(--bar-muted); text-decoration: none; font: 600 14px/1 var(--body); padding: 14px 12px 13px; border-bottom: 3px solid transparent; white-space: nowrap }
.tabs a:hover { color: var(--bar-ink) }
.tabs a[aria-current="page"] { color: #fff; border-bottom-color: var(--yellow) }
.tabs a:focus-visible { outline: 2px solid var(--yellow); outline-offset: -2px }

main { padding-block: 24px 56px }
main.angosto { max-width: 460px }
.view { display: flex; flex-direction: column; gap: 20px }
.head { display: flex; flex-direction: column; gap: 6px; max-width: 760px }
.head p { color: var(--muted) }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; min-width: 0 }
.card.admin { border-style: dashed; border-color: var(--brand) }
.card.stack, .stack { display: flex; flex-direction: column; gap: 12px }
.card.centro { display: grid; place-items: center }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px }
.cardhead form { margin: 0 }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px }

.chip { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1 var(--body); padding: 5px 9px; border-radius: 999px; white-space: nowrap }
.chip.good { background: var(--good-soft); color: var(--good) }
.chip.warn { background: var(--warn-soft); color: var(--warn) }
.chip.bad { background: var(--bad-soft); color: var(--bad) }
.chip.info { background: var(--brand-soft); color: var(--brand) }
.good-t { color: var(--good) } .warn-t { color: var(--warn) }

.flash { border-radius: 10px; padding: 12px 14px; font-weight: 500; border: 1px solid transparent }
.flash.good { background: var(--good-soft); color: var(--good); border-color: rgba(17,121,90,0.25) }
.flash.bad { background: var(--bad-soft); color: var(--bad); border-color: rgba(184,50,42,0.25) }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(196,117,18,0.25) }

/* connection chips */
.conn { display: flex; flex-wrap: wrap; gap: 6px }
.conn span { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; background: var(--surface) }
.conn span.on { color: var(--good); border-color: rgba(17,121,90,0.35) }
.conn span.on::before { content: "● " }
.conn span.off::before { content: "○ " }

/* alerts */
.alerts { display: flex; flex-direction: column }
.alert { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start }
.alert:first-child { border-top: none; padding-top: 4px }
.alert p { min-width: 0 }
.alert .chip { justify-self: start }
.alert small { display: block; color: var(--muted); font-size: 13px }

/* picks */
.picks { display: flex; flex-direction: column }
.pick { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line) }
.pick:first-child { border-top: none }
.pick img, .pick .sinfoto { width: 56px; height: 56px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--line) }
.pick .t { min-width: 0 }
.pick .t b { display: block; font-weight: 600; font-size: 14px; line-height: 1.3 }
.pick .p { text-align: right; font-weight: 600 }
.pick .p small { display: block; font-weight: 500; font-size: 12px }
.nota { margin-top: 10px }

/* loop */
.loop { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px }
.loop div { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--bg); position: relative }
.loop b { display: block; font: 600 15px/1.2 var(--display) }
.loop span { font-size: 13px; color: var(--muted) }
.loop div:not(:last-child)::after { content: "→"; position: absolute; right: -10px; top: 50%; transform: translate(50%, -50%); color: var(--muted); font-size: 14px }

/* tables */
.tablebox { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface) }
.tablebox.plano { border: 0; border-radius: 0; background: transparent }
table { border-collapse: collapse; width: 100%; font-size: 14px }
th { text-align: left; font: 600 12px/1.2 var(--body); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface) }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top }
tr:last-child td { border-bottom: none }
td.r, th.r { text-align: right }
td .sub { display: block; color: var(--muted); font-size: 12.5px }
.vacio { padding: 14px }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface) }
.seg button { font: 600 13px/1 var(--body); color: var(--muted); background: none; border: 0; padding: 10px 14px; cursor: pointer }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff }
input[type="search"] { font: 15px var(--body); padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); min-width: 0; width: 260px; max-width: 100% }
.stats { display: flex; flex-wrap: wrap; gap: 14px 28px }
.stat b { display: block; font: 700 30px/1.1 var(--display) }
.stat span { font-size: 13px; color: var(--muted) }

/* buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 14px/1 var(--body); border-radius: 8px; padding: 11px 14px; min-height: 42px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; list-style: none }
.btn::-webkit-details-marker { display: none }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff }
.btn.peligro { color: var(--bad); border-color: rgba(184,50,42,0.35) }
.btn.chico { min-height: 32px; padding: 6px 10px; font-size: 12.5px }
.btn.grande { min-height: 48px; font-size: 15.5px; width: 100% }
.btn[disabled] { opacity: 0.6; cursor: progress }
.seg button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap }
.row form { margin: 0 }
.form { display: flex; flex-direction: column; gap: 14px }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px }
.form label small { font-weight: 400; color: var(--muted); font-size: 12.5px }
.form input[type="email"], .form input[type="password"], .form input[type="text"], .form select, .form textarea {
  font: 16px var(--body); padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); width: 100%; min-width: 0 }
.form textarea { resize: vertical; min-height: 84px }
.form input[type="file"] { font: 14px var(--body); max-width: 100% }
.form details summary { cursor: pointer; color: var(--brand) }
.form details label { margin-top: 10px }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0 }
legend { font: 700 16px/1.2 var(--display); padding: 0; margin-bottom: 8px }
.angosto-form { max-width: 480px }
.login { margin-top: 28px; display: flex; flex-direction: column; gap: 14px }

/* product picker */
.productos { max-height: 330px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); -webkit-overflow-scrolling: touch }
.prod { display: grid !important; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-weight: 400 !important }
.prod:last-child { border-bottom: 0 }
.prod input { width: 20px; height: 20px; accent-color: var(--brand); margin: 0 }
.prod .t { min-width: 0 }
.prod .t b { display: block; font-weight: 600; font-size: 14px; line-height: 1.3 }
.prod .precio { font-weight: 600; font-size: 13.5px }
.prod:has(input:checked) { background: var(--brand-soft) }
.toggles { display: flex; flex-wrap: wrap; gap: 8px }
.toggle { position: relative; display: inline-flex !important; flex-direction: row !important; cursor: pointer }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px }
.toggle span { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: 600 14px/1 var(--body); color: var(--muted) }
.toggle input:checked + span { background: var(--bar); border-color: var(--bar); color: #fff }
.toggle input:checked + span::before { content: "✓"; margin-right: 6px; color: var(--yellow) }
.toggle input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px }
.pedir { gap: 20px }
@media (min-width: 960px) {
  .pedir { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); column-gap: 32px; align-items: start }
  .pedir > fieldset:first-of-type { grid-column: 1; grid-row: 1 / span 5 }
  .pedir > :not(fieldset:first-of-type) { grid-column: 2 }
  .pedir .productos { max-height: 460px }
}

/* jobs */
.job { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line) }
.job:first-of-type { border-top: 0 }
.job p { min-width: 0; font-size: 14px }
.job small { display: block; color: var(--muted); font-size: 12.5px }
.job small.err, .err-inline { color: var(--bad) }

/* media */
.filtros { display: flex; gap: 6px; flex-wrap: wrap; scroll-margin-top: 60px }
.filtros a { text-decoration: none; font: 600 13.5px/1 var(--body); color: var(--muted); padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface) }
.filtros a span { opacity: 0.7; margin-left: 4px }
.filtros a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: #fff }
.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 16px }
.media .empty { grid-column: 1 / -1 }
.m { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; scroll-margin-top: 60px }
.m .frame { background: var(--bar); position: relative; overflow: hidden; aspect-ratio: 4 / 5; max-height: 560px; width: 100% }
.m .frame img, .m .frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block }
.m .meta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1 }
.m .meta b { font-size: 14px; line-height: 1.3 }
.m .estado { display: flex; flex-direction: column; gap: 4px; align-items: flex-start }
.m .quien { color: var(--muted); font-size: 12.5px }
.m .row { margin-top: auto }
.nota-cambio { font-size: 13.5px; background: var(--brand-soft); border-radius: 8px; padding: 8px 10px }
.cambio { width: 100% }
.cambio[open] summary { margin-bottom: 8px }
.cambio + .btn, .row > .btn { flex: 0 0 auto }
.m .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px }
.m .row form .btn, .m .row > .btn, .m .row summary.btn { width: 100% }
.m .row .cambio[open] { grid-column: 1 / -1; order: 3 }
.empty { border: 1px dashed var(--line); border-radius: 12px; padding: 22px; color: var(--muted); text-align: center; background: var(--surface) }

/* kit */
.budget { display: flex; height: 34px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line) }
.budget div { display: flex; align-items: center; justify-content: center; font: 600 12px/1 var(--body); color: #fff; white-space: nowrap; overflow: hidden; padding: 0 6px }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--muted) }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px }
.copy { display: flex; flex-direction: column; gap: 10px }
.copy .titular { font-family: var(--display); font-size: 17px }
.copy .txt { font: 14px/1.55 var(--body); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; white-space: pre-wrap; margin: 0; overflow-wrap: anywhere }

/* report */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px }
.kpi b { font: 700 28px/1.1 var(--display) }
.kpi.pending b { font-size: 17px; color: var(--muted); font-weight: 600 }
.kpi span { font-size: 13px; color: var(--muted) }
.historial { display: flex; flex-wrap: wrap; gap: 6px }
.historial a { text-decoration: none; font-size: 13px; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink) }
.historial a[aria-current="page"] { border-color: var(--brand); color: var(--brand); font-weight: 600 }

/* connections */
.estado-cx .cardhead { margin-bottom: 4px }
.archivos { list-style: none; margin: 4px 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px }
.archivos li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px }
.archivos small { color: var(--muted) }
.archivos form { margin: 0 0 0 auto }
.sub2 { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 4px }
.pasos { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px }
.lista { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px }
.vista { max-height: 560px; width: auto; border-radius: 10px }

footer { border-top: 1px solid var(--line); padding-block: 18px 28px; color: var(--muted); font-size: 13px }
@media (prefers-reduced-motion: no-preference) { .view { animation: in 0.18s ease-out } @keyframes in { from { opacity: 0.6; transform: translateY(3px) } to { opacity: 1; transform: none } } }

/* phones */
@media (max-width: 640px) {
  h2 { font-size: 22px }
  .card { padding: 16px }
  .brand img { height: 26px }
  .brand .sys { border-left: 0; padding-left: 0 }
  .brand .sys span { display: none }
  .who a span { display: none }
  .loop { grid-template-columns: 1fr 1fr } .loop div::after { display: none }
  .alert { grid-template-columns: 1fr; gap: 6px }
  .stats { gap: 12px 20px } .stat b { font-size: 24px }
  input[type="search"] { width: 100% }
  .toolbar .seg { width: 100% } .seg button { flex: 1 }
  /* tables become stacked cards */
  .rtable thead { display: none }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100% }
  .rtable tr { padding: 10px 14px; border-bottom: 1px solid var(--line) }
  .rtable tr:last-child { border-bottom: 0 }
  .rtable td { border: 0; padding: 3px 0 3px 112px; text-align: left !important; position: relative; min-height: 26px; overflow-wrap: anywhere }
  .rtable td::before { content: attr(data-label); position: absolute; left: 0; top: 4px; width: 104px; font: 600 11px/1.5 var(--body); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted) }
  .rtable td[colspan] { padding-left: 0 }
  .rtable td[colspan]::before { content: none }
  .rtable td:first-child { padding-left: 0; font-weight: 600 }
  .rtable td:first-child::before { content: none }
  .rtable td:first-child .sub { font-weight: 400 }
  .tablebox.plano .rtable tr { padding-inline: 0 }
}

/* product page whose data looks like another product's (globalgt.calidad) */
.aviso-ficha { display: block; margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; line-height: 1.4 }
.aviso-ficha b { font-weight: 600 }
.aviso-ficha .linea { display: block; padding-left: 12px; text-indent: -10px }
.aviso-ficha .linea::before { content: "· " }
