/* Portal de soporte Buyservice. Fuentes del sistema: sin dependencias externas por la política de seguridad (CSP). */
:root {
  --bg: #f2f4f7; --surface: #ffffff; --sunken: #e9edf2; --line: #d9dfe7;
  --fg: #17202b; --muted: #5b6676;
  --accent: #2350c4; --accent-soft: #e3eafb; --accent-ink: #ffffff;
  --crit: #c4302c; --crit-soft: #fbe5e4;
  --high: #c9620f; --high-soft: #fcebdc;
  --med: #8f6f00; --med-soft: #f7efcf;
  --low: #4f7d5d; --low-soft: #e2efe5;
  --ok: #1f7a4a; --ok-soft: #dcf1e4;
  --note: #f7f1dd;
  --r: 8px;
  --f-body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --f-mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e131a; --surface: #161d27; --sunken: #111821; --line: #283241;
    --fg: #e5e9ef; --muted: #93a0b3;
    --accent: #7398ff; --accent-soft: #1d2a4a; --accent-ink: #0a1022;
    --crit: #ff6d67; --crit-soft: #3a1b1d; --high: #ff9e52; --high-soft: #3a2616;
    --med: #e4c24c; --med-soft: #352e14; --low: #86b996; --low-soft: #1b2e22;
    --ok: #52c487; --ok-soft: #15301f; --note: #2a2716;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--f-body); }
a { color: var(--accent); }
h1 { font-size: 24px; line-height: 1.25; margin: 0; letter-spacing: -.01em; text-wrap: balance; overflow-wrap: anywhere; }
h2 { font-size: 18px; margin: 0; }
.h-sm { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.minw0 { min-width: 0; }

.wrap { max-width: 1240px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.main { padding-block: 24px 48px; display: flex; flex-direction: column; gap: 18px; }
.foot { padding-block: 16px 32px; display: flex; gap: 16px; justify-content: space-between; color: var(--muted); font-size: 13px; flex-wrap: wrap; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 20px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); margin-right: auto; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: .04em; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { color: var(--muted); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 6px 12px; border-radius: 6px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.nav a:hover { background: var(--sunken); color: var(--fg); }
.nav a[aria-current] { background: var(--accent-soft); color: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: var(--r); cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--fg); white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--crit); border-color: var(--crit); background: transparent; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.pad { padding: 20px; }
.pad-h { padding: 16px 20px 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.narrow { max-width: 460px; width: 100%; margin: 24px auto 0; }
.narrow.wide { max-width: 760px; margin-top: 0; }
.page-head { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.head-tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back { color: var(--muted); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--fg); }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > label, .field > legend { font-size: 13px; font-weight: 600; }
.field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea, .toolbar input, .toolbar select, .inline input, .inline select {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 9px 11px; width: 100%; min-width: 0;
}
.field textarea { resize: vertical; }
.radios label, .check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; font-weight: 400; }
.radios legend { margin-bottom: 6px; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.code-input { font-family: var(--f-mono); font-size: 26px !important; letter-spacing: .3em; text-align: center; }
.inline { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline input { padding: 5px 8px; }
.inline select { padding: 5px 8px; width: auto; }

.alert { padding: 12px 16px; border-radius: var(--r); border: 1px solid var(--line); font-size: 14px; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-ok { background: var(--ok-soft); border-color: transparent; }
.alert-info { background: var(--accent-soft); border-color: transparent; }
.alert-error { background: var(--crit-soft); border-color: transparent; color: var(--fg); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.s-nuevo { background: var(--accent-soft); color: var(--accent); }
.s-asignado { background: var(--sunken); color: var(--fg); }
.s-progreso { background: var(--high-soft); color: var(--high); }
.s-espera_cliente { background: var(--med-soft); color: var(--med); }
.s-resuelto { background: var(--ok-soft); color: var(--ok); }
.s-cerrado { background: var(--sunken); color: var(--muted); }
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.prio::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.t-critica { color: var(--crit); } .t-alta { color: var(--high); } .t-media { color: var(--med); } .t-baja { color: var(--low); }
.sla { font-size: 13px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sla.ok { color: var(--ok); } .sla.warn { color: var(--high); } .sla.late { color: var(--crit); } .sla.neutral { color: var(--muted); font-weight: 500; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: var(--sunken); color: var(--muted); vertical-align: middle; }
.tag-esc { background: var(--crit-soft); color: var(--crit); }
.tag-note { background: var(--note); color: var(--med); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); align-self: flex-start; flex-wrap: wrap; }
.seg a { padding: 7px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.seg a[aria-current] { background: var(--accent-soft); color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stat { background: var(--surface); padding: 12px 16px; display: flex; flex-direction: column; text-decoration: none; color: var(--fg); }
.stat:hover { background: var(--sunken); }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat.alert .v { color: var(--crit); }
.stat.warn .v { color: var(--high); }

.load { display: flex; gap: 8px; flex-wrap: wrap; }
.load-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-decoration: none; color: var(--fg); font-size: 13px; }
.load-item:hover { border-color: var(--muted); }
.load-name { font-weight: 600; }
.load-nums { color: var(--muted); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search] { flex: 1 1 240px; width: auto; }
.toolbar select { width: auto; flex: 0 1 auto; }

.list { overflow: hidden; }
.row, .qrow { display: grid; align-items: center; column-gap: 14px; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--fg); }
.row:last-child, .qrow:last-child { border-bottom: 0; }
.row:hover, .qrow:hover:not(.qhead) { background: var(--sunken); }
.row { grid-template-columns: 4px minmax(0, 1fr) auto; }
.qrow { grid-template-columns: 4px 132px minmax(0, 1fr) 200px 150px 150px; }
.qhead { padding-block: 9px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; background: var(--sunken); }
.stripe { align-self: stretch; border-radius: 0 3px 3px 0; margin-block: -12px; }
.qhead .stripe, .qhead > span:first-child { margin: 0; }
.p-critica { background: var(--crit); } .p-alta { background: var(--high); } .p-media { background: var(--med); } .p-baja { background: var(--low); }
.row-main, .c-main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.row-top { display: flex; gap: 10px; align-items: center; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.c-st { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.c-ag { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty p { margin: 0; max-width: 52ch; }

.desc { white-space: normal; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.side { position: sticky; top: 16px; }
aside.side { max-height: none; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ev { padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); }
.ev.sys { border-style: dashed; background: transparent; }
.ev.msg { background: var(--surface); }
.ev.msg.from-client { background: var(--accent-soft); border-color: transparent; }
.ev.note { background: var(--note); border-color: transparent; }
.ev-meta { font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ev-sys { font-size: 14px; color: var(--muted); margin-top: 2px; }
.ev-body { margin-top: 4px; overflow-wrap: anywhere; }
.files { margin: 8px 0 0; padding-left: 18px; font-size: 14px; }
.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); background: var(--sunken); padding: 9px 12px; white-space: nowrap; }
.table td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.off td { opacity: .55; }
.secret { border-color: var(--high); background: var(--high-soft); }
.prose { line-height: 1.65; }
.prose h2 { margin-top: 18px; }
.prose p { max-width: 68ch; }

@media (max-width: 980px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .qrow { grid-template-columns: 4px minmax(0, 1fr) auto; grid-template-areas: "s id sla" "s main main" "s st ag"; row-gap: 6px; }
  .qhead { display: none; }
  .qrow .stripe { grid-area: s; }
  .qrow .c-id { grid-area: id; } .qrow .c-main { grid-area: main; } .qrow .c-sla { grid-area: sla; justify-self: end; }
  .qrow .c-st { grid-area: st; } .qrow .c-ag { grid-area: ag; justify-self: end; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 4px minmax(0, 1fr); }
  .row-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; }
  .who span { display: none; }
  h1 { font-size: 21px; }
}
