:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d9dee7;
  --text: #18202b;
  --muted: #667085;
  --accent: #147a5b;
  --danger: #b42318;
  --warn: #b54708;
}

* {
  box-sizing: border-box;
}

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

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  font-weight: 680;
}

h2 {
  font-size: 14px;
  font-weight: 680;
}

p,
.muted {
  color: var(--muted);
  font-size: 13px;
}

main {
  padding: 18px;
}

button,
input,
select,
textarea {
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
}

button {
  padding: 0 12px;
  cursor: pointer;
}

button:disabled {
  color: #98a2b3;
  cursor: not-allowed;
}

.dangerButton {
  border-color: #fecdca;
  color: var(--danger);
}

.dangerGhostButton {
  border-color: #fecdca;
  background: #fffafa;
  color: var(--danger);
}

.dangerGhostButton:hover:not(:disabled) {
  border-color: #fda29b;
  background: #fff1f0;
}

.dangerTextButton {
  width: auto;
  min-width: 44px;
  height: 28px;
  flex: none;
  padding: 0 9px;
  border-color: transparent;
  background: #fff7f7;
  color: var(--danger);
  font-size: 12px;
  line-height: 26px;
  white-space: nowrap;
}

.dangerTextButton:hover:not(:disabled) {
  border-color: #fecdca;
  background: #fee4e2;
}

.dangerSolidButton {
  border-color: #b42318;
  background: #b42318;
  color: #fff;
}

.dangerSolidButton:hover:not(:disabled) {
  border-color: #912018;
  background: #912018;
}

input {
  width: 190px;
  padding: 0 10px;
}

select {
  width: 100%;
  min-height: 84px;
  padding: 8px;
}

textarea {
  width: 100%;
  height: auto;
  min-height: 74px;
  padding: 9px 10px;
  resize: vertical;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.authPanel {
  display: grid;
  width: 300px;
  gap: 6px;
}

.authHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #344054;
  font-size: 12px;
  font-weight: 650;
}

.authStatus {
  border-radius: 999px;
  background: #fff4e5;
  color: var(--warn);
  padding: 2px 8px;
  font-size: 11px;
}

.authOptional .authStatus {
  background: #e7f5ef;
  color: var(--accent);
}

.authInputRow {
  display: flex;
  gap: 8px;
}

.authInputRow input {
  width: 210px;
}

.authInputRow button {
  flex: none;
}

.authPanel p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 14px;
}

.lower {
  grid-template-columns: 420px 1fr;
  margin-top: 14px;
}

.panel {
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panelHeader {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.list {
  max-height: 520px;
  overflow: auto;
}

.list.compact {
  max-height: 300px;
}

.item {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.item:hover,
.item.active {
  background: #eef7f3;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.title {
  overflow: hidden;
  min-width: 0;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  flex: none;
  border-radius: 999px;
  padding: 3px 8px;
  background: #e7f5ef;
  color: var(--accent);
  font-size: 12px;
  font-weight: 620;
}

.badge.warn {
  background: #fff4e5;
  color: var(--warn);
}

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

.preview {
  margin-top: 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detailBody {
  padding: 14px;
}

.section {
  margin-bottom: 18px;
}

.section h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

pre {
  overflow: auto;
  border-radius: 8px;
  background: #101828;
  color: #f2f4f7;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
}

.formStack {
  display: grid;
  gap: 12px;
  padding: 14px;
}

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

.formStack input {
  width: 100%;
}

.checkLine {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.checkLine input {
  width: auto;
  height: auto;
}

.splitList {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 14px;
  padding: 14px;
}

.splitList.three {
  grid-template-columns: 220px 1fr 1fr;
}

.splitList h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.tagRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tagListItem {
  cursor: default;
}

.tagActions {
  display: flex;
  min-width: 0;
  flex: none;
  align-items: center;
  gap: 6px;
}

.tagActions .badge {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emptyState {
  padding: 14px;
}

.modalOverlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(16 24 40 / 42%);
  backdrop-filter: blur(3px);
}

.modalOverlay[hidden] {
  display: none;
}

.confirmDialog {
  width: min(460px, 100%);
  border: 1px solid #f2d1cf;
  border-radius: 12px;
  background: #fffdfc;
  box-shadow: 0 22px 70px rgb(16 24 40 / 24%);
  padding: 20px;
}

.confirmEyebrow {
  margin-bottom: 6px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.confirmTitle {
  color: var(--text);
  font-size: 18px;
  line-height: 1.35;
}

.confirmMessage {
  margin-top: 8px;
  color: #475467;
  font-size: 14px;
  line-height: 1.6;
}

.confirmList {
  display: grid;
  gap: 7px;
  margin: 16px 0 0;
  padding: 12px 14px 12px 30px;
  border: 1px solid #fecdca;
  border-radius: 8px;
  background: #fff7f7;
  color: #475467;
  font-size: 13px;
  line-height: 1.45;
}

.modalCheckLine {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  color: #344054;
  font-size: 13px;
}

.modalCheckLine input {
  width: 16px;
  height: 16px;
}

.modalActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .splitList,
  .splitList.three {
    grid-template-columns: 1fr;
  }
}
