:root {
  --ground: #eef1f4;
  --panel: #ffffff;
  --ink: #17212b;
  --ink-soft: #55616d;
  --line: #d9dfe5;
  --accent: #14707a;
  --accent-ink: #ffffff;
  --focus: #1b8c97;
  --crit: #a6261d; --crit-bg: #fbe4e1;
  --high: #b65a0a; --high-bg: #fdebd6;
  --med: #8a6d0b;  --med-bg: #f7efc9;
  --low: #476070;  --low-bg: #e3eaef;
  --ok: #1d6b43;   --ok-bg: #dcf0e4;
  --info: #25598f; --info-bg: #dfeaf6;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #12181e; --panel: #1b232b; --ink: #e5eaee; --ink-soft: #9aa7b2; --line: #2d3943;
    --accent: #3fb0bb; --accent-ink: #0d1a1c; --focus: #5cc4ce;
    --crit: #ff9b92; --crit-bg: #3d1d1b; --high: #ffbb7a; --high-bg: #3c2810; --med: #ecd36d; --med-bg: #342d0e;
    --low: #a9bccb; --low-bg: #26323b; --ok: #82d9a8; --ok-bg: #173424; --info: #8fbdf0; --info-bg: #172b40;
  }
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--ground); color: var(--ink); line-height: 1.45;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.bar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar h1 { font-size: 1.05rem; margin: 0; letter-spacing: .01em; }
.bar .grow { flex: 1; }
.bar .who { color: var(--ink-soft); font-size: .9rem; }
.page { max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; }

button { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; }
button:hover { border-color: var(--ink-soft); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }

input, select, textarea { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 9px; }
textarea { resize: vertical; min-height: 84px; }
label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); margin: 12px 0 4px; }

.login { max-width: 340px; margin: 12vh auto 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 24px; }
.login h1 { font-size: 1.2rem; margin: 0 0 4px; }
.login p { margin: 0 0 8px; color: var(--ink-soft); }
.error { color: var(--crit); background: var(--crit-bg); border-radius: var(--radius); padding: 7px 10px; margin: 10px 0 0; font-size: .92rem; }

.summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.summary .count { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; }
.summary .count b { font-size: 1.15rem; margin-right: 6px; }
.summary .count.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 12px; }
.filters label { margin: 0 0 3px; }
.filters .field { min-width: 0; }

.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 92px 112px 108px 150px; gap: 10px; align-items: center;
  padding: 9px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--ground); }
.row.head { cursor: default; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); background: var(--ground); }
.row.head:hover { background: var(--ground); }
.row .id { font-family: var(--mono); color: var(--ink-soft); }
.row .title { min-width: 0; }
.row .title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .title small { color: var(--ink-soft); }
.row .when { color: var(--ink-soft); font-size: .86rem; }
.empty { padding: 28px; text-align: center; color: var(--ink-soft); }

.chip { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.sev-critical { background: var(--crit-bg); color: var(--crit); }
.sev-high { background: var(--high-bg); color: var(--high); }
.sev-medium { background: var(--med-bg); color: var(--med); }
.sev-low { background: var(--low-bg); color: var(--low); }
.st-open { background: var(--high-bg); color: var(--high); }
.st-confirmed { background: var(--info-bg); color: var(--info); }
.st-in_progress { background: var(--info-bg); color: var(--info); }
.st-fixed { background: var(--ok-bg); color: var(--ok); }
.st-verified { background: var(--ok-bg); color: var(--ok); }
.st-wont_fix, .st-duplicate { background: var(--low-bg); color: var(--low); }

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 0 0 6px; }
.card + .card { margin-top: 14px; }
.detail h1 { font-size: 1.25rem; margin: 0 0 4px; }
.meta-line { color: var(--ink-soft); font-size: .88rem; margin-bottom: 12px; }
.pre { white-space: pre-wrap; word-break: break-word; margin: 0; }
.mono { font-family: var(--mono); font-size: .88rem; background: var(--ground); padding: 8px 10px; border-radius: var(--radius); }
.side label:first-child { margin-top: 0; }

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.shots a { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--ground); }
.shots img { display: block; width: 100%; height: 110px; object-fit: cover; }
.shots figcaption { font-size: .75rem; color: var(--ink-soft); padding: 3px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shots figure { margin: 0; }
.drop { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 10px; text-align: center; color: var(--ink-soft);
  font-size: .9rem; margin-top: 8px; }
.drop.over { border-color: var(--accent); color: var(--accent); }
.queued { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.queued span { background: var(--ground); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: .82rem; }
.queued button { border: 0; background: none; padding: 0 6px; color: var(--ink-soft); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 2px solid var(--line); padding: 0 0 12px 12px; margin-left: 4px; }
.timeline .who { font-weight: 600; }
.timeline .at { color: var(--ink-soft); font-size: .8rem; margin-left: 6px; }
.timeline .note { margin-top: 3px; white-space: pre-wrap; word-break: break-word; background: var(--ground); border-radius: var(--radius); padding: 6px 10px; }

.overlay { position: fixed; inset: 0; background: rgba(8, 14, 20, .6); display: grid; place-items: start center; overflow: auto; padding: 5vh 12px; z-index: 20; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; width: min(640px, 100%); }
.modal h2 { margin: 0 0 4px; font-size: 1.1rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.lightbox img { max-width: 100%; max-height: 82vh; display: block; margin: 0 auto; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--panel);
  padding: 8px 16px; border-radius: 999px; z-index: 30; font-size: .9rem; }

@media (max-width: 860px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field.wide { grid-column: 1 / -1; }
  .bar .who { display: none; }
  .bar { padding: 10px 12px; }
  /* Dos líneas por reporte: número y título; debajo severidad, estado y fecha. */
  .row { grid-template-columns: 40px auto 1fr; grid-template-rows: auto auto; row-gap: 6px; column-gap: 8px; }
  .row.head { display: none; }
  .row .id { grid-column: 1; grid-row: 1; }
  .row .title { grid-column: 2 / 4; grid-row: 1; }
  .row > .chip:nth-of-type(1) { grid-column: 1; grid-row: 2; justify-self: start; }
  .row > .chip:nth-of-type(2) { grid-column: 2; grid-row: 2; justify-self: start; }
  .row .assignee { display: none; }
  .row .when { grid-column: 3; grid-row: 2; justify-self: end; font-size: .8rem; }
  .detail { grid-template-columns: 1fr; }
  .pair { grid-template-columns: 1fr; }
}
