/* ArborBidPro — shared styles.
   Arial/Helvetica only. White background. Green #2e8b3e accent. */

:root {
  --ab-green: #2e8b3e;
  --ab-green-dark: #246e31;
  --ab-ink: #1a1a1a;
  --ab-muted: #6b7280;
  --ab-border: #e5e7eb;
  --ab-bg: #ffffff;
  --ab-bg-soft: #f7f7f5;
  --ab-danger: #b42318;
  --ab-warn-bg: #fff7cc;
  --ab-warn-border: #e0b800;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ab-bg);
  color: var(--ab-ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--ab-green); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 12px; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

p { margin: 0 0 12px; }

/* ---------- Layout ---------- */
.ab-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ab-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.ab-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--ab-border);
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.ab-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.ab-brand-logo {
  height: 44px;
  width: auto;
  display: block;
}
.ab-brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--ab-green);
  display: inline-block;
}
.ab-brand-name {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
}

/* ---------- Forms ---------- */
.ab-field { margin-bottom: 14px; }
.ab-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ab-ink);
}
.ab-input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--ab-border);
  border-radius: 8px;
  font: inherit;
  color: var(--ab-ink);
  background: #fff;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ab-input:focus {
  border-color: var(--ab-green);
  box-shadow: 0 0 0 3px rgba(46, 139, 62, 0.15);
}

/* ---------- Buttons ---------- */
.ab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.ab-btn-primary {
  background: var(--ab-green);
  color: #fff;
}
.ab-btn-primary:hover { background: var(--ab-green-dark); }
.ab-btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.ab-btn-secondary {
  background: #fff;
  color: var(--ab-ink);
  border-color: var(--ab-border);
}
.ab-btn-secondary:hover { background: var(--ab-bg-soft); }
.ab-btn-block { width: 100%; }

/* ---------- Tabs ---------- */
.ab-tabs {
  display: flex;
  gap: 4px;
  background: var(--ab-bg-soft);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 20px;
}
.ab-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  color: var(--ab-muted);
  cursor: pointer;
}
.ab-tab.is-active {
  background: #fff;
  color: var(--ab-ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ---------- Messages ---------- */
.ab-error {
  background: #fef2f2;
  color: var(--ab-danger);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 14px;
  display: none;
}
.ab-error.is-visible { display: block; }

.ab-note {
  font-size: 13px;
  color: var(--ab-muted);
  margin-top: 12px;
  text-align: center;
}

/* ---------- Utility ---------- */
.ab-hidden { display: none !important; }

/* ---------- Intake chat ---------- */
.ab-intake-shell {
  height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.ab-intake-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ab-border);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.ab-intake-header .ab-btn { padding: 8px 10px; font-size: 13px; }
.ab-intake-title-wrap {
  flex: 1;
  text-align: center;
  line-height: 1.2;
  min-width: 0;
}
.ab-intake-title { font-weight: 700; font-size: 15px; }
.ab-intake-sub   { font-size: 12px; color: var(--ab-muted); }
.ab-intake-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ab-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 15px;
}
.ab-msg-user {
  background: var(--ab-green);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
}
.ab-msg-assistant {
  background: var(--ab-bg-soft);
  color: var(--ab-ink);
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}
.ab-intake-status {
  padding: 4px 14px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ab-muted);
  font-size: 13px;
}
.ab-dots { display: inline-flex; gap: 3px; }
.ab-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ab-muted);
  animation: ab-blink 1.2s infinite ease-in-out;
}
.ab-dots span:nth-child(2) { animation-delay: 0.15s; }
.ab-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ab-blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}
.ab-intake-composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ab-border);
  background: #fff;
  position: sticky;
  bottom: 0;
}
.ab-intake-composer textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 140px;
  border: 1px solid var(--ab-border);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  line-height: 1.4;
  outline: none;
  background: #fff;
  color: var(--ab-ink);
}
.ab-intake-composer textarea:focus {
  border-color: var(--ab-green);
  box-shadow: 0 0 0 3px rgba(46, 139, 62, 0.15);
}
.ab-intake-composer .ab-btn { padding: 10px 16px; }
.ab-mic-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--ab-border);
  background: #fff;
  color: var(--ab-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.ab-mic-btn:hover { background: var(--ab-bg-soft); }
.ab-mic-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ab-mic-btn.is-listening {
  background: var(--ab-green);
  border-color: var(--ab-green);
  color: #fff;
  animation: ab-mic-pulse 1.4s ease-in-out infinite;
}
@keyframes ab-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 139, 62, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(46, 139, 62, 0); }
}
.ab-intake-max {
  margin: 6px 0;
  padding: 14px;
  background: var(--ab-warn-bg);
  border: 1px solid var(--ab-warn-border);
  border-radius: 10px;
  color: var(--ab-ink);
  font-size: 14px;
  align-self: stretch;
}

