/* Companionships (InterviewsDesktop, InterviewsPhone), a companionship's page and a district's page
   (DistrictDesktop, DistrictPhone).  At 1024px and up the district cards hold a table of rows; below that each row
   becomes a small card of its own with the badge top right and the buttons in two columns, and the Organization
   switch moves into the navy header. */

@media (min-width: 1024px) { .comp-phone-only { display: none !important; } }
@media (max-width: 1023px) { .comp-desktop-only { display: none !important; } }

/* The Scheduled badge; Done, Overdue and Never interviewed use the shared badges.  Done is one color everywhere. */
.badge-scheduled { background: var(--gold-50); color: var(--gold-900); }

/* The Organization switch sits in the tools row on both sizes; on phones it takes the full width. */
.comp-phone-switch { flex-basis: 100%; }
.comp-phone-switch .segmented { width: 100%; }
.comp-phone-switch .segmented-item { flex: 1 1 0; padding: 0 6px; font-size: 13px; white-space: normal; text-align: center; line-height: 1.2; }

/* Switch, chips and the bar legend. */
.comp { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.comp-tools { display: flex; align-items: center; gap: var(--space-12); flex-wrap: wrap; }
.comp-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-500); }
.comp-legend > span { display: flex; align-items: center; gap: 6px; }
.comp-swatch { width: 10px; height: 10px; border-radius: 2px; }
.comp-swatch-in { background: var(--navy-700); }
.comp-swatch-other { background: var(--navy-300); }
.comp-swatch-scheduled { background: var(--gold-400); }
@media (max-width: 1023px) {
  .comp { gap: 16px; }
  .comp-tools .chips { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
}

/* Quarter tiles. */
.comp-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.comp-tile {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 20px; border-radius: var(--radius-card); min-width: 0;
}
.comp-tile-label { font-size: 13px; font-weight: 600; }
.comp-tile-value { font-family: var(--font-display); font-size: 36px; font-weight: var(--weight-display); line-height: 1; }
.comp-tile-note { font-size: 12px; overflow-wrap: anywhere; }
.comp-tile-navy { background: var(--navy-950); color: var(--gold-200); }
.comp-tile-navy .comp-tile-label, .comp-tile-navy .comp-tile-note { color: var(--navy-200); }
.comp-tile-white { background: #FFFFFF; color: var(--navy-700); border: 1px solid var(--border-card); }
.comp-tile-white .comp-tile-label, .comp-tile-white .comp-tile-note { color: var(--ink-500); }
.comp-tile-ruby { background: var(--ruby-800); color: #FFFFFF; }
.comp-tile-ruby .comp-tile-label, .comp-tile-ruby .comp-tile-note { color: var(--ruby-100); }
.comp-tile-walnut { background: var(--walnut-900); color: var(--gold-200); }
.comp-tile-walnut .comp-tile-label, .comp-tile-walnut .comp-tile-note { color: var(--walnut-300); }
.comp-tiles-district .comp-tile-navy { color: #FFFFFF; }
.comp-tiles-district .comp-tile-white { color: var(--ink-900); }
@media (max-width: 1023px) {
  .comp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .comp-tile { padding: 14px; gap: 4px; }
  .comp-tile-label { font-size: 12px; }
  .comp-tile-value { font-size: 32px; }
  .comp-tile-note { font-size: 11px; }
}

.comp-org-title { font-family: var(--font-display); font-size: var(--type-section); font-weight: var(--weight-display); color: var(--walnut-900); }

/* District cards. */
.comp-district { min-width: 0; overflow: hidden; }
.comp-district-head { display: flex; align-items: center; gap: 16px; padding: 16px 22px; }
.comp-district-head-plain { justify-content: space-between; align-items: baseline; padding: 16px 22px 10px; }
.comp-district-text { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.comp-district-name { font-family: var(--font-display); font-size: 20px; font-weight: var(--weight-display); color: var(--navy-950); }
.comp-district-link { color: inherit; text-decoration: none; }
.comp-district-link:hover { color: var(--navy-700); text-decoration: underline; }
.comp-district-leader { font-size: 13px; color: var(--ink-500); }
.comp-district-summary { font-size: 14px; font-weight: 700; color: var(--navy-700); white-space: nowrap; }
.comp-district-progress { display: flex; flex-direction: column; gap: var(--space-8); width: 300px; flex-shrink: 0; }
.comp-bar { display: block; width: 100%; height: 10px; border-radius: 6px; background: var(--paper-200); }
.comp-bar-in { fill: var(--navy-700); }
.comp-bar-other { fill: var(--navy-300); }
.comp-bar-scheduled { fill: var(--gold-400); }
@media (max-width: 1023px) {
  .comp-district-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px; }
  .comp-district-head-plain { display: flex; padding: 14px 14px 6px; }
  .comp-district-summary { white-space: normal; text-align: right; font-size: 13px; }
  .comp-district-progress { grid-column: 1 / -1; width: 100%; }
}

/* Rows: a table on desktop. */
.comp-rows { list-style: none; margin: 0; padding: 0; }
.comp-grid, .comp-row {
  display: grid; grid-template-columns: 1.6fr 0.6fr 1.1fr 1.3fr 190px; gap: 16px; align-items: center; padding: 13px 22px;
}
.comp-grid-district, .comp-row-district { grid-template-columns: 1.4fr 1.5fr 0.7fr 1fr 1fr 160px; }
.comp-grid-head {
  padding: 9px 22px; font-size: 12px; font-weight: 700; letter-spacing: var(--tracking-table); text-transform: uppercase;
  color: var(--walnut-300); background: var(--walnut-900);
}
.comp-row { border-top: 1px solid var(--border-row); font-size: 14px; }
.comp-rows > li:first-child { border-top: 0; }
.comp-row.is-open { background: var(--paper-40); }
.comp-row-names { font-size: 15px; font-weight: 700; color: var(--ink-900); text-decoration: none; overflow-wrap: anywhere; }
.comp-row-names:hover { color: var(--navy-700); }
.comp-row-cell { color: var(--ink-500); }
.comp-row-households { color: var(--ink-700); overflow-wrap: anywhere; }
.comp-row-meta { display: none; }
.comp-row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.comp-btn {
  min-height: 36px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--paper-500); background: #FFFFFF;
  color: var(--ink-900); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; white-space: nowrap;
}
.comp-btn:hover { color: var(--ink-900); background: var(--paper-25); }
.comp-btn-record { border: 1.5px solid var(--walnut-900); color: var(--walnut-900); font-weight: 700; }
.comp-btn-record:hover { color: var(--walnut-900); background: var(--walnut-50); }

/* Rows: a small card on phones. */
@media (max-width: 1023px) {
  .comp-grid-head { display: none; }
  .comp-row, .comp-row-district {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'names status' 'meta meta' 'actions actions';
    gap: 8px; padding: 14px;
  }
  .comp-row-district { grid-template-areas: 'names status' 'households households' 'meta meta'; }
  .comp-row-names { grid-area: names; }
  .comp-row-status { grid-area: status; }
  .comp-row-status .badge { font-size: 11px; padding: 3px 8px; }
  .comp-row-cell { display: none; }
  .comp-row-households { grid-area: households; font-size: 13px; }
  .comp-row-meta { grid-area: meta; display: block; font-size: 12px; color: var(--ink-500); }
  .comp-row-actions { grid-area: actions; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comp-row-actions:empty { display: none; }
  .comp-btn { min-height: 42px; border-radius: var(--radius-control); font-size: 14px; }
}

/* The inline schedule form, under a row and on a companionship's page. */
.comp-row-panel { padding: 0 22px 14px; background: var(--paper-40); }
.comp-schedule {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius-choice);
  background: var(--paper-40); border: 1.5px solid var(--gold-500);
}
.comp-schedule-form { display: grid; grid-template-columns: 1fr 1fr 1.4fr auto; gap: 14px; align-items: end; }
.comp-schedule-field { font-size: 13px; min-width: 0; }
.comp-schedule-field .input, .comp-schedule-field .select { height: 42px; font-size: 14px; }
.comp-schedule-save { height: 44px; }
.comp-schedule-note { grid-column: 1 / -1; font-size: 12px; color: var(--ink-500); }
.comp-schedule-cancel-form { align-self: flex-start; }
.comp-schedule-cancel { padding: 0; color: var(--ruby-800); }
.comp-schedule-cancel:hover { color: var(--ruby-950); }
.comp-card .comp-schedule { margin: 0 20px 18px; }
.comp-card .comp-schedule-form { grid-template-columns: 1fr 1fr; }
.comp-card .comp-schedule-who, .comp-card .comp-schedule-save { grid-column: 1 / -1; }
@media (max-width: 1023px) {
  .comp-row-panel { padding: 0 14px 14px; }
  .comp-schedule-form { grid-template-columns: 1fr 1fr; }
  .comp-schedule-who, .comp-schedule-save { grid-column: 1 / -1; }
  .comp-schedule-field .input, .comp-schedule-field .select { height: var(--control-h-field-phone); }
  .comp-schedule-save { height: 48px; }
  .comp-card .comp-schedule { margin: 0 14px 14px; }
}
.comp-reschedule summary {
  min-height: 44px; display: flex; align-items: center; padding: 0 20px; font-size: 14px; font-weight: 700;
  color: var(--navy-700); cursor: pointer;
}
@media (max-width: 1023px) { .comp-reschedule summary { padding: 0 14px; } }

/* A companionship's page. */
.comp-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; padding: 22px 28px;
  border-radius: 16px; background: var(--navy-950); color: #FFFFFF;
}
.comp-hero-eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--navy-200);
}
.comp-hero-title { font-family: var(--font-display); font-size: var(--type-title-lg); font-weight: var(--weight-display); line-height: var(--leading-tight); }
.comp-hero-tags { display: flex; flex-wrap: wrap; gap: var(--space-8); }
.comp-hero-tag {
  font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: var(--radius-tag); background: var(--navy-700);
  color: var(--gold-200); text-decoration: none;
}
a.comp-hero-tag:hover { color: var(--gold-100); background: var(--navy-900); }
.comp-hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 6px 0 0; max-width: 520px; }
.comp-hero-stats > div { display: flex; flex-direction: column-reverse; gap: 2px; }
.comp-hero-stats dt { font-size: 12px; color: var(--navy-200); }
.comp-hero-stats dd { margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: var(--weight-display); color: var(--gold-200); line-height: 1.1; }
.comp-hero-rule { position: absolute; left: 0; right: 0; bottom: 0; height: var(--gold-rule); }
.comp-hero-line { font-size: var(--type-body-sm); color: var(--navy-100); }
.comp-hero-action { position: absolute; top: 22px; right: 28px; }
@media (max-width: 1023px) {
  .comp-hero { padding: 16px; border-radius: var(--radius-card); }
  .comp-hero-title { display: none; }
  .comp-hero-stats dd { font-size: 26px; }
}
.comp-flag { align-items: flex-start; }

