/* Broker Diary App — Header + Bottom nav */
.app-body {
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: 72px;
}

.app-shell,
.app-shell input,
.app-shell select,
.app-shell textarea,
.app-shell button {
  font-family: var(--font-sans);
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

.app-header-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px 12px 8px;
  border-bottom: none;
  background: transparent;
  overflow-x: clip;
}

.app-header-bar .logo {
  font-size: 1.125rem;
}

.app-header-bar .logo-icon {
  width: 28px;
  height: 28px;
}

.header-main,
.header-sub {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.header-main-right,
.header-sub-right {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.header-sub-right {
  margin-left: auto;
}

.header-logo-left {
  min-width: 0;
  max-width: 100%;
}

.header-copy {
  display: none;
}

.header-profile-btn {
  flex-shrink: 0;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.header-reminder-wrap {
  position: relative;
}

.header-bell-btn {
  position: relative;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.header-bell-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.header-bell-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
}

.header-reminder-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 36px));
  border: 1px solid rgba(26,22,18,0.12);
  border-radius: 14px;
  background: rgba(245,240,232,0.98);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 8px 32px rgba(26,22,18,0.13);
  z-index: 1400;
  padding: 12px;
}

.header-reminder-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.header-reminder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.header-reminder-item {
  border: 1px solid rgba(26,22,18,0.10);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

.header-reminder-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.header-reminder-item-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
}

.header-reminder-item-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-reminder-item .btn {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 0.6875rem;
}

.app-reminder-banner {
  margin: 12px 20px 0;
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.08);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.app-reminder-banner-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.app-reminder-banner-copy strong {
  font-size: 0.8125rem;
  color: var(--text);
}

.app-reminder-banner-copy span {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.app-reminder-banner-close {
  background: var(--bg-elevated);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 4px 8px;
  min-height: 26px;
  cursor: pointer;
  white-space: nowrap;
}

.app-reminder-banner-close:hover {
  background: var(--accent-muted);
  border-color: var(--accent);
}

/* DISMISS ALL button in reminder panel header */
#header-reminder-dismiss-all {
  font-size: 0.6875rem;
  padding: 3px 8px;
  min-height: 24px;
}

.header-theme-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.header-theme-wrap label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-theme-wrap .theme-select {
  min-width: 84px;
  height: 34px;
  padding-top: 4px;
  padding-bottom: 4px;
  font-size: 0.8125rem;
}

.header-plan-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #facc15;
  color: #78350f;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-subtitle {
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.header-logout-btn {
  flex-shrink: 0;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.header-bell-btn {
  width: 34px;
  height: 34px;
}

.user-welcome {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}

.app-content {
  padding: 16px 20px 24px;
}

.app-mini-footer {
  margin: 8px 20px calc(92px + env(safe-area-inset-bottom));
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.app-mini-footer-copy,
.app-mini-footer-help {
  margin: 0;
}

.app-mini-footer-help a {
  color: var(--accent);
  text-decoration: none;
}

.app-mini-footer-help a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translate(-50%, 12px);
  max-width: calc(100vw - 32px);
  width: max-content;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg-elevated);
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1200;
}

.app-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
}

.app-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}

.app-confirm-card {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 28px));
  margin: 22vh auto 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 16px 14px;
  box-shadow: var(--shadow-lg);
}

.app-confirm-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--text);
}

.app-confirm-card p {
  margin: 0 0 14px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.app-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Views */
.view {
  display: none;
}

.view.active {
  display: block;
}

.view.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-elevated);
  z-index: 100;
  overflow: auto;
  padding-bottom: 24px;
}

.view.overlay.active {
  display: block;
}

.overlay-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 1;
}

@media (max-width: 640px) {
  .header-reminder-panel {
    right: -8px;
  }

  .app-reminder-banner {
    margin: 10px 12px 0;
  }
}

.back-btn {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 0;
}

.overlay-body {
  padding: 20px;
}

/* Screen title */
.screen-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
  text-align: center;
}

.screen-subtitle {
  margin: -8px 0 14px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

.section-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 24px 0 12px;
  text-align: center;
}

/* Today's follow-ups (dashboard) */
.followup-list {
  list-style: none;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 8px;
}

.followup-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.followup-list li:last-child {
  border-bottom: none;
}

.followup-list .empty-state,
.followup-task-list .empty-state,
.followup-history-list .empty-state {
  color: var(--text-muted);
  font-size: 0.9375rem;
  padding: 24px;
  text-align: center;
}

.followup-info strong {
  display: block;
  font-size: 0.9375rem;
}

.followup-time {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.followup-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--bg-subtle);
  border: none;
  text-decoration: none;
  cursor: pointer;
  color: var(--accent);
  transition: background 0.2s;
}

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

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Quick stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--bg-elevated);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.stat-card:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.stat-card .stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.stat-card .stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 4px;
}

