/* JA-052 job C: Roles feed, Hidden roles, Apply queue folders, pack choices and agent instructions.
   Part 1 is the workflow the classic look gets too (counted links, Hidden roles view, Resume pack part, agent instructions);
   it uses only tokens from tokens.css. Part 2 is the desk look: every rule starts with :root[data-ui="desk"], so with the
   attribute off nothing in it matches and the classic look is unchanged. Values come from the V5 design (paper cards, rubber
   stamps, folders with paper peeking out); the desk tokens from desk-shell.css are used with the design's value as fallback. */

/* ============================================================================
   Part 1: shared by both looks
   ========================================================================== */

/* Counted links in the feed toolbar: Hidden roles and the roles waiting for a friend. */
.v5-count-link {
  text-decoration: none;
}

.v5-count-link:hover {
  text-decoration: none;
}

/* Four counts and links now share the toolbar line with the search box, so the pills are a little tighter. */
.v7-feed-tools .v7-opportunity-counts {
  gap: 4px;
}

.v7-feed-tools .v7-stat-pill {
  padding: 0 9px;
  gap: 4px;
}

/* Hidden roles view (/jobs?view=hidden) */
.v7-hidden-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
}

.v7-hidden-lead {
  margin: 0;
  max-width: 62ch;
  font-size: 13px;
  line-height: 19px;
}

.v7-count-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 11px;
  border: 1px solid var(--rule);
  border-radius: calc(var(--r-box) * 99);
  background: var(--wash);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.v7-hidden-page .v7-text-link {
  align-self: flex-start;
  gap: var(--sp-1);
}

/* The sheet of paper that flies to the Apply folder. A copy of the card, thrown away when the flight ends. */
.v5-fly-ghost {
  position: fixed;
  margin: 0;
  z-index: 70;
  pointer-events: none;
  transform-origin: center;
  overflow: hidden;
}

/* The paper that peeks out of an Apply folder is part of the desk look only. */
.v5-peek {
  display: none;
}

/* Under the Apply queue toolbar */
.v5-agent-slot:empty {
  display: none;
}

/* One notice area under the queue toolbar (JA-052 F2): the "That's a lot for one sitting" reminder and the notes said once for
   many rows ("N roles marked Needs a look ...") share one box, one message to a line, in both looks. */
.v5-queue-notices {
  border: 1px solid var(--caution);
  border-radius: calc(var(--r-box) + 4px);
  background: var(--caution-wash);
  color: var(--caution);
  overflow: hidden;
}

.v5-queue-notices .v7-queue-shared-notes {
  gap: 0;
}

.v5-queue-notice-line,
.v5-queue-notices .v7-queue-shared-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 30px;
  max-width: none;
  margin: 0;
  padding: 3px 12px;
  border-radius: 0;
  background: transparent;
  font-size: 13px;
  line-height: 19px;
}

.v5-queue-notice-text {
  min-width: 0;
}

/* A thin rule between two messages, never through one */
.v5-queue-notice-pace:not(:empty) + .v7-queue-shared-notes:not(:empty),
.v5-queue-notices .v7-queue-shared-note + .v7-queue-shared-note {
  border-top: 1px solid var(--rule);
}

.v5-queue-notice-dismiss {
  flex: none;
  color: var(--caution);
}

@media (min-width: 900px) {
  .v5-queue-notice-dismiss {
    min-height: 28px;
    padding: 0 var(--sp-2);
  }
}

/* Instructions for your AI agent (collapsed under the queue toolbar) */
.v5-agent-instructions {
  border: 1px solid var(--rule);
  border-radius: calc(var(--r-box) + 4px);
  background: var(--page);
  color: var(--ink);
}

.v5-agent-summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 19px;
  font-weight: 600;
  cursor: pointer;
}

.v5-agent-body {
  padding: 0 14px 14px;
}

.v5-agent-lead {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 19px;
}

.v5-agent-facts {
  margin: 0;
  font-size: 13px;
  line-height: 19px;
}

.v5-agent-text {
  width: 100%;
  min-height: 160px;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 19px;
}

.v5-agent-actions {
  gap: var(--sp-2) var(--sp-3);
}

.v5-agent-copied {
  min-height: 19px;
  color: var(--good);
  font-size: 13px;
  line-height: 19px;
  font-weight: 600;
}

/* Resume pack: a collapsible part inside each Apply queue row */
.v5-pack-choices {
  border-top: 1px dashed var(--rule);
  padding-top: 2px;
}

