:root {
  --ink: #15202b;
  --muted: #5c6b7a;
  --paper: #f7f4ef;
  --panel: rgba(255, 252, 247, 0.92);
  --line: #d7cfc3;
  --teal: #0f5c5c;
  --teal-deep: #0a3f3f;
  --copper: #b86b2a;
  --ok: #1f6b45;
  --warn: #8a3b12;
  --shadow: 0 18px 50px rgba(21, 32, 43, 0.08);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(15, 92, 92, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(184, 107, 42, 0.16), transparent 50%),
    linear-gradient(180deg, #efe8dc 0%, var(--paper) 40%, #ebe4d8 100%);
}

.boot-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  place-items: center;
  align-content: center;
  justify-items: center;
  gap: 12px;
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(15, 92, 92, 0.22), transparent 55%),
    linear-gradient(165deg, #1a2c2c 0%, #0f1c1c 42%, #2a2118 100%);
  color: #f4efe6;
}
.boot-screen p {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}
body.booting .boot-screen { display: grid; }
body.booting header.top,
body.booting main {
  visibility: hidden;
}
body.booting .auth-gate {
  display: none !important;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(21, 32, 43, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 32, 43, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  z-index: 0;
}

.top, main { position: relative; z-index: 1; }
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  max-width: none;
  margin: 0;
  padding: 0;
  background: rgba(255, 252, 247, 0.88);
  border-bottom: 1px solid rgba(215, 207, 195, 0.85);
  backdrop-filter: blur(16px);
  transition: box-shadow 0.2s ease;
}
.top.is-scrolled {
  box-shadow: 0 6px 18px rgba(21, 32, 43, 0.06);
}
.top-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: nowrap;
  min-height: 56px;
}

.brand { display: flex; gap: 10px; align-items: center; flex: 0 0 auto; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  color: #fff;
  background: linear-gradient(145deg, var(--teal), var(--teal-deep));
  box-shadow: 0 6px 14px rgba(15, 92, 92, 0.22);
}
.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand p {
  display: none;
}

.tabs {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.55);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  flex: 1 1 auto;
  justify-content: center;
  max-width: 640px;
  min-width: 0;
}
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.tab.active {
  background: var(--ink);
  color: #fff;
}
.tab:hover { color: var(--ink); }
.tab.active:hover { color: #fff; }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px 48px;
}

.panel { display: none; animation: fade 0.35s ease; }
.panel.active { display: block; }

.layout-split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 20px;
  align-items: start;
}

.stack, .preview-pane, .section-block, .history-item, .exp-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stack, .section-block { padding: 22px; }
.profile-form { background: transparent; border: 0; box-shadow: none; padding: 0; display: grid; gap: 16px; }

label {
  display: grid;
  gap: 7px;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.hint { font-weight: 500; color: var(--muted); font-size: 0.85rem; }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input, textarea {
  width: 100%;
  border: 1px solid #cfc5b6;
  background: #fffdf9;
  border-radius: 12px;
  padding: 12px 13px;
  font: inherit;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 92, 92, 0.15);
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.btn.primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 22px rgba(21, 32, 43, 0.18);
}
.btn.accent {
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 92, 92, 0.22);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.status {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.status.ok { color: var(--ok); }
.status.err { color: var(--warn); }

.preview-pane { padding: 18px; min-height: 640px; position: sticky; top: 16px; }
.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.preview-head h2, .section-block h2, .section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
}
.preview-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.preview-empty {
  border: 1px dashed #c9bdaa;
  border-radius: 14px;
  padding: 36px 22px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}
