/* ============================================================
   Internships — visual system

   One accent hue (green) carries every interactive and data
   mark. The Statistics bars are a single-series magnitude
   chart, so they use one hue at varying emphasis rather than a
   categorical palette — which sidesteps colorblind-adjacency
   problems entirely instead of trying to pass them.

   Dark mode is chosen, not flipped: its surfaces sit slightly
   warm, and the accent lifts in lightness so it still reads
   against a dark ground.
   ============================================================ */

/* ---------- typeface ----------
   Geist, self-hosted (see static/fonts/README.md). The system sans stack this
   replaced is the default every generated UI ships with; Geist has actual
   character in its terminals and a proper variable weight axis, which is what
   makes the 500/600 steps below possible instead of jumping 400 -> 700. */

@font-face {
  font-family: "Geist";
  src: url("/static/fonts/geist-variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/geist-mono-variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}

:root {
  /* surfaces, warm neutral */
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-sunken: #f1efea;
  --border: #e4e1da;
  --border-strong: #d3cfc5;

  /* ink */
  --text: #1e1c19;
  --text-secondary: #6b665d;
  --text-muted: #918b80;

  /* accent */
  --accent: #2e6b4f;
  --accent-hover: #245740;
  --accent-soft: #e7f0ea;
  --accent-ring: rgba(46, 107, 79, .28);
  /* Ink that sits ON the accent. White works on the dark-green light-mode
     accent; the dark-mode accent is far lighter, so white would drop to
     2.5:1 there. This token is what keeps both modes legible. */
  --on-accent: #ffffff;

  /* status */
  --warn-bg: #fbf0d8;
  --warn-text: #8a6116;
  --danger: #a53d2c;          /* danger as TEXT, on a page background */
  --danger-solid: #a53d2c;    /* danger as a FILL, with white text on it */
  --danger-soft: #fbe9e5;

  /* data marks */
  --bar-track: #eceae4;
  --bar-fill: #2e6b4f;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 20, .05);
  --shadow: 0 1px 2px rgba(28, 25, 20, .04), 0 6px 20px rgba(28, 25, 20, .06);
  --shadow-lg: 0 4px 12px rgba(28, 25, 20, .08), 0 20px 48px rgba(28, 25, 20, .14);

  --ease: cubic-bezier(.4, 0, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --surface: #1d1f24;
    --surface-sunken: #191b1f;
    --border: #2e3138;
    --border-strong: #3d414a;

    --text: #eae7e1;
    --text-secondary: #9d978c;
    --text-muted: #7b756a;

    --accent: #64b287;
    --accent-hover: #7cc39b;
    --accent-soft: #1e3128;
    --accent-ring: rgba(100, 178, 135, .32);
    --on-accent: #10201a;     /* 6.6:1 on the light-mode-lifted accent */

    --warn-bg: #382e19;
    --warn-text: #dcb367;
    --danger: #dd8171;        /* lifted so it reads as text on a dark page */
    --danger-solid: #b8442f;  /* deepened so white text on it stays 5.4:1 */
    --danger-soft: #35211d;

    --bar-track: #26292f;
    --bar-fill: #64b287;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .28);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, .4), 0 20px 48px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Geist", ui-sans-serif, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Tabular figures everywhere by default: this interface is mostly counts,
     dates and IDs, and proportional digits make columns jitter as they update. */
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent-soft); color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  height: 60px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.015em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--accent);
  flex-shrink: 0;
}

.tabs { display: flex; gap: 2px; }

/* An underline indicator reads quieter than a filled pill and keeps the
   bar from looking like four competing buttons. */
.tab-btn {
  position: relative;
  border: 0;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color .15s var(--ease), background .15s var(--ease);
}

.tab-btn::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform .18s var(--ease);
}

.tab-btn:hover { color: var(--text); background: var(--surface-sunken); }
.tab-btn.active { color: var(--text); font-weight: 550; background: none; }
.tab-btn.active::after { transform: scaleX(1); }

.badge {
  display: inline-block;
  margin-left: 7px;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 9px;
  background: var(--danger-solid);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  vertical-align: 1px;
  font-variant-numeric: tabular-nums;
}

/* ---------- layout ---------- */

main { max-width: 940px; margin: 0 auto; padding: 36px 24px 80px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: rise .22s var(--ease); }

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.muted { color: var(--text-secondary); }