/* Recent leads */
.lead-preview-list {
  list-style: none;
  margin-bottom: 16px;
}

.lead-preview-list li {
  display: block;
  /* Change flex to block for custom internal flex */
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
}

.lead-preview-list li:active {
  background: var(--bg-subtle);
}

.lead-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.lead-name {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-right: 8px;
}

.lead-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: block;
}

.lead-followup {
  margin-top: 6px;
  font-size: 0.8125rem;
}

.tag {
  font-size: 0.6875rem;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.tag-new {
  background: #e0e7ff;
  color: #3730a3;
}

.tag-contacted {
  background: #dbeafe;
  color: #1e40af;
}

.tag-visit {
  background: #fef3c7;
  color: #92400e;
}

.tag-visit-scheduled {
  background: #fef3c7;
  color: #92400e;
}

.tag-negotiation {
  background: #fce7f3;
  color: #9d174d;
}

.tag-closed {
  background: #d1fae5;
  color: #065f46;
}

.tag-not-interested {
  background: #f1f5f9;
  color: #475569;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.leads-top-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.leads-action-btn {
  height: 40px;
  min-width: 140px;
  padding: 0 14px;
  line-height: 1;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.leads-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
}

.search-input {
  flex: 1 1 260px;
  padding: 10px 12px;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
}

.filter-select {
  padding: 10px 12px;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  min-width: 140px;
  /* Ensure it doesn't get too small */
  flex-shrink: 0;
  /* Don't shrink */
}

.toolbar-sort-row {
  justify-content: flex-end;
  align-items: center;
  margin-top: -8px;
}

.toolbar-sort-row .filter-select {
  min-width: 170px;
}

.sort-by-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1;
}

.leads-total-label {
  margin-right: auto;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.leads-quick-filter {
  margin: -6px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.leads-quick-filter-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.leads-quick-filter .btn {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 0.6875rem;
}

/* Lead cards (list) */
.lead-card-list {
  list-style: none;
}

.lead-card-list li {
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
}

.lead-card-list .lead-name {
  margin-bottom: 0;
  /* Handled by flex parent */
}

.lead-card-list .lead-meta {
  display: block;
  margin-bottom: 6px;
}

.cold-card-list li {
  cursor: default;
}

.cold-card-list .empty-state {
  list-style: none;
  margin: 0;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

.cold-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.cold-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
}

.cold-card-actions .btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  padding-left: 10px;
  padding-right: 10px;
  white-space: nowrap;
}

.cold-card-actions .btn[data-cold-action="convert"] {
  flex: 0 0 auto;
}

.cold-card-actions a.btn {
  flex: 0 0 auto;
}

.tag-interested {
  background: #dcfce7;
  color: #166534;
}

.tag-not-interested {
  background: #fef2f2;
  color: #991b1b;
}

.tag-new-cold {
  background: #e0e7ff;
  color: #3730a3;
}

.tag-converted {
  background: #dbeafe;
  color: #1d4ed8;
}

.cold-status-select {
  width: auto;
  min-width: 132px;
  padding: 8px 10px;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
}

.cold-delete-top {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 0.6875rem;
}

.call-disabled-btn,
.btn.is-disabled,
.icon-btn.call-disabled-btn {
  opacity: 0.55;
  cursor: default;
}

.acres-map-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

.acres-map-panel .field {
  margin-bottom: 10px;
}

.acres-map-panel label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.acres-map-panel select {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
}

.leads-pagination {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.leads-pagination .btn {
  min-width: 54px;
  min-height: 32px;
  padding: 7px 10px;
  font-size: 0.75rem;
}

.leads-pagination .page-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 6px;
}

.leads-pagination .page-list {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.leads-pagination .page-btn {
  min-width: 34px;
  min-height: 32px;
  padding-left: 8px;
  padding-right: 8px;
}

.leads-pagination .page-ellipsis {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 3px;
}

.leads-pagination .page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.leads-pagination .page-jump input {
  width: 54px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 4px 6px;
  font-size: 0.75rem;
}

/* Add lead form & Profile form */
.form-add-lead .field,
#form-profile .field,
#team-invite-modal-form .field,
#team-member-edit-modal-form .field {
  margin-bottom: 16px;
}

.form-add-lead label,
#form-profile label,
#team-invite-modal-form label,
#team-member-edit-modal-form label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-add-lead input,
.form-add-lead select,
.form-add-lead textarea,
#form-profile input,
#form-profile select,
#form-profile textarea,
#team-invite-modal-form input,
#team-invite-modal-form select,
#team-invite-modal-form textarea,
#team-member-edit-modal-form input,
#team-member-edit-modal-form select,
#team-member-edit-modal-form textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
}

