:root {
  color-scheme: light;
  --bg: #f4efe7;
  --paper: #fffdf8;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #dbcdbd;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --shadow: 0 20px 40px rgba(58, 34, 10, 0.08);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 28%),
    linear-gradient(180deg, #fbf7f0 0%, var(--bg) 100%);
  color: var(--ink);
}

code {
  background: rgba(15, 118, 110, 0.08);
  border-radius: 6px;
  padding: 0.1rem 0.35rem;
}

.page-shell,
.landing-shell {
  width: min(1200px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.landing-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.landing-card,
.hero-panel,
.panel {
  background: color-mix(in srgb, var(--paper) 90%, white 10%);
  border: 1px solid rgba(219, 205, 189, 0.8);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.landing-card,
.hero-panel,
.panel {
  padding: 1.5rem;
}

.hero-panel {
  margin-bottom: 1.5rem;
}

.landing-card {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  margin-bottom: 0.75rem;
}

h2 {
  font-size: 1.4rem;
}

p {
  line-height: 1.5;
}

.support-copy,
.message-line,
.panel-header p,
.plain-list,
th,
td,
input,
button,
textarea,
select {
  font-size: 0.95rem;
}

.landing-actions,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.toolbar {
  margin-bottom: 1rem;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.stack-form {
  display: grid;
  gap: 0.9rem;
}

.compact-form {
  margin: 1rem 0 1.25rem;
}

.form-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.5rem;
}

.form-mode-row strong {
  color: var(--accent-strong);
}

.form-mode-row .secondary-button {
  padding: 0.55rem 0.85rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 0.95rem;
  background: white;
  color: var(--ink);
}

textarea {
  min-height: 180px;
  resize: vertical;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
}

button,
.primary-button,
.secondary-button {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
}

.danger-button {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.data-table {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.75rem;
  vertical-align: top;
  border-bottom: 1px solid rgba(219, 205, 189, 0.8);
}

th {
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
}

tr:last-child td {
  border-bottom: none;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
}

.table-actions button {
  padding: 0.55rem 0.8rem;
  white-space: nowrap;
}

.hidden {
  display: none;
}

.message-line {
  min-height: 1.4rem;
  margin-top: 0.75rem;
  color: var(--muted);
}

.plain-list {
  padding-left: 1rem;
}

.cost-page-shell {
  width: min(1540px, calc(100vw - 2rem));
}

.cost-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.cost-hero .support-copy {
  max-width: 760px;
  margin-bottom: 0;
}

.cost-login-form {
  max-width: 520px;
  margin-top: 1rem;
}

.cost-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.summary-card {
  min-height: 142px;
  padding: 1.2rem;
  border: 1px solid rgba(219, 205, 189, 0.9);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 253, 248, 0.82)),
    var(--paper);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.summary-card-accent {
  color: white;
  border-color: transparent;
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 255, 255, 0.2), transparent 32%),
    linear-gradient(135deg, #0f766e, #164e63);
}

.summary-card span,
.summary-card small {
  color: var(--muted);
}

.summary-card-accent span,
.summary-card-accent small {
  color: rgba(255, 255, 255, 0.78);
}

.summary-card strong {
  margin: 0.5rem 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 2.5vw, 2.35rem);
  line-height: 1;
}

.cost-table-panel {
  padding: 0;
  overflow: hidden;
}

.cost-panel-header,
.table-controls,
.pagination {
  padding: 1.25rem 1.5rem;
}

.cost-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.cost-panel-header p {
  margin-bottom: 0;
}

.table-controls {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(140px, 1fr));
  gap: 0.8rem;
  border-top: 1px solid var(--line);
  background: rgba(15, 118, 110, 0.035);
}

.cost-data-table {
  max-height: min(66vh, 760px);
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.cost-data-table table {
  min-width: 1500px;
}

.cost-data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.cost-data-table tbody tr:hover {
  background: rgba(15, 118, 110, 0.045);
}

.sort-button {
  width: 100%;
  justify-content: flex-start;
  padding: 0;
  border-radius: 0;
  color: inherit;
  background: transparent;
  white-space: nowrap;
}

.sort-button::after {
  content: "";
  width: 0.8rem;
  margin-left: 0.3rem;
}

.sort-button.active[data-direction="asc"]::after {
  content: "↑";
}

.sort-button.active[data-direction="desc"]::after {
  content: "↓";
}

.numeric {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.numeric .sort-button {
  justify-content: flex-end;
}

.money-cell,
.response-id {
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.82rem;
}

.total-money {
  color: var(--accent-strong);
  font-weight: 700;
}

.source-badge,
.stage-label {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  white-space: nowrap;
}

.source-badge {
  color: #0c4a6e;
  background: #e0f2fe;
}

.stage-label {
  color: #7c2d12;
  background: #ffedd5;
}

.cell-detail {
  display: block;
  max-width: 190px;
  margin-top: 0.25rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.date-cell {
  min-width: 170px;
}

.response-id {
  display: block;
  max-width: 220px;
  overflow-wrap: anywhere;
}

.empty-table {
  padding: 3rem;
  text-align: center;
  color: var(--muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}

.pagination button {
  padding: 0.6rem 1rem;
}

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

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

  .page-shell,
  .landing-shell {
    width: min(100vw - 1rem, 100%);
  }

  .toolbar,
  .landing-actions,
  .cost-hero,
  .cost-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .table-controls {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .cost-summary,
  .table-controls {
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}
