/* styles.css: Contractor Quote Follow-Up Tracker */
:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-alt: #f1f5f9;
  --border: #e2e8f0;
  --border-focus: #2563eb;

  --text-main: #0f172a;
  --text-muted: #334155;
  --text-light: #64748b;

  --primary: #1e3a8a;
  --primary-hover: #172554;
  --primary-contrast: #ffffff;

  --accent: #2563eb;
  --accent-light: #dbeafe;

  --amber-bg: #fef3c7;
  --amber-text: #78350f;
  --amber-border: #f59e0b;

  --green-bg: #dcfce7;
  --green-text: #14532d;
  --green-border: #22c55e;

  --red-bg: #fee2e2;
  --red-text: #7f1d1d;
  --red-border: #ef4444;

  --blue-bg: #e0f2fe;
  --blue-text: #075985;
  --blue-border: #0284c7;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-width: 320px;
  overflow-x: hidden;
  padding: 16px 12px;
}

.app-wrapper {
  max-width: 1100px;
  margin: 0 auto;
}

/* Header */
.app-header {
  margin-bottom: 20px;
  text-align: left;
}

.brand-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.badge-brand {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent-light);
  color: #1e40af;
  padding: 4px 10px;
  border-radius: 9999px;
}

.badge-private {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-alt);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border);
}

.app-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 8px;
}

.app-subtitle {
  font-size: 0.98rem;
  color: var(--text-muted);
  max-width: 720px;
}

/* Banners */
.notice-banner, .link-banner, .notification-banner, .error-banner {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.notice-banner {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #14532d;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.notice-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.notice-text {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
}

.link-banner {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
}

.link-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}

.link-desc {
  font-size: 0.85rem;
  margin-bottom: 10px;
  color: #1e40af;
}

.link-copy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 6px;
}

.share-link-input {
  flex: 1;
  font-family: monospace;
  font-size: 0.82rem;
  padding: 8px 10px;
  border: 1px solid #93c5fd;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #0f172a;
  min-width: 0;
  overflow-wrap: anywhere;
}

.copy-feedback-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: #15803d;
  display: block;
  min-height: 18px;
}

.notification-banner {
  background: #f0fdf4;
  border: 1px solid #22c55e;
  color: #14532d;
  font-weight: 600;
  font-size: 0.9rem;
}

.error-banner {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red-text);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Stats Section */
.stats-section {
  margin-bottom: 20px;
}

.pipeline-summary-card {
  background: #0f172a;
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-md);
}

.pipeline-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 700;
  margin-bottom: 2px;
}

.pipeline-summary-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.01em;
}

.won-summary-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #4ade80;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.metric-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 4px;
}