/* ---------- apply deck ---------- */

.deck-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 22px;
}

.deck-position {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  min-width: 62px;
  text-align: center;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  box-shadow: var(--shadow-sm);
  transition: color .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
}

.icon-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.icon-btn:active:not(:disabled) { transform: translateY(1px); }
.icon-btn:disabled { opacity: .3; cursor: default; box-shadow: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 26px;
}

.card-header h2 {
  margin: 0 0 5px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.3;
}

.card-header p { margin: 0; font-size: 13px; }

.status-pill {
  flex-shrink: 0;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--surface-sunken);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.status-new { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.status-drafted { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.status-submitted { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.status-skipped { opacity: .65; }
/* Retired by the stale sweep. Quieter than skipped: you never decided
   anything about it, it simply aged out. */
.status-expired { opacity: .5; font-style: italic; }

/* Taken down at the source. Distinct from expired: that aged out, this is
   gone from the employer's board entirely. */
.status-closed { opacity: .5; text-decoration: line-through; }

/* Provenance is reference material: available, never competing with the role. */
.source-link { color: var(--text-secondary); font-size: .85em; white-space: nowrap; }
.source-link:hover { color: var(--accent); }

.loading {
  padding: 56px 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.field-group { margin-bottom: 24px; }

.field-group label,
.stats-section h3 {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}

textarea, select, input[type="password"], input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text);
  font: inherit;
  resize: vertical;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}

textarea {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
}

textarea:hover, select:hover { border-color: var(--border-strong); }

textarea:focus, select:focus,
input[type="password"]:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

select {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.readonly-block {
  max-height: 280px;
  overflow-y: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.action-btns { display: flex; gap: 10px; }

.link-btn {
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
  transition: color .15s var(--ease);
}
.link-btn:hover { color: var(--accent); }

.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease),
              color .15s var(--ease), transform .1s var(--ease);
}

.btn:active:not(:disabled) { transform: translateY(1px); }

.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn.secondary { background: var(--surface); color: var(--text-secondary); border-color: var(--border); }
.btn.secondary:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }

.btn:disabled { opacity: .4; cursor: default; box-shadow: none; }

.empty-state { padding: 96px 24px; text-align: center; color: var(--text-secondary); }
.empty-state h2 { margin: 0 0 10px; font-size: 17px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.empty-state p { margin: 0 auto; max-width: 400px; font-size: 14px; }

/* ---------- list ---------- */

.list-filters { margin-bottom: 18px; }
.list-filters select { width: auto; min-width: 190px; }

#list-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.listing-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.listing-table th {
  padding: 13px 18px;
  text-align: left;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.listing-table td { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.listing-table tbody tr:last-child td { border-bottom: 0; }
.listing-table tbody tr { cursor: pointer; transition: background .12s var(--ease); }
.listing-table tbody tr:hover { background: var(--surface-sunken); }

/* Direct link to the employer's application form, on every List row. */
.row-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.row-link:hover { text-decoration: underline; }

/* ---------- stats ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}

.stat-card .label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* The hero number is the whole point of a stat tile — let it be big. */
.stat-card .value {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stats-section { margin-bottom: 40px; }
.stats-section h3 { margin: 0 0 16px; }

.bar-list { display: flex; flex-direction: column; gap: 6px; }

.bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 44px;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  padding: 3px 0;
  border-radius: 6px;
  transition: background .12s var(--ease);
}

.bar-row:hover { background: var(--surface-sunken); }

/* Labels and values wear text tokens, never the series color — the bar
   itself carries the identity. */
.bar-label {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Recessive track, no border: the data is the fill, not the container. */
.bar-track {
  height: 10px;
  background: var(--bar-track);
  border-radius: 5px;
  overflow: hidden;
}

/* Rounded only on the data end, anchored flat to the baseline. */
.bar-fill {
  height: 100%;
  background: var(--bar-fill);
  min-width: 3px;
  border-radius: 0 4px 4px 0;
  transition: width .4s var(--ease), filter .12s var(--ease);
}

.bar-row:hover .bar-fill { filter: brightness(1.08); }

.bar-count {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ---------- modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 12, .5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fade .16s var(--ease);
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal[hidden] { display: none; }

.modal-content {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 30px;
  animation: rise .2s var(--ease);
}

.modal-close { position: absolute; top: 16px; right: 16px; font-size: 20px; line-height: 1; }

/* ---------- application questions ---------- */

.questions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.questions-header label { margin-bottom: 0; }
.questions-actions { display: flex; gap: 6px; }

.btn.tiny {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
}

.btn.tiny.secondary { background: var(--surface); color: var(--text-secondary); border-color: var(--border); }
.btn.tiny:hover:not(:disabled) { background: var(--accent-hover); color: var(--on-accent); }
.btn.tiny.secondary:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); background: var(--surface); }

.questions-status { font-size: 12px; margin-bottom: 12px; }

.question {
  padding: 16px;
  margin-bottom: 10px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s var(--ease);
}

.question:hover { border-color: var(--border-strong); }

.q-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.q-label { font-size: 13px; font-weight: 550; line-height: 1.5; }

.q-req {
  margin-left: 6px;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--danger);
}

.q-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.q-tag {
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
}

.q-tag.subtle { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }

.question .q-input { background: var(--surface); font-size: 13px; }
.question textarea.q-input { font-family: inherit; line-height: 1.6; }

.q-note { margin-top: 8px; font-size: 12px; color: var(--text-secondary); }
.q-note.warn { color: var(--warn-text); }

/* Self-identification questions are never AI-drafted — the dashed edge is
   the visual reminder that this one is yours to answer. */
.question.sensitive { border-style: dashed; background: transparent; }

/* ---------- answer bank ---------- */

.answers-intro { max-width: 640px; margin: 0 0 24px; font-size: 14px; }

.answer-card {
  padding: 18px 20px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s var(--ease);
}

.answer-card:hover { border-color: var(--border-strong); }

.answer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.answer-q { font-size: 14px; font-weight: 550; line-height: 1.5; }
.answer-meta { font-size: 12px; margin: 5px 0 12px; color: var(--text-muted); }
.answer-text { background: var(--surface-sunken); font-family: inherit; font-size: 13px; }

/* ---------- "new postings arrived" pill ---------- */

.new-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto 18px;
  padding: 9px 17px;
  border: 1px solid var(--accent);
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .15s var(--ease), color .15s var(--ease);
}

.new-pill[hidden] { display: none; }
.new-pill:hover { background: var(--accent); color: var(--on-accent); }
.new-pill:hover .new-pill-dot { background: var(--on-accent); }

.new-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger-solid);
  animation: pulse 2s ease-in-out infinite;
}

