:root {
  --bg: #eef3f9;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --line: #cfe0f5;
  --line-strong: #9fbbe4;
  --text: #0f2645;
  --muted: #557095;
  --blue: #1267e8;
  --blue-dark: #0b4bb1;
  --green: #17a966;
  --green-dark: #0b7c46;
  --yellow: #fff3bf;
  --yellow-line: #eda900;
  --danger: #c4233d;
  --shadow: 0 18px 46px rgba(35, 55, 82, 0.14);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7faff 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.app-shell { width: min(1510px, calc(100vw - 32px)); margin: 0 auto; padding-bottom: 28px; }
.topbar {
  height: 64px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  border-bottom: 3px solid #d7dee8;
  gap: 20px;
}
.tabs { display: flex; gap: 12px; align-items: end; }
.tab {
  min-width: 104px;
  height: 40px;
  border: 0;
  border-radius: 5px 5px 0 0;
  background: #869898;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 9px rgba(22, 40, 56, 0.18);
}
.tab.active {
  background: linear-gradient(180deg, #33424c, #22323c);
  border-bottom: 3px solid #f3c400;
}
.brand-row { display: flex; align-items: center; gap: 12px; padding-bottom: 11px; }
.brand-mark { display: inline-flex; align-items: baseline; gap: 0; color: #4f5963; font-size: 23px; line-height: 1; white-space: nowrap; }
.brand-mark span { width: 11px; height: 16px; margin-right: 5px; border-left: 5px solid #19c95f; border-top: 5px solid #19c95f; display: inline-block; transform: translateY(1px); }
.brand-mark strong { color: #232d35; }
.brand-mark em { font-style: normal; color: #8a8f93; }
.user-chip { color: var(--muted); font-size: 12px; font-weight: 700; }
.logout-link { color: var(--blue); font-size: 12px; font-weight: 700; text-decoration: none; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 214px; gap: 18px; padding-top: 18px; }
.main-column { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-lite { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 0 rgba(255,255,255,.8) inset; }
.quick-search { position: relative; display: grid; grid-template-columns: 160px 1fr; align-items: center; gap: 18px; padding: 14px; z-index: 10; }
.quick-title { display: flex; align-items: center; gap: 10px; color: #063b82; font-size: 16px; }
.quick-title svg { width: 24px; height: 24px; fill: none; stroke: var(--blue); stroke-width: 2; stroke-linecap: round; }
.quick-fields { display: grid; grid-template-columns: minmax(260px, 520px); gap: 12px; }
label { display: block; color: #4a6385; font-size: 12px; font-weight: 700; }
input, select {
  width: 100%;
  height: 36px;
  margin-top: 5px;
  border: 1px solid #bfd2ef;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(18, 103, 232, .12); }
input.is-blocked { background: var(--yellow); border-color: var(--yellow-line); }
.search-results {
  position: absolute;
  top: 76px;
  left: 193px;
  width: min(450px, calc(100vw - 250px));
  max-height: 242px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  box-shadow: var(--shadow);
}
.result-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #e5edf8; cursor: pointer; }
.result-row:last-child { border-bottom: 0; }
.result-row:hover { background: #eef6ff; }
.result-row strong { display: block; font-size: 13px; color: var(--text); }
.result-row span { color: var(--muted); font-size: 12px; }
.result-row b { color: var(--blue); font-size: 12px; }
.entry-card { padding: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 11px; }
.section-head h2, .actions-panel h2 { margin: 0; color: #063b82; font-size: 18px; letter-spacing: 0; }
.section-head span { color: var(--muted); font-size: 12px; font-weight: 700; }
.section-gap { margin-top: 22px; }
.grid { display: grid; gap: 12px; }
.personal-grid { grid-template-columns: 1fr 1fr 1.6fr; max-width: 900px; }
.personal-grid > label:nth-child(1) { grid-column: 1 / span 2; }
.personal-grid > label:nth-child(2) { grid-column: 3 / span 2; }
.personal-grid > .personal-company { grid-column: 5 / span 4; }
.personal-phone { grid-column: 1 / span 1; }
.personal-address { grid-column: 2 / span 3; }
.personal-city { grid-column: 5 / span 2; }
.personal-state { grid-column: 7 / span 1; }
.personal-zip { grid-column: 8 / span 1; }
.payment-grid { grid-template-columns: minmax(210px, 300px) minmax(120px, 170px) minmax(260px, 390px); max-width: 900px; align-items: end; }
.bank-grid { grid-template-columns: .9fr 1.25fr .9fr .8fr .95fr .85fr; max-width: 900px; }
.span2 { grid-column: span 2; }
.wide { grid-column: span 1; }
.inline-warning {
  color: var(--danger) !important;
  background: #fff5d7;
  border: 1px solid #f2be42;
  border-radius: 6px;
  padding: 7px 9px;
  max-width: 520px;
}
.lower-grid { display: grid; grid-template-columns: minmax(520px, 1.36fr) minmax(340px, .84fr); gap: 14px; align-items: start; }
.check-card { padding: 10px; display: flex; align-items: flex-start; justify-content: center; min-height: 0; align-self: start; }
.check-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 2.32 / 1;
  background: #fbfffd;
  border: 1px solid #9ad7b4;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(28, 48, 70, .13);
  font-family: 'Courier New', monospace;
}
.watermark { position: absolute; inset: 0; background: repeating-radial-gradient(ellipse at center, rgba(33, 147, 96, .045) 0 2px, transparent 3px 12px); opacity: .75; }
.check-topline { position: absolute; top: 0; left: 0; right: 0; height: 14px; background: #88d7a6; color: #fff; text-align: center; font: 700 8px Arial; }
.check-name { position: absolute; top: 28px; left: 34px; font-weight: 700; }
.check-number { position: absolute; top: 28px; right: 28px; color: #e00021; font-size: 18px; }
.check-date { position: absolute; top: 52px; right: 28px; }
.check-pay-label { position: absolute; top: 111px; left: 34px; font: 8px Arial; color: #6b7784; }
.check-payee { position: absolute; top: 120px; left: 120px; right: 150px; border-bottom: 1px solid #6a7179; padding-bottom: 4px; font-size: 20px; font-weight: 700; }
.check-amount { position: absolute; top: 122px; right: 34px; font-size: 18px; font-weight: 700; }
.check-words { position: absolute; top: 164px; left: 34px; right: 34px; border-bottom: 1px solid #6a7179; padding-bottom: 4px; font-size: 17px; font-weight: 700; }
.check-address { position: absolute; left: 38px; bottom: 62px; white-space: pre-line; font-size: 13px; }
.trusign-logo { position: absolute; right: 50px; bottom: 54px; width: 132px; object-fit: contain; }
.micr { position: absolute; left: 98px; right: 0; bottom: 16px; font-size: 20px; letter-spacing: 2px; }
.history-card { padding: 14px; min-width: 0; }
.history-table-wrap { height: 260px; overflow: auto; border: 1px solid #dce7f6; border-radius: 6px; }
table { width: 100%; border-collapse: collapse; }
th { background: #f2f6fb; color: #526b91; text-transform: uppercase; font-size: 11px; text-align: left; padding: 9px 10px; }
td { border-top: 1px solid #e3ebf6; padding: 10px; color: var(--text); font-size: 13px; }
td:nth-child(2), th:nth-child(2) { text-align: right; }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; background: #ddf6e7; color: var(--green-dark); font-size: 12px; font-weight: 700; }
.status-pill.pending { background: #e9f1ff; color: var(--blue-dark); }
.status-pill.blocked { background: #ffe4e9; color: var(--danger); }
.action-column { display: flex; flex-direction: column; gap: 10px; }
.primary, .secondary, .success {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 18px;
  font-weight: 700;
}
.primary { background: linear-gradient(180deg, var(--blue), #0756cf); color: #fff; }
.secondary { background: #fff; color: #0756cf; border-color: #9fc0f4; }
.success { background: linear-gradient(180deg, #22b456, #159044); color: #fff; }
.primary:disabled, .success:disabled, .secondary:disabled { opacity: .62; cursor: not-allowed; }
.actions-panel { padding: 14px; margin-top: 6px; display: flex; flex-direction: column; gap: 12px; }
.icon-btn { width: 100%; font-size: 13px; }
.status-chips { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid #e4edf8; padding-top: 12px; }
.status-chips span { border-radius: 999px; padding: 6px 10px; background: #eef2f8; color: #435b7e; font-size: 12px; font-weight: 700; }
.status-chips span:nth-child(2) { background: #fff1bd; }
.status-chips span:nth-child(3) { background: #dff6e9; color: var(--green-dark); }
.modal-backdrop[hidden] { display: none !important; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 22, 40, .36); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-card { position: relative; width: min(460px, calc(100vw - 28px)); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 62px rgba(15, 34, 57, .28); padding: 25px 24px 20px; }
.modal-card h2 { margin: 0 0 8px; color: #063b82; font-size: 22px; }
.modal-card p { margin: 0 0 18px; color: var(--muted); }
.modal-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 1px solid #c3d7f4; border-radius: 50%; background: #fff; color: #063b82; font-weight: 800; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-grid label:first-child, .modal-grid label:last-child { grid-column: span 2; }
.info-row { margin: 16px 0; padding: 10px 12px; border: 1px solid #b9d6ff; background: #eef6ff; border-radius: 6px; color: #315172; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 390px; padding: 13px 16px; border-radius: 8px; background: #10233d; color: #fff; box-shadow: var(--shadow); z-index: 150; font-weight: 700; }
.toast.error { background: #b4233c; }
.login-page { display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #0d2137, #173a5b); }
.login-card { width: min(430px, 100%); background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px rgba(7, 24, 43, .28); }
.login-card h1 { margin: 18px 0 4px; }
.login-card p { margin: 0 0 18px; color: var(--muted); }
.login-card label { margin-bottom: 13px; }
.full { width: 100%; }
.alert-error { background: #fff1f2; border: 1px solid #f1b9bf; color: var(--danger); border-radius: 8px; padding: 10px 12px; margin: 0 0 14px; font-weight: 700; }
@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  .action-column { display: grid; grid-template-columns: repeat(3, 1fr); }
  .actions-panel { grid-column: 1 / -1; }
  .lower-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { width: calc(100vw - 18px); }
  .topbar { height: auto; align-items: stretch; flex-direction: column-reverse; padding-top: 12px; }
  .quick-search, .quick-fields, .personal-grid, .payment-grid, .bank-grid, .modal-grid { grid-template-columns: 1fr; }
  .span2, .modal-grid label:first-child, .modal-grid label:last-child { grid-column: auto; }
  .search-results { left: 14px; right: 14px; width: auto; top: 142px; }
  .action-column { grid-template-columns: 1fr; }
  .check-payee { font-size: 13px; left: 75px; right: 90px; }
  .check-amount, .check-number, .micr { font-size: 12px; }
}

/* Compact CSR scale */
body { font-size: 12px; }
.app-shell { width: min(1420px, calc(100vw - 28px)); padding-bottom: 22px; }
.topbar { height: 54px; gap: 14px; }
.tabs { gap: 9px; }
.tab { min-width: 92px; height: 34px; font-size: 12px; }
.brand-row { gap: 9px; padding-bottom: 9px; }
.brand-mark { font-size: 18px; }
.brand-mark span { width: 9px; height: 13px; margin-right: 4px; border-left-width: 4px; border-top-width: 4px; }
.user-chip, .logout-link { font-size: 11px; }
.workspace { grid-template-columns: minmax(0, 1fr) 188px; gap: 14px; padding-top: 14px; }
.main-column { gap: 11px; }
.quick-search { grid-template-columns: 132px 1fr; gap: 12px; padding: 10px 12px; }
.quick-title { gap: 8px; font-size: 13px; }
.quick-title svg { width: 18px; height: 18px; }
.quick-fields { grid-template-columns: minmax(240px, 460px); gap: 9px; }
label { font-size: 9px; }
input, select { height: 34px; margin-top: 3px; padding: 6px 8px; border-radius: 5px; font-size: 10pt; }
.search-results { top: 58px; left: 154px; max-height: 210px; width: min(410px, calc(100vw - 220px)); }
.result-row { gap: 8px; padding: 7px 9px; }
.result-row strong { font-size: 12px; }
.result-row span, .result-row b { font-size: 9px; }
.entry-card { padding: 11px 12px; }
.section-head { gap: 10px; margin-bottom: 8px; }
.section-head h2, .actions-panel h2 { font-size: 15px; }
.section-head span { font-size: 9px; }
.section-gap { margin-top: 16px; }
.grid { gap: 9px; }
.personal-grid { grid-template-columns: .85fr .95fr .95fr .95fr 1fr .9fr .45fr .65fr; max-width: 835px; align-items: end; }
.payment-grid { grid-template-columns: minmax(190px, 280px) minmax(115px, 160px) minmax(250px, 360px); max-width: 835px; align-items: end; }
.bank-grid { max-width: 835px; }
.inline-warning { padding: 6px 8px; font-size: 11px; }
.lower-grid { grid-template-columns: minmax(470px, 1.28fr) minmax(320px, .72fr); gap: 11px; align-items: start; }
.check-card, .history-card { padding: 11px; }
.check-card { min-height: 0; padding: 8px; align-self: start; }
.check-preview { width: min(100%, 560px); border: 0; border-radius: 2px; box-shadow: 0 9px 16px rgba(0, 0, 0, .22); }

.check-topline { height: 12px; font: 700 7px Arial; }
.check-name { top: 23px; left: 28px; }
.check-number { top: 23px; right: 24px; font-size: 14px; }
.check-date { top: 43px; right: 24px; }
.check-pay-label { top: 92px; left: 28px; font: 7px Arial; }
.check-payee { top: 99px; left: 102px; right: 132px; padding-bottom: 3px; font-size: 16px; }
.check-amount { top: 101px; right: 28px; font-size: 14px; }
.check-words { top: 136px; left: 28px; right: 28px; padding-bottom: 3px; font-size: 14px; }
.check-address { left: 31px; bottom: 52px; font-size: 11px; }
.trusign-logo { right: 42px; bottom: 45px; width: 108px; }
.micr { left: 82px; bottom: 13px; font-size: 15px; letter-spacing: 1px; }
.history-table-wrap { height: 218px; }
th { font-size: 9px; padding: 7px 9px; }
td { padding: 7px 9px; font-size: 12px; }
.status-pill { padding: 2px 7px; font-size: 9px; }
.action-column { gap: 8px; }
.primary, .secondary, .success { min-height: 36px; padding: 0 14px; font-size: 12px; }
.actions-panel { padding: 11px; margin-top: 4px; gap: 9px; }
.icon-btn { font-size: 12px; }
.status-chips { gap: 6px; padding-top: 9px; }
.status-chips span { padding: 4px 8px; font-size: 9px; }
.modal-card { width: min(420px, calc(100vw - 28px)); padding: 20px 20px 17px; }
.modal-card h2 { font-size: 18px; }
.modal-card p { margin-bottom: 14px; font-size: 12px; }
.modal-close { top: 11px; right: 11px; width: 28px; height: 28px; }
.modal-grid { gap: 9px; }
.info-row { margin: 12px 0; padding: 8px 10px; font-size: 12px; }
.toast { padding: 10px 13px; font-size: 12px; }
.login-card { padding: 24px; }

@media (max-width: 760px) {
  .topbar { height: auto; }
  .quick-search, .quick-fields, .personal-grid, .payment-grid, .bank-grid, .modal-grid { grid-template-columns: 1fr; }
  .personal-grid > label, .personal-company, .personal-phone, .personal-address, .personal-city, .personal-state, .personal-zip, .payment-payee, .payment-reference, .payment-memo { grid-column: auto; }
  .personal-grid, .payment-grid, .bank-grid { max-width: none; }
  .search-results { left: 12px; right: 12px; width: auto; top: 116px; }
  .check-preview { width: 100%; max-width: none; }
  .check-card { min-height: auto; }
  .check-payee { font-size: 12px; left: 72px; right: 84px; }
  .check-amount, .check-number, .micr { font-size: 11px; }
}
/* Keep compact entry cards from stretching past their fields */
.quick-search { width: min(100%, 650px); }
.entry-card { width: min(100%, 1020px); }

@media (max-width: 760px) {
  .quick-search,
  .entry-card { width: 100%; }
}
/* Balance CSR working column edges */
.quick-search,
.entry-card,
.lower-grid { width: min(100%, 1020px); }
.quick-search { grid-template-columns: 132px minmax(0, 1fr); }
.quick-fields { grid-template-columns: 1fr; }
.lower-grid { grid-template-columns: minmax(0, 1fr) 430px; }
.check-preview { width: min(100%, 560px); }

@media (max-width: 1080px) {
  .quick-search,
  .entry-card,
  .lower-grid { width: 100%; }
  .lower-grid { grid-template-columns: 1fr; }
}
/* Fill balanced panels while keeping cleaner side gutters */
.quick-search,
.entry-card,
.check-card,
.history-card { padding-left: 20px; padding-right: 20px; }
.personal-grid,
.payment-grid,
.bank-grid,
.quick-fields { max-width: none; width: 100%; }
.personal-grid { grid-template-columns: .95fr 1fr 1fr 1fr 1.05fr .95fr .55fr .75fr; }
.payment-grid { grid-template-columns: minmax(230px, 1.05fr) minmax(140px, .6fr) minmax(300px, 1.35fr); }
.bank-grid { grid-template-columns: .9fr 1.25fr .9fr .85fr 1fr .9fr; }
.check-preview { width: 100%; max-width: 560px; }

@media (max-width: 760px) {
  .quick-search,
  .entry-card,
  .check-card,
  .history-card { padding-left: 12px; padding-right: 12px; }
  .personal-grid,
  .payment-grid,
  .bank-grid,
  .quick-fields { grid-template-columns: 1fr; max-width: none; width: 100%; }
}
/* Separate form panels */
.entry-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 !important;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 20px;
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
}
.form-panel .section-head { margin-bottom: 8px; }
.form-panel .section-head h2 { font-size: 15px; }

@media (max-width: 760px) {
  .entry-card { gap: 9px; }
  .form-panel { padding: 12px; }
}
/* Balance lower check/history panels */
.lower-grid { align-items: stretch; }
.check-card,
.history-card { min-height: 280px; }
.check-card {
  align-self: stretch;
  align-items: center;
}
.history-card {
  display: flex;
  flex-direction: column;
}
.history-card .section-head { flex: 0 0 auto; }
.history-table-wrap {
  flex: 1 1 auto;
  height: auto;
  min-height: 218px;
}

@media (max-width: 1080px) {
  .check-card,
  .history-card { min-height: 0; }
}