.v5-pack-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px var(--sp-3);
  min-height: 36px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 19px;
  cursor: pointer;
}

.v5-pack-title {
  font-weight: 600;
}

.v5-pack-summary-text {
  color: var(--ink-2);
  font-size: 12px;
  line-height: 18px;
}

.v5-pack-body {
  padding: 4px 0 6px;
}

.v5-pack-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-2) var(--sp-3);
}

.v5-pack-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.v5-pack-field label {
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}

.v5-pack-field .select {
  width: 100%;
  min-height: 38px;
  padding: 6px var(--sp-2);
  font-size: 13px;
  line-height: 19px;
}

.v5-pack-note {
  margin: 0;
  font-size: 12px;
  line-height: 18px;
}

@media (max-width: 899px) {
  /* Filters and Add role share a line; the batch button, which is full width, comes after them. */
  .v7-feed-tools .v7-bulk-apply-btn {
    order: 3;
  }

  .v5-pack-fields {
    grid-template-columns: 1fr;
  }

  .v5-pack-summary,
  .v5-pack-choices .btn,
  .v5-pack-field .select,
  .v5-agent-actions .btn,
  .v7-hidden-page .v7-text-link {
    min-height: 44px;
  }

  .v5-agent-text {
    min-height: 200px;
  }
}

/* ============================================================================
   Part 2: the desk look (everything below starts with :root[data-ui="desk"])
   ========================================================================== */

