/* ============================================================
   ProjectTelemetry — Issues + Location Breakdown Structure
   assets/issues.css

   Extends the shared .co-* family from change-orders.css and the
   .cd-* dashboard family from curves-dash.css. Only what is genuinely
   new to Issues and the LBS lives here:

     .co-chip / .co-sel / .co-tog / .co-search / .co-check
        toolbar controls the other modules will want next
     .iss-*   the issue log
     .lbs-*   the location tree

   Type pills are hue-coded by who owns the issue, not by how bad it is:
   safety and environmental sit in the safety officer's red-orange band,
   quality in the QC officer's violet, and everything the field owns in
   neutral slate. Severity is carried by the due date, which is where a
   superintendent already looks.
   ============================================================ */

/* ── toolbar controls ──────────────────────────────────────── */
.co-sel, .co-search {
  height: 30px; border: 1px solid var(--bd); border-radius: 8px; background: var(--white);
  color: var(--ink); font-size: 12.5px; padding: 0 8px; max-width: 190px;
}
.co-search { min-width: 150px; }
.co-sel:focus, .co-search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.co-tog {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px;
  border: 1px solid var(--bd); border-radius: 8px; background: var(--white);
  color: var(--ink-soft); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.co-tog:hover { background: var(--bg2); }
.co-tog.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.co-tog i { font-size: 14px; }

.co-check {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px;
  color: var(--ink-soft); font-weight: 500; cursor: pointer; padding: 2px 0;
}

/* ── type chips (the log's primary filter) ─────────────────── */
.iss-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 10px; }
.co-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  border: 1px solid var(--bd); border-radius: 999px; background: var(--white);
  color: var(--ink-soft); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.co-chip:hover { background: var(--bg2); }
