/* App UI — extends theme.css */

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

.app-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.app-logo {
  font-family: 'Playfair Display', serif;
  font-weight: 800;
  font-size: 20px;
  color: var(--fg);
  text-decoration: none;
}

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

.app-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.app-nav a:hover { color: var(--fg); }
.app-nav a.active { color: var(--accent); }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

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

.btn-primary:hover {
  background: #b04d14;
}

.btn-secondary {
  background: var(--bg-alt);
  color: var(--fg);
  border: 1px solid var(--border);
}

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

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--bg-alt);
  color: var(--fg);
}

/* Main content */
.app-main {
  flex: 1;
  padding: 40px 48px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

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

.dashboard-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.5px;
}

.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.job-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  display: block;
  transition: all 0.2s;
  cursor: pointer;
}

.job-card:hover {
  box-shadow: 0 4px 20px rgba(30, 30, 46, 0.08);
  border-color: var(--sand);
}

.job-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.job-card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.job-card-meta {
  font-size: 13px;
  color: var(--fg-muted);
}

.job-card-stats {
  display: flex;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.stat-pill {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
}

.stat-pill strong {
  color: var(--fg);
}

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--fg-muted);
}

.empty-state h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--fg);
  margin-bottom: 12px;
}

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

/* Job detail / pipeline */
.pipeline-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
  align-items: start;
}

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

.pipeline-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.pipeline-meta {
  font-size: 14px;
  color: var(--fg-muted);
}

.pipeline-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--fg-muted);
  text-decoration: none;
  margin-bottom: 24px;
}

.pipeline-back:hover { color: var(--fg); }

.pipeline-columns {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  min-height: 400px;
}

.stage-column {
  min-width: 220px;
  flex-shrink: 0;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.stage-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-muted);
}

.stage-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--border);
  padding: 2px 7px;
  border-radius: 10px;
}

.candidate-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.candidate-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: all 0.15s;
}

.candidate-card:hover {
  box-shadow: 0 2px 12px rgba(30, 30, 46, 0.07);
}

.candidate-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.candidate-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.candidate-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.candidate-email {
  font-size: 12px;
  color: var(--fg-muted);
}

.candidate-actions {
  display: flex;
  gap: 4px;
}

.candidate-action-btn {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--fg-muted);
  transition: all 0.1s;
  text-decoration: none;
}

.candidate-action-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.candidate-action-btn.email-btn {
  font-size: 10px;
  padding: 0 8px;
  width: auto;
}

/* Sidebar */
.pipeline-sidebar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: sticky;
  top: 80px;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-muted);
  margin-bottom: 20px;
}

.sidebar-job-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.sidebar-job-location {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 20px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.sidebar-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.sidebar-stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
}

.sidebar-stat-label {
  font-size: 12px;
  color: var(--fg-muted);
}

/* Form */
.form-container {
  max-width: 600px;
  margin: 0 auto;
}

.form-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--fg-muted);
  text-decoration: none;
  margin-bottom: 32px;
}

.form-back:hover { color: var(--fg); }

.form-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.5px;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.form-label span {
  color: var(--accent);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  color: var(--fg);
  background: var(--white);
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
}

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

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

/* Email modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 30, 46, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(30, 30, 46, 0.2);
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* Success flash */
.flash {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 24px;
}

.flash-success {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

/* 404 */
.page-404 {
  text-align: center;
  padding: 80px 24px;
}

/* Auth pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-alt);
}

.auth-logo {
  font-family: 'Playfair Display', serif;
  font-weight: 800;
  font-size: 28px;
  color: var(--fg);
  text-decoration: none;
  margin-bottom: 32px;
  display: block;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 4px 24px rgba(30, 30, 46, 0.06);
}

.auth-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 15px;
  color: var(--fg-muted);
  margin-bottom: 28px;
}

.auth-form .form-group {
  margin-bottom: 18px;
}

.auth-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
}

.auth-form input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  color: var(--fg);
  background: var(--white);
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 4px;
  min-height: 18px;
}

.btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

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

.auth-footer a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

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

.form-error {
  background: #FEE2E2;
  border: 1px solid #FECACA;
  color: #991B1B;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
}

/* Tenant welcome banner */
.tenant-banner {
  background: linear-gradient(135deg, var(--sand-light), var(--bg-alt));
  border-bottom: 1px solid var(--border);
  padding: 14px 48px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--fg);
}

.tenant-banner strong {
  font-weight: 600;
}

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

/* Responsive */
@media (max-width: 900px) {
  .app-header { padding: 0 24px; }
  .app-main { padding: 24px; }
  .pipeline-layout { grid-template-columns: 1fr; }
  .pipeline-sidebar { position: static; }
  .jobs-grid { grid-template-columns: 1fr; }
  .tenant-banner { padding: 12px 24px; flex-wrap: wrap; }
}