:root {
  --ink: #1c241c;
  --muted: #5c675c;
  --paper: #f4efe6;
  --card: #fffdf8;
  --line: #d9d0c0;
  --accent: #2f5d50;
  --accent-2: #b86b3c;
  --ok: #2f5d50;
  --err: #8b2e2e;
  --shadow: 0 12px 40px rgba(28, 36, 28, 0.08);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --tap: 44px;
  --pad-x: max(16px, env(safe-area-inset-left));
  --pad-r: max(16px, env(safe-area-inset-right));
  --pad-b: max(20px, env(safe-area-inset-bottom));
  --tabbar-h: calc(56px + env(safe-area-inset-bottom));
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #e7efe8 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #f0e2d4 0%, transparent 50%),
    var(--paper);
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.is-authed {
  padding-bottom: var(--tabbar-h);
}
a { color: var(--accent); }
.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px var(--pad-r) 40px var(--pad-x);
}

/* ---------- Header ---------- */
.top {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
}
.top-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px var(--pad-r) 10px var(--pad-x);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
}
.brand {
  font-family: var(--serif);
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.05rem;
  white-space: nowrap;
}
.top-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}
.top-nav a,
.linkish {
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  padding: 10px 12px;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
}
.top-nav a:hover,
.linkish:hover { color: var(--ink); background: rgba(28, 36, 28, 0.04); }
.inline { display: inline; margin: 0; }