.comp-page { display: flex; flex-direction: column; gap: var(--space-20); }
.comp-page-side, .comp-page-main { display: flex; flex-direction: column; gap: var(--space-20); min-width: 0; }
@media (min-width: 1024px) {
  .comp-page { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 22px; align-items: start; }
}

.comp-card { min-width: 0; overflow: hidden; }
.comp-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-12); padding: 16px 20px 8px; }
.comp-card-title { font-family: var(--font-display); font-size: 19px; font-weight: var(--weight-display); color: var(--walnut-900); }
.comp-card-meta { font-size: 12px; color: var(--ink-500); text-align: right; }
.comp-card-empty { padding: 12px 20px 16px; font-size: 14px; color: var(--ink-500); border-top: 1px solid var(--border-row); }
.comp-card-line { padding: 4px 20px 8px; font-size: 14px; color: var(--ink-700); }
.comp-list { list-style: none; margin: 0; padding: 0; }
.comp-list-row {
  display: flex; flex-direction: column; gap: 2px; padding: 11px 20px; border-top: 1px solid var(--border-row);
  text-decoration: none; color: var(--ink-900);
}
.comp-list-row:hover { color: var(--ink-900); background: var(--paper-25); }
.comp-list-row-split { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--space-12); }
.comp-list-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.comp-list-name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.comp-list-sub { font-size: 12px; color: var(--ink-500); }
.comp-need { display: flex; flex-direction: column; gap: 4px; padding: 12px 20px; border-top: 1px solid var(--border-row); }
.comp-need-text { font-size: 13px; color: var(--ink-700); overflow-wrap: anywhere; }
@media (max-width: 1023px) {
  .comp-card-head { padding: 14px 14px 8px; }
  .comp-card-title { font-size: var(--type-section); }
  .comp-card-empty, .comp-card-line { padding-left: 14px; padding-right: 14px; }
  .comp-list-row, .comp-need { padding: 12px 14px; }
}

