:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-alt: #f0f4f3;
  --line: #d7dddf;
  --text: #192124;
  --muted: #5f6b70;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --warning: #996300;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.4;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

button.secondary:hover {
  background: var(--surface-alt);
}

button.danger {
  color: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

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

label input,
label textarea {
  color: var(--text);
  font-weight: 400;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.app {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-actions,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 4px;
  font-size: 15px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(320px, 1fr) minmax(320px, 1fr);
  grid-template-areas:
    "create payloads detail"
    "create fires detail";
  gap: 18px;
  padding: 18px;
}

.section {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.create-section {
  grid-area: create;
}

.payload-section {
  grid-area: payloads;
}

.fire-section {
  grid-area: fires;
}

.detail-section {
  grid-area: detail;
  min-height: calc(100vh - 110px);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.payload-form {
  display: grid;
  gap: 12px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.check {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-weight: 600;
}

.check input {
  width: auto;
}

.list {
  display: grid;
  gap: 10px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.item {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.item-title {
  min-width: 0;
}

.item-title h3,
.item-title p {
  overflow-wrap: anywhere;
}

.item-title p,
.meta,
.snippet,
.snippet-label {
  color: var(--muted);
  font-size: 12px;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.item-actions button {
  min-height: 32px;
  padding: 0 10px;
}

.snippet-stack {
  display: grid;
  gap: 6px;
}

.snippet-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.snippet-label {
  font-weight: 800;
}

.snippet {
  min-width: 0;
  overflow-x: auto;
  border-radius: 6px;
  background: #eef2f1;
  color: #263234;
  padding: 8px;
  white-space: nowrap;
}

.status,
.count {
  min-width: 28px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  text-align: center;
}

.badge {
  width: max-content;
  border-radius: 999px;
  background: #e6f4f1;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
}

.badge.disabled {
  background: #f7eceb;
  color: var(--danger);
}

.report-detail {
  min-height: 420px;
  max-height: calc(100vh - 170px);
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
  color: #d7f0e8;
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(280px, 360px) minmax(320px, 1fr);
    grid-template-areas:
      "create payloads"
      "fires detail";
  }

  .detail-section {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "create"
      "payloads"
      "fires"
      "detail";
    padding: 12px;
  }

  .section {
    padding: 12px;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .item-header {
    flex-direction: column;
  }

  .item-actions {
    justify-content: flex-start;
  }

  .snippet-row {
    grid-template-columns: 1fr;
  }
}
