:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #252328;
  background: #f7f5f7;
  font-size: 16px;
  line-height: 1.5;
  --ink-soft: #625965;
  --accent: #8c1c5f;
  --accent-dark: #6c1348;
  --line: #e8e0e6;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; }
button, input, select { margin: 0; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid #a73c7d; outline-offset: 3px; }

.masthead { background: #2c1929; color: #fff; }
.masthead-inner {
  width: min(1120px, 100% - 48px);
  min-height: 64px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 1rem; font-weight: 750; letter-spacing: .09em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 6px;
  background: #f7ddec;
  color: #6c1348;
  font-family: Georgia, serif;
  font-size: 1.14rem;
  letter-spacing: 0;
}
.environment { border-inline-start: 1px solid #725b6e; padding-inline-start: 16px; font-size: .84rem; color: #eedeea; }
.masthead-spacer { flex: 1; }
.masthead .logout { border-color: #725b6e; background: transparent; color: #fff; }
.masthead .logout:hover { background: #463044; }

main { width: min(1120px, 100% - 48px); margin: 44px auto 64px; }
.login-card { max-width: 440px; margin: min(10vh, 96px) auto 0; padding: 30px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 10px 32px #4525380b; }
.login-card h1 { font-size: 1.7rem; }
.login-card > p { margin-top: 8px; color: var(--ink-soft); }
.login-card form { display: grid; gap: 10px; margin-top: 24px; }
.login-card form .primary { margin-top: 4px; }

.hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.hero h1 { margin-top: 4px; font-size: clamp(1.85rem, 4vw, 2.65rem); line-height: 1.1; letter-spacing: -.035em; }
.hero > div:first-child > p:last-child { margin-top: 10px; color: var(--ink-soft); }
.eyebrow { color: var(--accent-dark); font-size: .75rem; font-weight: 760; letter-spacing: .095em; text-transform: uppercase; }
.total-card {
  min-width: 172px;
  display: grid;
  padding: 12px 18px;
  border: 1px solid #efd9e7;
  border-radius: 12px;
  background: #fff4fa;
  color: #69234e;
}
.total-card span { font-size: .83rem; font-weight: 670; }
.total-card strong { font-size: 1.8rem; line-height: 1.2; font-variant-numeric: tabular-nums; }

.section-nav { display: flex; gap: 4px; margin-top: 28px; border-bottom: 1px solid #dacfd8; }
.section-nav button {
  padding: 10px 15px;
  border: 1px solid transparent;
  border-bottom: 3px solid transparent;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--ink-soft);
}
.section-nav button:hover { background: #f2e8ef; }
.section-nav button[aria-pressed="true"] { border-bottom-color: var(--accent); color: var(--accent-dark); }

.panel {
  overflow: hidden;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 20px #45253807;
}
.panel-head, .panel-tools, .panel-footer { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 17px 22px; }
.panel-head { min-height: 94px; }
.panel-head h2 { font-size: 1.2rem; letter-spacing: -.014em; }
.panel-head p { margin-top: 3px; color: var(--ink-soft); font-size: .9rem; }
.panel-head > button { flex: none; }
.panel-tools { align-items: end; border-top: 1px solid var(--line); }
.filter, .field { display: grid; gap: 5px; }
.filter-input { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.filter-input input { width: min(100%, 214px); }
label { font-weight: 650; font-size: .86rem; }
input:not([type="checkbox"]), select {
  min-width: 0;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid #cdbec9;
  border-radius: 7px;
  background: #fff;
  color: inherit;
}
input::placeholder { color: #766777; opacity: 1; }
input:read-only { background: #f7f3f6; }
button {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #d5c8d2;
  border-radius: 7px;
  background: #fff;
  color: #3e303c;
  font-size: .86rem;
  font-weight: 670;
}
button:hover:enabled { background: #f5edf3; }
button.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
button.primary:hover:enabled { border-color: var(--accent-dark); background: var(--accent-dark); }
button.danger { border-color: #9f2437; background: #9f2437; color: #fff; }
button.danger:hover:enabled { background: #7b1424; }

.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 660px; border-collapse: collapse; text-align: start; font-size: .88rem; }
th { background: #f5eff4; color: #4e3e4d; font-size: .77rem; font-weight: 740; text-align: start; }
th, td { padding: 11px 14px; border-block-end: 1px solid #eee7ed; }
th:first-child, td:first-child { padding-inline-start: 22px; }
th:last-child, td:last-child { padding-inline-end: 22px; }
td { vertical-align: middle; }
tbody tr:last-child td { border-block-end: 0; }
tbody tr:hover { background: #fcf9fb; }
.folio, .numeric, .correlation { font-variant-numeric: tabular-nums; }
.folio { font-weight: 720; color: #372334; }
.actions-column { text-align: end; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-actions button { min-height: 33px; padding: 4px 8px; }
.row-actions .remove { color: #8b293a; }
.pill { display: inline-block; border-radius: 5px; padding: 3px 7px; background: #eee8ee; color: #4f4050; font-size: .79rem; font-weight: 700; white-space: nowrap; }
.pill.success { background: #e4f1e7; color: #245232; }
.pill.progress { background: #e9eefb; color: #2c467c; }
.pill.ready { background: #f9edd8; color: #764609; }
.pill.error { background: #fbe7e9; color: #8b293a; }
.empty { padding-block: 32px; color: var(--ink-soft); }
.panel-footer { border-top: 1px solid var(--line); }
.panel-footer p { color: var(--ink-soft); font-size: .83rem; }
.pagination { display: flex; gap: 6px; }

.notice { padding: 10px 12px; border-radius: 7px; background: #edf2fb; color: #304668; font-size: .87rem; }
.notice.overall { margin-top: 16px; }
.notice.error { background: #fbe7e9; color: #8b293a; }
.notice.success { background: #e4f1e7; color: #245232; }

dialog {
  width: min(552px, 100% - 28px);
  max-height: min(90vh, 780px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: inherit;
  box-shadow: 0 20px 60px #2c192949;
}
dialog::backdrop { background: #2c192977; }
.dialog-content { padding: 23px; }
.dialog-content h2 { font-size: 1.28rem; }
.dialog-content > p { margin-top: 6px; color: var(--ink-soft); }
.dialog-content > .notice { margin-top: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.receipt-field { grid-column: 1 / -1; }
.checkbox-label { display: flex; align-items: center; gap: 8px; margin-block: 5px; }
.checkbox-label input { width: 17px; height: 17px; accent-color: var(--accent); }
.field-help { color: var(--ink-soft); font-size: .8rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.audit-dialog { width: min(800px, 100% - 28px); }
.correlation { overflow-wrap: anywhere; font-size: .83rem; }
.payloads { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 16px; }
.payloads h3 { font-size: .88rem; }
.payloads pre {
  min-height: 120px;
  max-height: 310px;
  overflow: auto;
  margin: 5px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8f4f8;
  font-size: .78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .masthead-inner, main { width: calc(100% - 28px); }
  main { margin-top: 24px; }
  .masthead-inner { min-height: 60px; gap: 9px; }
  .environment { padding-inline-start: 9px; font-size: .72rem; }
  .logout { padding-inline: 7px; }
  .hero { align-items: stretch; flex-direction: column; gap: 16px; }
  .total-card { display: flex; justify-content: space-between; align-items: center; min-width: 0; padding: 8px 13px; }
  .total-card strong { font-size: 1.48rem; }
  .section-nav { margin-top: 16px; }
  .panel-head, .panel-tools, .panel-footer { padding: 12px; gap: 8px; }
  .panel-head { min-height: auto; align-items: flex-start; }
  .panel-head p { font-size: .81rem; }
  .panel-tools { align-items: flex-end; flex-wrap: wrap; }
  th:first-child, td:first-child { padding-inline-start: 12px; }
  th:last-child, td:last-child { padding-inline-end: 12px; }
  .dialog-content { padding: 16px; }
  .form-grid, .payloads { grid-template-columns: 1fr; }
}
