body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: #f5f6f8;
  color: #222;
}
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  background: #eef2f5;
}
.login-screen[hidden] { display: none; }
.login-card {
  width: min(380px, calc(100vw - 40px));
  background: white;
  padding: 28px;
  border-radius: 10px;
  box-shadow: 0 18px 50px #0002;
}
.login-card h1 { margin-bottom: 10px; }
.login-card label { display: block; font-weight: bold; margin-top: 14px; }
.login-card input, .login-card button { width: 100%; margin-top: 6px; }
.login-card button { margin-top: 20px; background: #17365d; color: white; border: 0; }
.login-error { color: #a51616; margin-top: 12px; min-height: 18px; }
#signedInUser { font-size: 13px; white-space: nowrap; }
#logoutBtn { background: #374151; color: white; border: 1px solid #6b7280; }
.account-checklist { max-height: 230px; overflow: auto; border: 1px solid #d1d5db; padding: 8px; }
.account-checklist label { display: flex; gap: 7px; align-items: center; font-weight: normal; margin: 4px 0; }
.account-checklist input { width: auto; }
.admin-only[hidden] { display: none; }
header {
  background: #1f2937;
  color: white;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}
h1 { margin: 0; font-size: 22px; }
nav { display: flex; gap: 8px; flex: 1; }
.tab {
  background: #374151;
  color: white;
  border: 1px solid #4b5563;
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
}
.tab.active { background: white; color: #111827; }
main { padding: 20px; }
.panel {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}
.actions { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
select, button, input, textarea {
  padding: 8px 10px;
  font-size: 14px;
  box-sizing: border-box;
}
button { cursor: pointer; }
button.small { padding: 4px 8px; font-size: 12px; margin-right: 4px; }
button.danger { color: #991b1b; }
#accountSelect { min-width: 360px; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  border-bottom: 1px solid #e5e7eb;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}
th { background: #f3f4f6; }
.num { text-align: right; }
a { color: #0645ad; }
#status { font-size: 13px; opacity: 0.9; margin-left: auto; }
.page { display: none; }
.active-page { display: block; }
.two-column {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px;
  align-items: start;
}
.form-card {
  border-left: 1px solid #e5e7eb;
  padding-left: 18px;
  position: sticky;
  top: 12px;
}
.form-card label {
  display: block;
  font-weight: bold;
  margin-top: 10px;
  margin-bottom: 4px;
}
.form-card input,
.form-card select,
.form-card textarea {
  width: 100%;
}
.checkbox-label {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  font-weight: normal !important;
}
.checkbox-label input { width: auto; }
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
tr.inactive { color: #777; background: #fafafa; }
@media (max-width: 1000px) {
  .two-column { grid-template-columns: 1fr; }
  .form-card { border-left: 0; padding-left: 0; position: static; }
}
.new-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px 16px;
  max-width: 980px;
}
.new-check-grid .wide { grid-column: span 3; }
.new-check-grid label {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
}
.new-check-grid input,
.new-check-grid select {
  width: 100%;
}
.hint { color: #555; }
@media (max-width: 800px) {
  .new-check-grid { grid-template-columns: 1fr; }
  .new-check-grid .wide { grid-column: span 1; }
}
.settings-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr);
  gap: 14px 18px;
  max-width: 900px;
}
.settings-grid label {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
}
.readonly-box {
  padding: 9px 10px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 4px;
}
.signature-preview-wrap {
  display: none;
  margin-top: 14px;
}
.signature-preview-wrap img {
  max-width: 420px;
  max-height: 120px;
  border: 1px solid #d1d5db;
  background: white;
  padding: 8px;
}
@media (max-width: 800px) {
  .settings-grid { grid-template-columns: 1fr; }
}

#checksTable th[data-sort] {
  cursor: pointer;
  user-select: none;
}

#checksTable th[data-sort]:hover,
#checksTable th.sorted {
  text-decoration: underline;
}

button.warning {
  background: #8a5a00;
  color: white;
}

.muted {
  color: #666;
  font-size: 0.85em;
  margin-left: 6px;
}
.required { color: #b00020; font-weight: bold; }
.secondary-btn { margin: 6px 0; }
.address-section {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 12px;
  background: #fafafa;
}
.address-section label { margin-top: 8px; }
th[data-sort] { cursor: pointer; user-select: none; }
th.sorted { text-decoration: underline; }

/* Layout Designer */
.layout-toolbar-row { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.layout-designer-shell { display:grid; grid-template-columns:minmax(700px, 1fr) 330px; gap:18px; align-items:start; }
.layout-preview-column { overflow:auto; }
.layout-preview-row { display:flex; align-items:flex-start; }
.layout-ruler-top { margin-left:34px; height:28px; position:relative; background:repeating-linear-gradient(to right,#999 0,#999 1px,transparent 1px,transparent 10px); border-bottom:1px solid #999; }
.layout-ruler-left { width:34px; flex:0 0 34px; position:relative; background:repeating-linear-gradient(to bottom,#999 0,#999 1px,transparent 1px,transparent 10px); border-right:1px solid #999; }
.layout-canvas-viewport { overflow:auto; padding:8px; background:#e9edf2; max-width:100%; }
.layout-canvas { position:relative; width:850px; height:350px; background:#fff; border:2px solid #3267d6; box-shadow:0 2px 8px rgba(0,0,0,.18); transform-origin:top left; outline:none; }
.layout-item { position:absolute; cursor:move; user-select:none; white-space:pre; border:1px solid transparent; min-width:4px; min-height:4px; box-sizing:border-box; }
.layout-item:hover { border-color:#9bbcff; background:rgba(80,130,255,.06); }
.layout-item.selected { border:2px solid #e53935; background:rgba(255,50,50,.08); z-index:50; }
.layout-line { height:0; border-top-style:solid; transform-origin:left center; }
.layout-signature-placeholder { border:1px dashed #777; color:#666; padding:3px; font-size:11px; }
.layout-micr { font-family:'Courier New', monospace; letter-spacing:1px; }
.layout-editor-panel { position:sticky; top:10px; max-height:80vh; overflow:auto; padding:14px; border:1px solid #ddd; background:#fafafa; border-radius:6px; }
.layout-editor-panel select[size] { width:100%; min-height:220px; }
.layout-editor-panel input, .layout-editor-panel select { width:100%; box-sizing:border-box; margin-bottom:8px; }
.layout-property-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.layout-nudge-row { display:flex; gap:6px; margin:8px 0 14px; }
.layout-nudge-row button { min-width:42px; }
.layout-micr-panel, .layout-copy-panel { margin-top:16px; padding-top:12px; border-top:1px solid #ccc; }
@media (max-width:1100px) { .layout-designer-shell { grid-template-columns:1fr; } .layout-editor-panel { position:static; max-height:none; } }

/* v19 layout designer consistency fixes */
.layout-item { z-index: 1; }
.layout-item.selected { z-index: 100; }
.layout-item:not(.selected) { pointer-events:auto; }
.layout-editor-panel option { padding:3px 5px; }
@font-face {
  font-family: 'GnuMICR';
  src: url('/fonts/GnuMICR.ttf') format('truetype');
  font-display: swap;
}
.layout-micr { font-family:'GnuMICR','Courier New',monospace; letter-spacing:0; }
.print-modal[hidden] { display: none; }
.print-modal {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center;
  justify-content: center; padding: 20px; background: rgba(16, 32, 48, 0.62);
}
.print-modal-card {
  width: min(720px, 96vw); max-height: 92vh; overflow: auto; background: #fff;
  border-radius: 10px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.print-modal-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.print-modal-header h2 { margin: 0; }
.print-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.print-settings-grid label { display: flex; flex-direction: column; gap: 5px; }
.print-settings-grid input[readonly] { background: #eef7f0; color: #145c32; font-weight: 700; }
@media (max-width: 680px) { .print-settings-grid { grid-template-columns: 1fr; } }
