/* =======================================
   LeadForge App Shell
   Uses design tokens from theme.css
   ======================================= */

/* ----- Layout ----- */
.app-body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  min-height: 100vh;
}

.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ----- Nav ----- */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--fg);
}

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

.nav-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}
.nav-link:hover { color: var(--fg); }

/* ----- Buttons ----- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #0a0a0f;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--accent-dim); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary.btn-lg { font-size: 1rem; padding: 0.8rem 1.75rem; }
.btn-primary.btn-sm { font-size: 0.8rem; padding: 0.4rem 0.9rem; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--fg-muted);
  font-size: 0.875rem;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: var(--fg-muted); color: var(--fg); }
.btn-ghost.btn-sm { font-size: 0.8rem; padding: 0.4rem 0.8rem; }

.btn-accent {
  display: inline-flex;
  align-items: center;
  background: rgba(74, 222, 128, 0.1);
  color: var(--accent);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(74, 222, 128, 0.2);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-accent:hover { background: rgba(74, 222, 128, 0.2); }
.btn-accent.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.75rem; }

/* ----- Page header ----- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 1rem;
}

.breadcrumb {
  display: inline-block;
  color: var(--fg-muted);
  font-size: 0.875rem;
  text-decoration: none;
  margin-bottom: 0.5rem;
  transition: color 0.15s;
}
.breadcrumb:hover { color: var(--fg); }

.page-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.page-subtitle {
  color: var(--fg-muted);
  font-size: 0.9375rem;
  margin-top: 0.25rem;
}

/* ----- Stats row ----- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.accent-card {
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.04);
}

.stat-label {
  color: var(--fg-muted);
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
}
.accent-card .stat-value { color: var(--accent); }

/* ----- Dashboard grid ----- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}

/* ----- Panel ----- */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.link-accent {
  color: var(--accent);
  font-size: 0.875rem;
  text-decoration: none;
  transition: opacity 0.15s;
}
.link-accent:hover { opacity: 0.8; }

/* ----- ICP card ----- */
.icp-card {
  display: block;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.icp-card:hover { border-color: var(--accent-dim); }
.icp-card:last-child { margin-bottom: 0; }

.icp-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.625rem;
}

.icp-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--fg);
}

.icp-meta {
  color: var(--fg-muted);
  font-size: 0.8125rem;
  margin-top: 0.2rem;
}

.icp-counts {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.count-badge {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}

.icp-titles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.title-chip {
  background: rgba(74, 222, 128, 0.08);
  color: var(--accent);
  border: 1px solid rgba(74, 222, 128, 0.2);
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-family: var(--font-display);
  font-weight: 500;
}

/* ----- Email row ----- */
.email-row {
  display: block;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s;
}
.email-row:last-child { border-bottom: none; }
.email-row:hover { background: rgba(255,255,255,0.02); border-radius: 8px; padding-left: 0.5rem; }

.email-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.email-to {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--fg);
}

.email-company { color: var(--fg-muted); font-weight: 400; }
.email-subject { color: var(--fg); font-size: 0.875rem; margin-bottom: 0.15rem; }
.email-icp-name { color: var(--fg-muted); font-size: 0.78rem; }
.email-preview-text { color: var(--fg-muted); font-size: 0.8125rem; margin-top: 0.25rem; line-height: 1.5; }

/* ----- Status badges ----- */
.status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  font-family: var(--font-display);
}