/* ---------- Proposal page chrome ---------- */
.ab-prop-shell {
  min-height: 100vh;
  background: #f1f2ef;
  display: flex;
  flex-direction: column;
}
.ab-prop-topbar {
  background: #fff;
  border-bottom: 1px solid var(--ab-border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
}
.ab-prop-title { font-weight: 700; }
.ab-prop-save-status { color: var(--ab-muted); font-size: 13px; }
.ab-prop-topbar-spacer { flex: 1; }
.ab-prop-review {
  background: var(--ab-warn-bg);
  border-bottom: 1px solid var(--ab-warn-border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  position: sticky;
  top: 52px;
  z-index: 19;
}
.ab-prop-review-text {
  flex: 1;
  min-width: 220px;
  font-size: 14px;
  line-height: 1.4;
}
.ab-prop-review-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}
.ab-prop-review-check input { width: 18px; height: 18px; }
.ab-prop-main {
  flex: 1;
  padding: 24px 12px 40px;
}
@media (max-width: 640px) {
  .ab-prop-review { top: auto; position: static; }
}

/* ---------- Follow-up messages ---------- */
.ab-followups {
  max-width: 8.5in;
  margin: 24px auto 0;
  background: #fff;
  border: 1px solid var(--ab-border);
  border-radius: 8px;
  padding: 18px 20px;
}
.ab-followups-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ab-followups-title { margin: 0; font-size: 16px; }
.ab-followups-sub {
  color: var(--ab-muted);
  font-size: 13px;
  margin: 4px 0 14px;
}
.ab-followups-empty {
  color: var(--ab-muted);
  font-size: 14px;
  padding: 14px 0 4px;
}
.ab-followups-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ab-followup-card {
  border: 1px solid var(--ab-border);
  border-radius: 6px;
  padding: 12px 14px;
  background: #fafafa;
}
.ab-followup-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
/* ---------- Invoice panel ---------- */
.ab-invoice {
  max-width: 8.5in;
  margin: 24px auto 0;
  background: #fff;
  border: 1px solid var(--ab-border);
  border-radius: 8px;
  padding: 18px 20px;
}
.ab-invoice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ab-invoice-title { margin: 0; font-size: 16px; }
.ab-invoice-sub {
  color: var(--ab-muted);
  font-size: 13px;
  margin: 4px 0 14px;
}
.ab-invoice-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}
.ab-invoice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.ab-invoice-field { display: flex; flex-direction: column; gap: 4px; }
.ab-invoice-field-full { grid-column: 1 / -1; }
.ab-invoice-field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ab-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ab-invoice-field input,
.ab-invoice-field textarea {
  border: 1px solid var(--ab-border);
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  font-family: Arial, Helvetica, sans-serif;
  background: #fff;
}
.ab-invoice-field input:focus,
.ab-invoice-field textarea:focus {
  outline: 2px solid rgba(46, 139, 62, 0.4);
  outline-offset: 1px;
  border-color: #2e8b3e;
}
.ab-invoice-field textarea { resize: vertical; min-height: 68px; }
.ab-invoice-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}
@media (max-width: 640px) {
  .ab-invoice-grid { grid-template-columns: 1fr; }
}

.ab-followup-day {
  font-size: 12px;
  font-weight: 700;
  color: var(--ab-green-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ab-followup-text {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ab-ink);
}
.ab-followup-copy {
  font-size: 12px;
  padding: 4px 10px;
}

/* ---------- Dashboard ---------- */
.ab-dash-shell {
  min-height: 100vh;
  background: #f1f2ef;
  display: flex;
  flex-direction: column;
}
.ab-dash-topbar {
  background: #fff;
  border-bottom: 1px solid var(--ab-border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
}
.ab-dash-brand {
  font-weight: 700;
  font-size: 16px;
  color: var(--ab-green-dark);
  display: inline-flex;
  align-items: center;
}
.ab-dash-brand-logo {
  height: 32px;
  width: auto;
  display: block;
}
.ab-dash-spacer { flex: 1; }
.ab-dash-reminder {
  background: var(--ab-warn-bg);
  border-bottom: 1px solid var(--ab-warn-border);
  padding: 12px 16px;
  font-size: 14px;
}
.ab-dash-reminder strong {
  background: #b42318;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  margin-right: 6px;
  font-size: 13px;
}
.ab-dash-main {
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 40px;
  box-sizing: border-box;
}
.ab-dash-title {
  font-size: 20px;
  margin: 0 0 16px;
}
.ab-dash-empty {
  background: #fff;
  border: 1px dashed var(--ab-border);
  border-radius: 8px;
  padding: 32px 20px;
  text-align: center;
  color: var(--ab-muted);
}
.ab-dash-empty p { margin: 0 0 14px; }
.ab-dash-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ab-dash-item-link {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--ab-border);
  border-radius: 8px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ab-ink);
  transition: border-color 120ms, box-shadow 120ms;
}
.ab-dash-item-link:hover {
  border-color: var(--ab-green);
  box-shadow: 0 1px 4px rgba(46, 139, 62, 0.12);
}
.ab-dash-item-main { min-width: 0; flex: 1; }
.ab-dash-item-top {
  display: flex;
  gap: 10px;
  align-items: baseline;
  color: var(--ab-muted);
  font-size: 12px;
}
.ab-dash-item-number { font-weight: 600; color: var(--ab-green-dark); }
.ab-dash-item-customer {
  font-weight: 600;
  font-size: 15px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ab-dash-item-address {
  color: var(--ab-muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ab-dash-item-side {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 110px;
}
.ab-dash-item-price {
  font-weight: 700;
  color: var(--ab-green-dark);
}
.ab-chip {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ab-chip-warn  { background: var(--ab-warn-bg); color: #b45309; border: 1px solid var(--ab-warn-border); }
.ab-chip-muted { background: #eef0ec; color: var(--ab-muted); }
.ab-chip-soft  { background: #edf7ef; color: var(--ab-green-dark); }