.form-add-lead textarea,
#form-profile textarea,
#team-invite-modal-form textarea,
#team-member-edit-modal-form textarea {
  resize: vertical;
  min-height: 60px;
}

.form-add-lead select {
  height: 42px;
  /* Enforce height to match inputs */
  appearance: none;
  /* Remove default OS styling for consistency */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-add-lead .add-property-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.form-add-lead .add-property-link:hover,
#form-lead-edit .add-property-link:hover {
  text-decoration: underline;
}

#form-lead-edit .add-property-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.form-add-lead button[type="submit"] {
  margin-top: 8px;
}

/* Follow-up task list */
.followup-task-list {
  list-style: none;
}

.followup-task-list li {
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.followup-task-info strong {
  display: block;
  margin-bottom: 4px;
}

.followup-task-info .muted {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.followup-task-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.followup-task-actions .btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.followup-history-list {
  list-style: none;
}

.followup-history-list li {
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.followup-history-headbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: 20px 0 12px;
  min-height: 36px;
}

.followup-history-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
}

.followup-history-month {
  min-width: 170px;
  max-width: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  padding: 8px 12px;
}

.followup-history-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.followup-history-download-btn {
  min-height: 36px;
  min-width: 36px;
  width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.followup-history-subtitle {
  margin-top: -6px;
}

.followup-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.followup-history-head .muted {
  font-size: 0.8125rem;
}

.followup-history-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Profile */
.profile-card {
  background: var(--bg-elevated);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.profile-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.profile-tab-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.profile-tab-btn.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: rgba(37, 99, 235, 0.28);
}

.profile-tab-panel {
  display: none;
}

.profile-tab-panel.active {
  display: block;
}

.profile-membership-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.profile-membership-head .btn {
  margin-top: 0;
}

.profile-plan,
.profile-renewal {
  margin-bottom: 12px;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.profile-card .btn {
  margin-top: 16px;
}

.billing-card {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg);
}

.profile-payment-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-payment-actions .btn {
  margin-top: 0;
}

#profile-payment-panel .field {
  margin-bottom: 12px;
}

#profile-payment-panel label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

#profile-payment-panel select,
#profile-payment-panel input {
  width: 100%;
  max-width: 360px;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
}

.profile-billing-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.billing-item {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.team-card {
  background: var(--bg);
}

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

.team-card-title {
  margin: 0;
}

.team-seat-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.team-seat-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.75rem;
}

.team-card-note {
  margin-bottom: 10px;
}

.team-seat-actions .btn {
  margin-top: 0;
}

.team-invite-modal-card {
  margin-top: 14vh;
}

.team-invite-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.team-invite-modal-head h3 {
  margin: 0;
}

