:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d9dfd6;
  --primary: #0f7c6c;
  --primary-strong: #0a5d52;
  --accent: #d97706;
  --soft: #edf5f2;
  --shadow: 0 18px 48px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(15, 124, 108, 0.08), transparent 34%),
    linear-gradient(225deg, rgba(217, 119, 6, 0.08), transparent 40%),
    var(--bg);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
  line-height: 1.6;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: inherit;
  font-weight: 760;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--primary);
  box-shadow: 0 8px 20px rgba(15, 124, 108, 0.12);
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 56px;
}

.title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 12px 0 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 720;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.08;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

.status-pill {
  min-width: 90px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  white-space: nowrap;
}

.status-pill.error {
  color: #b42318;
  background: #fff4f2;
  border-color: #fecdca;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.controls,
.result-panel,
.table-panel {
  padding: 18px;
}

.field {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.field label,
.field legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 124, 108, 0.12);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.segmented input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.segmented span {
  display: grid;
  min-height: 36px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  user-select: none;
}

.segmented input:checked + span {
  background: var(--primary);
  color: #fff;
}

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

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.examples button,
.icon-button,
.row-action {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.examples button {
  padding: 6px 10px;
  color: var(--muted);
  font-size: 13px;
}

.examples button:hover,
.icon-button:hover,
.row-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.icon-button {
  padding: 6px 12px;
  font-size: 13px;
}

.row-action {
  padding: 5px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.row-action.primary-action {
  border-color: rgba(15, 124, 108, 0.28);
  background: var(--soft);
  color: var(--primary-strong);
}

.row-action:disabled,
.icon-button:disabled,
.path-chip:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 160px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
}

.chip.accent {
  background: #fff6e7;
  color: var(--accent);
}

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

.result-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.result-item dt {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.result-item dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
  font-size: 14px;
  line-height: 1.45;
}

.drill-panel {
  margin-top: 18px;
  padding: 16px 18px;
}

.drill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.drill-current {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.drill-current span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.drill-current strong {
  overflow-wrap: anywhere;
  font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
  font-size: 16px;
  line-height: 1.45;
}

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

.drill-path {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.path-chip {
  min-height: 32px;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.path-chip.active {
  border-color: rgba(15, 124, 108, 0.28);
  background: var(--soft);
  color: var(--primary-strong);
}

.table-panel {
  margin-top: 18px;
}

.table-note {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

.usable-table {
  min-width: 860px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f4f7f3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

td {
  font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-row td {
  color: var(--muted);
  font-family: inherit;
  text-align: center;
}

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

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

  .status-pill {
    text-align: left;
  }
}

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

  .shell,
  .topbar {
    width: min(100vw - 20px, 1180px);
  }

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

  .controls,
  .result-panel,
  .table-panel {
    padding: 14px;
  }

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

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

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

  .table-note {
    text-align: left;
  }
}
