/* ═══════════════════════════════════════════════
   ResumeAI — App Dashboard Stylesheet
   ═══════════════════════════════════════════════ */

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #1E293B;
  background: #F1F5F9;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }
input, textarea, button { font-family: inherit; }
textarea { resize: vertical; }

/* ═══════════════════════════════════════════════
   AUTH GATE
   ═══════════════════════════════════════════════ */

.auth-gate {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.auth-left {
  flex: 1;
  background: linear-gradient(160deg, #0F172A 0%, #1E3A8A 100%);
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: white;
  min-height: 100vh;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.125rem;
  font-weight: 700;
  color: white;
}

.auth-left-content { padding: 40px 0; }
.auth-left-content h1 {
  font-size: clamp(2.2rem, 3.5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.auth-left-content h1 span { color: #60A5FA; }
.auth-left-content p { font-size: 1rem; color: #94A3B8; line-height: 1.7; max-width: 380px; margin-bottom: 36px; }

.auth-stats { display: flex; gap: 36px; }
.stat { display: flex; flex-direction: column; gap: 3px; }
.stat strong { font-size: 1.625rem; font-weight: 800; color: #fff; }
.stat span { font-size: 0.8rem; color: #64748B; }

.auth-right {
  width: 460px;
  flex-shrink: 0;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  min-height: 100vh;
}

.auth-card { width: 100%; max-width: 360px; }

.auth-tabs {
  display: flex;
  background: #E2E8F0;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 28px;
}
.auth-tab {
  flex: 1; padding: 9px;
  border: none; background: transparent;
  border-radius: 7px;
  font-size: 0.875rem; font-weight: 600;
  color: #64748B; cursor: pointer;
  transition: all 0.18s;
}
.auth-tab.active { background: white; color: #1E293B; box-shadow: 0 1px 4px rgba(0,0,0,0.1); }

.auth-welcome { margin-bottom: 22px; }
.auth-welcome h2 { font-size: 1.25rem; font-weight: 700; color: #0F172A; margin-bottom: 4px; }
.auth-welcome p { font-size: 0.875rem; color: #64748B; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.8125rem; font-weight: 500; color: #374151; margin-bottom: 5px; }
.form-group input {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid #E2E8F0; border-radius: 8px;
  font-size: 0.9375rem; color: #1E293B;
  background: white; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.form-error {
  background: #FEF2F2; border: 1px solid #FECACA;
  color: #DC2626; padding: 10px 13px;
  border-radius: 8px; font-size: 0.8125rem; margin-bottom: 12px;
}

.btn-auth {
  width: 100%; padding: 11px;
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  color: white; border: none; border-radius: 9px;
  font-size: 0.9375rem; font-weight: 600;
  cursor: pointer; transition: all 0.18s;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(37,99,235,0.3);
}
.btn-auth:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(37,99,235,0.4); }
.btn-auth:active { transform: none; }
.btn-auth:disabled { opacity: 0.65; cursor: not-allowed; transform: none; box-shadow: none; }

.auth-switch { font-size: 0.8125rem; color: #64748B; text-align: center; }
.link-btn { background: none; border: none; color: #2563EB; font-weight: 600; cursor: pointer; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════
   APP SHELL — full viewport, flex row
   ═══════════════════════════════════════════════ */

.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: fixed;
  top: 0; left: 0;
}

/* ═══════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════ */

.sidebar {
  width: 232px;
  flex-shrink: 0;
  height: 100vh;
  background: #0F172A;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 18px 16px 14px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #94A3B8;
  transition: all 0.15s;
  cursor: pointer;
}
.sidebar-link:hover { background: rgba(255,255,255,0.07); color: #E2E8F0; }
.sidebar-link.active { background: rgba(37,99,235,0.18); color: #60A5FA; font-weight: 600; }

.sidebar-bottom {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 10px;
}

.sidebar-plan {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  margin-bottom: 6px;
}
.plan-badge {
  font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 6px; border-radius: 4px;
  background: #1E40AF; color: #93C5FD;
  flex-shrink: 0;
}
.plan-info { display: flex; flex-direction: column; overflow: hidden; }
.plan-info span:first-child { font-size: 0.8rem; font-weight: 600; color: #E2E8F0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-info span:last-child { font-size: 0.7rem; color: #64748B; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
}
.user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: white; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-info span { display: block; font-size: 0.75rem; color: #94A3B8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn {
  background: none; border: none; color: #475569;
  cursor: pointer; padding: 4px; border-radius: 5px;
  display: flex; flex-shrink: 0;
  transition: all 0.15s;
}
.logout-btn:hover { color: #94A3B8; background: rgba(255,255,255,0.06); }

/* ═══════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════ */

.main-content {
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  background: #F1F5F9;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════ */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px 0;
  flex-shrink: 0;
}
.topbar-left h1 { font-size: 1.25rem; font-weight: 700; color: #0F172A; }
.topbar-left p { font-size: 0.875rem; color: #64748B; margin-top: 2px; }
.topbar-right { flex-shrink: 0; }

.upgrade-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.8125rem;
  color: #92400E;
  white-space: nowrap;
}
.btn-upgrade {
  background: #F59E0B; color: white;
  padding: 4px 11px; border-radius: 6px;
  font-size: 0.8rem; font-weight: 600;
}
.btn-upgrade:hover { background: #D97706; }

/* ═══════════════════════════════════════════════
   BUILDER GRID
   ═══════════════════════════════════════════════ */

.builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 16px 28px 24px;
  flex: 1;
}

/* ═══════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════ */

.form-card, .results-card, .history-card {
  background: white;
  border-radius: 14px;
  border: 1px solid #E2E8F0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.history-card { margin: 0 28px 28px; }

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid #F1F5F9;
  flex-shrink: 0;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #0F172A;
}
.card-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-icon-gray { background: linear-gradient(135deg, #475569, #334155); }

/* ═══════════════════════════════════════════════
   RESUME FORM
   ═══════════════════════════════════════════════ */

.resume-form {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}

.form-section { margin-bottom: 18px; }

/* Photo upload */
.photo-upload-area {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #F8FAFC;
  border: 1.5px dashed #CBD5E1;
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  margin-bottom: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.photo-upload-area:hover { border-color: #2563EB; background: #EFF6FF; }
.photo-preview {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #E2E8F0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-upload-label { display: flex; flex-direction: column; gap: 2px; }
.photo-upload-text { font-size: 0.875rem; font-weight: 600; color: #374151; }
.photo-upload-hint { font-size: 0.75rem; color: #94A3B8; }

.section-label {
  font-size: 0.6875rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: #94A3B8; margin-bottom: 10px;
}

.input-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 0.8rem; font-weight: 500; color: #374151; }
.req { color: #EF4444; }
.optional { color: #94A3B8; font-weight: 400; }

.field input, .field textarea {
  padding: 8px 11px;
  border: 1.5px solid #E2E8F0;
  border-radius: 7px;
  font-size: 0.875rem;
  color: #1E293B;
  background: #FAFAFA;
  outline: none;
  width: 100%;
  transition: all 0.15s;
}
.field input:focus, .field textarea:focus {
  border-color: #2563EB;
  background: white;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
.field input::placeholder, .field textarea::placeholder { color: #CBD5E1; }

.hint { font-size: 0.72rem; color: #94A3B8; margin-top: 3px; }

.form-error {
  background: #FEF2F2; border: 1px solid #FECACA;
  color: #DC2626; padding: 9px 12px;
  border-radius: 7px; font-size: 0.8125rem; margin-bottom: 10px;
}

.form-actions {
  display: flex; gap: 8px;
  padding-top: 14px;
  border-top: 1px solid #F1F5F9;
  flex-shrink: 0;
}

.btn-generate {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 18px;
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  color: white; border: none; border-radius: 9px;
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all 0.18s;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.btn-generate:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,0.4); }
.btn-generate:active { transform: none; }
.btn-generate:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-clear {
  padding: 11px 16px;
  background: #F8FAFC; color: #64748B;
  border: 1.5px solid #E2E8F0; border-radius: 9px;
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.btn-clear:hover { background: #F1F5F9; }

/* ═══════════════════════════════════════════════
   RESULTS PANEL
   ═══════════════════════════════════════════════ */

.results-card { min-height: 300px; }

.empty-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 40px 28px; gap: 12px;
}
.empty-state h3 { font-size: 0.9375rem; font-weight: 600; color: #334155; }
.empty-state p { font-size: 0.8125rem; color: #94A3B8; line-height: 1.6; max-width: 260px; }
.empty-state strong { color: #2563EB; }

.loading-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 28px; gap: 14px; text-align: center;
}
.loading-state h3 { font-size: 0.9375rem; font-weight: 600; color: #334155; }
.loading-state > p { font-size: 0.8125rem; color: #94A3B8; }

.loading-ring {
  width: 44px; height: 44px;
  border: 3px solid #E2E8F0;
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-steps { display: flex; flex-direction: column; gap: 7px; text-align: left; width: 210px; }
.loading-step { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: #CBD5E1; transition: color 0.3s; }
.loading-step.active { color: #334155; font-weight: 500; }
.step-dot { width: 6px; height: 6px; border-radius: 50%; background: #CBD5E1; flex-shrink: 0; transition: background 0.3s; }
.loading-step.active .step-dot { background: #2563EB; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ATS Bar */
.ats-bar {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 18px;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  flex-shrink: 0;
}
.ats-score-ring { position: relative; flex-shrink: 0; }
.ats-score-number {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; color: #0F172A;
}
.ats-meta { flex: 1; min-width: 0; }
.ats-label { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #94A3B8; margin-bottom: 2px; }
.ats-grade { font-size: 0.9375rem; font-weight: 700; color: #0F172A; margin-bottom: 6px; }
.ats-tips-inline { display: flex; flex-direction: column; gap: 3px; }
.ats-tip { font-size: 0.72rem; color: #64748B; display: flex; gap: 4px; }
.ats-tip::before { content: '→'; color: #2563EB; flex-shrink: 0; }

/* Output Section Headers (replaces tabs — both resume + cover show at once) */
.output-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
  border-top: 1px solid #E2E8F0;
  background: #F8FAFC;
  flex-shrink: 0;
}
.output-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748B;
}
.output-section-actions { display: flex; gap: 5px; align-items: center; }

/* Output Tabs (kept for any legacy references) */
.output-tabs {
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid #E2E8F0;
  background: white;
  flex-shrink: 0;
}
.output-tab {
  display: flex; align-items: center; gap: 5px;
  padding: 10px 12px;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.8125rem; font-weight: 500;
  color: #94A3B8; cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.output-tab:hover { color: #475569; }
.output-tab.active { color: #2563EB; border-bottom-color: #2563EB; }

.tab-actions { margin-left: auto; display: flex; gap: 5px; align-items: center; }

.btn-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1.5px solid #E2E8F0;
  background: white; color: #64748B;
  cursor: pointer; transition: all 0.15s;
}
.btn-icon:hover { background: #F8FAFC; }
.btn-icon-primary { background: #EFF6FF; border-color: #BFDBFE; color: #2563EB; }
.btn-icon-primary:hover { background: #DBEAFE; }

/* Result Pane */
.results-content { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.result-pane { overflow-y: auto; flex: 1; }

/* Resume Document — two-column template container */
.resume-doc {
  padding: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 12.5px; line-height: 1.7;
  color: #1a1a1a; background: white;
}

/* Cover Letter output — separate from resume template */
.cover-doc {
  padding: 20px 24px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 13px; line-height: 1.8;
  color: #1E293B; background: white;
}

/* Two-column resume template */
.resume-tpl { display: flex; min-height: 560px; }
.resume-tpl-left {
  width: 36%; background: #1E2B3C; color: #fff;
  padding: 28px 18px; display: flex; flex-direction: column; gap: 18px;
}
.resume-tpl-right { width: 64%; background: #fff; padding: 24px 22px; }

.tpl-photo-wrap { text-align: center; padding: 16px 0 10px; }
/* Circular clip wrapper — more reliable than border-radius on <img> for PDF capture */
.tpl-photo-circle {
  width: 140px; height: 140px; border-radius: 50%;
  overflow: hidden;
  border: 4px solid rgba(255,255,255,0.5);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.15);
  display: block; margin: 0 auto 10px;
  flex-shrink: 0;
}
.tpl-photo {
  width: 140px; height: 140px;
  object-fit: cover; object-position: center top;
  display: block;
}
.tpl-photo-placeholder {
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 4px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
}

.tpl-section-label {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: rgba(255,255,255,0.45);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 5px; margin-bottom: 8px;
}
.tpl-section-label-dark {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: #1E2B3C;
  display: flex; align-items: center; gap: 0;
  margin-bottom: 10px;
}
.tpl-contact-line { font-size: 0.78rem; color: rgba(255,255,255,0.75); margin-bottom: 5px; }
.tpl-about { font-size: 0.78rem; color: rgba(255,255,255,0.75); line-height: 1.65; }
.tpl-skill { font-size: 0.78rem; color: rgba(255,255,255,0.8); padding-left: 10px; position: relative; margin-bottom: 4px; }
.tpl-skill::before { content: '•'; position: absolute; left: 0; color: rgba(255,255,255,0.4); }

.tpl-name { font-size: 1.45rem; font-weight: 800; color: #1E2B3C; letter-spacing: -0.02em; line-height: 1.1; }
.tpl-jobtitle { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #64748B; margin-top: 3px; margin-bottom: 16px; }
.tpl-divider { border: none; border-top: 1.5px solid #E2E8F0; margin-bottom: 16px; }

.tpl-exp-block { margin-bottom: 12px; padding-left: 14px; border-left: 2px solid #E2E8F0; }
.tpl-exp-date { font-size: 0.72rem; font-weight: 700; color: #9B6A40; margin-bottom: 2px; }
.tpl-exp-title { font-size: 0.875rem; font-weight: 700; color: #0F172A; }
.tpl-exp-company { font-size: 0.78rem; color: #64748B; margin-bottom: 4px; }
.tpl-exp-bullet { font-size: 0.8rem; color: #374151; padding-left: 12px; position: relative; margin-bottom: 2px; line-height: 1.55; }
.tpl-exp-bullet::before { content: '·'; position: absolute; left: 0; color: #2563EB; font-weight: 700; }
.tpl-edu-block { margin-bottom: 10px; }
.tpl-edu-degree { font-size: 0.875rem; font-weight: 700; color: #0F172A; }
.tpl-edu-school { font-size: 0.78rem; color: #64748B; }
.resume-name { font-size: 18px; font-weight: 700; color: #0F172A; font-family: 'Inter',sans-serif; letter-spacing: -0.3px; margin-bottom: 2px; }
.resume-section-title {
  font-family: 'Inter',sans-serif;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: #2563EB; border-bottom: 1.5px solid #BFDBFE;
  padding-bottom: 4px; margin-top: 16px; margin-bottom: 8px;
}
.resume-line { color: #374151; font-size: 12.5px; line-height: 1.7; margin-bottom: 1px; }
.resume-bullet { color: #374151; font-size: 12.5px; line-height: 1.7; padding-left: 13px; position: relative; margin-bottom: 2px; }
.resume-bullet::before { content: '▸'; position: absolute; left: 0; color: #2563EB; font-size: 9px; top: 3px; }
.resume-spacer { height: 5px; }

/* ─── Template Picker ──────────────────────────────────────────────────────── */
.tpl-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.tpl-picker-card {
  border: 2px solid #E2E8F0;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  background: #fff;
}
.tpl-picker-card:hover {
  border-color: #93C5FD;
  box-shadow: 0 4px 12px rgba(37,99,235,0.1);
  transform: translateY(-1px);
}
.tpl-picker-card.selected {
  border-color: #2563EB;
  box-shadow: 0 0 0 1px #2563EB, 0 4px 14px rgba(37,99,235,0.18);
}
.tpl-picker-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #F8FAFC;
  display: block;
}
.tpl-picker-thumb svg { display: block; width: 100%; height: 100%; }
.tpl-picker-name {
  display: block;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  padding: 5px 8px 4px;
}
.tpl-picker-card.selected .tpl-picker-name { color: #2563EB; }

.tpl-pro-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* ─── Color Swatches ───────────────────────────────────────────────────────── */
.color-swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px currentColor, 0 2px 6px rgba(0,0,0,0.2);
  transform: scale(1.12);
}
.color-swatch-custom {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px dashed #CBD5E1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, transform 0.15s;
  background: #F8FAFC;
  position: relative;
}
.color-swatch-custom:hover { border-color: #94A3B8; transform: scale(1.1); }

/* Template shake animation for locked tpl click */
@keyframes tplShake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* History */
.history-list { padding: 4px 0; }
.history-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 18px;
  border-bottom: 1px solid #F8FAFC;
  transition: background 0.15s;
}
.history-item:hover { background: #F8FAFC; }
.history-item:last-child { border-bottom: none; }
.history-icon { width: 34px; height: 34px; background: #EFF6FF; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.history-info { flex: 1; }
.history-name { font-size: 0.8125rem; font-weight: 600; color: #1E293B; }
.history-date { font-size: 0.72rem; color: #94A3B8; }
.history-view { font-size: 0.8rem; font-weight: 500; color: #2563EB; background: none; border: none; cursor: pointer; padding: 5px 10px; border-radius: 6px; transition: background 0.15s; }
.history-view:hover { background: #EFF6FF; }

/* Global Banner */
.global-banner {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #1E293B; color: white;
  padding: 10px 20px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 9999; white-space: nowrap;
  animation: slideUp 0.25s ease;
}
.global-banner.success { background: #065F46; }
.global-banner.error { background: #991B1B; }
@keyframes slideUp { from { opacity:0; transform: translateX(-50%) translateY(8px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* ─── Mobile sidebar overlay ─────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

.sidebar-close { display: none; }
.mobile-topbar { display: none; }
.hamburger {
  display: none;
  background: none;
  border: none;
  color: #1E293B;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.15s;
}
.hamburger:hover { background: #F1F5F9; }

/* ─── Responsive — Tablet (1024px) ──────────── */
@media (max-width: 1024px) {
  .sidebar { width: 210px; }
  .builder-grid { grid-template-columns: 1fr; }
  .topbar { padding: 18px 20px 0; }
  .builder-grid { padding: 14px 20px 20px; }
  .history-card { margin: 0 20px 20px; }
}

/* ─── Responsive — Mobile (768px) ───────────── */
@media (max-width: 768px) {
  /* Auth gate: hide left decorative panel */
  .auth-left { display: none; }
  .auth-right { width: 100%; min-height: 100vh; padding: 32px 20px; }
  .auth-card { max-width: 100%; }

  /* App shell: fixed layout becomes scrollable */
  .app-shell {
    position: relative;
    height: auto;
    min-height: 100vh;
    overflow: visible;
    flex-direction: column;
  }

  /* Sidebar: off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 260px;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    flex-shrink: 0;
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-close {
    display: flex;
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
  }
  .sidebar-close:hover { color: white; background: rgba(255,255,255,0.1); }

  /* Mobile top bar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid #E2E8F0;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
  }
  .mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0F172A;
  }
  .hamburger { display: flex; }

  /* Main content: full width, scrollable */
  .main-content {
    height: auto;
    overflow: visible;
    width: 100%;
  }

  /* Topbar */
  .topbar {
    padding: 16px 16px 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .topbar-left h1 { font-size: 1.1rem; }
  .topbar-right { width: 100%; }
  .upgrade-banner {
    width: 100%;
    justify-content: space-between;
    white-space: normal;
  }

  /* Builder grid: single column */
  .builder-grid {
    grid-template-columns: 1fr;
    padding: 12px 16px 20px;
    gap: 14px;
  }

  /* History */
  .history-card { margin: 0 16px 20px; }

  /* Input grid: stack on mobile */
  .input-grid-2 { grid-template-columns: 1fr; }

  /* Template picker: 2 columns on mobile */
  .tpl-picker-grid { grid-template-columns: repeat(2, 1fr); }

  /* Form actions: stack */
  .form-actions { flex-direction: column; }
  .btn-clear { order: 2; text-align: center; }

  /* Resume template: stack columns */
  .resume-tpl { flex-direction: column; }
  .resume-tpl-left { width: 100%; }
  .resume-tpl-right { width: 100%; }

  /* ATS bar: tighten */
  .ats-bar { padding: 12px 14px; gap: 10px; }

  /* Global banner: full width */
  .global-banner {
    left: 16px; right: 16px;
    transform: none;
    white-space: normal;
    text-align: center;
  }
  @keyframes slideUp { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }
}

/* ─── Responsive — Small mobile (480px) ─────── */
@media (max-width: 480px) {
  .auth-right { padding: 24px 16px; }
  .topbar-left h1 { font-size: 1rem; }
  .card-title { font-size: 0.875rem; }
  .tpl-picker-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .builder-grid { padding: 10px 12px 16px; gap: 12px; }
  .history-card { margin: 0 12px 16px; }
  .resume-form { padding: 14px; }
}
