:root {
  --brand-blue: #0a6ebd;
  --brand-dark: #0b1f3a;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --border: #dde3ea;
  --text: #1c2733;
  --muted: #64748b;
  --green: #1a9d5c;
  --red: #d64545;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  background: var(--brand-dark);
  color: white;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-name { font-weight: 700; font-size: 18px; }
.brand-sub { font-size: 12px; letter-spacing: 2px; opacity: 0.8; margin-left: 6px; }

.status-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rep-display {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
}

.dashboard-link {
  font-size: 13px;
  color: white;
  background: rgba(255,255,255,0.15);
  padding: 5px 12px;
  border-radius: 14px;
  text-decoration: none;
}

.dashboard-link:hover {
  background: rgba(255,255,255,0.25);
}

.logout-link {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  text-decoration: underline;
  cursor: pointer;
}

.pending-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  background: #f5a623;
  color: white;
  font-weight: 600;
}

.xero-status {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
}
.xero-status.connected { background: var(--green); }
.xero-status.disconnected { background: var(--red); }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

h1 { font-size: 22px; margin-bottom: 4px; }
.subtitle { color: var(--muted); font-size: 13px; margin-top: 0; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 16px;
  margin-top: 0;
  color: var(--brand-dark);
  border-bottom: 2px solid var(--brand-blue);
  padding-bottom: 8px;
  display: inline-block;
}

.card h3 { font-size: 14px; margin-top: 20px; color: var(--brand-dark); }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}

@media (min-width: 560px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--muted);
  gap: 4px;
}

input, select {
  font-size: 15px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: white;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--brand-blue);
}

.hint { font-size: 13px; color: var(--muted); }

.extra-works-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
}

.extra-works-table th, .extra-works-table td {
  border: 1px solid var(--border);
  padding: 6px;
  text-align: left;
}

.extra-works-table input {
  width: 100%;
  padding: 6px;
  font-size: 13px;
}

.extra-works-table td.qty-cell input,
.extra-works-table td.price-cell input {
  width: 70px;
}

.btn-secondary {
  margin-top: 10px;
  background: white;
  border: 1px solid var(--brand-blue);
  color: var(--brand-blue);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.btn-primary {
  background: var(--brand-blue);
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  margin-top: 16px;
  cursor: pointer;
}

.btn-primary:disabled { opacity: 0.6; }

.remove-row {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 16px;
}

.totals {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  font-size: 14px;
}

.totals div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.total-line {
  font-size: 16px;
  color: var(--brand-dark);
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 10px !important;
}

.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.photo-grid img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.sig-block { margin-top: 18px; }

.sig-pad {
  width: 100%;
  height: 160px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: #fafbfc;
  touch-action: none;
}

.btn-clear {
  margin-top: 6px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.submit-status {
  margin-top: 12px;
  font-size: 14px;
  text-align: center;
}

.submit-status.success { color: var(--green); }
.submit-status.error { color: var(--red); }

/* ============================================================ */
/* Step wizard                                                   */
/* ============================================================ */

.step-progress {
  display: flex;
  justify-content: space-between;
  margin: 4px 0 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.step-item {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.step-item .step-num {
  display: none;
}

.step-item.active {
  color: var(--brand-blue);
  border-bottom-color: var(--brand-blue);
}

.step-item.done {
  color: var(--green);
  border-bottom-color: var(--green);
}

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

.step-heading {
  margin-bottom: 6px;
}

.step-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  margin: 0 0 4px;
}

.step-heading h1 {
  font-size: 24px;
  margin: 0 0 4px;
}

.step-desc {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 16px;
}

.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  margin-bottom: 40px;
}

.btn-nav {
  width: auto;
  min-width: 140px;
  margin-top: 0;
}

.visually-hidden-fields {
  display: none;
}

/* ---------- Package cards (solar / battery) ---------- */

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.dot-solar { background: #f5a623; }
.dot-battery { background: var(--green); }

.optional-tag {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.package-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.pkg-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pkg-card:hover {
  border-color: var(--brand-blue);
}

.pkg-card.selected {
  border-color: var(--brand-dark);
  border-width: 2px;
  background: #f5f8fb;
}

.pkg-card-compact {
  padding: 10px 16px;
}

.pkg-card-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--brand-dark);
}

.pkg-card-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.pkg-card-price {
  font-weight: 700;
  font-size: 16px;
  color: var(--brand-dark);
  white-space: nowrap;
  margin-left: 12px;
}

/* ---------- Add-ons ---------- */

.addon-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}

.addon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.addon-row:last-child {
  border-bottom: none;
}

.addon-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.addon-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.addon-qty {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  color: var(--brand-blue);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.qty-val {
  min-width: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  border-radius: 24px;
  transition: 0.15s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.15s;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--brand-blue);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(18px);
}

/* ---------- Review step ---------- */

.review-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.review-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 12px;
}

.tag-solar { background: #fff3cd; color: #8a6300; }
.tag-battery { background: #d4f4e2; color: #1a9d5c; }

.review-lines {
  display: flex;
  flex-direction: column;
}

.review-line {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.review-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  margin-top: 6px;
  border-top: 2px solid var(--brand-dark);
  font-size: 17px;
  color: var(--brand-dark);
}

.deposit-label {
  margin-top: 14px;
}

.review-customer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.review-customer h3 {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 6px;
}

.review-customer p {
  margin: 2px 0;
  font-size: 15px;
}