/* Past interviews. */
.comp-past { list-style: none; margin: 0; padding: 0; }
.comp-past-entry { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-top: 1px solid var(--border-row); }
.comp-past-body { display: flex; flex-direction: column; gap: 3px; flex-grow: 1; min-width: 0; }
.comp-past-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.comp-past-when { font-size: 14px; font-weight: 600; }
.comp-past-outcome { font-size: 13px; color: var(--ink-500); }
.comp-past-note { font-size: 13px; color: var(--ink-700); line-height: var(--leading-note); overflow-wrap: anywhere; }
.comp-past-note .badge { margin-right: 4px; }
.comp-past-edit { display: inline-flex; align-items: center; min-height: 32px; font-size: 13px; font-weight: 700; text-decoration: none; }
@media (max-width: 1023px) {
  .comp-past-entry { flex-direction: column; gap: 6px; padding: 12px 14px; }
  .comp-past-edit { min-height: 44px; }
}

/* Companionship notes. */
.comp-note-form-wrap { display: flex; flex-direction: column; gap: 10px; padding: 4px 20px 16px; }
.comp-notes { list-style: none; margin: 0; padding: 0; }
.comp-note { display: flex; flex-direction: column; gap: 4px; padding: 12px 20px; border-top: 1px solid var(--border-row); }
.comp-note-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.comp-note-meta { font-size: 12px; color: var(--ink-500); }
.comp-note-text { font-size: 14px; color: var(--ink-700); line-height: var(--leading-note); overflow-wrap: anywhere; }
@media (max-width: 1023px) {
  .comp-note-form-wrap { padding: 4px 14px 14px; }
  .comp-note { padding: 12px 14px; }
}

/* History. */
.comp-history { list-style: none; margin: 0; padding: 0; }
.comp-history-entry { display: flex; flex-direction: column; gap: 2px; padding: 11px 20px; border-top: 1px solid var(--border-row); }
.comp-history-text { font-size: 14px; font-weight: 600; }
.comp-history-meta { font-size: 12px; color: var(--ink-500); }
@media (max-width: 1023px) { .comp-history-entry { padding: 11px 14px; } }