.co-chip.on { background: var(--ink); border-color: var(--ink); color: var(--white); }
.co-chip-n {
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--accent-bg); color: var(--accent);
  font-size: 10.5px; font-weight: 700; display: inline-grid; place-items: center;
  font-variant-numeric: tabular-nums;
}
.co-chip.on .co-chip-n { background: rgba(255,255,255,.22); color: #fff; }

/* ── the log ───────────────────────────────────────────────── */
.iss-table th.iss-cb, .iss-table td.iss-cb { width: 34px; padding-right: 0; }
.iss-r { cursor: pointer; }
.iss-open { cursor: pointer; }
.iss-open:hover { text-decoration: underline; }
.iss-flag { font-size: 13px; color: var(--ink-faint); margin-left: 3px; vertical-align: -1px; }

.iss-bulk {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
}

/* Type — who owns it. */
.co-pill.iss-t-punch         { background: var(--bg2); color: var(--ink-soft); border-color: var(--bd); }
.co-pill.iss-t-safety        { background: rgba(220,38,38,.10); color: #B91C1C; }
.co-pill.iss-t-environmental { background: rgba(217,119,6,.12); color: #B45309; }
.co-pill.iss-t-quality       { background: rgba(124,58,237,.11); color: #6D28D9; }
.co-pill.iss-t-commissioning { background: rgba(13,148,136,.12); color: #0F766E; }
.co-pill.iss-t-coordination  { background: rgba(14,165,233,.11); color: #0284C7; }
.co-pill.iss-t-design        { background: rgba(99,102,241,.10); color: #4F46E5; }
.co-pill.iss-t-housekeeping  { background: var(--bg2); color: var(--ink-faint); border-color: var(--bd); }
.co-pill.iss-t-warranty      { background: rgba(190,24,93,.10); color: #9D174D; }
.co-pill.iss-t-other         { background: var(--bg2); color: var(--ink-faint); border-color: var(--bd); }

/* Status — where it is in its life. */
.co-pill.iss-s-open             { background: rgba(14,165,233,.11); color: #0284C7; }
.co-pill.iss-s-in_progress      { background: rgba(217,119,6,.12); color: #B45309; }
.co-pill.iss-s-ready_for_review { background: rgba(99,102,241,.12); color: #4F46E5; }
.co-pill.iss-s-rejected         { background: rgba(220,38,38,.10); color: #B91C1C; }
.co-pill.iss-s-closed           { background: rgba(22,163,74,.12); color: #15803D; }
.co-pill.iss-s-void             { background: var(--bg2); color: var(--ink-faint); border-color: var(--bd); text-decoration: line-through; }
.co-pill.neg                    { background: rgba(220,38,38,.10); color: #B91C1C; }

/* Ball in court — who owes the next move. */
.co-pill.iss-b-assignee { background: rgba(217,119,6,.10); color: #B45309; }
.co-pill.iss-b-manager  { background: rgba(99,102,241,.10); color: #4F46E5; }
.co-pill.iss-b-reporter { background: var(--bg2); color: var(--ink-soft); border-color: var(--bd); }
.co-pill.iss-b-none     { background: transparent; color: var(--ink-faint); border-color: var(--bd); }

.co-num.neg { color: #DC2626; }
.co-age-n   { min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; font-size: 12px; }

/* ── overview bars ─────────────────────────────────────────── */
.iss-bar-row {
  display: grid; grid-template-columns: 130px 1fr 34px 34px; align-items: center; gap: 10px;
  width: 100%; padding: 7px 2px; border: 0; background: none; cursor: pointer; text-align: left;
  border-radius: 6px;
}
.iss-bar-row:hover { background: var(--bg2); }
.iss-bar-l { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.iss-bar-n { font-size: 12.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.iss-bar-o { font-size: 12px; text-align: right; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.iss-bar-o.neg { color: #DC2626; font-weight: 650; }

/* ── the detail drawer ─────────────────────────────────────── */
.iss-d-head { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.iss-d-desc { font-size: 13.5px; line-height: 1.55; color: var(--ink); margin: 0 0 16px; white-space: pre-wrap; }
.iss-d-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 2px 18px;
  border-top: 1px solid var(--bd); border-bottom: 1px solid var(--bd); padding: 10px 0; margin-bottom: 14px;
}
.iss-d-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 12.5px; }
.iss-d-row span { color: var(--ink-faint); }
.iss-d-row strong { color: var(--ink); font-weight: 600; text-align: right; }

.iss-d-note { margin-bottom: 12px; }
.iss-d-note label {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 3px;
}
.iss-d-note p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; }
.iss-d-note.neg p { color: #B91C1C; }

.iss-d-atts label, .iss-d-comments > label {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-faint); margin: 14px 0 6px;
}
.iss-atts { display: flex; flex-wrap: wrap; gap: 8px; }
.iss-att {
  width: 76px; border: 1px solid var(--bd); border-radius: 8px; overflow: hidden;
  display: block; text-decoration: none; background: var(--bg2);
}
.iss-att img { width: 100%; height: 56px; object-fit: cover; display: block; }
.iss-att i { display: block; font-size: 22px; padding: 16px 0; text-align: center; color: var(--ink-faint); }
.iss-att span {
  display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  text-align: center; padding: 3px 0; color: var(--ink-faint); border-top: 1px solid var(--bd);
}

.iss-c { padding: 8px 0; border-bottom: 1px solid var(--bd); }
.iss-c strong { font-size: 12.5px; color: var(--ink); margin-right: 8px; }
.iss-c span { font-size: 11px; color: var(--ink-faint); }
.iss-c p { margin: 3px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; }
.iss-c-new { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.iss-c-new textarea { flex: 1; }
.iss-d-acts { display: inline-flex; gap: 6px; margin-right: auto; }

/* ── the location tree ─────────────────────────────────────── */
.lbs-tree { border: 1px solid var(--bd); border-radius: 12px; background: var(--white); overflow: hidden; }
.lbs-node {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  border-bottom: 1px solid var(--bd); font-size: 13px;
}
.lbs-tree > .lbs-node:last-child { border-bottom: none; }
.lbs-node:hover { background: var(--bg2); }
.lbs-node:hover .lbs-acts { opacity: 1; }

.lbs-tw, .lbs-tw-sp { width: 20px; height: 20px; flex: none; }
.lbs-tw { border: 0; background: none; cursor: pointer; color: var(--ink-faint); display: grid; place-items: center; }
.lbs-tw:hover { color: var(--ink); }
.lbs-ico { font-size: 15px; color: var(--ink-faint); flex: none; }
.lbs-name { font-weight: 600; color: var(--ink); }
.lbs-code {
  font-size: 11px; font-weight: 600; color: var(--ink-faint);
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 5px; padding: 1px 5px;
}
.lbs-type {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-faint); margin-left: 2px;
}
.lbs-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent-bg); color: var(--accent); font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center; font-variant-numeric: tabular-nums;
}
.lbs-photos { font-size: 11.5px; color: var(--ink-faint); display: inline-flex; align-items: center; gap: 3px; }
.lbs-badge + .lbs-photos { margin-left: 8px; }
.lbs-node > .lbs-photos:not(.lbs-badge + .lbs-photos) { margin-left: auto; }

.lbs-acts { display: inline-flex; gap: 2px; margin-left: 8px; opacity: 0; transition: opacity .12s; }
@media (hover: none) { .lbs-acts { opacity: 1; } }

.lbs-untagged {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin-bottom: 12px;
  border: 1px solid var(--bd); border-left: 3px solid #D97706; border-radius: 8px;
  background: rgba(217,119,6,.05); font-size: 12.5px; color: var(--ink-soft);
}

/* ── the LBS empty state ───────────────────────────────────── */
.lbs-empty { text-align: center; padding: 48px 24px; }
.lbs-empty > i { font-size: 34px; color: var(--ink-faint); }
.lbs-empty h3 { margin: 12px 0 6px; font-size: 16px; color: var(--ink); }
.lbs-empty p { margin: 0 auto 20px; max-width: 480px; font-size: 13px; line-height: 1.6; color: var(--ink-soft); }
.lbs-tpl {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px; max-width: 720px; margin: 0 auto 16px;
}
.lbs-card {
  text-align: left; padding: 14px; border: 1px solid var(--bd); border-radius: 10px;
  background: var(--white); cursor: pointer; display: flex; flex-direction: column; gap: 4px;
}
.lbs-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.lbs-card strong { font-size: 13px; color: var(--ink); }
.lbs-card span { font-size: 12px; line-height: 1.45; color: var(--ink-soft); }

/* ── dark theme ────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  .co-chip.on .co-chip-n { background: rgba(0,0,0,.25); }
}