.preview-content { display: grid; gap: 14px; }
.pdf-embed {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #edf0f3;
  min-height: 720px;
}
.pdf-embed iframe {
  display: block;
  width: 100%;
  height: 720px;
  border: 0;
  background: #fff;
}
.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 22, 28, 0.62);
  display: grid;
  place-items: center;
  padding: 18px;
}
.pdf-modal.hidden { display: none !important; }
.pdf-modal__panel {
  width: min(960px, 100%);
  height: min(90vh, 920px);
  background: #fffdf9;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(15, 22, 28, 0.28);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}
.pdf-modal__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.pdf-modal__bar strong { font-size: 0.95rem; }
.pdf-modal__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pdf-modal iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #edf0f3;
}
body.pdf-modal-open { overflow: hidden; }
.preview-content .mail, .preview-content .cv {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fffdf9;
}
.preview-content h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.1rem;
}
.preview-content .meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.cv-name { font-family: var(--font-display); font-size: 1.45rem; margin: 0; }
.cv-headline { color: var(--teal); margin: 4px 0 8px; font-weight: 600; }
.cv-section { margin-top: 12px; }
.cv-section strong {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 6px;
}
.cv-exp { margin-bottom: 10px; }
.cv-exp ul { margin: 6px 0 0; padding-left: 18px; }
.cv-exp li { margin-bottom: 4px; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.exp-list { display: grid; gap: 12px; }
.exp-card { padding: 14px; }
.exp-card .field-row { margin-bottom: 0; }
.exp-card .remove {
  margin-top: 8px;
  background: transparent;
  border: 0;
  color: var(--warn);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.history-list { display: grid; gap: 10px; margin-top: 14px; }
.history-item {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 16px;
  align-items: start;
}
.history-item-main { min-width: 0; }
.history-item h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.history-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.history-item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}
.history-item-actions .btn {
  padding: 8px 12px;
  font-size: 0.88rem;
}
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge.generated { background: #e7f0ff; color: #1d4f91; }
.badge.sent, .badge.applied { background: #e4f5eb; color: #1f6b45; }
.badge.failed { background: #fde8df; color: #8a3b12; }
.badge.draft, .badge.new, .badge.queued, .badge.applying { background: #eee9e1; color: #5c6b7a; }
.badge.no_email, .badge.skipped { background: #f5efe4; color: #8a6412; }
.badge.opened, .badge.clicked { background: #e4f5eb; color: #1f6b45; }
.badge.delivered, .badge.sent-track { background: #e7f0ff; color: #1d4f91; }
.badge.bounced, .badge.spam { background: #fde8df; color: #8a3b12; }
.badge.none { background: #eee9e1; color: #5c6b7a; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 10px;
  font-weight: 600;
}
.check-row input { margin-top: 3px; width: auto; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.stat-card {
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  animation: fade 0.45s ease both;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--teal-deep);
  line-height: 1.1;
}
.stat-card .stat-label {
  margin-top: 4px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

.streak-card-wrap { margin-top: 16px; }
.streak-card {
  position: relative;
  margin-top: 0;
  padding: 0;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(15, 92, 92, 0.22);
  background: linear-gradient(145deg, #fffdf9 0%, #f3ebe0 48%, #e8f3f0 100%);
  box-shadow: var(--shadow);
  animation: fade 0.5s ease both;
}
.streak-card__glow {
  position: absolute;
  inset: -40% -20% auto -20%;
  height: 70%;
  background: radial-gradient(ellipse at 30% 40%, rgba(15, 92, 92, 0.2), transparent 55%);
  pointer-events: none;
}
.streak-card--hot .streak-card__glow {
  background: radial-gradient(ellipse at 30% 40%, rgba(184, 107, 42, 0.28), transparent 55%);
}
.streak-card--fire .streak-card__glow {
  background: radial-gradient(ellipse at 20% 30%, rgba(255, 120, 40, 0.35), transparent 50%);
}
.streak-card__layout {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  padding: 20px 22px 18px;
  align-items: start;
}
.streak-card__hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 96px;
  padding: 12px 10px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(21, 32, 43, 0.08);
}
.streak-flame {
  color: var(--copper);
  filter: drop-shadow(0 4px 8px rgba(184, 107, 42, 0.35));
  animation: streak-flicker 2.4s ease-in-out infinite;
}
.streak-flame--hot { color: #e07a2a; }
.streak-flame--fire { color: #e85d04; animation-duration: 1.6s; }
.streak-seed { font-size: 2rem; line-height: 1; }
.streak-hero__nums {
  text-align: center;
  line-height: 1.05;
}
.streak-hero__value {
  display: block;
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 700;
  color: var(--teal-deep);
  letter-spacing: -0.02em;
}
.streak-card--fire .streak-hero__value {
  background: linear-gradient(135deg, #c44d0a, #e85d04 40%, var(--teal-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.streak-hero__caption {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.streak-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.streak-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(21, 32, 43, 0.06);
  color: var(--muted);
}
.streak-pill--best {
  background: linear-gradient(90deg, rgba(232, 93, 4, 0.15), rgba(184, 107, 42, 0.2));
  color: #9a3d08;
}
.streak-pill--today {
  background: rgba(31, 107, 69, 0.12);
  color: var(--ok);
}
.streak-headline {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.streak-subline {
  margin: 0 0 14px;
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 42em;
}
.streak-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.streak-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.streak-day__dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: rgba(21, 32, 43, 0.07);
  border: 2px solid rgba(21, 32, 43, 0.08);
  transition: transform 0.2s ease, background 0.2s ease;
}
.streak-day--today .streak-day__dot {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(15, 92, 92, 0.15);
}
.streak-day--done .streak-day__dot {
  background: linear-gradient(145deg, var(--teal), #148080);
  border-color: transparent;
  transform: scale(1.02);
}
.streak-day__label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.streak-day--today .streak-day__label { color: var(--teal-deep); }
.streak-goal { margin-bottom: 14px; }
.streak-goal__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.streak-goal__row strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--teal-deep);
}
.streak-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(21, 32, 43, 0.08);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(21, 32, 43, 0.06);
}
.streak-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #1a9e9e 55%, var(--copper));
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px rgba(15, 92, 92, 0.35);
}
.streak-cta {
  width: 100%;
  max-width: 320px;
  font-size: 1rem;
  padding: 12px 18px;
  box-shadow: 0 8px 24px rgba(184, 107, 42, 0.25);
}
@keyframes streak-flicker {
  0%, 100% { transform: scale(1) translateY(0); opacity: 1; }
  50% { transform: scale(1.04) translateY(-2px); opacity: 0.92; }
}

#history-filter {
  border: 1px solid #cfc5b6;
  background: #fffdf9;
  border-radius: 12px;
  padding: 8px 10px;
  font: inherit;
}
.history-search-bar {
  padding-top: 4px;
}
.history-search-label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.history-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
#history-search {
  min-width: min(320px, 100%);
  flex: 1 1 240px;
  border: 1px solid #cfc5b6;
  background: #fffdf9;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}
#history-search:focus {
  outline: 2px solid rgba(15, 92, 92, 0.25);
  border-color: rgba(15, 92, 92, 0.45);
}

.profile-setup-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(184, 107, 42, 0.35);
  background: linear-gradient(135deg, rgba(255, 248, 236, 0.98), rgba(255, 236, 210, 0.92));
  box-shadow: 0 10px 28px rgba(184, 107, 42, 0.12);
}
.profile-setup-banner.hidden { display: none !important; }
.profile-setup-banner__copy { flex: 1 1 280px; }
.profile-setup-banner__copy strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 6px;
}
.profile-setup-banner__copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  max-width: 52em;
}
.profile-setup-banner .btn { flex-shrink: 0; }

.history-item-wrap { display: grid; gap: 0; margin-bottom: 10px; }
.history-item-wrap .history-details {
  margin: 0;
  padding: 14px 16px 16px;
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fade 0.25s ease;
}
.history-item-wrap .history-item {
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.history-item-wrap .history-details:not(.hidden) + .history-item,
.history-item-wrap .history-details:not(.hidden) {
  /* details shown below item */
}
.history-item-wrap .history-details:not(.hidden) {
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 0;
}
.history-details.hidden { display: none; }
.history-details h4 {
  margin: 14px 0 6px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.history-details h4:first-child { margin-top: 0; }
.history-details pre,
.history-details .detail-block {
  margin: 0;
  padding: 12px;
  background: rgba(21, 32, 43, 0.04);
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.history-details .poster-thumb {
  max-width: 100%;
  max-height: 280px;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin-top: 8px;
}

.outreach-split { align-items: start; }
.portfolio-list { display: grid; gap: 10px; margin-bottom: 14px; }
.portfolio-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf9;
  display: grid;
  gap: 6px;
}
.portfolio-card a { word-break: break-all; }
.portfolio-card .actions { margin: 6px 0 0; }
.sample-picks { display: grid; gap: 8px; margin-top: 6px; }
.sample-pick {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 500;
}
.sample-pick input { width: auto; margin-top: 3px; }
select {
  width: 100%;
  border: 1px solid #cfc5b6;
  background: #fffdf9;
  border-radius: 12px;
  padding: 12px 13px;
  font: inherit;
  color: var(--ink);
}

.upload-block .hint-block {
  margin: 6px 0 14px;
  color: var(--muted);
  line-height: 1.45;
}
.upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.upload-row input[type="file"] {
  flex: 1 1 220px;
  padding: 10px;
  background: #fffdf9;
}
.upload-row select {
  border: 1px solid #cfc5b6;
  background: #fffdf9;
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
}

.scraper-meta {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.scraper-chip {
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.scraper-chip strong {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}
#jobs-filter,
#jobs-source-filter {
  border: 1px solid #cfc5b6;
  background: #fffdf9;
  border-radius: 12px;
  padding: 8px 10px;
  font: inherit;
}

.job-row__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.job-details {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf9;
}
.job-details__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 10px;
  font-size: 0.92rem;
  color: var(--muted);
}
.job-details__meta strong {
  color: var(--ink);
  font-weight: 600;
  margin-right: 4px;
}
.job-details__desc {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  max-height: 320px;
  overflow: auto;
}
.jobs-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}
.jobs-pager.hidden {
  display: none;
}
.badge.queued { background: #e8f3ff; color: #1a5f9e; }
.badge.applying { background: #fff4d6; color: #8a6200; }
.badge.applied { background: #e5f6ea; color: #1f6b3a; }
.badge.no_email { background: #f1eee8; color: #6b6358; }
.badge.failed { background: #fde8e6; color: #9b2c2c; }
.badge.new { background: #f3eef9; color: #5b3d8a; }

.poster-drop {
  border: 1.5px dashed #c9bdaa;
  border-radius: 14px;
  min-height: 120px;
  display: grid;
  place-items: center;
  padding: 14px;
  cursor: pointer;
  background: #fffdf9;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
  color: var(--muted);
}
.poster-drop:hover, .poster-drop:focus, .poster-drop.dragover {
  border-color: var(--teal);
  background: rgba(15, 92, 92, 0.05);
}
.poster-preview {
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
  object-fit: contain;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin-ring {
  to { transform: rotate(360deg); }
}
@keyframes pulse-dot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
@keyframes loader-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(21, 32, 43, 0.42);
  backdrop-filter: blur(6px);
}
.app-loader.hidden { display: none; }
.app-loader-card {
  width: min(420px, 100%);
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(21, 32, 43, 0.22);
  padding: 28px 24px 22px;
  text-align: center;
  animation: loader-in 0.35s ease both;
}
.loader-ring {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(15, 92, 92, 0.15);
  border-top-color: var(--teal);
  border-right-color: var(--copper);
  animation: spin-ring 0.85s linear infinite;
}
.loader-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--ink);
}
.loader-message {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
  min-height: 2.8em;
  transition: opacity 0.25s ease;
}
.loader-message.fade-swap { opacity: 0; }
.loader-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}
.loader-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulse-dot 1.2s ease-in-out infinite;
}
.loader-dots span:nth-child(2) { animation-delay: 0.15s; background: var(--copper); }
.loader-dots span:nth-child(3) { animation-delay: 0.3s; }

body.loading { overflow: hidden; }

.celebrate-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1100;
}
.celebrate-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  z-index: 1200;
  min-width: min(340px, calc(100vw - 32px));
  max-width: 420px;
  padding: 16px 20px;
  border-radius: 16px;
  background: #fffdf9;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(21, 32, 43, 0.18);
  text-align: center;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.celebrate-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.celebrate-toast.hidden { display: none; }
.celebrate-toast strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--teal-deep);
}
.celebrate-toast span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 960px) {
  .top-inner {
    padding: 6px 12px 8px;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    min-height: 0;
  }
  .brand h1 { font-size: 1.05rem; }
  .tabs {
    order: 3;
    width: 100%;
    max-width: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    border-radius: 999px;
    padding: 3px;
  }
  .tab {
    flex: 0 0 auto;
    padding: 6px 11px;
    font-size: 0.82rem;
    white-space: nowrap;
  }
  .account-bar { margin-left: auto; }
  .account-meta { display: none; }
  main { padding: 12px 14px 40px; }
  .layout-split, .field-row { grid-template-columns: 1fr; }
  .preview-pane { position: static; min-height: auto; }
  .pdf-embed, .pdf-embed iframe { min-height: 480px; height: 480px; }
  .stack, .section-block { padding: 16px; }
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }
  .section-head h2 { margin: 0; }
  #history-filter, #jobs-filter { width: 100%; }
  #history-search { width: 100%; min-width: 0; }
  .history-toolbar { width: 100%; }
  .profile-setup-banner { flex-direction: column; align-items: stretch; }
  .profile-setup-banner .btn { width: 100%; }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .stat-card { padding: 10px 12px; }
  .stat-card .stat-value { font-size: 1.3rem; }
  .history-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .history-item-actions {
    justify-content: flex-start;
    padding-top: 4px;
    border-top: 1px dashed var(--line);
  }
  .history-item-actions .btn {
    flex: 1 1 auto;
    text-align: center;
    min-width: calc(33% - 8px);
  }
  .streak-card__layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .streak-card__hero {
    flex-direction: row;
    justify-content: center;
    gap: 14px;
    width: 100%;
  }
  .streak-hero__nums { text-align: left; }
  .streak-hero__value { font-size: 2.35rem; display: inline; }
  .streak-hero__caption { display: inline; margin-left: 8px; font-size: 0.68rem; }
  .streak-week { gap: 4px; }
  .streak-day__dot { width: 30px; height: 30px; font-size: 0.75rem; }
  .streak-cta { max-width: none; }
  .actions .btn { flex: 1 1 auto; }
  .outreach-split { grid-template-columns: 1fr; }
  .portfolio-add-form .field-row { grid-template-columns: 1fr; }
  .history-item-wrap .history-item { border-radius: var(--radius); }
  .history-item-wrap .history-details {
    border-radius: var(--radius);
    border-top: 1px solid var(--line);
    margin-bottom: 10px;
  }
  .history-item-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .history-item-actions .badge { grid-column: 1 / -1; justify-self: start; }
  .history-item-actions .btn-history-more { grid-column: 1 / -1; }
  .preview-pane { order: 2; }
  .layout-split > form.stack { order: 1; }
}

@media (max-width: 960px) {
  .home-hero { grid-template-columns: 1fr; padding: 18px; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-showcase { padding: 28px 20px 12px; min-height: auto; }
  .auth-showcase h2 { font-size: 2rem; }
  .auth-preview { display: none; }
  .auth-panel { padding: 8px 16px 32px; background: transparent; }
  .auth-card { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18); }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .brand h1 { font-size: 1rem; }
  .brand-mark { width: 30px; height: 30px; font-size: 0.72rem; }
}

.account-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 0;
  flex: 0 0 auto;
  padding: 3px 4px 3px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.9);
}
.account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--teal), var(--teal-deep));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.account-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.account-meta strong {
  font-size: 0.82rem;
  color: var(--ink);
}
.account-meta span {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-bar .btn {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
}

.home-hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  align-items: stretch;
  margin: 0 0 18px;
  padding: 26px 26px 22px;
  border-radius: 22px;
  border: 1px solid rgba(15, 92, 92, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 253, 249, 0.95), rgba(232, 243, 240, 0.9) 55%, rgba(247, 236, 220, 0.92));
  box-shadow: var(--shadow);
}
.home-kicker {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
}
.home-hero__copy h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.25rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.home-hero__copy p {
  margin: 0;
  color: var(--muted);
  max-width: 38em;
  line-height: 1.5;
}
.daily-quote {
  margin: 16px 0 0;
  padding: 12px 14px 12px 16px;
  border-left: 3px solid var(--teal);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 0 12px 12px 0;
}
.daily-quote p {
  margin: 0;
  color: var(--ink) !important;
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1.45;
  max-width: none !important;
}
.daily-quote cite {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--teal-deep);
  letter-spacing: 0.02em;
}
.home-actions {
  display: grid;
  gap: 8px;
}
.home-action {
  text-align: left;
  border: 1px solid rgba(21, 32, 43, 0.08);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  padding: 11px 12px 11px 12px;
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.home-action:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 92, 92, 0.28);
  box-shadow: 0 8px 20px rgba(21, 32, 43, 0.06);
}
.home-action__icon {
  grid-row: 1 / span 2;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(15, 92, 92, 0.1);
  color: var(--teal-deep);
  font-weight: 700;
  align-self: center;
}
.home-action strong { font-size: 0.95rem; }
.home-action span:last-child {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.82rem;
}

