/* ROOVI area styles: ops (inbox, request, athletes, athlete). Owned by the ops area owner.
   Uses the tokens and components from css/app.css. Every selector is scoped under a class
   prefixed "ops-" so areas never collide. Desktop first for the team (dataTable, two column
   request page) but usable at 390px: tables stack into cards, no horizontal scroll. */

/* ----- shared bits ----- */
.ops-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.ops-unassigned { color: var(--text-tertiary); }
.ops-assignee { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.ops-with-chip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ops-item-links { display: flex; flex-wrap: wrap; gap: 0 var(--space-4); margin-top: 4px; }
/* inline links in side panels and lists keep a 44px tap target */
.ops-kv a.link, .ops-item-links a.link { display: inline-flex; align-items: center; min-height: 44px; }

/* stacked definition lists (label above value) for the narrow side panels */
.ops-kv-stack .kv-row { flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 0; }
.ops-kv-stack dt { max-width: none; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.ops-kv-stack dd { max-width: 100%; text-align: left; font-weight: 500; }
.ops-kv dd { font-weight: 500; }

/* ----- filters and tabs ----- */
.ops-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--space-3); margin-bottom: var(--space-2); }
.ops-filters .field { margin-bottom: var(--space-3); }
@media (min-width: 640px) {
  .ops-filters { grid-template-columns: repeat(2, minmax(0, 280px)); }
  .ops-filters-athletes { grid-template-columns: minmax(0, 360px) minmax(0, 280px); }
}
.ops-tab-label { position: relative; display: inline-flex; align-items: center; gap: 8px; } /* position: keeps the sr-only text inside the scrolling tab strip */
.ops-tab-count {
  min-width: 22px; padding: 0 7px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text-secondary);
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.tab-btn.is-active .ops-tab-count { background: var(--accent-tint); border-color: var(--accent-border); color: var(--accent-strong); }

