:root {
  color-scheme: dark;
  --bg: #0a0d0f;
  --panel: #12171b;
  --panel-2: #171e24;
  --line: #26313a;
  --text: #eef3f4;
  --muted: #9aa8ae;
  --accent: #48d6b5;
  --accent-2: #e9c46a;
  --danger: #ff5f73;
  --ok: #63df7d;
  --ack: #a879ff;
  --done: #7f8990;
  --shadow: 0 18px 50px rgba(0,0,0,.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, select {
  font: inherit;
}
button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--accent);
  color: #04110e;
  font-weight: 800;
  cursor: pointer;
}
button.secondary {
  background: #27313a;
  color: var(--text);
  border: 1px solid var(--line);
}
button.danger-button {
  background: rgba(255,95,115,.14);
  color: #ffd7de;
  border: 1px solid rgba(255,95,115,.45);
}
input, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0d1216;
  color: var(--text);
  padding: 10px 12px;
}
label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 48px); letter-spacing: 0; }
h2 { margin-bottom: 14px; font-size: 18px; }
p { color: var(--muted); line-height: 1.5; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  padding: 22px;
  background: #060809;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  font-size: 18px;
}
.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}
.sidebar nav {
  display: grid;
  gap: 8px;
}
.sidebar nav a {
  padding: 12px;
  border-radius: 6px;
  color: var(--muted);
}
.sidebar nav a:hover {
  background: var(--panel);
  color: var(--text);
}
.signed-in {
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.shell {
  margin-left: 248px;
  padding: 34px;
}
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 60% 35%, rgba(72,214,181,.12), transparent 28%),
    var(--bg);
}
.login-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 26px;
}
.login-logo {
  width: min(280px, 72vw);
  justify-self: center;
}
.login-form {
  display: grid;
  gap: 16px;
  padding: 24px;
  background: rgba(18,23,27,.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.upload {
  display: flex;
  gap: 10px;
  align-items: center;
}
.upload input {
  max-width: 250px;
}
.back {
  color: var(--accent);
  font-weight: 800;
  display: inline-block;
  margin-bottom: 10px;
}

.flashes {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}
.flash {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: var(--panel);
}
.flash.error { border-color: rgba(255,95,115,.5); }
.flash.success { border-color: rgba(72,214,181,.5); }

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stats div {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.stats strong {
  display: block;
  font-size: 28px;
}
.stats span { color: var(--muted); }

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 220px auto;
  gap: 10px;
  margin-bottom: 24px;
}

.map-section, .detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.section-heading h2 { margin: 0; }
.section-heading span { color: var(--muted); }
.map-shell {
  position: relative;
}
.map-mode-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  display: flex;
  gap: 4px;
  padding: 5px;
  background: rgba(6,8,9,.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}
.map-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  gap: 6px;
  padding: 6px;
  background: rgba(6,8,9,.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}
.map-mode-controls button,
.map-controls button {
  min-width: 38px;
  min-height: 34px;
  padding: 7px 10px;
  background: #eaf4f1;
  color: #07100d;
}
.map-mode-controls button {
  min-width: 0;
  background: rgba(234, 244, 241, .12);
  color: var(--text);
  border-color: rgba(234, 244, 241, .14);
}
.map-mode-controls button.active {
  background: #eaf4f1;
  color: #07100d;
}
.lag-map {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #020303;
  aspect-ratio: 1 / 1;
  max-height: 70vh;
  margin-inline: auto;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.lag-map:active,
.lag-map.is-dragging {
  cursor: grabbing;
}
.lag-map-content {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  will-change: transform;
  --point-scale: 1;
}
.lag-map img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
}
.heat-point,
.lag-cell,
.lag-point {
  position: absolute;
}
.heat-point {
  width: var(--heat-size);
  height: var(--heat-size);
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 3px solid rgba(255, 190, 82, calc(.58 + (var(--heat-alpha) * .32)));
  background:
    radial-gradient(circle, rgba(255, 92, 68, calc(var(--heat-alpha) * .42)) 0 15%, rgba(255, 174, 67, calc(var(--heat-alpha) * .24)) 42%, rgba(255, 209, 94, calc(var(--heat-alpha) * .08)) 66%, rgba(255, 209, 94, 0) 74%);
  box-shadow:
    0 0 0 8px rgba(255, 190, 82, calc(var(--heat-alpha) * .10)),
    inset 0 0 0 1px rgba(255, 255, 255, .22);
  filter: saturate(1.12);
  mix-blend-mode: normal;
  pointer-events: none;
}
.heat-point::before {
  content: "";
  position: absolute;
  inset: -11px;
  border: 2px solid rgba(255, 190, 82, calc(var(--heat-alpha) * .22));
  border-radius: inherit;
}
.heat-point.hot {
  border-color: rgba(255, 86, 116, calc(.62 + (var(--heat-alpha) * .32)));
  background:
    radial-gradient(circle, rgba(255, 45, 91, calc(var(--heat-alpha) * .48)) 0 16%, rgba(255, 93, 72, calc(var(--heat-alpha) * .25)) 43%, rgba(255, 202, 85, calc(var(--heat-alpha) * .09)) 67%, rgba(255, 202, 85, 0) 75%);
  box-shadow:
    0 0 0 9px rgba(255, 86, 116, calc(var(--heat-alpha) * .12)),
    inset 0 0 0 1px rgba(255, 255, 255, .24);
}
.heat-point.hot::before {
  border-color: rgba(255, 86, 116, calc(var(--heat-alpha) * .25));
}
.lag-cell {
  width: var(--cell-size);
  height: var(--cell-size);
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 223, 151, .7);
  border-radius: 6px;
  background: rgba(228, 154, 56, calc(.34 + (var(--heat-alpha) * .4)));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .5),
    0 0 4px rgba(228, 154, 56, calc(var(--heat-alpha) * .28));
  color: #fff6df;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,.75);
}
.lag-cell.hot {
  border-color: rgba(255, 167, 180, .78);
  background: rgba(224, 55, 80, calc(.38 + (var(--heat-alpha) * .42)));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .5),
    0 0 5px rgba(255, 83, 111, calc(var(--heat-alpha) * .34));
}
.lag-point {
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  transform: translate(-50%, -50%) scale(var(--point-scale));
  transform-origin: center;
  border: 1px solid rgba(4, 8, 8, .95);
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #fff4b6 0 16%, #f0c15b 38%, #b77b25 100%);
  box-shadow:
    0 0 0 1px rgba(255, 245, 190, .28),
    0 0 5px rgba(233, 196, 106, .44),
    0 1px 2px rgba(0, 0, 0, .5);
  cursor: pointer;
  will-change: transform;
  display: grid;
  place-items: center;
  color: #120c02;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
}
.lag-point.hot {
  background: radial-gradient(circle at 35% 30%, #ffd7de 0 14%, #ff5f73 42%, #9f1e35 100%);
  box-shadow:
    0 0 0 1px rgba(255, 210, 218, .34),
    0 0 6px rgba(255, 95, 115, .52),
    0 1px 2px rgba(0, 0, 0, .55);
}
.lag-point.cluster {
  min-width: 17px;
  height: 17px;
}
.lag-point.dense {
  min-width: 22px;
  height: 22px;
  font-size: 10px;
}
.lag-map[data-map-view="markers"] .heat-point,
.lag-map[data-map-view="markers"] .lag-cell,
.lag-map[data-map-view="heatmap"] .lag-point,
.lag-map[data-map-view="heatmap"] .lag-cell,
.lag-map[data-map-view="cells"] .heat-point,
.lag-map[data-map-view="cells"] .lag-point {
  display: none;
}

.feedback-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.pagination-status {
  color: var(--muted);
  font-size: 13px;
}
.pagination-links {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.pagination-links a {
  min-width: 36px;
  text-align: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0d1216;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.pagination-links a:hover,
.pagination-links a.current {
  border-color: rgba(72,214,181,.6);
  color: var(--text);
}
.pagination-links a.current {
  background: rgba(72,214,181,.14);
}
.pagination-links a.disabled {
  opacity: .38;
  pointer-events: none;
}
.feedback-card {
  --status-color: var(--ok);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid rgba(99,223,125,.48);
  border-radius: 8px;
  border-left: 8px solid var(--status-color);
  box-shadow: inset 3px 0 0 rgba(255,255,255,.08);
}
.feedback-card.status-open {
  --status-color: var(--ok);
  border-color: rgba(99,223,125,.5);
  border-left-color: var(--status-color);
}
.feedback-card.status-ack {
  --status-color: var(--ack);
  border-color: rgba(168,121,255,.54);
  border-left-color: var(--status-color);
}
.feedback-card.status-done {
  --status-color: var(--done);
  border-color: rgba(127,137,144,.55);
  border-left-color: var(--status-color);
  opacity: .82;
}
.feedback-card:hover {
  border-color: var(--status-color);
}
.card-main p {
  margin-bottom: 14px;
  color: var(--text);
}
.card-title, .meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.card-title { margin-bottom: 8px; }
.card-title strong { font-size: 18px; }
.card-title span, .meta span, .pill {
  border: 1px solid var(--line);
  color: var(--muted);
  background: #0d1216;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
}
.log-badge.error {
  color: #ffd7de;
  border-color: rgba(255,95,115,.55);
  background: rgba(255,95,115,.12);
}
.log-badge.warning {
  color: #ffe3a3;
  border-color: rgba(233,196,106,.55);
  background: rgba(233,196,106,.12);
}
.status-box {
  min-width: 190px;
  display: grid;
  gap: 8px;
  align-content: start;
}
.pill.open {
  color: #bcffd0;
  border-color: rgba(99,223,125,.52);
  background: rgba(99,223,125,.11);
}
.pill.ack {
  color: #e4d7ff;
  border-color: rgba(168,121,255,.56);
  background: rgba(168,121,255,.13);
}
.pill.done {
  color: #d3d8dc;
  border-color: rgba(127,137,144,.56);
  background: rgba(127,137,144,.14);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.35fr);
  gap: 16px;
  margin-bottom: 16px;
}
.message-panel p {
  color: var(--text);
  font-size: 18px;
}
.screenshot-panel img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: block;
}
dl {
  display: grid;
  gap: 10px;
  margin: 0;
}
dl div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.plain-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.plain-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.plain-list span { color: var(--muted); }
.raw-json {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #cfe3e0;
}
.console-panel {
  margin: 16px 0;
}
.console-list {
  display: grid;
  gap: 10px;
}
.console-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1216;
  padding: 12px;
}
.console-entry.error {
  border-color: rgba(255,95,115,.48);
}
.console-entry.warning {
  border-color: rgba(233,196,106,.48);
}
.console-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
}
.console-entry.error .console-entry-head strong {
  color: var(--danger);
}
.console-entry.warning .console-entry-head strong {
  color: var(--accent-2);
}
.console-entry pre {
  margin: 0;
  color: var(--text);
  font-size: 13px;
}
.console-entry details {
  margin-top: 10px;
}
.console-entry summary {
  cursor: pointer;
  color: var(--muted);
}
.console-entry details pre {
  margin-top: 8px;
  color: #cfe3e0;
}
.console-note {
  margin: 12px 0 0;
}
.user-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
}
.alias-panel {
  margin-bottom: 16px;
}
.alias-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.alias-table {
  margin-top: 16px;
}
.user-form { display: grid; gap: 14px; }
.inline-reset {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(110px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.inline-reset input {
  min-height: 38px;
}
.inline-reset button {
  min-height: 38px;
  padding: 8px 12px;
}
.role-form {
  display: grid;
  gap: 8px;
}
.role-form button {
  width: fit-content;
  min-height: 36px;
  padding: 8px 12px;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check input {
  width: auto;
  min-height: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
th { color: var(--muted); font-weight: 700; }
.table-link {
  color: var(--accent);
  font-weight: 800;
}
.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .signed-in { margin-left: auto; margin-top: 0; }
  .shell { margin-left: 0; padding: 20px; }
  .topbar, .feedback-card { grid-template-columns: 1fr; display: grid; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .filters, .detail-grid, .user-grid, .alias-form, .inline-reset { grid-template-columns: 1fr; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .status-box { min-width: 0; }
}

@media (max-width: 560px) {
  .shell { padding: 14px; }
  .upload, .top-actions { width: 100%; }
  .upload input, .top-actions form, .top-actions button { width: 100%; max-width: none; }
  .stats { grid-template-columns: 1fr; }
  dl div { grid-template-columns: 1fr; }
}