.new-pill-action { opacity: .7; text-decoration: underline; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* ---------- login ---------- */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 350px;
  padding: 36px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.login-card h1 { margin: 0 0 8px; font-size: 21px; font-weight: 600; letter-spacing: -.02em; }
.login-card p { margin: 0 0 22px; font-size: 13px; color: var(--text-secondary); }
.login-card input { margin-bottom: 12px; text-align: center; }
.login-card .btn { width: 100%; }
.login-error { color: var(--danger) !important; font-weight: 500; }

/* ---------- responsive ---------- */

@media (max-width: 700px) {
  .topbar { gap: 12px; padding: 0 14px; height: 56px; }
  .brand { display: none; }
  .tab-btn { padding: 8px 9px; font-size: 13px; }
  .tab-btn::after { left: 9px; right: 9px; }
  main { padding: 22px 14px 56px; }
  .card { padding: 20px; }
  .card-header h2 { font-size: 18px; }
  .card-actions { flex-direction: column-reverse; align-items: stretch; }
  .action-btns .btn { flex: 1; }
  .bar-row { grid-template-columns: 96px 1fr 36px; gap: 10px; }
  .modal-content { padding: 22px; }
  .stat-card .value { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- work-term badges ---------- */
/* Deliberately quieter than .status-pill: the term is context you scan past,
   while status is the thing you act on. Same shape, recessive weight. */
.term-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--text-secondary);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
}

.term-none {
  color: var(--text-muted, var(--text-secondary));
  cursor: help;
}

.list-filters select { min-width: 9.5rem; }


/* ============================================================
   Typographic detail
   ============================================================ */

/* Negative tracking on display sizes, positive on small caps labels — the
   optical correction that stops large text looking loose and small uppercase
   text looking cramped. */
h1, h2, .card-title, .stat-value {
  letter-spacing: -0.018em;
  text-wrap: balance;      /* no orphaned last word in a heading */
}

p, .muted, .field-note {
  text-wrap: pretty;
}

label, .questions-header label, th {
  letter-spacing: 0.04em;
}

/* ============================================================
   Resume attachment preview
   ============================================================ */

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.field-note {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: normal;
}

.field-note.warn { color: var(--warn-text); }

/* Rendered page images rather than an embedded PDF. Height is driven by the
   content now, so a two-page resume shows both instead of scrolling inside a
   fixed 460px box. */
.pdf-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  padding: 10px;
  border: 1px solid var(--border);
}

