/* The signed-in app (index.html + app.js).
 *
 * The "gold + espresso" system from the JobSwipe design canvas, matched to home.css:
 * warm off-white paper, one ink colour, gold for emphasis, green for anything that has
 * been sent and clay for anything that needs the user. Light-only on purpose — the
 * design commits to a single warm look.
 *
 * Class names are unchanged from the previous sheet: app.js renders the same markup, so
 * the restyle lives entirely here.
 */

:root {
  color-scheme: light;

  --ink: #2b2114;
  --ink-deep: #241c0a;
  --ink-hover: #3d2f16;
  --mid: #57534b;
  --muted: #7a766e;
  --faint: #a09b93;

  --gold: #C69A3F;
  --gold-soft: #f7edd6;
  --gold-line: #eaddbe;
  --gold-ink: #96701f;

  --green: #3f6f52;
  --green-soft: #f2f6f3;
  --green-bright: #7fbf98;

  --clay: #c46a4a;
  --clay-soft: #fbf1ec;
  --red: #c0402c;

  --paper: #fdfcfb;
  --card: #ffffff;
  --sunk: #f7f5f2;
  --hair: #f1efeb;
  --stone: #eae7e1;
  --line: #e4e0da;
  --line-2: #e8e5e0;

  --display: 'Space Grotesk', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --card-radius: 30px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--sunk);
  display: flex; align-items: center; justify-content: center;
  -webkit-font-smoothing: antialiased;
}

/* Phone frame (centered on desktop, full-bleed on mobile) */
#phone {
  position: relative;
  width: 100%; max-width: 430px; height: 100vh; height: 100dvh;
  background: var(--paper);
  display: flex; flex-direction: column; overflow: hidden;
}
@media (min-width: 480px) {
  #phone {
    height: 92vh; max-height: 900px;
    border-radius: 42px;
    box-shadow: 0 24px 60px -30px rgba(20, 19, 15, .28);
    border: 1px solid var(--line);
  }
}
#app { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.boot { margin: auto; color: var(--faint); }
.hidden { display: none !important; }

/* Generic screen */
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 22px 22px 10px; overflow-y: auto; }
.screen h1 { font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0 0; }
.screen h2 { font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0; }
.sub { color: var(--faint); font-size: 13px; margin: 6px 0 16px; line-height: 1.55; }
.center { align-items: center; justify-content: center; text-align: center; }

.btn {
  border: 0; border-radius: 18px; padding: 18px 20px;
  font-family: var(--body); font-size: 16px; font-weight: 600; cursor: pointer; width: 100%;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:active { background: var(--ink-hover); }
.btn-ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn-row { display: flex; gap: 10px; }
.link { background: none; border: 0; color: var(--ink); font-weight: 600; cursor: pointer; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--stone); }
.spacer { flex: 1; }

.logo { font-family: var(--display); font-size: 44px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.02; }
.logo span { color: var(--gold); }
.hero-emoji {
  width: 56px; height: 56px; border-radius: 18px; background: var(--gold); color: var(--ink-deep);
  display: grid; place-items: center; font-size: 26px; margin-bottom: 14px;
}

.field {
  width: 100%; border: 1px solid var(--line); border-radius: 16px; padding: 15px;
  font-family: var(--body); font-size: 16px; background: var(--card); color: var(--ink); margin-bottom: 12px;
}
.field:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
.uploadbox {
  border: 1.5px dashed var(--gold-line); border-radius: 22px; padding: 28px; text-align: center;
  background: var(--gold-soft); color: var(--muted); cursor: pointer;
}
.uploadbox strong { color: var(--ink); }

/* Location suggestions (Places) under the location field */
.suggest { display: flex; flex-direction: column; gap: 6px; margin: -4px 0 12px; text-align: left; }
.suggest .sug {
  background: var(--card); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 12px 14px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; text-align: left;
}
.suggest .sug:active { border-color: var(--gold); background: var(--gold-soft); }

