:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #68717d;
  --line: #d9dee5;
  --paper: #ffffff;
  --panel: #f5f7fa;
  --accent: #126c5a;
  --accent-2: #8f3f30;
  --warn: #b76b00;
  --danger: #a02727;
  --focus: #2359c6;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #edf1f5;
}

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

button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
}

button.secondary {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 38%, transparent);
  outline-offset: 2px;
}

.shell {
  min-height: 100vh;
}

.loading, .auth {
  width: min(480px, calc(100vw - 32px));
  margin: 8vh auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.auth h1 {
  font-size: 28px;
  margin: 0 0 8px;
}

.muted {
  color: var(--muted);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand strong {
  font-size: 18px;
}

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

.tabs {
  display: flex;
  gap: 6px;
  padding: 12px 22px 0;
  overflow-x: auto;
}

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

.tabs button.active {
  background: var(--paper);
  border-color: var(--line);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px 22px 28px;
}

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

.panel h2, .panel h3 {
  margin: 0 0 12px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  font-weight: 650;
  font-size: 13px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 14px;
  padding: 14px;
}

legend {
  font-weight: 750;
  padding: 0 6px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-row input {
  width: auto;
  min-height: auto;
}

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

.list {
  display: grid;
  gap: 8px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.list-item button {
  min-height: 32px;
  padding: 0 10px;
}

.status {
  min-height: 24px;
  color: var(--accent);
  font-weight: 650;
}

.error {
  color: var(--danger);
}

.preview-wrap {
  overflow: auto;
  background: #cfd6df;
  padding: 18px;
  border-radius: 8px;
}

.check-page {
  width: 8.5in;
  min-height: 11in;
  background: white;
  padding: 0.38in;
  color: #111;
  box-shadow: 0 12px 28px rgba(25, 35, 45, 0.18);
}

.stub, .blank-panel {
  border: 1px dashed #a8adb4;
  min-height: 2.4in;
  padding: 0.18in;
  margin-bottom: 0.18in;
  display: grid;
  gap: 8px;
}

.check {
  position: relative;
  min-height: 3.35in;
  border: 1px solid #8c929a;
  padding: 0.2in;
  overflow: hidden;
}

.check-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.22;
}

.check-content {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr auto;
  gap: 10px;
  z-index: 1;
}

.payer, .bank {
  line-height: 1.25;
}

.check-number {
  text-align: right;
  font-weight: 800;
  font-size: 18px;
}

.pay-line, .amount-line, .memo-line, .signature-line {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: end;
  min-height: 34px;
  border-bottom: 1px solid #111;
}

.amount-line {
  grid-template-columns: auto 1fr auto;
}

.routing {
  grid-column: 1 / -1;
  margin-top: 22px;
  font-family: "Courier New", monospace;
  letter-spacing: 1px;
}

.logo-img {
  max-height: 48px;
  max-width: 140px;
  object-fit: contain;
}

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

.admin-table th, .admin-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px;
}

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

  .check-page {
    transform-origin: top left;
    width: 8.5in;
  }
}

@media print {
  body {
    background: white;
  }

  .app-header, .tabs, .workspace > .panel:first-child, .actions.no-print {
    display: none !important;
  }

  .workspace {
    display: block;
    padding: 0;
  }

  .panel, .preview-wrap {
    border: 0;
    padding: 0;
    background: white;
  }

  .check-page {
    box-shadow: none;
    width: 8.5in;
    min-height: 11in;
    page-break-after: always;
  }
}