.metric-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.card-open .metric-value { color: #1e3a8a; }
.card-limbo .metric-value { color: #b45309; }
.card-won .metric-value { color: #15803d; }
.card-won-val .metric-value { color: #15803d; }
.card-lost .metric-value { color: #64748b; }

/* CTAs */
.cta-section-top {
  margin-bottom: 20px;
}

.cta-box {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
  .cta-box {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.cta-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.cta-heading {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 4px;
  color: #ffffff;
}

.cta-desc {
  font-size: 0.88rem;
  color: #cbd5e1;
  max-width: 600px;
}

.btn-cta {
  display: inline-block;
  background: #f59e0b;
  color: #0f172a;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  text-decoration: none;
  text-align: center;
  flex-shrink: 0;
  transition: transform 0.1s ease, background 0.1s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-cta:hover {
  background: #d97706;
  transform: translateY(-1px);
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (min-width: 860px) {
  .content-grid {
    grid-template-columns: 360px 1fr;
    align-items: start;
  }
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px 16px;
}

.card-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Form */
.form-group {
  margin-bottom: 14px;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-col {
  flex: 1;
  min-width: 0;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.required {
  color: #dc2626;
}

.form-input, .form-textarea, .search-input {
  width: 100%;
  font-size: 0.92rem;
  color: var(--text-main);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-textarea:focus, .search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Currency input prefix padding (lessons.md rule) */
.currency-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-prefix {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  font-weight: 700;
  pointer-events: none;
  font-size: 0.95rem;
}

.currency-input {
  padding-left: 24px;
}

.inline-error {
  display: block;
  font-size: 0.8rem;
  color: #dc2626;
  font-weight: 600;
  margin-top: 4px;
  min-height: 1.1em;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger, .btn-sm {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 10px 14px;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, transform 0.1s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-danger {
  background: #ffffff;
  border-color: #fca5a5;
  color: #dc2626;
}

.btn-danger:hover {
  background: var(--red-bg);
}

.btn-danger-confirm {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #b91c1c !important;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-light);
  padding: 4px 8px;
}

.btn-icon:hover {
  color: var(--text-main);
}

/* Board Column */
.board-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Script Copied Banner */
.script-banner {
  background: #f0fdf4;
  border: 2px solid #22c55e;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  overflow-wrap: anywhere;
}

.script-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.script-badge {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #14532d;
}

.script-meta {
  font-size: 0.75rem;
  color: #15803d;
}

.script-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 6px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.script-tip {
  display: block;
  font-size: 0.78rem;
  color: #166534;
  font-weight: 500;
}

/* Controls Bar */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.search-box {
  flex: 1;
  min-width: 220px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-count {
  position: absolute;
  right: 10px;
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 600;
}

/* Cheatsheet */
.cheatsheet-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.cheatsheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.cheatsheet-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

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

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

.cadence-item {
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--border);
}

.cadence-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.badge-day1 { background: #dbeafe; color: #1e40af; }
.badge-day3 { background: #fef3c7; color: #78350f; border: 1px solid #f59e0b; }
.badge-day7 { background: #fed7aa; color: #7c2d12; border: 1px solid #f97316; }
.cadence-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.cadence-template {
  display: block;
  font-size: 0.78rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  color: var(--text-main);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* Empty State */
.empty-state {
  background: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.empty-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 0.9rem;
  color: var(--text-light);
  max-width: 420px;
  margin: 0 auto;
}

/* Pipeline Sections */
.pipeline-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}

.section-header-won {
  border-bottom-color: #86efac;
}

.section-header-lost {
  border-bottom-color: #cbd5e1;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.badge-count {
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--bg-alt);
  color: var(--text-main);
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid var(--border);
}

.badge-count-won {
  background: #dcfce7;
  color: #14532d;
  border-color: #86efac;
}

.badge-count-lost {
  background: var(--bg-alt);
  color: var(--text-light);
}

.badge-amount-won {
  font-size: 0.92rem;
  font-weight: 800;
  color: #15803d;
}

.badge-amount-lost {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-light);
}

.section-hint {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Quote Cards */
.quotes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quote-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  overflow-wrap: anywhere;
}

.quote-card:hover {
  box-shadow: var(--shadow-md);
}

.quote-card-won {
  border-left: 4px solid #22c55e;
  background: #fbfdfc;
}

.quote-card-lost {
  border-left: 4px solid #94a3b8;
  opacity: 0.85;
}

.quote-card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.customer-info {
  flex: 1;
  min-width: 180px;
}

.customer-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.job-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
}

.quote-amount-tag {
  font-size: 1.2rem;
  font-weight: 800;
  color: #1e3a8a;
  white-space: nowrap;
}

.amount-won {
  color: #15803d;
}

/* Due Badges */
.due-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 9999px;
  margin-bottom: 10px;
  line-height: 1.2;
}

.badge-amber {
  background-color: var(--amber-bg);
  color: var(--amber-text);
  border: 1px solid var(--amber-border);
}

.badge-blue {
  background-color: var(--blue-bg);
  color: var(--blue-text);
  border: 1px solid var(--blue-border);
}

.badge-orange {
  background-color: #ffedd5;
  color: #9a3412;
  border: 1px solid #fb923c;
}

.badge-red {
  background-color: var(--red-bg);
  color: var(--red-text);
  border: 1px solid var(--red-border);
}

.badge-green {
  background-color: var(--green-bg);
  color: var(--green-text);
  border: 1px solid var(--green-border);
}

.badge-gray {
  background-color: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Quote Meta */
.quote-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-label {
  font-weight: 600;
  color: var(--text-muted);
}

.quote-notes {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 10px;
  font-style: italic;
}

/* Quote Actions */
.quote-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.action-group-left {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.action-group-right {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-copy-script {
  background: #fef3c7;
  color: #78350f;
  border: 1px solid #f59e0b;
  font-weight: 700;
}

.btn-copy-script:hover {
  background: #fde68a;
}

.btn-status-won {
  background: #dcfce7;
  color: #14532d;
  border: 1px solid #86efac;
}

.btn-status-won:hover {
  background: #bbf7d0;
}

.btn-status-lost {
  background: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-status-lost:hover {
  background: #e2e8f0;
}

.btn-status-reopen {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

.btn-status-reopen:hover {
  background: #bae6fd;
}

/* Early Access Demand Test Card (AGENTS 3b) */
.early-access-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 24px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.early-access-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: #f59e0b;
  color: #0f172a;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.early-access-title {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 8px;
  color: #ffffff;
}

.early-access-text {
  font-size: 0.92rem;
  color: #cbd5e1;
  max-width: 650px;
  margin-bottom: 14px;
  line-height: 1.45;
}

.btn-early-access {
  display: inline-block;
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: transform 0.1s ease, background 0.1s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-early-access:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

/* Data Controls */
.data-controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 24px;
}

.data-controls-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text-main);
}

.data-controls-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 12px;
}

.data-controls-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  padding-bottom: 20px;
  text-align: center;
}

.footer-cta-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

@media (min-width: 600px) {
  .footer-cta-row {
    flex-direction: row;
    justify-content: center;
    gap: 12px;
  }
}

.footer-cta-text {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
}

.footer-cta-link {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--accent);
  text-decoration: underline;
}

.footer-meta {
  font-size: 0.8rem;
  color: var(--text-light);
}

.footer-link {
  color: var(--text-light);
  text-decoration: underline;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