body:not(.authed) header.top,
body:not(.authed) main {
  visibility: hidden;
}
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: auto;
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(15, 92, 92, 0.22), transparent 55%),
    radial-gradient(700px 420px at 100% 10%, rgba(184, 107, 42, 0.18), transparent 50%),
    linear-gradient(165deg, #1a2c2c 0%, #0f1c1c 42%, #2a2118 100%);
}
.auth-gate.hidden { display: none; }
.auth-shell {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}
.auth-showcase {
  color: #f4efe6;
  padding: 40px 48px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}
.auth-showcase__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.auth-showcase__brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
}
.auth-showcase__brand span {
  color: rgba(244, 239, 230, 0.7);
  font-size: 0.9rem;
}
.auth-showcase h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4vw, 3.15rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
}
.auth-lede {
  margin: 0 0 28px;
  max-width: 30em;
  font-size: 1.08rem;
  line-height: 1.55;
  color: rgba(244, 239, 230, 0.78);
}
.auth-points {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: grid;
  gap: 14px;
}
.auth-points li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
}
.auth-points span {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #e8b86d;
  padding-top: 4px;
}
.auth-points strong { display: block; margin-bottom: 2px; }
.auth-points p {
  margin: 0;
  color: rgba(244, 239, 230, 0.68);
  font-size: 0.94rem;
  line-height: 1.4;
}
.auth-preview {
  max-width: 320px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.08);
  border: 1px solid rgba(255, 252, 247, 0.12);
}
.auth-preview__bar {
  width: 42px;
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, #e8b86d, #0f5c5c);
  margin-bottom: 12px;
}
.auth-preview__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
}
.auth-preview__role {
  margin: 4px 0 12px;
  color: #c9ddd8;
  font-size: 0.88rem;
}
.auth-preview__line {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 252, 247, 0.12);
  margin-bottom: 7px;
}
.auth-preview__line--short { width: 62%; }

