/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:         #0a66c2;
  --blue-dark:    #004182;
  --blue-light:   #eff6ff;
  --blue-border:  #bfdbfe;
  --text:         #0f172a;
  --text-2:       #475569;
  --text-3:       #94a3b8;
  --border:       #e2e8f0;
  --bg:           #f1f5f9;
  --card:         #ffffff;
  --green:        #059669;
  --amber:        #d97706;
  --red:          #dc2626;
  --r-sm:         6px;
  --r:            10px;
  --r-lg:         14px;
  --r-xl:         20px;
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.05);
  --shadow:       0 1px 3px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.05);
}

[data-theme="dark"] {
  --blue:         #3b82f6;
  --blue-dark:    #60a5fa;
  --blue-light:   #1e3a5f;
  --blue-border:  #1d4ed8;
  --text:         #f1f5f9;
  --text-2:       #cbd5e1;
  --text-3:       #64748b;
  --border:       #334155;
  --bg:           #0f172a;
  --card:         #1e293b;
  --green:        #34d399;
  --amber:        #fbbf24;
  --red:          #f87171;
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.4);
  --shadow:       0 1px 3px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.5), 0 1px 4px rgba(0,0,0,0.3);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

/* ── App Navigation ───────────────────────────────────────── */
.app-nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.nav-logo-mark {
  width: 44px;
  height: 44px;
  background: var(--blue);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  flex-shrink: 0;
  color: #fff;
  box-shadow: 0 2px 8px rgba(10,102,194,0.25);
  line-height: 1;
}

.nav-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.nav-subtitle {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
  line-height: 1.2;
  margin-top: 2px;
}

/* ── Nav right group & theme toggle ──────────────────────── */
.nav-right-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}

.theme-icon-sun  { display: block; }
.theme-icon-moon { display: none; }

[data-theme="dark"] .theme-icon-sun  { display: none; }
[data-theme="dark"] .theme-icon-moon { display: block; }

/* ── User Status Bar ──────────────────────────────────────── */
.user-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.status-email {
  font-size: 0.82rem;
  color: var(--text-2);
  font-weight: 500;
}

.status-attempts {
  font-size: 0.77rem;
  color: var(--blue);
  background: var(--blue-light);
  border: 1px solid var(--blue-border);
  border-radius: 20px;
  padding: 3px 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-logout-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 5px 13px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.status-logout-btn:hover { border-color: var(--red); color: var(--red); }

.status-auth-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 16px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.status-auth-btn:hover { border-color: var(--blue); color: var(--blue); }

.status-auth-btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.status-auth-btn.primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

/* ── Page Content ─────────────────────────────────────────── */
.page-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 28px 72px;
}

/* ── Tab Bar ──────────────────────────────────────────────── */
.tab-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.tab-bar-row .tab-bar { margin-bottom: 0; }

.tab-bar {
  display: flex;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 3px;
  width: fit-content;
  box-shadow: var(--shadow-sm);
}

.tab {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 26px;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.tab:disabled { opacity: 0.4; cursor: not-allowed; }
.tab.active { background: var(--blue); color: #fff; box-shadow: var(--shadow-sm); }

.tab-panel { width: 100%; }

.preview-standalone-btn {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.preview-standalone-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ── Compose two-column layout ────────────────────────────── */
.compose-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

/* ── Compose Sidebar ──────────────────────────────────────── */
.compose-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 80px;
}

.sidebar-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.sidebar-card--steps {
  border-left: 3px solid var(--blue);
}

.sidebar-card--hook {
  border-left: 3px solid var(--amber);
  background: #fffbeb;
  border-color: #fde68a;
  border-left-color: var(--amber);
}
[data-theme="dark"] .sidebar-card--hook {
  background: #1c1a0f;
  border-color: #854d0e;
}
[data-theme="dark"] .sidebar-card--hook .sidebar-section-label {
  color: #fb923c;
}
[data-theme="dark"] .sidebar-checklist li {
  color: #fcd34d;
}
[data-theme="dark"] .sidebar-checklist li::before {
  color: #fb923c;
}

.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-bottom: 14px;
}

.sidebar-tips {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sidebar-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.5;
}

.tip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
  margin-top: 6px;
}

.sidebar-avoid {
  margin-top: 14px;
  font-size: 0.79rem;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--r-sm);
  padding: 9px 12px;
  line-height: 1.5;
}

