:root {
  color-scheme: light;
  --bg: #f8f8fa;
  --panel: #ffffff;
  --ink: #25242d;
  --text: #5d5d6b;
  --muted: #92929f;
  --line: #e2e1e8;
  --line-soft: #edecf1;
  --accent: #6c4ff6;
  --accent-strong: #563dd3;
  --danger: #bc4055;
  --warning: #ae7311;
  --success: #27815f;
  --shadow: 0 18px 48px rgba(31, 27, 48, 0.13);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  background:
    radial-gradient(circle at 92% -5%, rgba(108, 79, 246, 0.08), transparent 25%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(108, 79, 246, 0.55);
  outline-offset: 2px;
}

.app-header {
  align-items: center;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(226, 225, 232, 0.9);
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(285px, 1fr) auto auto;
  min-height: 76px;
  padding: 12px max(26px, calc((100vw - 1440px) / 2));
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand-mark {
  background: var(--accent);
  border-radius: 9px;
  box-shadow: 0 6px 16px rgba(108, 79, 246, 0.24);
  display: inline-block;
  height: 32px;
  overflow: hidden;
  position: relative;
  transform: rotate(-4deg);
  width: 32px;
}

.brand-mark i:first-child {
  background: #fff;
  border-radius: 99px;
  height: 15px;
  left: 8px;
  position: absolute;
  top: 8px;
  width: 6px;
}

.brand-mark i:last-child {
  background: #fff;
  border-radius: 50%;
  height: 6px;
  position: absolute;
  right: 7px;
  top: 8px;
  width: 6px;
}

.app-header h1,
.panel h2,
.column h3,
.recorder-lab h2 {
  color: var(--ink);
  letter-spacing: -0.45px;
  margin: 0;
}

.app-header h1 {
  font-size: 16px;
}

.eyebrow {
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 3px;
  text-transform: uppercase;
}

nav {
  display: flex;
  gap: 4px;
}

nav a,
button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 680;
  min-height: 38px;
  padding: 8px 13px;
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

.recorder-load-error {
  background: #fff3f5;
  border: 1px solid #edcbd1;
  border-radius: 9px;
  color: #9f3447;
  display: grid;
  font-size: 9px;
  gap: 2px;
  min-width: 210px;
  padding: 8px 11px;
}

.recorder-load-error strong {
  color: inherit;
  font-size: 10px;
}

.recorder-load-error code {
  background: rgba(159, 52, 71, .08);
  border-radius: 3px;
  padding: 1px 3px;
}

button:hover,
nav a:hover {
  background: #f7f5ff;
  border-color: #cfc7fa;
  color: var(--accent-strong);
}

main {
  margin: 26px auto 64px;
  max-width: 1440px;
  padding: 0 26px;
  width: 100%;
}

.recorder-lab {
  background:
    radial-gradient(circle at 93% 0, rgba(153, 129, 255, 0.24), transparent 31%),
    linear-gradient(140deg, #241c3f, #302253 62%, #392768);
  border-radius: 17px;
  box-shadow: 0 18px 38px rgba(38, 27, 67, 0.16);
  color: #cec8db;
  display: grid;
  gap: 25px;
  grid-template-columns: minmax(250px, 0.8fr) minmax(470px, 1.2fr);
  margin-bottom: 20px;
  overflow: hidden;
  padding: 24px;
  position: relative;
}

.recorder-lab::after {
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 30px 30px;
  content: '';
  inset: 0;
  mask-image: linear-gradient(to right, transparent, #000);
  pointer-events: none;
  position: absolute;
}

.lab-heading,
.lab-settings,
.telemetry-grid {
  position: relative;
  z-index: 1;
}

.lab-heading {
  align-items: flex-start;
  display: flex;
  gap: 13px;
}

.lab-icon {
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  color: #ae9bff;
  display: flex;
  flex: 0 0 auto;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.recorder-lab .eyebrow {
  color: #b9aaff;
}

.recorder-lab h2 {
  color: #fff;
  font-size: 18px;
  margin-bottom: 7px;
}

.recorder-lab p {
  font-size: 10px;
  line-height: 1.55;
  margin: 0;
}

.lab-settings {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr 1fr auto auto;
}

.lab-settings label {
  color: #c1bacd;
}

.lab-settings select {
  background-color: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.14);
  color: #fff;
}

.lab-settings select option {
  color: var(--ink);
}

.lab-settings button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.integration-settings {
  grid-column: 1 / -1;
  position: relative;
  z-index: 1;
}

.integration-settings summary {
  color: #d8d2e4;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  width: max-content;
}

.integration-settings > div {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) minmax(180px, .8fr);
  margin-top: 12px;
}

.integration-settings label {
  color: #c1bacd;
}

.integration-settings input {
  background-color: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.14);
  color: #fff;
}

.integration-settings p {
  color: #aaa2b8;
  padding-bottom: 8px;
}

.check-control {
  align-items: center;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  display: flex;
  gap: 7px;
  min-height: 38px;
  padding: 0 10px;
  white-space: nowrap;
}

.check-control input {
  accent-color: var(--accent);
  min-height: 0;
  width: auto;
}

.telemetry-grid {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.telemetry-grid > div {
  align-items: center;
  background: rgba(255,255,255,.075);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  display: flex;
  gap: 10px;
  min-height: 56px;
  padding: 10px;
}

.telemetry-icon {
  align-items: center;
  background: rgba(255,255,255,.1);
  border-radius: 7px;
  color: #b9aaff;
  display: flex;
  font-size: 12px;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.status-icon::before {
  background: #65d1aa;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(101,209,170,.12);
  content: '';
  height: 7px;
  width: 7px;
}

body[data-recorder-status="recording"] .status-icon::before {
  animation: telemetry-pulse 1s ease infinite;
  background: #ff6c85;
  box-shadow: 0 0 0 5px rgba(255,108,133,.12);
}

@keyframes telemetry-pulse {
  50% { transform: scale(.7); }
}

.telemetry-grid small,
.telemetry-grid strong {
  display: block;
}

.telemetry-grid small {
  color: #aaa3b9;
  font-size: 8px;
}

.telemetry-grid strong {
  color: #fff;
  font-size: 10px;
  margin-top: 2px;
}

.toolbar,
.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  box-shadow: 0 1px 2px rgba(27, 24, 42, 0.035);
}

.toolbar {
  align-items: end;
  display: grid;
  gap: 13px;
  grid-template-columns: 190px 160px minmax(260px, 1fr) auto;
  margin-bottom: 18px;
  padding: 15px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 10px;
  font-weight: 700;
  gap: 6px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 11px;
  min-height: 38px;
  outline: none;
  padding: 8px 10px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #9f8af5;
  box-shadow: 0 0 0 3px rgba(108, 79, 246, 0.09);
}

textarea {
  line-height: 1.5;
  resize: vertical;
}

.secondary {
  background: #f7f6f9;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 430px;
}

.panel {
  padding: 20px;
}

.hero-panel {
  align-content: space-between;
  display: grid;
  min-height: 420px;
}

.case-heading,
.section-title {
  align-items: flex-start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.case-heading h2 {
  font-size: 32px;
  line-height: 1.09;
  max-width: 760px;
}

.hero-panel p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
  max-width: 760px;
}

.hero-panel .hint {
  background: #f4f1ff;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  color: var(--text);
  font-size: 11px;
  padding: 10px 12px;
}

.metric-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, 1fr);
}

.metric-row div {
  background: #faf9fc;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 13px;
}

.metric-row span {
  color: var(--muted);
  display: block;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.metric-row strong {
  color: var(--ink);
  display: block;
  font-size: 23px;
  letter-spacing: -.7px;
  margin-top: 6px;
}

.stacked-form {
  display: grid;
  gap: 13px;
}

.split {
  display: grid;
  gap: 11px;
  grid-template-columns: 1fr 1fr;
}

fieldset {
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
}

fieldset legend {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  padding: 0 4px;
}

fieldset label {
  align-items: center;
  color: var(--text);
  display: flex;
  font-weight: 500;
  gap: 8px;
}

fieldset input {
  accent-color: var(--accent);
  min-height: 0;
  width: auto;
}

.layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 300px minmax(0, 1fr);
  margin-top: 18px;
}

.timeline {
  display: grid;
  gap: 14px;
  padding-left: 20px;
}

.timeline li::marker {
  color: var(--accent);
}

.timeline li strong,
.timeline li span {
  display: block;
}

.timeline li strong {
  color: var(--ink);
  font-size: 10px;
}

.timeline li span {
  color: var(--muted);
  font-size: 9px;
  margin-top: 2px;
}

.segmented {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  overflow: hidden;
}

.segmented button {
  border: 0;
  border-radius: 0;
  min-height: 32px;
  padding: 5px 10px;
}

.segmented .active {
  background: var(--accent);
  color: #fff;
}

.columns {
  display: grid;
  gap: 11px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
}

.column {
  background: #faf9fc;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  min-height: 300px;
  padding: 13px;
}

.column h3 {
  font-size: 11px;
}

.ticket {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-top: 11px;
  padding: 11px;
}

.ticket.selected {
  border-color: #9d89f3;
  box-shadow: 0 0 0 3px rgba(108, 79, 246, 0.1);
}

.ticket p {
  color: var(--text);
  font-size: 10px;
  line-height: 1.45;
  margin: 8px 0 0;
}

.badge {
  align-items: center;
  background: #f0eef5;
  border-radius: 999px;
  color: #615e6b;
  display: inline-flex;
  font-size: 8px;
  font-weight: 800;
  min-height: 21px;
  padding: 3px 8px;
}

.badge.danger { background: #fff0f2; color: var(--danger); }
.badge.warning { background: #fff5df; color: var(--warning); }
.badge.success { background: #eaf8f1; color: var(--success); }

table {
  border-collapse: collapse;
  margin-top: 14px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  font-size: 10px;
  padding: 12px 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.toast {
  background: #282431;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  bottom: 24px;
  box-shadow: var(--shadow);
  color: #fff;
  font-size: 11px;
  max-width: 340px;
  padding: 13px 15px;
  position: fixed;
  right: 24px;
  transform: translateY(120px);
  transition: transform 180ms ease;
  z-index: 20;
}

.toast.show {
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .app-header {
    grid-template-columns: 1fr auto;
  }

  .app-header nav {
    display: none;
  }

  .recorder-lab {
    grid-template-columns: 1fr;
  }

  .lab-settings {
    grid-template-columns: repeat(3, 1fr) auto auto;
  }
}

@media (max-width: 860px) {
  .grid,
  .layout {
    grid-template-columns: 1fr;
  }

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

  .lab-settings,
  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .integration-settings > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .app-header {
    align-items: stretch;
    grid-template-columns: 1fr;
    padding: 12px 16px;
  }

  #buglessly-recorder-slot > * {
    width: 100%;
  }

  main {
    padding: 0 14px;
  }

  .recorder-lab {
    padding: 18px;
  }

  .integration-settings > div {
    grid-template-columns: 1fr;
  }

  .lab-settings,
  .telemetry-grid,
  .toolbar,
  .columns,
  .metric-row,
  .split {
    grid-template-columns: 1fr;
  }

  .check-control {
    min-height: 40px;
  }

  .case-heading,
  .section-title {
    display: grid;
  }

  .case-heading h2 {
    font-size: 26px;
  }
}