.resume-page {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.pdf-actions { margin: 8px 0 0; }

.pdf-fallback {
  margin: 0;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* The tailored draft is real work, but it is not what gets submitted, so it
   sits closed by default rather than competing with the file above. */
.draft-details {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  overflow: hidden;
}

.draft-details > summary {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  list-style: none;
  transition: color .15s var(--ease), background .15s var(--ease);
}

.draft-details > summary::-webkit-details-marker { display: none; }

.draft-details > summary::before {
  content: "\203A";           /* rotates to point down when open */
  display: inline-block;
  margin-right: 8px;
  transition: transform .2s var(--ease);
}

.draft-details[open] > summary::before { transform: rotate(90deg); }
.draft-details > summary:hover { color: var(--text); background: var(--surface); }

.draft-details .field-note { padding: 0 12px; }
.draft-details textarea { margin: 8px 12px 12px; width: calc(100% - 24px); }

/* ============================================================
   Skeleton loading
   ============================================================ */

/* Replaces the bare "Drafting..." line. A skeleton shaped like the result
   tells you what is coming and stops the card collapsing to nothing while
   the model works. */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-sunken) 25%,
    color-mix(in srgb, var(--surface-sunken) 60%, var(--border)) 37%,
    var(--surface-sunken) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.4s var(--ease) infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to   { background-position: -100% 0; }
}

.skeleton-line { height: 12px; margin-bottom: 10px; }
.skeleton-line.short { width: 42%; }
.skeleton-line.medium { width: 74%; }
.skeleton-block { height: 190px; margin-bottom: 14px; }

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* Inline error, used when drafting fails. Not window.alert, not a toast that
   vanishes before you've read the reason. */
.inline-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 26%, transparent);
  font-size: 14px;
}

/* ============================================================
   Internship list — table proportions
   ============================================================ */

/* 940px is right for reading a single application card, but wrong for a
   7-column table: it squeezed Role into five-line wraps while 40% of a
   1440px window sat empty. The list tab gets its own wider measure. */
#tab-list { --list-measure: 1320px; }

#tab-list.tab-panel {
  max-width: var(--list-measure);
  margin-inline: auto;
  width: 100%;
}

@media (min-width: 1024px) {
  main:has(#tab-list.active) { max-width: var(--list-measure); }
}

/* Explicit proportions beat letting the browser guess from content: without
   them one long Palantir title sets the width for every row. */
.listing-table { table-layout: fixed; }
.listing-table th:nth-child(1), .listing-table td:nth-child(1) { width: 11%; }  /* Company  */
.listing-table th:nth-child(2), .listing-table td:nth-child(2) { width: 32%; }  /* Role     */
.listing-table th:nth-child(3), .listing-table td:nth-child(3) { width: 11%; }  /* Term     */
.listing-table th:nth-child(4), .listing-table td:nth-child(4) { width: 20%; }  /* Location */
.listing-table th:nth-child(5), .listing-table td:nth-child(5) { width: 9%; }   /* Posted   */
.listing-table th:nth-child(6), .listing-table td:nth-child(6) { width: 9%; }   /* Status   */
.listing-table th:nth-child(7), .listing-table td:nth-child(7) { width: 8%; }   /* Apply    */

/* "41m ago" breaking across two lines made every row taller than its content
   needed. Same for the pills and the link. */
.listing-table td:nth-child(5),
.listing-table td:nth-child(6),
.listing-table td:nth-child(7) { white-space: nowrap; }

.listing-table td { vertical-align: top; }
.listing-table td:nth-child(1) { font-weight: 500; }

/* Long role titles get two lines, then an ellipsis. The clamp lives on an
   inner span: setting display:-webkit-box on the <td> itself takes the cell
   out of table layout entirely, which collapses the column to a sliver. */
.listing-table td .role-cell {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 900px) {
  /* Below this the fixed proportions stop helping; let it scroll instead. */
  .listing-table { table-layout: auto; min-width: 820px; }
  #list-table-wrap { overflow-x: auto; }
}

/* Term filter sits at the right of the deck nav. Absolutely positioned so the
   prev/next controls stay optically centred on the card rather than being
   shoved left by the select's width. */
.deck-nav { position: relative; }

#deck-term-filter {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  /* Base `select` rules set width:100%, which made this cover the whole nav
     and hide the arrows behind it. */
  width: auto;
  min-width: 9.5rem;
}