/* ----- inbox and athletes tables ----- */
.ops-who { display: inline-flex; flex-direction: column; gap: 1px; text-align: left; }
.ops-who-name { font-weight: 700; }
.ops-who-club { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.ops-col-subject { max-width: 320px; }
.ops-subject { display: block; overflow-wrap: anywhere; }
.ops-age { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ops-score { display: inline-flex; align-items: center; gap: var(--space-2); }
.ops-meter { display: block; width: 96px; height: 8px; border-radius: var(--radius-pill); background: var(--border); overflow: hidden; }
.ops-meter-fill { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--accent); }
.ops-score-value { min-width: 3ch; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ----- request page ----- */
.ops-header-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.ops-header-assignee, .ops-header-age { font-size: 14px; color: var(--text-secondary); }

.ops-request-grid {
  display: grid; align-items: start; gap: var(--space-4);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "handling" "details" "athlete" "copy" "thread" "audit";
}
.ops-area { min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.ops-area > .card + .card { margin-top: 0; }
.ops-area-handling { grid-area: handling; }
.ops-area-details { grid-area: details; }
.ops-area-athlete { grid-area: athlete; }
.ops-area-copy { grid-area: copy; }
.ops-area-thread { grid-area: thread; }
.ops-area-audit { grid-area: audit; }
@media (min-width: 960px) {
  .ops-request-grid {
    grid-template-columns: minmax(0, 1fr) 360px;
    grid-template-areas:
      "details handling"
      "details athlete"
      "copy    athlete"
      "thread  athlete"
      "audit   athlete";
  }
}

.ops-inline-form { display: flex; flex-wrap: wrap; align-items: stretch; gap: var(--space-2); }
.ops-inline-form .select { flex: 1 1 220px; width: auto; min-width: 0; }
.ops-inline-form .btn { flex: none; }
.ops-handling-quick { margin: calc(-1 * var(--space-2)) 0 var(--space-4); }

.ops-request-subject { margin: 0 0 var(--space-3); font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.ops-subtitle { margin: var(--space-4) 0 var(--space-2); font-size: 14px; font-weight: 700; color: var(--text-secondary); }
.ops-question {
  margin: 0 0 var(--space-3); padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.ops-answer-shown {
  margin-bottom: var(--space-3); padding: var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-secondary);
}
.ops-message-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.ops-help-link { margin-top: var(--space-3); }
.ops-received { margin-top: var(--space-3); }
.ops-listing { margin-bottom: var(--space-3); }
.ops-listing-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ops-listing-url { margin: 8px 0 12px; font-family: var(--mono); font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; word-break: break-all; }
.ops-listing-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
/* a Luntero listing: photo (4:3), title, facts, then one button per source */
.ops-listing-luntero { display: flex; flex-direction: column; gap: var(--space-2); }
/* capped so the price, city, id and source buttons stay above the fold on desktop; still full width on a phone */
.ops-listing-photo { display: block; width: 100%; max-width: 320px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.ops-listing-photo-empty { display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); color: var(--text-tertiary); }
.ops-listing-title { margin: var(--space-2) 0 0; font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.ops-listing-sources { margin-top: var(--space-2); }
.ops-viewing-banner { margin-top: var(--space-3); }
.ops-employer-flag { margin-top: var(--space-4); }
.ops-employer-flag .btn { margin-top: var(--space-2); }

/* housing status flow */
.ops-flow-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); }
.ops-flow-head .card-title { margin: 0; }
.ops-steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); margin: var(--space-4) 0; padding: 0; }
.ops-step { display: flex; flex-direction: column; padding-top: 10px; border-top: 4px solid var(--border-strong); font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.ops-step-done { border-top-color: var(--accent); color: var(--accent-strong); }
.ops-step-done .ops-step-label::before { content: "\2713\00a0"; }
.ops-step-current { border-top-color: var(--amber-strong); color: var(--text); font-weight: 700; }
.ops-step-current .ops-step-label::before { content: "\25CF\00a0"; color: var(--amber-strong); }
.ops-step-dot { display: none; }
.ops-flow-cancelled { margin-bottom: var(--space-3); font-weight: 600; }
.ops-flow-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ops-viewing-form .field:last-of-type { margin-bottom: 0; }
.ops-sheet-problem:empty { display: none; }
.ops-sheet-problem { margin-top: var(--space-3); }

/* copy text */
.ops-copytext {
  max-height: 360px; overflow: auto;
  padding: var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.ops-copy-actions { margin-top: var(--space-3); }

/* conversation */
.ops-thread { list-style: none; display: flex; flex-direction: column; gap: var(--space-3); margin: 0 0 var(--space-4); padding: 0; }
.ops-thread-empty { margin: 0 0 var(--space-4); }
.ops-msg { padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.ops-msg-team { background: var(--accent-tint); border-color: var(--accent-border); }
.ops-msg-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: 6px; }
.ops-msg-who { font-weight: 700; }
.ops-msg-time { margin-left: auto; font-size: 12px; color: var(--text-secondary); }
.ops-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.ops-msg-read { margin-top: 6px; font-size: 12px; color: var(--text-secondary); }
.ops-reply > * + * { margin-top: var(--space-3); }
.ops-reply .field { margin-bottom: 0; }

/* ----- athlete page ----- */
.ops-glance { margin: 0 0 var(--space-4); }
.ops-person-grid { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); margin-bottom: var(--space-6); }
.ops-person-grid > .card + .card { margin-top: 0; }
@media (min-width: 960px) {
  .ops-person-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; }
}
.ops-tasks-intro { margin-bottom: var(--space-4); }
.ops-module { margin-bottom: var(--space-6); }
.ops-module-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); margin: 0 0 var(--space-2); font-size: 16px; font-weight: 700; }
.ops-module-progress { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.ops-task-title { display: flex; flex-direction: column; gap: 2px; }
.ops-task-name { font-weight: 600; }
.ops-task-note { display: block; font-size: 12px; color: var(--text-secondary); }
.ops-task-status { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.ops-task-control { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.ops-task-control .select { width: auto; min-width: 140px; }
.ops-task-done { font-size: 13px; color: var(--text-secondary); }
.ops-task-focus td { background: var(--amber-tint); }
.ops-task-focus { outline: 2px solid var(--amber-border); outline-offset: -2px; }
.ops-col-control { min-width: 330px; }

/* ----- phones: tables are stacked cards, keep values readable and inside the card ----- */
@media (max-width: 639px) {
  .ops-who, .ops-task-title, .ops-task-status { align-items: flex-end; text-align: right; }
  .ops-task-control { justify-content: flex-end; }
  .ops-col-subject { max-width: none; }
  .ops-col-control { min-width: 0; }
  .ops-inline-form .select { flex-basis: 100%; }
  .ops-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--space-3); }
  .ops-flow-actions .btn, .ops-listing-actions .btn { flex: 1 1 100%; }
}