.status-draft     { background: rgba(139,139,160,0.15); color: #8a8a9a; border: 1px solid rgba(139,139,160,0.2); }
.status-discovered { background: rgba(139,139,160,0.15); color: #8a8a9a; border: 1px solid rgba(139,139,160,0.2); }
.status-approved  { background: rgba(74,222,128,0.12); color: var(--accent); border: 1px solid rgba(74,222,128,0.25); }
.status-sent      { background: rgba(96,165,250,0.12); color: #60a5fa; border: 1px solid rgba(96,165,250,0.25); }
.status-replied   { background: rgba(251,191,36,0.12); color: var(--yellow); border: 1px solid rgba(251,191,36,0.25); }
.status-booked    { background: rgba(74,222,128,0.2); color: var(--accent); border: 1px solid rgba(74,222,128,0.4); }
.status-rejected  { background: rgba(248,113,113,0.1); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }
.status-emailed   { background: rgba(96,165,250,0.1); color: #60a5fa; border: 1px solid rgba(96,165,250,0.2); }

/* ----- Empty state ----- */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--fg-muted);
}

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

/* ----- Form styles ----- */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 720px;
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

.required { color: var(--red); margin-left: 2px; }
.optional { color: var(--fg-muted); font-weight: 400; font-size: 0.8125rem; }

.form-input {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  padding: 0.7rem 1rem;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}
.form-input:focus { border-color: var(--accent-dim); }
.form-input::placeholder { color: var(--fg-muted); }

.form-textarea {
  resize: vertical;
  min-height: 90px;
}

.form-hint {
  color: var(--fg-muted);
  font-size: 0.8125rem;
  margin-top: 0.4rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* Tags input */
.tags-input-wrapper {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
  min-height: 48px;
  cursor: text;
  transition: border-color 0.15s;
}
.tags-input-wrapper:focus-within { border-color: var(--accent-dim); }

.tags-list { display: flex; flex-wrap: wrap; gap: 0.375rem; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: rgba(74, 222, 128, 0.1);
  color: var(--accent);
  border: 1px solid rgba(74, 222, 128, 0.25);
  font-size: 0.8125rem;
  padding: 0.25rem 0.625rem;
  border-radius: 100px;
}

.tag button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  opacity: 0.7;
}
.tag button:hover { opacity: 1; }

.tags-input {
  border: none;
  background: transparent;
  color: var(--fg);
  font-size: 0.9375rem;
  outline: none;
  min-width: 180px;
  flex: 1;
}
.tags-input::placeholder { color: var(--fg-muted); }

.title-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.625rem;
  align-items: center;
}

.suggestion-chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.78rem;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.suggestion-chip:hover { border-color: var(--accent-dim); color: var(--accent); }

/* ----- Alerts ----- */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.alert-success { background: rgba(74,222,128,0.1); border: 1px solid rgba(74,222,128,0.25); color: var(--accent); }
.alert-error   { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.25); color: var(--red); }

/* ----- Tabs ----- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-count {
  background: rgba(255,255,255,0.06);
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 100px;
  margin-left: 0.4rem;
}

/* ----- Prospects table ----- */
.prospects-table {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.table-header {
  display: grid;
  grid-template-columns: 1.8fr 1.5fr 2fr 1fr 1.2fr;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-subtle);
  color: var(--fg-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-display);
}

.table-row {
  display: grid;
  grid-template-columns: 1.8fr 1.5fr 2fr 1fr 1.2fr;
  gap: 1rem;
  padding: 1rem 1.25rem;
  align-items: center;
  border-top: 1px solid var(--border);
  transition: background 0.1s;
}
.table-row:hover { background: var(--bg-subtle); }

.prospect-name { font-weight: 500; color: var(--fg); font-size: 0.9rem; }
.prospect-title-label { color: var(--fg-muted); font-size: 0.8rem; margin-top: 0.15rem; }
.prospect-company { color: var(--fg); font-size: 0.875rem; }
.prospect-location { color: var(--fg-muted); font-size: 0.78rem; }
.prospect-title-small { color: var(--fg-muted); font-size: 0.8rem; }

.signal-chip {
  background: rgba(251,191,36,0.07);
  border: 1px solid rgba(251,191,36,0.15);
  color: var(--yellow);
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  cursor: help;
}

/* ----- Email preview ----- */
.email-preview-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
}

@media (max-width: 820px) {
  .email-preview-card { grid-template-columns: 1fr; }
}

.email-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  height: fit-content;
}

.sidebar-section { margin-bottom: 1.25rem; }
.sidebar-section:last-child { margin-bottom: 0; }

.sidebar-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.375rem;
}

.sidebar-value { font-size: 0.875rem; color: var(--fg); line-height: 1.5; }
.sidebar-value.muted { color: var(--fg-muted); }

.email-editor {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.email-field { display: flex; flex-direction: column; gap: 0.4rem; }

.email-field-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.email-subject-input {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.7rem 1rem;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
.email-subject-input:focus { border-color: var(--accent-dim); }
.email-subject-input[readonly] { opacity: 0.8; cursor: default; }

.email-body-input {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.7;
  padding: 1rem;
  outline: none;
  width: 100%;
  resize: vertical;
  transition: border-color 0.15s;
}
.email-body-input:focus { border-color: var(--accent-dim); }
.email-body-input[readonly] { opacity: 0.8; cursor: default; }

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ----- Landing page nav link ----- */
.hero .nav-to-app {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  background: var(--accent);
  color: #0a0a0f;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 2rem;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s;
}
.hero .nav-to-app:hover { background: var(--accent-dim); }