:root[data-ui="desk"] {
  --v5c-ink: var(--window-ink, #17283F);
  --v5c-hard: 4px 4px 0 0 rgba(23, 40, 63, 0.92);
  --v5c-hard-sm: 3px 3px 0 0 rgba(23, 40, 63, 0.92);
  --v5c-paper: var(--paper, #FFFEFA);
  --v5c-paper-shadow: var(--paper-shadow, 2px 3px 0 rgba(23, 40, 63, 0.3), 8px 14px 20px rgba(23, 40, 63, 0.12));
  --v5c-folder: var(--folder, #FFC53D);
  --v5c-folder-ink: var(--folder-ink, #17283F);
  --v5c-cream: #F6EDD6;
  --v5c-note: var(--sticky-yellow, #FFF3A0);
  --v5c-stamp-green: #176B4C;
  --v5c-stamp-blue: #264CA7;
  --v5c-stamp-amber: #85550A;
  --v5c-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* ---- The feed toolbar and its counts ---- */
:root[data-ui="desk"] .v7-feed-tools {
  border: 1.5px solid var(--paper-edge, #E9DCC0);
  border-radius: 12px;
  background: var(--v5c-paper);
}

:root[data-ui="desk"] .v7-stat-pill {
  border: 1px solid var(--v5c-ink);
  background: var(--v5c-cream);
  color: var(--ink);
}

:root[data-ui="desk"] .v7-stat-pill.is-link {
  background: var(--v5c-paper);
  color: var(--ink);
}

:root[data-ui="desk"] .v7-stat-pill.is-link:hover,
:root[data-ui="desk"] .v7-stat-pill.is-link:focus-visible {
  background: var(--v5c-cream);
  border-color: var(--v5c-ink);
}

:root[data-ui="desk"] .v7-stat-pill strong,
:root[data-ui="desk"] .v7-stat-pill.is-link strong {
  color: var(--ink);
  font-family: var(--v5c-mono);
  font-size: 12px;
}

:root[data-ui="desk"] .v7-count-chip {
  border: 1.5px solid var(--v5c-ink);
  background: var(--v5c-cream);
  font-family: var(--v5c-mono);
}

:root[data-ui="desk"] .v7-undo-bar,
:root[data-ui="desk"] .v7-queue-feedback {
  border: 1.5px dashed var(--v5c-ink);
  border-radius: 10px;
  background: var(--v5c-note);
}

:root[data-ui="desk"] .v7-undo-bar-copy {
  color: var(--ink);
}

:root[data-ui="desk"] .v7-empty-panel {
  border: 1.5px dashed var(--v5c-ink);
  background: var(--v5c-paper);
}

/* ---- Paper role cards, with the match verdict as a rubber stamp ---- */
:root[data-ui="desk"] .v7-role-card {
  position: relative;
  padding: 26px 18px 16px;
  border: 1.5px solid var(--v5c-ink);
  border-radius: 4px 4px 12px 12px;
  /* Plain paper (JA-052 F2): the red stationery rule that ran across the card at the height of the place label is gone, so no
     label or word sits on a line. */
  background-color: var(--v5c-paper);
  box-shadow: var(--v5c-paper-shadow);
}

:root[data-ui="desk"] .v7-role-card:hover {
  border-color: var(--v5c-ink);
  box-shadow: 3px 5px 0 rgba(23, 40, 63, 0.45), 10px 18px 24px rgba(23, 40, 63, 0.14);
}

/* The paper clip */
:root[data-ui="desk"] .v7-role-card::before {
  content: "";
  position: absolute;
  top: -13px;
  left: 22px;
  width: 15px;
  height: 34px;
  z-index: 2;
  pointer-events: none;
  border: 2.5px solid #7D8AA0;
  border-radius: 8px;
  transform: rotate(4deg);
}

/* The turned-up corner */
:root[data-ui="desk"] .v7-role-card::after {
  content: "";
  position: absolute;
  right: -1.5px;
  bottom: -1.5px;
  width: 20px;
  height: 20px;
  pointer-events: none;
  background: linear-gradient(135deg, transparent 50%, #E8DDBF 50%, #F8F0DA 100%);
  border-radius: 0 0 12px 0;
  border-top-left-radius: 4px;
  box-shadow: -2px -2px 3px rgba(23, 40, 63, 0.12);
}

:root[data-ui="desk"] .v7-role-card-head {
  flex-wrap: wrap;
  gap: 6px var(--sp-2);
  margin-bottom: 8px;
  padding-left: 28px;
}

:root[data-ui="desk"] .v7-role-card-head .v7-match-score {
  margin-left: auto;
}

:root[data-ui="desk"] .v7-role-type {
  padding: 2px 8px;
  border: 1.5px dashed rgba(23, 40, 63, 0.4);
  border-radius: 4px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--v5c-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

:root[data-ui="desk"] .v7-match-score {
  min-height: 0;
  padding: 5px 8px;
  border: 2px solid currentColor;
  border-radius: 4px;
  background: transparent;
  color: var(--v5c-stamp-green);
  font-family: var(--v5c-mono);
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: rotate(-3deg);
  opacity: 0.92;
}

:root[data-ui="desk"] .v7-match-score.is-good {
  color: var(--v5c-stamp-blue);
  background: transparent;
}

:root[data-ui="desk"] .v7-match-score.is-possible {
  color: var(--v5c-stamp-amber);
  background: transparent;
}

:root[data-ui="desk"] .v7-role-title {
  padding: 4px 0 2px;
  font-size: 17px;
  line-height: 22px;
  font-weight: 700;
}

:root[data-ui="desk"] .v7-role-title:hover,
:root[data-ui="desk"] .v7-role-title:focus-visible {
  color: var(--v5c-stamp-blue);
}

:root[data-ui="desk"] .v7-role-sponsor {
  border-top: 1.5px dashed rgba(23, 40, 63, 0.25);
}

:root[data-ui="desk"] .v7-role-card-actions {
  gap: 8px;
  padding-top: 10px;
}

/* The paper's buttons are printed with a hard edge, like the folders. */
:root[data-ui="desk"] .v7-role-card .btn-primary,
:root[data-ui="desk"] .v7-role-card .btn-secondary,
:root[data-ui="desk"] .v7-queue-row .btn-primary,
:root[data-ui="desk"] .v7-queue-row .btn-secondary,
:root[data-ui="desk"] .v5-agent-instructions .btn-secondary,
:root[data-ui="desk"] .v7-empty-panel .btn-primary,
:root[data-ui="desk"] .v7-empty-panel .btn-secondary {
  border: 1.5px solid var(--v5c-ink);
  border-radius: 10px;
  box-shadow: var(--v5c-hard-sm);
}

:root[data-ui="desk"] .v7-role-card .btn-primary:active:not(:disabled),
:root[data-ui="desk"] .v7-role-card .btn-secondary:active:not(:disabled),
:root[data-ui="desk"] .v7-queue-row .btn-primary:active:not(:disabled),
:root[data-ui="desk"] .v7-queue-row .btn-secondary:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 0 rgba(23, 40, 63, 0.92);
}

/* Hidden roles: the same paper, dashed like something set aside */
:root[data-ui="desk"] .v5-hidden-card {
  border-style: dashed;
  box-shadow: 2px 3px 0 rgba(23, 40, 63, 0.2);
}

:root[data-ui="desk"] .v5-hidden-card:hover {
  box-shadow: 2px 3px 0 rgba(23, 40, 63, 0.2);
}

:root[data-ui="desk"] .v7-hidden-grid {
  padding-top: 12px;
  row-gap: 24px;
}

:root[data-ui="desk"] .v7-role-grid {
  padding-top: 12px;
  row-gap: 24px;
}

/* ---- Apply queue: a manila folder per role, with the paper peeking out ---- */
:root[data-ui="desk"] .v7-queue-list.v7-queue-stack {
  row-gap: 40px;
  padding-top: 30px;
}

:root[data-ui="desk"] .v7-queue-card.v7-queue-row {
  position: relative;
  gap: 8px;
  border: 1.5px solid var(--v5c-ink);
  border-radius: 4px 14px 14px 14px;
  background-color: var(--v5c-folder);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 60px);
  box-shadow: var(--v5c-hard);
  color: var(--ink);
}

:root[data-ui="desk"] .v7-queue-card.v7-queue-row.is-in-process {
  border-color: var(--v5c-ink);
}

/* The folder's tab */
:root[data-ui="desk"] .v7-queue-card.v7-queue-row::before {
  content: "";
  position: absolute;
  top: -13px;
  left: -1.5px;
  width: 100px;
  height: 13px;
  background: var(--folder-tab, #FFC53D);
  border: 1.5px solid var(--v5c-ink);
  border-bottom: 0;
  border-radius: 9px 14px 0 0;
  pointer-events: none;
}

/* An empty slot inside the folder (the remove confirmation, before it is asked) takes no room. */
:root[data-ui="desk"] .v7-queue-card.v7-queue-row > div:empty {
  display: none;
}

/* The paper peeking out of the folder */
:root[data-ui="desk"] .v7-queue-row .v5-peek {
  display: block;
  position: absolute;
  left: 126px;
  right: 18px;
  top: -25px;
  height: 25px;
  pointer-events: none;
}

:root[data-ui="desk"] .v5-peek i {
  position: absolute;
  bottom: 0;
  background: #FFFFFF;
  border: 1.5px solid var(--v5c-ink);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

:root[data-ui="desk"] .v5-peek i:nth-child(1) {
  left: 8px;
  right: -6px;
  height: 20px;
  transform: rotate(1.6deg);
  background: #F4EEDC;
  transform-origin: bottom left;
}

:root[data-ui="desk"] .v5-peek i:nth-child(2) {
  left: 0;
  right: 0;
  height: 24px;
  transform: rotate(-0.8deg);
  transform-origin: bottom right;
}

:root[data-ui="desk"] .v7-queue-title-btn {
  color: var(--ink);
}

:root[data-ui="desk"] .v7-queue-company,
:root[data-ui="desk"] .v7-queue-version,
:root[data-ui="desk"] .v7-queue-loc,
:root[data-ui="desk"] .v7-queue-subline {
  color: var(--v5c-folder-ink);
}

:root[data-ui="desk"] .v7-queue-row .v7-status-badge {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

:root[data-ui="desk"] .v7-queue-row .v7-queue-eta-pill {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

:root[data-ui="desk"] .v7-queue-row .v7-attention-line {
  border: 1.5px dashed var(--v5c-stamp-amber);
  background: #FFF4D2;
  color: #5B3A06;
}

:root[data-ui="desk"] .v7-queue-row .btn-quiet {
  color: #3F3210;
}

:root[data-ui="desk"] .v7-queue-pager .btn {
  border: 1.5px solid var(--v5c-ink);
  box-shadow: var(--v5c-hard-sm);
}

/* Resume pack inside the folder: a loose sheet clipped to the inside of it */
:root[data-ui="desk"] .v5-pack-choices {
  border-top: 1.5px dashed var(--v5c-ink);
}

:root[data-ui="desk"] .v5-pack-summary {
  color: var(--ink);
}

:root[data-ui="desk"] .v5-pack-summary-text,
:root[data-ui="desk"] .v5-pack-field label,
:root[data-ui="desk"] .v5-pack-note {
  color: var(--v5c-folder-ink);
}

:root[data-ui="desk"] .v5-pack-field .select {
  border: 1.5px solid var(--v5c-ink);
  background: var(--v5c-paper);
}

/* ---- The top of the queue, compacted (JA-052 F2): the toolbar, the agent disclosure and the notice area sit close together so the
   first folder starts high on the page. Nothing is left out. ---- */
:root[data-ui="desk"] .v7-queue-toolbar {
  padding: 7px 14px;
}

@media (min-width: 900px) {
  :root[data-ui="desk"] .v5-agent-summary {
    min-height: 40px;
  }
}

:root[data-ui="desk"] .v7-queue-list.v7-queue-stack {
  padding-top: 26px;
}

/* ---- The notice area: one dashed amber note under the toolbar ---- */
:root[data-ui="desk"] .v5-queue-notices {
  border: 1.5px dashed var(--v5c-stamp-amber);
  border-radius: 10px;
  background: #FFF4D2;
  color: #5B3A06;
}

:root[data-ui="desk"] .v5-queue-notices .v7-queue-shared-note {
  color: #5B3A06;
}

:root[data-ui="desk"] .v5-queue-notice-pace:not(:empty) + .v7-queue-shared-notes:not(:empty),
:root[data-ui="desk"] .v5-queue-notices .v7-queue-shared-note + .v7-queue-shared-note {
  border-top: 1px dashed rgba(133, 85, 10, 0.45);
}

:root[data-ui="desk"] .v5-queue-notice-dismiss {
  color: #5B3A06;
  font-weight: 700;
}

/* ---- Instructions for your AI agent ---- */
:root[data-ui="desk"] .v5-agent-instructions {
  border: 1.5px solid var(--v5c-ink);
  border-radius: 10px;
  background: var(--v5c-cream);
}

:root[data-ui="desk"] .v5-agent-summary {
  color: var(--ink);
  font-weight: 700;
}

:root[data-ui="desk"] .v5-agent-text {
  border: 1.5px solid var(--v5c-ink);
  background: var(--v5c-paper);
}

:root[data-ui="desk"] .v5-agent-copied {
  color: var(--v5c-stamp-green);
}

/* ---- Motion: only when the person has not asked for less ---- */
@media (prefers-reduced-motion: no-preference) {
  :root[data-ui="desk"] .v7-queue-row .v5-peek {
    transition: transform 200ms cubic-bezier(0.3, 1.4, 0.5, 1);
  }

  :root[data-ui="desk"] .v7-queue-row:hover .v5-peek,
  :root[data-ui="desk"] .v7-queue-row:focus-within .v5-peek {
    transform: translateY(-9px);
  }

  /* The Apply folder on the shelf gulps when a paper lands in it. */
  :root[data-ui="desk"] [data-testid="nav-apply"].v5-gulp {
    animation: v5c-gulp 360ms ease;
  }

  @keyframes v5c-gulp {
    0% {
      transform: scale(1);
    }

    40% {
      transform: scale(1.06);
    }

    100% {
      transform: scale(1);
    }
  }
}

/* ---- Phone: the paper is flat (no hard shadows), one column ---- */
@media (max-width: 899px) {
  :root[data-ui="desk"] .v7-role-card,
  :root[data-ui="desk"] .v5-hidden-card,
  :root[data-ui="desk"] .v7-queue-card.v7-queue-row {
    box-shadow: none;
  }

  :root[data-ui="desk"] .v7-role-card .btn-primary,
  :root[data-ui="desk"] .v7-role-card .btn-secondary,
  :root[data-ui="desk"] .v7-queue-row .btn-primary,
  :root[data-ui="desk"] .v7-queue-row .btn-secondary,
  :root[data-ui="desk"] .v5-agent-instructions .btn-secondary,
  :root[data-ui="desk"] .v7-empty-panel .btn-primary,
  :root[data-ui="desk"] .v7-empty-panel .btn-secondary,
  :root[data-ui="desk"] .v7-queue-pager .btn {
    box-shadow: none;
  }

  :root[data-ui="desk"] .v7-queue-row .v5-peek {
    left: 112px;
    right: 12px;
  }

  :root[data-ui="desk"] .v7-queue-list.v7-queue-stack {
    row-gap: 36px;
    padding-top: 22px;
  }

  /* The count line and "Browse roles" share a row instead of using three */
  :root[data-ui="desk"] .v7-queue-toolbar {
    flex-wrap: nowrap;
    align-items: center;
  }

  :root[data-ui="desk"] .v7-queue-toolbar-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  :root[data-ui="desk"] .v7-queue-toolbar-actions {
    flex: none;
  }
}
