:root {
  --brand: #b11d1d;
  --brand-dark: #8a1414;
}

body {
  background: #f4f5f7;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Navbar ---- */
.app-navbar {
  background: var(--brand);
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.app-navbar .navbar-brand { letter-spacing: .5px; }
.brand-mark {
  display: inline-block;
  width: 26px; height: 26px; line-height: 26px;
  text-align: center;
  background: #fff; color: var(--brand);
  border-radius: 6px; font-weight: 800;
  margin-right: 4px;
}

/* ---- Cards / lists ---- */
.card { border: none; border-radius: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.card + .card { margin-top: 12px; }

.list-tap { text-decoration: none; color: inherit; display: block; }
.list-tap:active { background: #eef0f3; }

/* Due badges */
.badge-due   { background: #fdecec; color: var(--brand-dark); }
.badge-clear { background: #e7f6ec; color: #1b7a3d; }

/* Cap width on large screens, still full-width on mobile */
.page-narrow { max-width: 760px; margin-inline: auto; }

.text-brand { color: var(--brand) !important; }

/* Icon prefix boxes on form inputs */
.input-group-text { background: #faf6f6; color: var(--brand); border-color: #e3e3e3; }

/* ---- Customer / list cards ---- */
.cust-list { display: flex; flex-direction: column; gap: 8px; }
.cust-card {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid #ececec; border-radius: 12px;
  padding: 10px 14px; text-decoration: none; color: inherit;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.cust-card:hover { border-color: #d9b3b3; box-shadow: 0 2px 8px rgba(0,0,0,.06); background: #fffafa; }
.cust-card:active { background: #f6eeee; }

.cust-avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: #fbe9e9; color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.cust-main { flex: 1; min-width: 0; }
.cust-name { font-weight: 600; font-size: 15px; color: #1a1a1a; margin-bottom: 2px; }
.cust-meta {
  font-size: 12.5px; color: #777;
  display: flex; flex-wrap: wrap; gap: 2px 12px;
}
.cust-meta span { display: inline-flex; align-items: center; white-space: nowrap; }
.cust-meta i { margin-right: 4px; font-size: 12px; opacity: .8; }

.pill { flex: none; font-size: 12px; padding: 4px 11px; border-radius: 20px; white-space: nowrap; }
.pill-due   { background: #fdecec; color: var(--brand-dark); }
.pill-clear { background: #e7f6ec; color: #1b7a3d; }
.cust-chev { color: #c4c4c4; font-size: 16px; flex: none; }

@media (max-width: 576px) {
  .cust-meta { gap: 1px 10px; }
  .cust-card { padding: 10px 12px; gap: 10px; }
}

/* ---- Search box ---- */
.search-hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; border-radius: 16px; padding: 20px;
}
.search-hero .form-control { height: 52px; font-size: 1.1rem; }

/* ---- Estimate builder ---- */
.li-row td { vertical-align: middle; }
.li-amount { max-width: 140px; text-align: right; }
.grand-total {
  font-size: 1.4rem; font-weight: 800; color: var(--brand-dark);
}

/* Sticky total bar on mobile */
.total-bar {
  position: sticky; bottom: 0;
  background: #fff; border-top: 2px solid var(--brand);
  padding: 10px 14px; box-shadow: 0 -2px 8px rgba(0,0,0,.08);
  z-index: 10;
}

/* Big tappable action buttons */
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); color: #fff; }

.stat-tile { text-align: center; padding: 14px; }
.stat-tile .num { font-size: 1.5rem; font-weight: 800; white-space: nowrap; }
.stat-tile .lbl { font-size: .75rem; text-transform: uppercase; color: #777; letter-spacing: .5px; }

/* Clickable stat tile */
a.stat-link { display: block; text-decoration: none; color: inherit; transition: border-color .12s, box-shadow .12s, background .12s; }
a.stat-link { border: 1px solid transparent; }
a.stat-link:hover { background: #fffafa; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
a.stat-link .lbl i { font-size: .7rem; opacity: .6; }

/* Make number inputs comfortable on mobile */
input[inputmode="numeric"], input[type="number"] { font-size: 1rem; }

/* ---- Site ledger page ---- */
.sum-tiles { display: flex; }
.sum-tiles .t { flex: 1; text-align: center; padding: 2px 4px; }
.sum-tiles .lbl { font-size: 11px; letter-spacing: .5px; color: #999; }
.sum-tiles .val { font-size: 19px; font-weight: 700; }
.paybar { height: 8px; border-radius: 6px; background: #eee; overflow: hidden; margin-top: 12px; }
.paybar > span { display: block; height: 100%; background: #1b9e5f; border-radius: 6px; }

.sec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sec-head h6 { margin: 0; color: #666; font-size: 14px; }
.sec-head h6 i { margin-right: 5px; opacity: .8; }

.item-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f1f1f1; font-size: 14px; }
.item-row:last-child { border-bottom: none; }
.item-row .amt { font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.item-total { display: flex; justify-content: space-between; padding-top: 10px; margin-top: 4px; border-top: 2px solid #eee; font-weight: 700; font-size: 15px; }
.item-total .amt { color: var(--brand-dark); }

.pay-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f1f1; }
.pay-row:last-of-type { border-bottom: none; }
.pay-icon { width: 38px; height: 38px; flex: none; border-radius: 50%; background: #eef6f0; color: #1b7a3d; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.pay-main { flex: 1; min-width: 0; }
.pay-amt { font-weight: 600; font-size: 15px; }

/* Payment card (site ledger) */
.pay-card {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid #ececec; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px;
}
.pay-card:last-of-type { margin-bottom: 0; }
.pay-actions { display: flex; gap: 6px; flex: none; }
.pay-actions .btn { padding: 4px 9px; line-height: 1; }
.pay-actions form { margin: 0; }

.pill-info { background: #e8f0fe; color: #1a56b0; }

/* Hide the up/down spinner arrows on number inputs */
input.no-spin::-webkit-outer-spin-button,
input.no-spin::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input.no-spin { -moz-appearance: textfield; appearance: textfield; }

@media (max-width: 576px) {
  .container { padding-left: 12px; padding-right: 12px; }
}
