:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #1c1d23;
  --panel-2: #24262e;
  --line: #3a414c;
  --text: #f4f6fb;
  --muted: #a8b0bd;
  --soft: #747d8b;
  --green: #3fd3a0;
  --red: #ff6b6b;
  --orange: #ffa63d;
  --blue: #4f8cff;
  --cyan: #62d4ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Avenir Next, Helvetica, Arial, sans-serif;
  letter-spacing: 0;
}

body.is-locked,
body.invite-page {
  min-width: 0;
}

.is-locked .shell {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 210px 24px 48px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(98, 212, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98, 212, 255, 0.04) 1px, transparent 1px),
    linear-gradient(145deg, #0a0d10 0%, #111418 48%, #071114 100%);
  background-size: 44px 44px, 44px 44px, auto;
}

.login-screen::before,
.invite-shell::before {
  content: "";
  width: min(520px, 58vw);
  aspect-ratio: 1;
  position: absolute;
  top: clamp(12px, 4vh, 46px);
  left: 50%;
  transform: translateX(-50%);
  background: url("./assets/MetalKairo.png") center / contain no-repeat;
  opacity: 0.9;
  pointer-events: none;
}

.login-panel {
  width: min(520px, 100%);
  position: relative;
  z-index: 1;
  border: 1px solid rgba(98, 212, 255, 0.24);
  border-radius: 8px;
  background: rgba(21, 24, 30, 0.84);
  padding: 30px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-panel h1 {
  margin: 0;
}

.login-copy,
.login-status {
  color: var(--muted);
  line-height: 1.45;
}

.login-status {
  margin: 14px 0 0;
  font-size: 13px;
}

#loginButton {
  width: 100%;
  height: 44px;
  margin-top: 18px;
  border-color: rgba(98, 212, 255, 0.55);
  background: linear-gradient(135deg, rgba(98, 212, 255, 0.24), rgba(63, 211, 160, 0.14));
}

body:not(.is-locked) .login-screen {
  display: none;
}

.invite-page {
  min-width: 0;
}

.invite-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  padding: 210px 24px 48px;
  background:
    linear-gradient(rgba(98, 212, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98, 212, 255, 0.04) 1px, transparent 1px),
    linear-gradient(145deg, #0a0d10 0%, #111418 48%, #071114 100%);
  background-size: 44px 44px, 44px 44px, auto;
}

.invite-panel {
  width: min(540px, 100%);
}

button,
input,
textarea {
  font: inherit;
}

button,
.file-control {
  height: 36px;
  border: 1px solid #424956;
  border-radius: 6px;
  background: #2b2f38;
  color: var(--text);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

button:hover,
.file-control:hover {
  border-color: #697386;
  background: #343a45;
}

.shell {
  min-height: 100vh;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  font-weight: 850;
}

.logout-button {
  margin-left: auto;
}

.api-bar {
  display: grid;
  grid-template-columns: minmax(360px, 520px) auto;
  gap: 10px;
  align-items: center;
}

input,
textarea {
  border: 1px solid #424956;
  border-radius: 6px;
  background: #15171d;
  color: var(--text);
}

.api-bar input {
  height: 36px;
  padding: 0 12px;
}

.toolbar {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #242833;
  border-bottom: 1px solid #242833;
  margin-bottom: 18px;
}

.file-control input {
  display: none;
}

.status {
  color: var(--muted);
  margin-left: auto;
  font-size: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(680px, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.case-panel,
.main-panel,
.payload-panel,
.timeline-panel,
.zoom-panel {
  border: 1px solid #272c36;
  border-radius: 8px;
  background: var(--panel);
}

.main-panel {
  display: grid;
  gap: 16px;
  border: 0;
  background: transparent;
}

.panel-head {
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #2b303a;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.case-list {
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding: 10px;
}

.case-card {
  width: 100%;
  min-height: 76px;
  display: grid;
  gap: 6px;
  text-align: left;
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid #303642;
  border-radius: 8px;
  background: #20232b;
}

.case-card.active {
  border-color: var(--orange);
  background: #28252a;
}

.case-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.case-meta {
  color: var(--muted);
  font-size: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.summary-grid div,
.artifact-list div {
  min-height: 70px;
  border: 1px solid #2b303a;
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 6px;
}

.summary-grid span,
.artifact-list span {
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-grid strong,
.artifact-list strong {
  font-size: 17px;
  overflow-wrap: anywhere;
}

.timeline-panel {
  min-height: 250px;
}

#timelineSvg {
  width: 100%;
  height: 230px;
  display: block;
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  text-transform: none;
}

.legend i {
  width: 20px;
  height: 8px;
  display: inline-block;
  border-radius: 999px;
  margin-right: 6px;
}

.legend .begin {
  background: var(--green);
}

.legend .end {
  background: var(--red);
}

.legend .diff {
  background: var(--orange);
}

.zoom-panel {
  overflow: hidden;
}

.zoom-controls {
  display: grid;
  grid-template-columns: 36px 180px 36px;
  gap: 8px;
  align-items: center;
}

.zoom-controls button {
  width: 36px;
  padding: 0;
}

.zoom-controls input {
  width: 180px;
}

#zoomCanvas {
  width: 100%;
  height: 430px;
  display: block;
  background: #111318;
}

.payload-panel textarea {
  width: calc(100% - 20px);
  height: 310px;
  margin: 10px;
  resize: vertical;
  padding: 10px;
  line-height: 1.45;
  font-family: SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.artifact-list {
  display: grid;
  gap: 10px;
  padding: 0 10px 10px;
}

@media (max-width: 1220px) {
  body {
    min-width: 0;
  }

  .workspace {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .payload-panel {
    grid-column: 1 / -1;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