.auth-panel {
  display: grid;
  place-items: center;
  padding: 28px 24px;
  background:
    linear-gradient(180deg, rgba(247, 244, 239, 0.96), #f4efe6);
}
.auth-card {
  width: min(440px, 100%);
  background: rgba(255, 252, 247, 0.94);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 26px 22px;
  box-shadow: 0 24px 60px rgba(15, 22, 24, 0.16);
}
.auth-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}
.auth-form-sub {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.45;
}
.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(21, 32, 43, 0.06);
}
.auth-switch__btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.auth-switch__btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(21, 32, 43, 0.08);
}
.auth-form { display: grid; }
.auth-form.stack { box-shadow: none; border: 0; background: transparent; padding: 0; }
.auth-submit { width: 100%; margin-top: 4px; padding: 13px 18px; }
.pw-wrap {
  position: relative;
  display: block;
}
.pw-wrap input { padding-right: 72px; }
.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--teal);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 8px;
}
.auth-fineprint {
  margin: 14px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.family-banner {
  margin: 0 0 14px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(15, 92, 92, 0.1);
  border: 1px solid rgba(15, 92, 92, 0.18);
  color: var(--teal-deep);
  font-weight: 600;
}
.family-list { display: grid; gap: 8px; margin: 12px 0; }
.family-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf9;
}
.family-row strong { display: block; }
.family-row span { color: var(--muted); font-size: 0.88rem; }
.admin-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-user-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf9;
  margin-bottom: 8px;
}
.admin-user-card h3 { margin: 0 0 4px; font-size: 1rem; }
.admin-user-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.subhead {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}
.extra-links { display: grid; gap: 8px; margin: 0 0 12px; }
.extra-link-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 8px;
  align-items: end;
}
.extra-link-row label { margin: 0; }
.cv-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.cv-template-card {
  text-align: left;
  border: 1px solid var(--line);
  background: #fffdf9;
  border-radius: 16px;
  padding: 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: grid;
  gap: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cv-template-card:hover {
  border-color: rgba(15, 92, 92, 0.35);
}
.cv-template-card.is-selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(15, 92, 92, 0.18);
}
.cv-template-card__preview {
  height: 168px;
  border-radius: 10px;
  overflow: hidden;
  background: #eef1f4;
  border: 1px solid rgba(21, 32, 43, 0.06);
}
.cv-template-card__preview object,
.cv-template-card__preview iframe {
  width: 100%;
  height: 220%;
  pointer-events: none;
  border: 0;
}
.cv-mock {
  display: grid;
  grid-template-columns: 38% 1fr;
  height: 100%;
  font-size: 7px;
  line-height: 1.3;
}
.cv-mock__side {
  background: #2f4a5e;
  color: #e8eef3;
  padding: 10px 8px;
}
.cv-mock__main { padding: 10px 8px; background: #f7f8fa; }
.cv-mock__bar {
  height: 6px;
  background: #c5d0da;
  border-radius: 3px;
  margin: 4px 0;
}
.cv-mock__bar.short { width: 55%; }
.cv-template-card strong { display: block; font-size: 0.95rem; }
.cv-template-card span { color: var(--muted); font-size: 0.8rem; display: block; }
.cv-template-card .cv-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cv-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 92, 92, 0.1);
  color: var(--teal-deep);
}
@media (max-width: 820px) {
  .cv-template-grid { grid-template-columns: 1fr; }
  .extra-link-row { grid-template-columns: 1fr; }
}