/* ---------- Type ---------- */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent-2);
  font-weight: 650;
  margin: 0 0 8px;
}
h1, h2 { font-family: var(--serif); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(1.55rem, 5.5vw, 2.4rem); margin: 0 0 10px; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
.lede { color: var(--muted); max-width: 42rem; margin: 0 0 14px; line-height: 1.45; }
.org { color: var(--muted); margin: 0 0 8px; }
.show-narrow { display: none; }

/* ---------- Login ---------- */
.login-card {
  max-width: 420px;
  margin: max(8vh, 32px) auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
}
.stack { display: grid; gap: 14px; }
label {
  display: grid;
  gap: 8px;
  font-weight: 550;
  font-size: 0.95rem;
}
input, select, textarea {
  font: inherit;
  font-size: 16px; /* prevents iOS Safari zoom-on-focus */
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  width: 100%;
  max-width: 100%;
  min-height: var(--tap);
  appearance: none;
  -webkit-appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.4;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(47, 93, 80, 0.35);
  outline-offset: 1px;
  border-color: var(--accent);
}
.btn {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 650;
  padding: 14px 20px;
  border-radius: 999px;
  cursor: pointer;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  text-decoration: none;
  font-weight: 650;
  color: var(--accent);
}

/* ---------- Board ---------- */
.hero-row {
  display: grid;
  gap: 16px;
  grid-template-columns: 1.4fr 1fr;
  align-items: end;
  margin-bottom: 18px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
a.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  min-height: var(--tap);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
a.stat:active { transform: scale(0.98); background: #faf6ee; }
a.stat.on {
  border-color: var(--accent);
  background: #e7efe8;
  box-shadow: inset 0 0 0 1px var(--accent);
}
a.stat.on .n { color: var(--accent); }
a.stat.on .l { color: var(--accent); font-weight: 650; }
.stat .n {
  display: block;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.1;
}
.stat .l { color: var(--muted); font-size: 0.75rem; margin-top: 2px; }
.filter-hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin: -6px 0 14px;
}
.filter-hint.show-narrow { display: none; }

.filters {
  margin: 0 calc(-1 * var(--pad-x)) 16px;
}
.filters-scroller {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding: 4px var(--pad-x) 10px;
  scrollbar-width: none;
}
.filters-scroller::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--card);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  touch-action: manipulation;
}
.chip.on {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.job-list { display: grid; gap: 10px; }
.job-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 16px 14px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--line);
  touch-action: manipulation;
  position: relative;
}
.job-card:active { background: #faf6ee; }
.job-card h2 { font-size: 1.12rem; margin: 6px 0; }
.job-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-right: 18px;
}
.chev {
  margin-left: auto;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  position: absolute;
  right: 14px;
  top: 16px;
}
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 650;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e7efe8;
  color: var(--accent);
}
.mute { color: var(--muted); font-size: 0.9rem; }
.next { margin: 10px 0 0; font-size: 0.95rem; line-height: 1.35; }
.status-interview { border-left-color: #3d6b9a; }
.status-offer { border-left-color: #2f5d50; }
.status-applied { border-left-color: var(--accent-2); }
.status-interested { border-left-color: #8a7a3d; }
.status-suggested { border-left-color: #9aa39a; }
.status-irrelevant { border-left-color: #9a6b5a; opacity: 0.9; }
.status-rejected,
.status-withdrawn,
.status-archived { border-left-color: #b0a89a; opacity: 0.92; }

.feedback-hint {
  margin: 0.75rem 0 0.4rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--mute, #6a655c);
}
.contact-box {
  margin: 1.1rem 0 1.4rem;
  padding: 0.95rem 1rem;
  border: 1px solid #d4c9b8;
  border-radius: 10px;
  background: #f7f3ec;
}
.contact-box h2 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
}
.contact-box p { margin: 0.35rem 0; }
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}
.contact-chip {
  margin: 0.25rem 0 0;
  font-size: 0.86rem;
  color: #3d4a3a;
}
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.4rem 0 0.85rem;
}
.btn-secondary {
  background: transparent;
  color: var(--ink, #1c1a16);
  border: 1px solid #c4b8a8;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:active { opacity: 0.85; }

.activity { margin-top: 32px; }
.activity ol, .timeline ol { list-style: none; padding: 0; margin: 0; }
.activity li, .timeline li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 3px;
}
.activity time, .timeline time { color: var(--muted); font-size: 0.82rem; }
.activity em { font-style: normal; color: var(--ink); }

.detail {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 16px 24px;
  box-shadow: var(--shadow);
}
.crumb { margin-bottom: 12px; }
.back-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 8px 4px;
  text-decoration: none;
  font-weight: 550;
}
.summary { color: var(--muted); line-height: 1.45; }
.next-banner {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: #e7efe8;
  border: 1px solid #c9dbcf;
  line-height: 1.4;
}
.update-form { margin-top: 22px; display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.save-bar { margin-top: 4px; }
.timeline { margin-top: 28px; }
.timeline p { margin: 4px 0 0; }
.kind {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-2);
  font-weight: 650;
}
.ext { font-weight: 650; text-decoration: none; }
.empty { color: var(--muted); }
.flashes { list-style: none; padding: 0; margin: 0 0 16px; }
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 8px; }
.flash.ok { background: #e7efe8; color: var(--ok); }
.flash.error, .error { background: #f6e4e4; color: var(--err); }

/* ---------- Mobile tab bar (iPhone thumb zone) ---------- */
.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgba(255, 253, 248, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px var(--pad-r) calc(6px + env(safe-area-inset-bottom)) var(--pad-x);
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.tab-form { margin: 0; display: contents; }
.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  touch-action: manipulation;
}
.tab.on, .tab:active { color: var(--accent); background: rgba(47, 93, 80, 0.08); }
.tab-ico { font-size: 1.15rem; line-height: 1; }

/* ---------- Phone / Pro Max ---------- */
@media (max-width: 800px) {
  .hero-row { grid-template-columns: 1fr; }
  .top-nav { display: none; }
  .tabbar { display: grid; }
  .hide-narrow { display: none; }
  .show-narrow { display: block; }
  .filter-hint.show-narrow { display: block; }
  .login-card { margin-top: max(6vh, 24px); padding: 24px 18px; }
  h1 { letter-spacing: -0.01em; }
}

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .wrap { padding-top: 16px; padding-bottom: 28px; }
  .detail { padding: 18px 14px 22px; border-radius: 16px; }
  .job-card { border-radius: 14px; }
  .save-bar {
    position: sticky;
    bottom: calc(var(--tabbar-h) + 8px);
    z-index: 5;
    padding-top: 8px;
    background: linear-gradient(to top, var(--card) 70%, transparent);
  }
}

/* Large phones (Pro Max class) — slightly roomier type & cards */
@media (min-width: 390px) and (max-width: 480px) {
  .job-card { padding: 18px 18px 18px 16px; }
  .stat .n { font-size: 1.55rem; }
  .chip { padding: 11px 16px; font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:active, .job-card:active { transform: none; }
}

@supports (padding: max(0px)) {
  .wrap {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}
