:root {
  --paper: #fffdf8;
  --ink: #1b1b1b;
  --line: #b8b2a2;
  --accent: #1f2a44;
  --accent-light: #eef1f7;
  --danger: #8a3324;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #d8d3c4;
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--ink);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-weight: 600; font-size: 15px; }
.auth-area { display: flex; align-items: center; gap: 8px; }
.user-name { font-size: 13px; }
.hidden { display: none !important; }

.tabbar {
  display: flex;
  background: #16203a;
  position: sticky;
  top: 45px;
  z-index: 9;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.tab-btn {
  flex: 1;
  padding: 11px 6px;
  background: transparent;
  border: none;
  color: #aab2c5;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.tab-btn.active {
  color: #fff;
  border-bottom-color: #cbd4ea;
}

.tab-panel.hidden { display: none; }

.panel-wrap {
  max-width: 480px;
  margin: 18px auto 40px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  padding: 22px 20px 26px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.panel-title {
  text-align: center;
  font-size: 18px;
  margin: 0 0 16px;
  font-family: Georgia, 'Times New Roman', serif;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
}
.hint { font-size: 13px; color: #666; }

.entries-list { margin-top: 14px; }
.entry-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fffef9;
}
.entry-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}
.entry-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  flex-wrap: wrap;
  flex: 1;
}
.entry-amount { color: var(--accent); }
.entry-chevron { font-size: 12px; color: #999; flex-shrink: 0; padding-left: 6px; }
.entry-deposit-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}
.entry-deposit-badge-yes { background: #e3f3e6; color: #1a6b3c; }
.entry-deposit-badge-no { background: #fbeee0; color: #a15c00; }
.entry-expandable {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.entry-desc { font-size: 12.5px; color: #555; margin-top: 4px; }

.deposited-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
  cursor: pointer;
}
.deposited-toggle input { transform: scale(1.1); }

.deposit-detail {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.deposit-detail-label { font-size: 11.5px; color: #777; margin-top: 4px; }
.deposit-date-input, .deposit-photo-input, .deposit-amount-input, .deposit-shortfall-input {
  font-family: inherit;
  font-size: 14px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}
.deposit-amount-hint { font-size: 11.5px; margin: 0; }
.deposit-shortfall-label { color: #a15c00; }
.deposit-shortfall-input { border-color: #d9a441; }
.proof-link { font-size: 12.5px; color: var(--accent); }
.save-deposit-btn {
  margin-top: 4px;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  align-self: flex-start;
}
.deposit-status { font-size: 12px; color: #1a6b3c; min-height: 14px; }

.entry-actions { display: flex; gap: 14px; margin-top: 8px; }
.entry-actions .link-btn { font-size: 12.5px; padding: 0; }
.danger-link { color: var(--danger) !important; }
.entry-action-status { font-size: 12px; color: #1a6b3c; min-height: 14px; }

.edit-panel {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.edit-field { display: flex; flex-direction: column; gap: 3px; }
.edit-field-label { font-size: 11.5px; color: #777; }
.edit-field input, .edit-field select {
  font-family: inherit;
  font-size: 14px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}
.edit-btn-row { display: flex; align-items: center; gap: 14px; margin-top: 4px; }

.report-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}
.report-btn {
  padding: 13px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.report-btn:active { background: var(--accent-light); }

.remit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #fff;
}
.remit-banner-warn { background: #7a4b12; }
.remit-banner-overdue { background: #8a3324; }
.remit-banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.remit-banner-title { font-size: 13.5px; font-weight: 600; }
.remit-banner-detail { font-size: 12px; opacity: 0.92; }
.remit-banner-btn {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.65);
  border-radius: 4px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.remit-banner-btn:active { background: rgba(255,255,255,0.25); }

.remit-form { display: flex; flex-direction: column; gap: 10px; }
.remit-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #555; }
.remit-field input {
  font-family: inherit;
  font-size: 15px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.remit-btn-row { display: flex; align-items: center; gap: 14px; margin-top: 2px; }
.remit-btn-row button[type="submit"] {
  padding: 10px 16px;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.names-dialog .remit-btn-row .link-btn { color: var(--accent); }

.ww-held {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 4px 0 14px;
  background: #fffef9;
}
.ww-held.ww-held-overdue { border-left-color: var(--danger); background: #fdf6f4; }
.ww-held-label { font-size: 12.5px; color: #555; }
.ww-held-amount { font-size: 22px; font-weight: 600; color: var(--accent); margin: 2px 0; }
.ww-held.ww-held-overdue .ww-held-amount { color: var(--danger); }
.ww-held-detail { font-size: 11.5px; color: #777; line-height: 1.45; }

.file-row { border-bottom: none; gap: 10px; flex-wrap: wrap; }

.statement-review {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.review-tx-heading { margin-top: 12px; }
.review-tx-list { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.review-tx-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fffef9;
}
.review-tx-row input, .review-tx-row select {
  font-family: inherit;
  font-size: 13px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}
.review-tx-row .tx-desc, .review-tx-row .tx-category { grid-column: 1 / -1; }
.review-tx-row .tx-remove {
  grid-column: 1 / -1;
  justify-self: end;
  border: none;
  background: none;
  color: var(--danger);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}
.review-tx-row.tx-ignored { opacity: 0.5; }
.tx-linked-note { grid-column: 1 / -1; font-size: 11.5px; color: #1a6b3c; }
.no-tx-hint { font-size: 12.5px; color: #666; }

.offline-banner {
  background: #7a4b12;
  color: #fff;
  text-align: center;
  padding: 8px 12px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.sheet {
  max-width: 480px;
  margin: 18px auto;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  padding: 22px 20px 26px;
}

.sheet-title {
  text-align: center;
  font-size: 20px;
  letter-spacing: 1px;
  margin: 0 0 18px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.field-label { font-weight: bold; min-width: 60px; }
.field-input {
  flex: 1;
  font-family: inherit;
  font-size: 16px;
  padding: 6px 4px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.date-input { max-width: 200px; }

.section { margin-bottom: 16px; }
.section-label { font-weight: bold; margin-bottom: 6px; }
.meeting-hint {
  margin: -2px 0 8px;
  font-size: 12px;
  color: #666;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.type-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.type-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}
.type-option input { transform: scale(1.15); }

.line-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dotted var(--line);
  padding: 6px 0;
}
.line-label { font-size: 15px; }
.line-input {
  font-family: inherit;
  font-size: 16px;
  text-align: right;
  border: none;
  background: transparent;
  width: 120px;
  padding: 2px 0;
}
.text-input { text-align: left; width: 100%; }
select.line-input { text-align: left; width: 100%; }

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 2px solid var(--ink);
  margin-top: 4px;
  padding-top: 10px;
}
.total-label { font-weight: bold; font-size: 16px; }
.total-display { font-weight: bold; font-size: 20px; }

.signature-display {
  font-style: italic;
  color: #444;
  font-size: 14px;
  text-align: right;
}

.manage-names-row { border-bottom: none; justify-content: flex-end; }

.submit-btn {
  width: 100%;
  margin-top: 18px;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
}
.submit-btn:active { opacity: 0.85; }
.submit-btn:disabled { background: #9aa0ad; cursor: not-allowed; }

.status-msg {
  margin-top: 10px;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  min-height: 18px;
}
.status-msg.ok { color: #1a6b3c; }
.status-msg.err { color: var(--danger); }

.link-btn {
  background: none;
  border: none;
  color: #cbd4ea;
  text-decoration: underline;
  font-size: 13px;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.sheet .link-btn { color: var(--accent); }

.queue-panel {
  max-width: 480px;
  margin: 0 auto 40px;
  padding: 12px 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #444;
  margin-bottom: 6px;
}
.queue-list { list-style: none; margin: 0; padding: 0; font-size: 13px; color: #555; }
.queue-list li { padding: 4px 0; border-bottom: 1px solid #c9c3b3; }

.names-dialog {
  border: none;
  border-radius: 8px;
  padding: 20px;
  max-width: 320px;
  width: 90%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.names-dialog h2 { margin-top: 0; font-size: 16px; }
.dialog-hint { font-size: 12px; color: #666; margin-top: -6px; }
.names-list { max-height: 180px; overflow-y: auto; margin-bottom: 10px; }
.name-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #eee; font-size: 14px; }
.name-row button { border: none; background: none; color: var(--danger); cursor: pointer; }
.add-name-form { display: flex; gap: 6px; margin-bottom: 12px; }
.add-name-form input { flex: 1; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
.add-name-form button { padding: 8px 12px; border: none; background: var(--accent); color: #fff; border-radius: 4px; }
.close-btn { width: 100%; padding: 10px; border: none; background: #eee; border-radius: 4px; cursor: pointer; }
