:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --surface: #fffdf7;
  --surface-2: #f8faf7;
  --ink: #17211f;
  --muted: #5a6863;
  --line: #d9ded7;
  --green: #0e7d68;
  --blue: #eaf2fb;
  --cream: #fff3dc;
  --danger: #9f3a38;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}

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

button,
.button {
  border: 1px solid #20312d;
  background: var(--ink);
  color: #fffdf7;
  border-radius: 7px;
  padding: 9px 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
}

button.ghost {
  background: transparent;
  color: var(--ink);
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 34px 40px 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 42px;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  margin-bottom: 0;
}

h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.summary {
  max-width: 880px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.header-actions,
.panel-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

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

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 10px 24px rgb(23 33 31 / 0.06);
}

.capture-panel,
.metrics-panel {
  align-self: start;
}

.ledger-panel,
.jobs-panel {
  grid-column: 2;
}

form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

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

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
  resize: vertical;
}

input {
  resize: none;
}

#providerBadge {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
}

.result-box {
  margin-top: 14px;
  padding: 12px;
  border-radius: 7px;
  background: #eaf7f2;
  color: #123c35;
  line-height: 1.45;
}

.result-box.error {
  background: #fff0ef;
  color: var(--danger);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.metrics div {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
}

.metrics strong {
  display: block;
  font-size: 28px;
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
}

.token-box,
.shortcut-box,
.setup-box {
  background: var(--cream);
  border: 1px solid #eadcc5;
  border-radius: 8px;
  padding: 14px;
}

.token-box {
  margin-bottom: 12px;
}

.token-box p,
.setup-box p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 10px;
}

.shortcut-box {
  margin-bottom: 12px;
}

.token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

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

pre {
  overflow: auto;
  max-height: 220px;
  background: #17211f;
  color: #e7f8ef;
  border-radius: 7px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
}

.table-wrap {
  overflow: auto;
  margin-top: 16px;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-2);
}

td strong {
  display: block;
}

td span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

td:last-child {
  white-space: nowrap;
}

td:last-child button + button {
  margin-left: 6px;
}

.amount {
  font-weight: 800;
}

.amount.negative {
  color: #a34234;
}

.amount.positive {
  color: #0d6e55;
}

.empty {
  color: var(--muted);
  padding: 18px;
}

.job-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.job-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--blue);
  padding: 12px;
}

.job-item p {
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 13px;
}

@media (max-width: 980px) {
  .app-header,
  .layout {
    padding-left: 18px;
    padding-right: 18px;
  }

  .app-header,
  .layout {
    display: block;
  }

  .header-actions {
    justify-content: flex-start;
    margin-top: 16px;
  }

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

  .panel {
    margin-bottom: 16px;
  }
}
