/* ===================================
   APP STYLES — Quotepilot
   Uses same CSS vars as theme.css
   =================================== */

/* --- Auth Pages --- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--navy-mid);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 40px;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}

.auth-logo-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--white);
}

.auth-logo-tag {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin-top: 2px;
}

.auth-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  text-align: center;
  margin-bottom: 28px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}

.auth-switch a {
  color: var(--orange);
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* --- App Shell --- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App Nav */
.app-nav {
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 24px;
}

.app-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.app-nav-logo {
  text-decoration: none;
}

.app-nav-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--white);
  letter-spacing: -0.02em;
}

.app-nav-links {
  display: flex;
  gap: 8px;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.15s;
}

.nav-link:hover, .nav-link.active {
  color: var(--white);
  background: rgba(255,255,255,0.06);
}

.app-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link-muted {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.nav-link-muted:hover {
  color: var(--light);
}

/* App Main */
.app-main {
  flex: 1;
  padding: 40px 0;
  background: var(--navy);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 680px;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--orange);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

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

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--light);
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  transition: all 0.15s;
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.06);
  color: var(--light);
  font-weight: 500;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
  font-weight: 500;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
  font-size: 13px;
  padding: 7px 14px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* Dashboard */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}

.dash-title {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
}

.dash-subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-top: 4px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--navy-mid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 20px;
}

.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.stat-active .stat-value { color: var(--orange); }
.stat-won .stat-value { color: #22C55E; }
.stat-lost .stat-value { color: #EF4444; }

/* Section */
.section {
  background: var(--navy-mid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
}

.link-arrow {
  color: var(--orange);
  text-decoration: none;
  font-size: 14px;
}

.link-arrow:hover {
  text-decoration: underline;
}

/* Quote List */
.quote-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.12s;
}

.quote-row:hover {
  background: rgba(255,255,255,0.04);
}

.quote-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quote-customer {
  font-weight: 500;
  color: var(--white);
  font-size: 15px;
}

.quote-date {
  font-size: 12px;
  color: var(--muted);
}

.quote-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quote-value {
  font-weight: 600;
  color: var(--white);
  font-size: 14px;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 100px;
}

.status-sent { background: rgba(100, 116, 139, 0.2); color: #94A3B8; }
.status-viewed { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.status-replied { background: rgba(249, 115, 22, 0.15); color: var(--orange); }
.status-won { background: rgba(34, 197, 94, 0.15); color: #22C55E; }
.status-lost { background: rgba(239, 68, 68, 0.15); color: #EF4444; }
.status-pending { background: rgba(100, 116, 139, 0.15); color: #94A3B8; }
.status-failed { background: rgba(239, 68, 68, 0.15); color: #EF4444; }

.status-lg {
  font-size: 13px;
  padding: 6px 16px;
}

.status-sm {
  font-size: 10px;
  padding: 2px 8px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--slate);
}

.empty-state h3 {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  color: var(--light);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 24px;
}

/* --- Page Headers --- */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 32px;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 4px;
}

.back-link:hover {
  color: var(--light);
}

.page-title {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
}

.page-subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-top: 4px;
}

/* --- Quote Table --- */
.quote-table-wrap {
  overflow-x: auto;
}

.quote-table {
  width: 100%;
  border-collapse: collapse;
}

.quote-table th {
  text-align: left;
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.quote-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 14px;
  color: var(--light);
}

.quote-table-row:hover td {
  background: rgba(255,255,255,0.02);
}

.quote-customer-link {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
}

.quote-customer-link:hover {
  color: var(--orange);
}

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

.quote-table-value {
  font-weight: 600;
  color: var(--white);
}

.followup-indicator {
  font-size: 12px;
  color: var(--muted);
}

.followup-indicator.none {
  color: var(--slate);
}

/* --- Quote Detail --- */
.quote-detail-header {
  margin-bottom: 28px;
}

.quote-detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.quote-detail-phone {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.quote-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 768px) {
  .quote-detail-grid { grid-template-columns: 1fr; }
}

.quote-detail-left, .quote-detail-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Detail Cards */
.detail-card {
  background: var(--navy-mid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 24px;
}

.detail-card-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 16px;
}

.detail-sub-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--light);
  margin-bottom: 12px;
  margin-top: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-value {
  font-size: 14px;
  color: var(--light);
}

.detail-value-lg {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
}

/* Status Update */
.status-update-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.status-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
  text-transform: capitalize;
}

.status-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--light);
}

.status-btn.active {
  border-color: transparent;
  color: var(--white);
}

.status-btn-sent.active { background: rgba(100, 116, 139, 0.3); }
.status-btn-viewed.active { background: rgba(59, 130, 246, 0.3); }
.status-btn-replied.active { background: rgba(249, 115, 22, 0.3); }
.status-btn-won.active { background: rgba(34, 197, 94, 0.3); }
.status-btn-lost.active { background: rgba(239, 68, 68, 0.3); }

/* --- Forms --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--light);
}

.form-group input,
.form-group textarea,
.form-group select {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  width: 100%;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--slate);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--orange);
  background: rgba(255,255,255,0.07);
}

.form-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #EF4444;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.form-error-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #EF4444;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-sm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .form-row, .form-row-sm { grid-template-columns: 1fr; }
}

.form-section {
  background: var(--navy-mid);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

.form-section-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 16px;
}

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

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

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

/* --- Follow-up Timeline (New Quote) --- */
.followup-preview {
  background: rgba(249, 115, 22, 0.04);
  border-color: rgba(249, 115, 22, 0.12);
}

.followup-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.followup-item {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
}

.followup-day {
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--orange);
}

.followup-label {
  font-size: 12px;
  color: var(--light);
  font-weight: 500;
}

.followup-text {
  font-size: 13px;
  color: var(--muted);
  grid-column: 2;
  line-height: 1.5;
}

/* --- Follow-up List (Detail page) --- */
.followup-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.followup-item-card {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 14px;
  border-left: 3px solid transparent;
}

.followup-item-card-sent { border-left-color: #22C55E; }
.followup-item-card-pending { border-left-color: var(--orange); }
.followup-item-card-failed { border-left-color: #EF4444; }
.followup-item-card-skipped { border-left-color: #64748B; }

.followup-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.followup-touch-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--light);
}

.followup-day-badge {
  font-size: 11px;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  padding: 2px 8px;
  border-radius: 100px;
}

.followup-message-text {
  font-size: 13px;
  color: var(--light);
  line-height: 1.5;
  margin-bottom: 6px;
}

.followup-sent-at, .followup-scheduled {
  font-size: 11px;
  color: var(--muted);
}

/* Edit Follow-ups */
.followup-edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.followup-edit-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.followup-edit-item label {
  font-size: 12px;
  font-weight: 600;
  color: var(--light);
}

.followup-edit-item textarea {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
}

.followup-edit-item textarea:focus {
  outline: none;
  border-color: var(--orange);
}

/* Danger Zone */
.danger-zone {
  border-color: rgba(239, 68, 68, 0.1);
}

/* Quote Form */
.quote-form {
  display: flex;
  flex-direction: column;
}

/* Edit form */
.edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Quote followups cell */
.quote-followups-cell {
  font-size: 13px;
}

/* followup-indicator inline */