.team-list-title {
  margin: 2px 0 8px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.team-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.team-item-name {
  margin-bottom: 2px;
}

.team-item-meta {
  font-size: 0.8125rem;
}

.team-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.team-member-main {
  min-width: 0;
}

.team-member-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.team-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.team-status-badge.pending {
  background: #fef9c3;
  border-color: #fde68a;
  color: #854d0e;
}

.team-status-badge.revoked,
.team-status-badge.expired {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #4b5563;
}

.team-status-badge.accepted {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.team-item-actions {
  margin-top: 8px;
}

.profile-billing-history .empty-state {
  list-style: none;
  margin: 0;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.lead-limit-hint {
  font-size: 0.875rem;
  margin-bottom: 12px;
}

.lead-limit-hint a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* Lead detail */
.lead-detail-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.lead-detail-summary {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lead-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.lead-detail-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 1px;
}

.lead-detail-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lead-detail-label {
  font-weight: 700;
  color: var(--text);
  min-width: 120px;
}

.lead-detail-value {
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.lead-detail-notes {
  margin: 0;
}

.prospect-summary-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.prospect-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.prospect-label {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.prospect-badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.prospect-text {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

#lead-comment-input {
  font-family: Helvetica, Arial, sans-serif;
}

#lead-comment-input::placeholder {
  font-family: Helvetica, Arial, sans-serif;
}

.lead-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.lead-detail-actions .btn {
  flex: 1;
  min-width: 100px;
}

.overlay-body .field {
  margin-bottom: 16px;
}

.overlay-body .field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.overlay-body select,
.overlay-body input,
.overlay-body textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.overlay-body select {
  height: 42px;
  /* Match input height */
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

#lead-deal-close {
  margin-top: 12px;
}

/* Visit outcome */
.outcome-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.outcome-btn {
  padding: 12px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 400;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  cursor: pointer;
}

.outcome-btn:hover,
.outcome-btn.selected {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--accent);
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 8px 0 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 50;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

.bottom-nav-item:hover {
  color: var(--text);
}

.bottom-nav-item.active {
  color: var(--accent);
}

.bottom-nav-item .nav-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 2px;
}

.bottom-nav-item .nav-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}



.bottom-nav-item.nav-add.active,
.bottom-nav-item.nav-add:hover {
  color: var(--accent);
}

.muted {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.lead-phone-inline {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.lead-history-list {
  list-style: none;
  margin: 8px 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  overflow: hidden;
}

.lead-history-list li {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.lead-history-list li:last-child {
  border-bottom: none;
}

.lead-history-list .empty-state {
  color: var(--text-muted);
  text-align: left;
}

.lead-doc-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

.lead-doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.lead-doc-item:last-child {
  border-bottom: none;
}

.lead-doc-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lead-doc-meta strong {
  font-size: 0.875rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desktop-logo {
  display: none;
}

/* Desktop Responsiveness */
@media (min-width: 768px) {
  .app-body {
    padding-bottom: 0;
    /* Remove bottom padding */
    background: var(--bg-subtle);
    /* Slightly distinct background for desktop feel */
  }

  .app-shell {
    width: 100%;
    max-width: none;
    padding-left: 240px;
    /* Space for Sidebar */
    padding-right: 20px;
    /* Padding on right */
    margin: 0;
  }

  .app-header-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
  }

  .header-main .logo {
    display: none;
  }

  .header-main {
    order: 3;
    justify-content: flex-end;
  }

  .header-copy {
    display: block;
    min-width: 0;
    flex: 1 1 auto;
    order: 1;
    padding: 0;
  }

  .header-sub {
    order: 2;
    justify-content: flex-end;
  }

  .app-content {
    padding-top: 24px;
  }

  .app-mini-footer {
    margin: 14px 20px 20px;
    font-size: 0.875rem;
  }

  .header-main,
  .header-sub {
    width: auto;
    gap: 8px;
  }

  .header-main-right,
  .header-sub-right {
    gap: 8px;
  }

  .header-profile-btn {
    display: none;
  }

  .header-theme-wrap .theme-select {
    min-width: 92px;
    height: 34px;
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 0.875rem;
  }

  .header-plan-badge {
    min-height: 34px;
    padding: 8px 12px;
    font-size: 0.8125rem;
  }

  .header-logout-btn {
    min-height: 34px;
    padding: 8px 14px;
    font-size: 0.875rem;
  }

  .app-toast {
    bottom: 24px;
  }

  /* Transform Bottom Nav to Sidebar */
  .bottom-nav {
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    max-width: none;
    transform: none;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 24px 0;
    border-top: none;
    border-right: 1px solid var(--border);
    background: var(--bg-elevated);
  }

  /* Logo in Sidebar */
  .desktop-logo {
    display: block;
    padding: 0 24px 24px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .desktop-logo .logo {
    font-size: 1.25rem;
  }

  .desktop-logo .logo-icon {
    width: 32px;
    height: 32px;
  }

  .bottom-nav-item {
    flex-direction: row;
    padding: 12px 24px;
    gap: 12px;
    font-size: 0.9375rem;
    border-radius: 0;
    color: var(--text-secondary);
  }

  .bottom-nav-item:hover {
    background: var(--bg-subtle);
    color: var(--text);
  }

  .bottom-nav-item.active {
    background: var(--accent-muted);
    color: var(--accent);
    border-right: 3px solid var(--accent);
  }

  .bottom-nav-item .nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
  }

  .bottom-nav-item.nav-add .nav-icon {
    font-size: 1.25rem;
    font-weight: normal;
  }

  /* Grid Layouts */
  .lead-card-list,
  .lead-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
  }

  .lead-card-list li,
  .lead-preview-list li {
    margin-bottom: 0;
    height: 100%;
    /* Uniform height */
  }

  .stats-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .stat-card {
    padding: 24px;
  }

  .form-add-lead,
  .profile-card,
  .bulk-upload-section,
  .auth-divider {
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .leads-top-actions {
    width: 100%;
    justify-content: center;
  }

  .leads-action-btn {
    width: 100%;
    max-width: 320px;
    min-height: 44px;
    margin-left: auto;
    margin-right: auto;
  }

  .app-mini-footer {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: calc(96px + env(safe-area-inset-bottom));
    text-align: center;
  }

  .followup-history-headbar {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 0;
  }

  .followup-history-controls {
    width: 100%;
    flex-direction: row;
    align-items: center;
  }

  .followup-history-month {
    width: auto;
    flex: 1 1 auto;
    max-width: 100%;
  }

  .followup-history-download-btn {
    flex: 0 0 36px;
  }

  .followup-history-title {
    position: static;
    transform: none;
  }
}