@media (max-width: 760px) {
  /* Absolute positioning stops working once the nav needs to wrap. */
  .deck-nav { flex-wrap: wrap; }
  #deck-term-filter { position: static; transform: none; width: 100%; }
}


/* ============================================================
   Touch targets
   ============================================================ */

/* Below this width the app is being used on a phone, where 34-37px controls
   are under both Apple's 44pt and Android's 48dp minimums and get mis-tapped.
   Desktop keeps the tighter sizing, where a mouse is precise. */
@media (max-width: 760px) {
  .tab-btn,
  .btn,
  .icon-btn,
  #deck-term-filter,
  .list-filters select,
  .draft-details > summary {
    min-height: 44px;
  }

  .icon-btn { min-width: 44px; }

  .btn, .tab-btn { padding-inline: 16px; }

  /* Links inside a line of text can't grow without breaking the line, so give
     them vertical padding instead of a min-height. */
  .card-actions a,
  .pdf-actions a,
  .row-link {
    display: inline-block;
    padding: 11px 0;
  }

  /* The deck controls are the primary navigation on a phone: give them room. */
  .deck-nav { gap: 12px; }

  main { padding: 20px 16px 64px; }
  .card { padding: 20px 16px; }
}

/* The cover letter is prose you read and edit, not code. Monospace made it
   roughly a third wider per line, which on a phone meant constant reflow and
   about six words a line. */
#field-cover { font-family: inherit; line-height: 1.65; }

@media (max-width: 760px) {
  /* Header and its buttons were colliding: the label sat under "Generate all". */
  .questions-header {
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
  }
  .questions-actions { margin-left: auto; }

  /* Long titles get room rather than three words a line. */
  #card-title { font-size: 1.25rem; }
}

/* ---------- programs tab ---------- */

.programs-intro {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}

.programs-intro p { max-width: 62ch; margin: 0; font-size: 13px; }
.programs-intro .btn { flex-shrink: 0; }

#programs-status { margin: 12px 0 18px; font-size: 13px; }

.program-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

/* Disabled entries stay legible rather than being greyed to the edge of
   readability: the eligibility line on them is the whole reason to keep them. */
.program-card-off { background: var(--surface-sunken); box-shadow: none; }

.program-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.program-head h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.program-head p { margin: 0; font-size: 12px; }

.program-when { margin: 12px 0 0; font-size: 13px; color: var(--text); }
.program-elig,
.program-note { margin: 6px 0 0; font-size: 12px; color: var(--text-secondary); }
/* `.btn` sets no display, which is harmless on a <button> and not on an <a>:
   left inline, its vertical padding spills out of the line box and paints over
   the note above it. */
.program-card .btn { display: inline-block; margin-top: 14px; text-decoration: none; }

/* Only "Open now" is filled in. It is the one state that was observed rather
   than predicted, and it should be the only thing that pulls the eye. */
.prog-open { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.prog-due { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.prog-upcoming { background: var(--surface-sunken); color: var(--text-secondary); }
.prog-closed { opacity: .55; text-decoration: line-through; }
.prog-unknown { opacity: .6; }

@media (max-width: 640px) {
  .programs-intro { flex-direction: column; gap: 12px; }
}
.program-pills { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.program-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.program-actions .btn { margin-top: 0; }

/* A decision you have recorded, as opposed to a state that was observed. */
.prog-applied { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.prog-skipped { opacity: .6; }

/* Country tag beside a location. Only the ones you can't take are coloured --
   Canada and the US are the expected case and shouldn't shout. */
.region-tag {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .04em;
  background: var(--surface-sunken);
  color: var(--text-muted);
  white-space: nowrap;
}
.region-other { background: var(--warn-bg); color: var(--warn-text); }