/* Card stack (swipe) */
.swipe-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 14px; }
.swipe-head .loc { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.swipe-head .count { color: var(--faint); font-size: 13px; }
.filterbar { display: flex; gap: 8px; margin: 0 0 14px; }
.finput {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 14px;
  padding: 11px 13px; font-family: var(--body); font-size: 13.5px; background: var(--card); color: var(--ink);
}
.fbtn {
  border: 0; background: var(--ink); color: var(--paper); border-radius: 14px;
  padding: 0 16px; font-family: var(--body); font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.deck { position: relative; flex: 1; min-height: 0; margin: 0; }
/* The two cards behind the top one are drawn by the deck itself, so a single job still
   looks like a stack you can work through. */
.deck::before, .deck::after {
  content: ''; position: absolute; border-radius: var(--card-radius); pointer-events: none;
}
.deck::before { left: 12px; right: 12px; top: 7px; bottom: -7px; background: var(--sunk); border: 1px solid var(--stone); }
.deck::after  { left: 18px; right: 18px; top: 14px; bottom: -14px; background: var(--hair); }
.card {
  position: absolute; inset: 0; background: var(--card); border: 1px solid var(--line-2);
  border-radius: var(--card-radius);
  box-shadow: 0 30px 50px -34px rgba(20, 19, 15, .35); padding: 24px;
  display: flex; flex-direction: column;
  will-change: transform; touch-action: none; user-select: none;
}
.card .co-logo {
  width: 52px; height: 52px; border-radius: 16px; background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 19px; font-weight: 700; color: var(--ink-deep); margin-bottom: 18px;
}
.card h3 { font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; line-height: 1.1; }
.card .co { color: var(--muted); font-size: 15px; margin-bottom: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag { background: var(--hair); color: var(--ink); border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600; }
.tag.remote { background: var(--green-soft); color: var(--green); }
.tag.salary { background: var(--green-soft); color: var(--green); }
.card .desc { color: var(--mid); font-size: 14px; line-height: 1.65; overflow: auto; flex: 1; }
.card .posted { color: var(--faint); font-size: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hair); }
.stamp {
  position: absolute; top: 24px; font-family: var(--display); font-size: 24px; font-weight: 700;
  padding: 5px 13px; border-radius: 12px; border: 3px solid; opacity: 0; transform: rotate(-12deg);
}
.stamp.like { left: 22px; color: var(--green); border-color: var(--green); }
.stamp.nope { right: 22px; color: var(--clay); border-color: var(--clay); transform: rotate(12deg); }

/* Skip · apply · save, laid out as the design has them: a wide primary between two
   round secondaries, so the thumb lands on "apply". */
.actions { display: flex; justify-content: center; align-items: center; gap: 16px; padding: 22px 0 8px; }
.act {
  width: 60px; height: 60px; border-radius: 99px; border: 1px solid var(--line); background: var(--card);
  font-size: 20px; color: var(--mid); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.act.nope:active { border-color: var(--clay); color: var(--clay); }
.act.info { width: 60px; height: 60px; font-size: 18px; }
.act.like {
  flex: 1; width: auto; height: 64px; border: 0; border-radius: 22px;
  background: var(--ink); color: var(--paper); font-family: var(--body); font-size: 16px; font-weight: 600; gap: 10px;
}
.act:active { transform: scale(.97); }

.empty-deck { margin: auto; text-align: center; color: var(--faint); padding: 30px; }

/* Applications tiles */
.app-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; }
.app-tile { background: var(--card); border: 1px solid var(--line-2); border-radius: 24px; padding: 18px; }
.app-tile .row1 { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.app-tile h4 { margin: 0 0 3px; font-size: 16px; font-weight: 700; }
.app-tile .co { color: var(--faint); font-size: 13px; }
.status {
  font-size: 11px; font-weight: 700; padding: 6px 10px; border-radius: 9px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.status.applied, .status.sent { background: var(--green-soft); color: var(--green); }
.status.applying { background: var(--gold-soft); color: var(--gold-ink); }
.status.queued { background: var(--hair); color: var(--muted); }
.status.failed { background: var(--clay-soft); color: var(--red); }
.status.needs_help { background: var(--clay-soft); color: var(--clay); }
.status.blocked, .status.unknown { background: var(--gold-soft); color: var(--gold-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dot.pulse { animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }
.help-box { margin-top: 14px; background: var(--sunk); border: 1px solid var(--line-2); border-radius: 16px; padding: 14px; }
.help-box .help-sum { font-size: 13px; line-height: 1.55; color: var(--mid); margin-bottom: 12px; }
.help-box label { font-size: 12px; font-weight: 700; display: block; margin-bottom: 5px; color: var(--muted); }
.help-choices { display: grid; gap: 8px; margin: 6px 0 10px; }
.help-box .help-choice { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-weight: 500; }
.app-progress { margin-top: 12px; padding: 11px 12px; border-radius: 14px; background: var(--sunk); display: grid; gap: 5px; }
.progress-step { font-size: 11.5px; line-height: 1.4; color: var(--faint); }
.progress-step span { display: inline-block; width: 14px; color: var(--green); font-weight: 700; }
.progress-step strong { color: var(--ink); text-transform: capitalize; margin-right: 3px; }
.progress-step.bad span { color: var(--clay); }

/* Per-application controls */
.app-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.app-act {
  background: var(--card); border: 1px solid var(--line); color: var(--mid);
  font-family: var(--body); font-size: 13px; font-weight: 600; padding: 11px 14px; border-radius: 14px; cursor: pointer;
}
.app-act:hover { color: var(--ink); border-color: var(--faint); }
.app-act:disabled { opacity: .5; cursor: default; }
/* The first control on a tile is the one we want tapped. */
.app-actions .app-act:first-child { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* Filter pills above the application list */
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.pill {
  border: 1px solid var(--line); background: var(--card); color: var(--mid);
  font-family: var(--body); font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 99px; cursor: pointer;
}
.pill.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---- Home dashboard ---- */
.match-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 4px 8px; }
.match-title { font-family: var(--display); font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.muted-sm { font-size: 12px; color: var(--faint); }
#home-matches { margin-bottom: 16px; }
.logo-sm {
  width: 34px; height: 34px; border-radius: 11px; background: var(--gold); color: var(--ink-deep);
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 14px; flex: none;
}
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px 14px; }
.home-head .day { font-size: 13px; color: var(--faint); font-weight: 500; }
.home-head .hello { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.home-head .avatar {
  width: 42px; height: 42px; border-radius: 99px; background: var(--stone); border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
}
.week-card { background: var(--ink); border-radius: 28px; padding: 22px; color: var(--paper); margin-bottom: 14px; }
.week-card .k { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #8f8b82; }
.week-card .v { font-family: var(--display); font-size: 52px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; margin-top: 8px; }
.week-card .note { background: rgba(253, 252, 251, .12); border-radius: 14px; padding: 8px 12px; font-size: 12px; font-weight: 600; color: #a8d6bb; }
.week-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.week-bars { display: flex; gap: 6px; align-items: flex-end; height: 52px; margin-top: 18px; }
.week-bars i { flex: 1; border-radius: 6px; background: var(--green); min-height: 4px; }
.week-bars i.today { background: var(--gold); }
.week-bars i.zero { background: rgba(253, 252, 251, .16); }
.week-days { display: flex; justify-content: space-between; font-size: 11px; color: #8f8b82; margin-top: 8px; }
.week-days span { flex: 1; text-align: center; }
.tiles { display: flex; gap: 12px; margin-bottom: 14px; }
.tile { flex: 1; background: var(--card); border: 1px solid var(--line-2); border-radius: 22px; padding: 16px; }
.tile .n { font-family: var(--display); font-size: 26px; font-weight: 700; }
.tile .n.gold { color: var(--gold); }
.tile .l { font-size: 12px; color: var(--faint); margin-top: 2px; line-height: 1.4; }
.recent { background: var(--card); border: 1px solid var(--line-2); border-radius: 24px; padding: 6px 18px; }
.recent .r {
  display: flex; align-items: center; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--hair); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.recent .r:last-child { border-bottom: 0; }
.recent .pip { width: 8px; height: 8px; border-radius: 99px; background: var(--green); flex: none; }
.recent .pip.clay { background: var(--clay); }
.recent .pip.grey { background: var(--stone); }
.recent .t { font-size: 14px; font-weight: 600; }
.recent .s { font-size: 12px; color: var(--faint); }

/* Bottom nav */
.tabbar { display: flex; border-top: 1px solid var(--hair); background: var(--paper); padding: 12px 20px 22px; }
.tab {
  flex: 1; background: none; border: 0; padding: 0; font-family: var(--body); font-size: 11px; font-weight: 600;
  color: var(--faint); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative;
}
.tab .ti { font-size: 18px; line-height: 1; }
.tab.active { color: var(--ink); }
.tab .badge {
  position: absolute; top: -4px; right: 50%; margin-right: -22px; background: var(--clay); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px;
  display: none; align-items: center; justify-content: center;
}

/* Chat */
.chat { flex: 1; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding-bottom: 8px; }
.bubble { max-width: 82%; padding: 13px 16px; border-radius: 18px; font-size: 14.5px; line-height: 1.5; }
.bubble.bot { background: var(--card); border: 1px solid var(--line-2); align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.me { background: var(--ink); color: var(--paper); align-self: flex-end; border-bottom-right-radius: 6px; }
.chat-input { display: flex; gap: 8px; padding-top: 8px; }
.chat-input input { flex: 1; }

.preview-frame { flex: 1; border: 1px solid var(--line-2); border-radius: 20px; background: var(--card); width: 100%; }
.loading-inline { color: var(--faint); font-size: 14px; text-align: center; padding: 16px; }

/* Spinner: shown in the deck while a search runs, and inside the search button itself. */
.spinner {
  display: inline-block; width: 22px; height: 22px; margin-bottom: 6px;
  border: 2.5px solid var(--stone); border-top-color: var(--gold);
  border-radius: 50%; animation: spin .7s linear infinite;
}
.spinner.sm { width: 14px; height: 14px; margin: 0; border-width: 2px; border-color: rgba(253,252,251,.35); border-top-color: var(--paper); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 14px; font-size: 13.5px; z-index: 50;
}

.acct-card { background: var(--card); border: 1px solid var(--line-2); border-radius: 24px; padding: 18px; margin-bottom: 14px; }
.acct-card h4 { margin: 0 0 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); font-weight: 700; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--hair); font-size: 14px; }
.kv:first-of-type { border-top: 0; }
.plan { border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 10px; }
.plan.current { border-color: var(--gold); background: var(--gold-soft); }
.plan .pn { font-weight: 700; }
.plan .pp { color: var(--muted); font-size: 13px; }

/* automatic-application consent + sent-mail transparency */
.consent-row { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 2px; font-size: 14px; line-height: 1.5; }
.consent-row input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--ink); }
.sent-copy { margin-top: 10px; font-size: 13px; }
.sent-copy summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.sent-copy .sent-body { margin-top: 8px; padding: 12px 14px; background: var(--sunk); border-radius: 14px; color: var(--mid); }
.sent-copy pre { white-space: pre-wrap; word-wrap: break-word; margin: 6px 0 0; font: inherit; }

/* Terms/Privacy links on the signed-out welcome screen. */
.legal-links { margin: 16px 0 4px; text-align: center; font-size: 11px; color: var(--faint); line-height: 1.6; }
.legal-links a { color: var(--faint); text-decoration: underline; text-underline-offset: 2px; }
