* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f6f8;
  color: #1a1f2c;
  margin: 0;
  line-height: 1.5;
}
.container { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }
.brand { color: #0a66c2; font-weight: 700; font-size: 20px; text-decoration: none; }
nav { background: #fff; border-bottom: 1px solid #e3e6eb; padding: 14px 16px; }
nav .inner { max-width: 960px; margin: 0 auto; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
nav a { color: #1a1f2c; text-decoration: none; font-weight: 500; }
nav a:hover { color: #0a66c2; }
nav a.cta {
  margin-left: auto; background: #0a66c2; color: #fff;
  padding: 8px 14px; border-radius: 6px;
}
nav a.cta:hover { background: #084e95; color: #fff; }

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 24px 0 12px; }

.card {
  background: #fff;
  border: 1px solid #e3e6eb;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

.btn {
  display: inline-block;
  background: #0a66c2;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  border: none;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
}
.btn:hover { background: #084e95; }
.btn.secondary { background: #fff; color: #0a66c2; border: 1px solid #0a66c2; }
.btn.secondary:hover { background: #eef4fb; }
.btn.danger { background: #c0392b; }
.btn.success { background: #1e8449; }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c5cad2;
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
}
textarea { min-height: 90px; }
label { display: block; font-weight: 500; margin: 12px 0 4px; font-size: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .row { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #e3e6eb; font-size: 14px; }
th { color: #5b6472; font-weight: 600; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge.draft { background: #e3e6eb; color: #5b6472; }
.badge.sent { background: #fff3cd; color: #8a6d00; }
.badge.signed { background: #d4edda; color: #1e8449; }
.badge.declined { background: #f8d7da; color: #c0392b; }
.badge.needs_scheduling { background: #fff3cd; color: #8a6d00; }
.badge.scheduled { background: #cfe8ff; color: #0a66c2; }
.badge.complete { background: #d4edda; color: #1e8449; }

.line-items { width: 100%; }
.line-items th, .line-items td { padding: 6px 4px; }
.line-items input { padding: 6px 8px; }
.li-desc { width: 60%; }
.li-qty { width: 70px; text-align: right; }
.li-price { width: 110px; text-align: right; }
.li-total { width: 110px; text-align: right; color: #5b6472; }
.li-remove { width: 30px; text-align: center; }
.li-remove button { background: none; border: none; color: #c0392b; font-size: 18px; cursor: pointer; }

.muted { color: #5b6472; font-size: 13px; }
.amount { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.totals { font-size: 18px; font-weight: 600; }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.flash.ok { background: #d4edda; color: #1e8449; }

.link-box {
  background: #f0f4f8;
  border: 1px dashed #b9c3cf;
  padding: 12px;
  border-radius: 6px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
}

/* Customer signing page — bigger touch targets, simpler layout */
.sign-wrapper { max-width: 600px; margin: 0 auto; padding: 16px; }
.sig-canvas {
  width: 100%;
  height: 200px;
  background: #fff;
  border: 2px dashed #b9c3cf;
  border-radius: 8px;
  touch-action: none;
  display: block;
}
.sign-actions { display: flex; gap: 8px; margin-top: 12px; }
.sign-actions .btn { flex: 1; padding: 14px; font-size: 16px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 25, 35, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 50;
  overflow-y: auto;
  padding: 32px 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.modal h2 { margin-top: 0; }
.modal .close-row { display: flex; justify-content: space-between; align-items: center; }
.modal .close-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: #5b6472; }

.radio-group { display: grid; gap: 6px; }
.radio-group label {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border: 1px solid #c5cad2; border-radius: 8px;
  cursor: pointer; margin: 0;
  font-weight: 400;
}
.radio-group label:hover { background: #f0f4f8; }
.radio-group input[type="radio"] { margin: 0; }
.radio-group label.selected { border-color: #0a66c2; background: #eef4fb; }

.calc-result {
  background: #eef4fb;
  border: 1px solid #b9d2eb;
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
}
.calc-result .breakdown { font-size: 13px; color: #5b6472; margin-bottom: 6px; }
.calc-result .total { font-size: 28px; font-weight: 700; color: #0a66c2; }
.calc-result .override-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.calc-result .override-row input { width: 130px; text-align: right; font-weight: 600; }