.sidebar-steps {
  list-style: none;
  counter-reset: steps;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-steps li {
  counter-increment: steps;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.81rem;
  color: var(--text-2);
  line-height: 1.45;
}

.sidebar-steps li::before {
  content: counter(steps);
  width: 20px;
  height: 20px;
  background: var(--blue-light);
  color: var(--blue);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.sidebar-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sidebar-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem;
  color: #78350f;
  line-height: 1.45;
}

.sidebar-checklist li::before {
  content: '✓';
  color: var(--amber);
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Form Section ─────────────────────────────────────────── */

.form-section {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 36px 40px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Field ────────────────────────────────────────────────── */
.field label {
  display: block;
  font-weight: 700;
  font-size: 0.84rem;
  margin-bottom: 10px;
  color: var(--text);
  letter-spacing: -0.005em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.optional { font-weight: 400; color: var(--text-3); font-size: 0.78rem; text-transform: none; letter-spacing: 0; }
.required { color: var(--red); }

/* ── Pillar Cards ─────────────────────────────────────────── */
.pillar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.pillar-card {
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 14px;
  cursor: pointer;
  transition: all 0.18s;
  text-align: left;
  user-select: none;
  background: #fafbfc;
  position: relative;
}
.pillar-card:hover {
  border-color: var(--blue);
  background: var(--blue-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.pillar-card.selected {
  border-color: var(--blue);
  background: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(10,102,194,0.1);
}
.pillar-card.selected::after {
  content: '✓';
  position: absolute;
  top: 9px;
  right: 10px;
  width: 18px;
  height: 18px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 18px;
  text-align: center;
}

.pillar-label {
  display: block;
  font-weight: 700;
  font-size: 0.83rem;
  color: var(--text);
  margin-bottom: 5px;
  line-height: 1.25;
  padding-right: 20px;
}
.pillar-card.selected .pillar-label { color: var(--blue); }

.pillar-desc {
  font-size: 0.75rem;
  color: var(--text-2);
  line-height: 1.45;
}
.pillar-desc small {
  display: block;
  color: var(--text-3);
  font-size: 0.72rem;
  margin-top: 2px;
}

/* ── Length Selector ──────────────────────────────────────── */
.length-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.length-card {
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.18s;
  background: #fafbfc;
  user-select: none;
  position: relative;
}
.length-card:hover {
  border-color: var(--blue);
  background: var(--blue-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.length-card.selected {
  border-color: var(--blue);
  background: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(10,102,194,0.1);
}
.length-card.selected::after {
  content: '✓';
  position: absolute;
  top: 9px; right: 10px;
  width: 18px; height: 18px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 18px;
  text-align: center;
}

.length-label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 3px;
}
.length-card.selected .length-label { color: var(--blue); }

.length-chars {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 2px;
}

.length-hint {
  display: block;
  font-size: 0.73rem;
  color: var(--text-3);
}

/* ── Framework Pills ──────────────────────────────────────── */
.framework-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.framework-card {
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 7px 18px;
  cursor: pointer;
  transition: all 0.15s;
  background: #fafbfc;
  display: inline-flex;
  align-items: center;
}
.framework-card:hover {
  border-color: var(--blue);
  background: var(--blue-light);
}
.framework-card.selected {
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: 0 2px 6px rgba(10,102,194,0.25);
}

.framework-label {
  font-weight: 600;
  font-size: 0.81rem;
  color: var(--text-2);
  white-space: nowrap;
  transition: color 0.15s;
}
.framework-card:hover .framework-label { color: var(--blue); }
.framework-card.selected .framework-label { color: #fff; }

.framework-desc { display: none; }

/* ── Framework Info Panel ─────────────────────────────────── */
.fw-info-panel {
  margin-top: 12px;
  background: var(--blue-light);
  border: 1px solid var(--blue-border);
  border-radius: var(--r);
  padding: 12px 16px;
  animation: fadeSlideIn 0.18s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fw-info-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 5px;
}

.fw-info-body {
  font-size: 0.8rem;
  color: var(--text-2);
  line-height: 1.55;
}

.fw-info-label {
  font-weight: 700;
  color: var(--text);
}

.fw-info-example {
  display: block;
  margin-top: 6px;
  font-style: italic;
  color: var(--text-2);
  border-left: 2px solid var(--blue-border);
  padding-left: 10px;
}

/* ── Inputs ───────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 11px 14px;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text);
  background: #fafbfc;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  resize: vertical;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(10,102,194,0.09);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

textarea { min-height: 150px; line-height: 1.6; }

.word-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 5px;
}

/* ── Generate Button ──────────────────────────────────────── */
button#generateBtn {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--r);
  padding: 15px 28px;
  font-size: 0.97rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s;
  width: 100%;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 10px rgba(10,102,194,0.3);
}
button#generateBtn:hover {
  background: var(--blue-dark);
  box-shadow: 0 4px 16px rgba(10,102,194,0.4);
  transform: translateY(-1px);
}
button#generateBtn:disabled {
  background: #93c5fd;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Loader ───────────────────────────────────────────────── */
.loader {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.hidden { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error Box ────────────────────────────────────────────── */
.error-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--r);
  padding: 12px 16px;
  color: var(--red);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ── Results Tab ──────────────────────────────────────────── */
.scores-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

.score-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.score-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-bottom: 10px;
}

.score-value {
  font-size: 2.6rem;
  font-weight: 900;
  color: var(--blue);
  line-height: 1;
  letter-spacing: -0.04em;
}
.score-value.good { color: var(--green); }
.score-value.okay { color: var(--amber); }
.score-value.low  { color: var(--red); }

.score-sub {
  font-size: 0.77rem;
  color: var(--text-2);
  margin-top: 8px;
  line-height: 1.4;
}

.coaching-inline {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.75;
  text-align: left;
}

/* ── Hints Block ──────────────────────────────────────────── */
.hints-block {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  margin-bottom: 16px;
}
.hints-block h3 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--amber);
  margin-bottom: 12px;
}
.hints-block ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.hints-block li {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.5;
  padding-left: 22px;
  position: relative;
}
.hints-block li::before { content: "✗"; position: absolute; left: 0; color: var(--red); font-weight: 700; }

/* ── FOMO Block ───────────────────────────────────────────── */
.fomo-block {
  border-radius: var(--r-lg);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.fomo-low  { background: linear-gradient(135deg, #1e3a5f 0%, #0a66c2 100%); }
.fomo-mid  { background: linear-gradient(135deg, #5b21b6 0%, #0a66c2 100%); }
.fomo-high { background: linear-gradient(135deg, #0a66c2 0%, #0891b2 100%); }
.fomo-top  { background: linear-gradient(135deg, #047857 0%, #0a66c2 100%); }

.fomo-score-badge {
  font-size: 2rem;
  font-weight: 900;
  color: rgba(255,255,255,0.95);
  white-space: nowrap;
  min-width: 72px;
  text-align: center;
}
.fomo-content { flex: 1; min-width: 180px; }
.fomo-headline { font-size: 0.93rem; font-weight: 700; color: #fff; line-height: 1.45; margin-bottom: 5px; }
.fomo-sub { font-size: 0.82rem; color: rgba(255,255,255,0.78); line-height: 1.55; }
.fomo-btn {
  background: #fff;
  color: var(--blue);
  font-weight: 700;
  font-size: 0.84rem;
  padding: 10px 20px;
  border-radius: var(--r);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.fomo-btn:hover { opacity: 0.9; }

/* ── Comparison ───────────────────────────────────────────── */
.comparison-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.result-block {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.result-header h2 {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.copy-btn {
  background: var(--blue-light);
  color: var(--blue);
  border: none;
  border-radius: var(--r-sm);
  padding: 7px 14px;
  font-size: 0.79rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.copy-btn:hover { background: var(--blue-border); }
.copy-btn.secondary { background: #f1f5f9; color: var(--text-2); }
.copy-btn.secondary:hover { background: #e2e8f0; }

.post-output {
  white-space: pre-wrap;
  line-height: 1.75;
  font-size: 0.9rem;
  color: var(--text);
  background: #f8fafc;
  border-radius: var(--r);
  padding: 16px;
  border: 1px solid var(--border);
}
.draft-output { color: var(--text-2); }
.post-output-wrap { border-radius: var(--r); overflow: hidden; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(3px);
}

.modal-box {
  background: var(--card);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

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

.preview-toggle {
  display: flex;
  background: #f1f5f9;
  border-radius: var(--r);
  padding: 3px;
  gap: 2px;
}

.toggle-btn {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.toggle-btn.active { background: #fff; color: var(--blue); box-shadow: var(--shadow-sm); }

.modal-close {
  background: #f1f5f9;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-2);
  padding: 7px 11px;
  border-radius: var(--r-sm);
  transition: all 0.15s;
  line-height: 1;
}
.modal-close:hover { background: #e2e8f0; color: var(--text); }

/* Preview input */
.preview-input-row { margin-bottom: 16px; }
.preview-input-row textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text);
  background: #f8fafc;
  resize: vertical;
}
.preview-input-row textarea:focus { outline: none; border-color: var(--blue); }

/* LinkedIn card preview */
.preview-frame { display: flex; flex-direction: column; align-items: center; }
.preview-desktop .li-card { width: 100%; max-width: 560px; }
.preview-mobile  .li-card { width: 375px; max-width: 100%; }

.li-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.li-header { display: flex; gap: 12px; margin-bottom: 12px; align-items: flex-start; }
.li-avatar { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.li-avatar svg { width: 100%; height: 100%; }
.li-name { font-weight: 700; font-size: 0.95rem; color: #000; }
.li-sub { font-size: 0.78rem; color: #666; margin-top: 1px; }
.li-time { font-size: 0.72rem; color: #888; margin-top: 2px; }
.li-body {
  font-size: 0.9rem; color: #000; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  margin-bottom: 12px; text-align: left; text-indent: 0; padding: 0;
}
.li-body span { display: inline; text-indent: 0; }
.li-more { color: #0a66c2; font-weight: 600; cursor: pointer; font-size: 0.9rem; }
.li-hidden { display: none; }
.li-actions { display: flex; border-top: 1px solid #e5e7eb; padding-top: 4px; gap: 4px; }
.li-btn { flex: 1; background: none; border: none; padding: 8px 4px; font-size: 0.78rem; color: #666; font-weight: 600; cursor: pointer; border-radius: 6px; }
.li-btn:hover { background: #f3f4f6; }
.preview-note { font-size: 0.75rem; color: var(--text-3); margin-top: 12px; text-align: center; }

/* ── Auth Modal ───────────────────────────────────────────── */
.auth-modal-box { max-width: 420px; }
.auth-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }

.auth-field { margin-bottom: 14px; }
.auth-field label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.auth-field input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 10px 13px;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text);
  background: #fafbfc;
  transition: all 0.15s;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(10,102,194,0.09);
}

.auth-submit-btn {
  width: 100%;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--r);
  padding: 12px;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(10,102,194,0.25);
}
.auth-submit-btn:hover { background: var(--blue-dark); box-shadow: 0 3px 12px rgba(10,102,194,0.35); }

.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--r-sm);
  padding: 10px 13px;
  color: var(--red);
  font-size: 0.83rem;
  margin-top: 10px;
  line-height: 1.5;
}

.auth-switch-text { font-size: 0.81rem; color: var(--text-2); text-align: center; margin-top: 16px; }
.auth-switch-text a { color: var(--blue); text-decoration: none; font-weight: 600; }
.auth-switch-text a:hover { text-decoration: underline; }

.verify-prompt {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.6;
  background: var(--blue-light);
  border: 1px solid var(--blue-border);
  border-radius: var(--r);
  padding: 14px 16px;
}

/* ── Upgrade Modal ────────────────────────────────────────── */
.upgrade-modal-box { max-width: 440px; text-align: center; padding: 44px 40px; }
.upgrade-icon { font-size: 2.6rem; margin-bottom: 14px; }
.upgrade-title { font-size: 1.25rem; font-weight: 800; color: var(--text); margin-bottom: 10px; letter-spacing: -0.02em; }
.upgrade-sub { font-size: 0.88rem; color: var(--text-2); line-height: 1.65; margin-bottom: 20px; }
.upgrade-actions { display: flex; flex-direction: column; gap: 10px; }
.upgrade-topup-card {
  background: var(--blue-light);
  border: 1px solid var(--blue-border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  text-align: left;
}
.upgrade-topup-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--blue);
  margin-bottom: 6px;
}
.upgrade-topup-email {
  font-size: 0.8rem;
  color: var(--text-2);
  margin-bottom: 12px;
  min-height: 16px;
}
.upgrade-topup-hint {
  font-size: 0.76rem;
  color: var(--text-3);
  margin-top: 10px;
  line-height: 1.5;
}
.upgrade-cta-btn {
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 13px 24px;
  border-radius: var(--r);
  text-decoration: none;
  display: block;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(10,102,194,0.3);
}
.upgrade-cta-btn:hover { background: var(--blue-dark); }
.upgrade-dismiss-btn { background: none; border: none; color: var(--text-3); font-size: 0.83rem; cursor: pointer; padding: 6px; }
.upgrade-dismiss-btn:hover { color: var(--text-2); }

/* ── Nav brand link ───────────────────────────────────────── */
.nav-brand-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}
.nav-brand-link:hover { text-decoration: underline; }

/* ── Footer ───────────────────────────────────────────────── */
.app-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  margin-top: 0;
}

.footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-2);
}

.footer-logo {
  font-size: 1rem;
  color: var(--blue);
}

.footer-by {
  font-weight: 400;
  color: var(--text-3);
}

.footer-brand a,
.footer-copy a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}
.footer-brand a:hover,
.footer-copy a:hover { text-decoration: underline; }

.footer-copy {
  font-size: 0.78rem;
  color: var(--text-3);
}

/* ── Loading Overlay ──────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}

.loading-box {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 48px 40px 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.loading-spinner {
  width: 52px;
  height: 52px;
  border: 3px solid var(--blue-border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  margin: 0 auto 28px;
}

.loading-message {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  min-height: 1.4em;
  transition: opacity 0.28s ease;
}

.loading-sub {
  font-size: 0.85rem;
  color: var(--text-3);
  line-height: 1.6;
  min-height: 2.8em;
  transition: opacity 0.28s ease;
}

.loading-message.fade-out,
.loading-sub.fade-out {
  opacity: 0;
}

.loading-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
}

.loading-dots span {
  width: 7px;
  height: 7px;
  background: var(--blue-border);
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { background: var(--blue-border); transform: scale(1); }
  40%           { background: var(--blue); transform: scale(1.3); }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-subtitle { display: none; }
  .status-email { display: none; }
  .footer-inner { flex-direction: column; align-items: center; text-align: center; gap: 8px; }
  .compose-layout { grid-template-columns: 1fr; }
  .compose-sidebar { position: static; }
  .page-content { padding: 20px 16px 52px; }
  .form-section { padding: 24px 20px; }
  .pillar-grid { grid-template-columns: 1fr 1fr; }
  .length-row  { grid-template-columns: 1fr 1fr 1fr; }
  .scores-row { grid-template-columns: 1fr; }
  .comparison-row { grid-template-columns: 1fr; }
}

/* ── Dark theme overrides ─────────────────────────────────── */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] textarea {
  background: #0f172a;
  color: var(--text);
}

[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] input[type="email"]:focus,
[data-theme="dark"] input[type="password"]:focus,
[data-theme="dark"] textarea:focus {
  background: #0f172a;
}

[data-theme="dark"] .pillar-card,
[data-theme="dark"] .length-card,
[data-theme="dark"] .framework-card {
  background: #1e293b;
}

[data-theme="dark"] .sidebar-avoid { background: #1e293b; }

[data-theme="dark"] .toggle-btn { background: #0f172a; }
[data-theme="dark"] .toggle-btn.active { background: #1e293b; }

[data-theme="dark"] .copy-btn.secondary { background: #334155; color: var(--text-2); }
[data-theme="dark"] .copy-btn.secondary:hover { background: #475569; }

[data-theme="dark"] .post-output { background: #0f172a; }

[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.7); }
[data-theme="dark"] .modal-box { background: #1e293b; }

[data-theme="dark"] .li-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .li-actions { border-top-color: #334155; }
[data-theme="dark"] .li-btn:hover { background: #334155; }

[data-theme="dark"] .auth-field input { background: #0f172a; }
[data-theme="dark"] .auth-error { background: #3b1d1d; color: #f87171; }

[data-theme="dark"] #errorBox { background: #3b1d1d; color: #f87171; }

/* warning/info banners (fffbeb amber) */
[data-theme="dark"] .fw-info-panel,
[data-theme="dark"] .sidebar-avoid { background: #292310; border-color: #854d0e; color: var(--text-2); }

/* score / output areas */
[data-theme="dark"] .score-section,
[data-theme="dark"] .coaching-section { background: #0f172a; }

[data-theme="dark"] .tab-bar { background: #0f172a; }

[data-theme="dark"] .loading-box { background: #1e293b; }

[data-theme="dark"] .fomo-box { background: linear-gradient(135deg, #1e3a5f 0%, #1e293b 100%); }

/* ── Sidebar teaser (logged-out) ──────────────────────────── */
.sidebar-teaser {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: var(--r);
  background: var(--blue-light);
  border: 1px dashed var(--blue-border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
}
.sidebar-teaser:hover { opacity: 0.85; }
.sidebar-teaser-lock { font-size: 0.85rem; }

.checklist-teaser {
  margin-top: 6px;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  color: var(--amber) !important;
  opacity: 0.9;
  list-style: none;
}
.checklist-teaser::before { content: '' !important; }

[data-theme="dark"] .sidebar-teaser {
  background: var(--blue-light);
  border-color: var(--blue-border);
}
