/* =========================================================================
   Networking — matchmaking, meeting requests, tag editor.
   Owns the .net-* namespace only. Every colour is a token from app.css, so
   this file needs no dark-mode block of its own except where a value is
   mixed by hand (see the two @media rules at the bottom).
   ========================================================================= */

.net-panel { display: block; }

.net-head { margin-bottom: var(--s-1); }
.net-title { font-size: 1.3rem; margin: 0; }

.net-lede {
  margin: 0 0 var(--s-4);
  color: var(--muted);
  font-size: .9rem;
  max-width: 62ch;
}

.net-tabs {
  position: sticky;
  top: calc(var(--banner-h) + var(--appbar-h));
  z-index: 12;
  background: var(--bg);
  margin-bottom: var(--s-4);
}
.net-tabs > button { display: inline-flex; align-items: center; gap: 6px; }
.net-tab-count { min-width: 20px; }

/* ------------------------------------------------------------ my profile */

.net-me { margin-bottom: var(--s-4); }
.net-me-sub {
  margin: var(--s-3) 0 var(--s-2);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.net-me-note {
  margin: var(--s-3) 0 0;
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: .9rem;
}

/* ------------------------------------------------------------------ tags */

.net-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.net-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.35;
}
.net-tag.is-want { background: var(--blue-soft); border-color: transparent; color: var(--navy); }
.net-tag.is-give { background: color-mix(in srgb, var(--success) 15%, var(--surface)); border-color: transparent; color: var(--success); }
.net-tag.is-topic { background: var(--surface-3); border-color: transparent; color: var(--ink); }

/* ------------------------------------------------------------- filters */

.net-chips { margin-bottom: var(--s-2); }
.net-count { margin: 0 0 var(--s-3); }

/* ------------------------------------------------------------ match card */

.net-match-list { display: flex; flex-direction: column; gap: var(--s-3); }

.net-match { padding: var(--s-4); }

.net-match-head,
.net-meeting-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: var(--r-sm);
}
.net-match-head:hover .net-person-name,
.net-meeting-head:hover .net-person-name { text-decoration: underline; }
.net-match-head:focus-visible,
.net-meeting-head:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 40%, transparent);
  outline-offset: 3px;
}

.net-person-id { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.net-person-name { font-weight: 700; font-size: .98rem; }
.net-person-role,
.net-person-place {
  color: var(--muted);
  font-size: .82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.net-strength {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--ink-2);
}
.net-strength.strong { background: var(--navy); color: #fff; }
.net-strength.good { background: var(--blue-soft); color: var(--navy); }

.net-whys { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-3); }

.net-why {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: .75rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.net-why.why-mutual { background: var(--navy); border-color: transparent; color: #fff; }
.net-why.why-offers { background: var(--blue-soft); border-color: transparent; color: var(--navy); }
.net-why.why-needs { background: color-mix(in srgb, var(--success) 15%, var(--surface)); border-color: transparent; color: var(--success); }
.net-why.why-attending { background: color-mix(in srgb, var(--orange) 18%, var(--surface)); border-color: transparent; color: var(--warn); }

.net-match-note,
.net-meeting-msg,
.net-request-note {
  margin: var(--s-3) 0 0;
  color: var(--ink-2);
  font-size: .88rem;
  font-style: italic;
  line-height: 1.45;
}

.net-match-actions,
.net-meeting-actions { margin-top: var(--s-4); }

/* ----------------------------------------------------------- meetings */

.net-section { margin-bottom: var(--s-6); }
.net-section-hint { margin: -2px 0 var(--s-3); }
.net-section .net-meeting + .net-meeting { margin-top: var(--s-3); }

.net-meeting { padding: var(--s-4); border-left: 4px solid var(--line-strong); }
.net-meeting.is-accepted { border-left-color: var(--success); }
.net-meeting.is-pending { border-left-color: var(--blue); }
.net-meeting.is-declined,
.net-meeting.is-cancelled { border-left-color: var(--line-strong); opacity: .78; }

.net-meeting-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: var(--s-3);
}
.net-meeting-dir {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.net-meeting-age { margin-left: auto; }

.net-meeting-proposed { margin: var(--s-3) 0 0; }

.net-meeting-slot {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  margin-top: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.net-meeting-slot-icon { font-size: 18px; line-height: 1.2; }
.net-meeting-slot-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.net-meeting-when { font-weight: 700; font-size: .92rem; }
.net-meeting-where { color: var(--muted); font-size: .82rem; }

/* -------------------------------------------------------- request sheet */

.net-request-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }

.net-request-warn {
  margin: 0 0 var(--s-3);
  padding: 10px var(--s-3);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  color: var(--warn);
  font-size: .85rem;
  font-weight: 600;
}

.net-slots { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-2); }

.net-slot {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
}
.net-slot:hover { border-color: var(--blue); }
.net-slot input { width: 20px; height: 20px; min-height: 0; flex: 0 0 auto; margin-top: 2px; accent-color: var(--navy); }
.net-slot.is-on { border-color: var(--navy); background: var(--blue-soft); }
.net-slot.is-disabled { opacity: .55; cursor: not-allowed; }
.net-slot.is-disabled:hover { border-color: var(--line-strong); }

.net-slot-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.net-slot-when { font-weight: 700; font-size: .9rem; }
.net-slot-where { color: var(--muted); font-size: .8rem; }
.net-slot-flag {
  margin-top: 2px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--warn);
}

.net-slot-count { margin-top: var(--s-2); }

/* ------------------------------------------------------------ tag editor */

.net-tags-card { margin-bottom: var(--s-4); }
.net-pick-count { font-size: .8rem; font-weight: 700; color: var(--muted); }

.net-tag-group + .net-tag-group { margin-top: var(--s-4); }
.net-tag-group-name {
  margin: 0 0 var(--s-2);
  font-size: .74rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.net-tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.net-pick { font-size: .82rem; }

.net-save-status { margin: var(--s-2) 0 0; }

.net-foot-note {
  margin: var(--s-5) 0 0;
  color: var(--muted);
  font-size: .8rem;
  max-width: 62ch;
}

/* ------------------------------------------------------------- desktop */

@media (min-width: 720px) {
  .net-match-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
  .net-match { display: flex; flex-direction: column; }
  .net-match-actions { margin-top: auto; padding-top: var(--s-4); }
}

/* ---------------------------------------------------------- dark mode */

@media (prefers-color-scheme: dark) {
  .net-strength.good { background: var(--blue-soft); color: #cfe0ff; }
  .net-why.why-offers { color: #cfe0ff; }
  .net-tag.is-want { color: #cfe0ff; }
  .net-slot.is-on { background: var(--blue-soft); border-color: var(--blue); }
  .net-request-warn { color: #e8a33d; }

  /* app.css styles the shared `.tabs` active item as `color: var(--navy)`, and
     --navy is NOT redefined for dark mode — so the selected sub-tab renders
     #002060 on a #0e1422 page and reads as the DIMMEST item in the strip.
     Scoped to this feature's own strip; the same defect is in every other
     `.tabs` user and belongs in app.css (flagged to the integrator). */
  .net-tabs > button.active {
    color: var(--ink);
    border-bottom-color: var(--blue);
  }
}

@media (prefers-reduced-motion: reduce) {
  .net-match-head, .net-meeting-head { transition: none; }
}

/* Same active-tab patch for the in-app theme switch (data-theme="dark"). */
:root[data-theme="dark"] .net-tabs > button.active { color: var(--ink); border-bottom-color: var(--blue); }
