/* Case Dashboard (11/18): three panels under the case header band.
   Contacts, Client Notes / Comms, and Tasks. Every rule is under .cov-grid. */

.cov-grid {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 14px;
  align-items: start;
  padding: 2px 0 12px;
}
.cov-grid .cov-left,
.cov-grid .cov-right { min-width: 0; }
.cov-grid .cov-left {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.cov-grid .cov-right > .body { min-width: 0; }

/* Header strip: small caps title, pill action, band-colored top edge. */
.cov-grid .cov-h,
.cov-grid .tv2-case-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg-alt);
  background: linear-gradient(115deg,
    color-mix(in srgb, var(--accent) 12%, var(--card-bg)),
    color-mix(in srgb, var(--teal) 8%, var(--card-bg)));
}
.cov-grid .cov-h {
  border: 1px solid var(--border);
  border-top: 3px solid var(--teal);
  border-radius: 14px 14px 0 0;
  box-shadow: var(--shadow);
}
.cov-grid .cov-more,
.cov-grid .tv2-case-head .tv2-btn {
  flex: none;
  margin-left: auto;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.2;
  white-space: nowrap;
  color: #06182E;
  background: var(--teal);
  border: 1px solid var(--teal);
  border-radius: 999px;
  padding: 4px 12px;
  min-height: 28px;
  cursor: pointer;
}
.cov-grid .cov-more:hover,
.cov-grid .tv2-case-head .tv2-btn:hover { filter: brightness(1.08); }
.cov-grid .cov-more:disabled { opacity: 0.45; cursor: default; filter: none; }

/* Card bodies sit flush under their header. Contacts is the top card, so it
   leaves a gap before the Notes header. */
.cov-grid .cov-contacts,
.cov-grid .cov-notes {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}
.cov-grid .cov-contacts { margin: 0 0 14px; padding: 0; gap: 0; }
.cov-grid .cov-notes { margin: 0; padding: 0; }

/* Contacts: one row per person, not a card inside the card. */
.cov-grid .cov-contact {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  margin: 0;
  padding: 10px 14px;
  text-align: left;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  min-width: 0;
}
.cov-grid .cov-contact:last-child { border-bottom: none; }
.cov-grid .cov-contact:hover { background: var(--bg-alt); border-bottom-color: var(--border); }
.cov-grid .cov-contact:last-child:hover { border-bottom-color: transparent; }
.cov-grid .cov-role {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
.cov-grid .cov-contact b {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}
.cov-grid .cov-contact span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cov-grid .cov-contact > span:not(.cov-role) {
  color: var(--text-muted);
  font-size: 12px;
}

/* Notes: type and date on the first line, the note under it, hairlines between. */
.cov-grid .activity-list { margin: 0; padding: 0; gap: 0; }
.cov-grid .activity-row {
  margin: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.cov-grid .activity-list > .activity-row:last-child { border-bottom: none; }
.cov-grid .activity-row-top { margin-bottom: 3px; }
.cov-grid .activity-summary { font-size: 13px; line-height: 1.4; color: var(--text); }
.cov-grid .activity-detail { margin-top: 3px; color: var(--text-muted); line-height: 1.45; overflow-x: auto; }
.cov-grid .activity-images img { max-width: 100%; height: auto; }
.cov-grid .empty-state { padding: 16px 14px; margin: 0; font-size: 13px; }

/* System updates: a quiet footer inside the Notes card, closed until opened. */
.cov-grid .activity-system {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}
.cov-grid .activity-system summary {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.cov-grid .activity-system summary::-webkit-details-marker { display: none; }
.cov-grid .activity-system summary::marker { content: ""; }
.cov-grid .activity-system summary::before {
  content: "\25B8";
  font-size: 11px;
  line-height: 1;
}
.cov-grid .activity-system[open] summary::before { content: "\25BE"; }
.cov-grid .activity-system[open] summary { border-bottom: 1px solid var(--border); }
.cov-grid .activity-system .activity-row { padding-left: 28px; background: transparent; }

/* Tasks: the whole list is one card. Rows are a list, the open row lifts. */
.cov-grid .tv2-case {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--teal);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}
.cov-grid .tv2-case-head {
  border-bottom: 1px solid var(--border);
}
.cov-grid .tv2-case-head h3 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.cov-grid .tv2-case-msg:empty { display: none; }
.cov-grid .tv2-case-msg:not(:empty) { padding: 8px 14px 0; }
.cov-grid .tv2-case-list { display: flex; flex-direction: column; min-width: 0; }
.cov-grid .tv2-case-list > .tv2-muted,
.cov-grid .tv2-case-list > .tv2-empty {
  margin: 0;
  padding: 14px;
  text-align: left;
  color: var(--text-muted);
  font-size: 13px;
}

.cov-grid .tv2-crow {
  border: 0;
  border-radius: 0;
  background: transparent;
  margin: 0;
  box-shadow: none;
}
.cov-grid .tv2-crow + .tv2-crow { border-top: 1px solid var(--border); }
.cov-grid .tv2-crow-pin { box-shadow: inset 3px 0 0 #e2a01c; }
.cov-grid .tv2-crow-line { border-radius: 0; padding: 8px 12px; }
.cov-grid .tv2-crow-line:hover { background: var(--bg-alt); border-radius: 0; }
.cov-grid .tv2-crow.open {
  margin: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
  overflow: hidden;
}
.cov-grid .tv2-crow.open + .tv2-crow { border-top: none; }
.cov-grid .tv2-crow.open.tv2-crow-pin { box-shadow: var(--shadow), inset 3px 0 0 #e2a01c; }

/* "Done (N)" is a divider, not another row. */
.cov-grid .tv2-done-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 8px 14px;
  text-align: left;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.cov-grid .tv2-done-toggle:hover { color: var(--text); }

@media (max-width: 900px) {
  .cov-grid { grid-template-columns: 1fr; }
}
