/* Compact communication log (log_entries/_log, _entry): one line per entry, expands inline (native <details>). */
.log-wrap { min-width:0; contain:inline-size; } /* long one-line previews never widen the page */
.log-toolbar { display:flex; align-items:center; gap:.4rem; flex-wrap:wrap; margin:.3rem 0 .5rem; }
.log-toolbar[hidden] { display:none; }
.log-toolbar .log-count { margin-left:auto; }
.log.log-compact > li.log-entry { padding:0; margin-bottom:.15rem; }
.log-item > summary.log-line { display:flex; align-items:center; gap:.45rem; padding:.25rem .6rem; cursor:pointer; list-style:none; min-height:1.8rem; font-size:.92rem; line-height:1.3; }
.log-item > summary.log-line::-webkit-details-marker { display:none; }
.log-item > summary.log-line::before { content:"▸"; color:var(--muted); flex:0 0 auto; width:.8rem; transition:transform .12s; }
.log-item[open] > summary.log-line::before { transform:rotate(90deg); }
.log-item > summary.log-line:hover { background:var(--sunken); }
.log-item > summary.log-line:focus-visible { outline:2px solid var(--brand); outline-offset:-2px; }
.log-item[open] > summary.log-line { border-bottom:1px solid var(--line); background:var(--sunken); }
.log-icon { flex:0 0 auto; width:1.3rem; text-align:center; }
.log-dir { flex:0 0 auto; font-size:.72rem; font-weight:600; text-transform:uppercase; letter-spacing:.03em; border-radius:999px; padding:.05rem .45rem; border:1px solid var(--line); color:var(--muted); background:var(--surface); }
.log-dir-received { color:#1d4ed8; border-color:#bfdbfe; background:#eff6ff; }
.log-line-main { flex:1 1 0; width:0; min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.log-who { font-weight:600; }
.log-subject { font-weight:600; color:var(--brand); }
.log-subject::before { content:"· "; color:var(--muted); font-weight:400; }
.log-preview { color:var(--muted); }
.log-clip, .log-flag { flex:0 0 auto; font-size:.85rem; color:var(--muted); white-space:nowrap; }
.log-when { flex:0 0 auto; margin-left:auto; font-size:.8rem; color:var(--muted); white-space:nowrap; }
.log-full { padding:.35rem .6rem .5rem 1.6rem; overflow-wrap:anywhere; }
.log-more { margin:.4rem 0; }
@media (max-width:600px) {
  .log-item > summary.log-line { flex-wrap:wrap; row-gap:.15rem; padding:.45rem .5rem; }
  .log-line-main { order:10; flex:1 0 100%; width:0; padding-left:1.25rem; box-sizing:border-box; }
  .log-full { padding-left:.6rem; }
}

/* NTF lease communication log: bordered, collapsible boxes with CSR + date in a left column. */
.lease-log .log.log-compact > li.lease-log-entry {
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 6px;
  margin-bottom: .5rem;
  background: var(--surface);
  overflow: hidden;
}
.lease-log-item > summary.lease-log-summary {
  display: grid;
  grid-template-columns: 1rem 12rem minmax(0, 1fr);
  align-items: start;
  column-gap: .75rem;
  row-gap: .15rem;
  padding: .55rem .75rem;
  min-height: 0;
}
.lease-log-item > summary.lease-log-summary::before { grid-row: 1 / span 2; }
.lease-log-csr { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.lease-log-when, .lease-log-channel { font-size: .8rem; color: var(--muted); }
.lease-log-preview { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.lease-log-item[open] > summary.lease-log-summary .lease-log-preview { display: none; }
.lease-log-item[open] > summary.lease-log-summary { border-bottom: 0; background: transparent; }
.lease-log-full { padding: 0 .75rem .7rem 15.25rem; } /* 0.75 + 1rem chevron + 0.75 + 12rem CSR + 0.75 */
.lease-log-body { min-width: 0; }
.lease-log-task, .lease-log-file { margin: .35rem 0 0; }
@media (max-width: 600px) {
  .lease-log-item > summary.lease-log-summary { grid-template-columns: 1rem minmax(0, 1fr); }
  .lease-log-item > summary.lease-log-summary .lease-log-preview { grid-column: 2; }
  .lease-log-full { padding-left: 2.5rem; } /* 0.75 + 1rem chevron + 0.75 */
}

/* Communication log entry and viewing fields stay stretchable. Never lock height or hide the resize handle. */
textarea[data-controller~="comm-resize"] {
  resize: both;
  overflow: auto;
  width: 100%;
  max-width: 100%;
  min-height: 5.5rem;
  min-width: 12rem;
  box-sizing: border-box;
}
.comm-view {
  resize: vertical;
  overflow: auto;
  min-height: 2.75rem;
  max-width: 100%;
  box-sizing: border-box;
  white-space: pre-wrap;
}

.log-tabs { margin:.2rem 0 .5rem; }
.log-tabs button { appearance:none; background:none; border:0; padding:.4rem .2rem; color:var(--ink-soft); cursor:pointer; font:inherit; }
.log-tabs button.active { border-bottom:3px solid var(--accent); font-weight:600; color:inherit; }
.log-tabs .log-tab-count { font-weight:400; color:var(--muted); }
.log-tab-empty { margin:.4rem 0; }
.log-tab-empty[hidden] { display:none; }

/* Tabs, search, and priority filter on one row. */
.log-tabs-bar { display:flex; align-items:center; gap:.75rem; flex-wrap:wrap; margin:.2rem 0 .5rem; border-bottom:1px solid var(--line); }
.log-tabs-bar .log-tabs { margin:0; border-bottom:0; flex:0 1 auto; }
.log-search { margin-left:auto; display:flex; align-items:center; }
.log-search input[type="search"] { min-width:11rem; max-width:18rem; width:16rem; padding:.3rem .55rem; font:inherit; border:1px solid var(--line); border-radius:6px; background:var(--surface); color:inherit; }
.log-priority-filter { display:flex; align-items:center; }
.log-priority-filter-select, .log-priority-select { padding:.3rem .45rem; font:inherit; border:1px solid var(--line); border-radius:6px; background:var(--surface); color:inherit; }
.log-priority-field { display:flex; align-items:center; gap:.4rem; margin:.35rem 0; }
.log-priority-form { display:inline-flex; align-items:center; margin:0 .35rem 0 0; }
.log-priority-form .log-priority-field { margin:0; }
.log-entry .prio-badge { flex:0 0 auto; font-size:.72rem; padding:0 .4rem; }

/* Full-entry priority fill: same backgrounds and text colours as Tasks priority tags
   (.prio-badge.prio-red etc. in application.css). Hover/open use a slightly stronger
   shade of the same colour so the grey sunken state does not cover the fill. */
.log.log-compact > li.log-entry.prio-red,
.log.log-compact > li.log-entry.prio-red .log-item,
.log.log-compact > li.log-entry.prio-red .log-full { background:#fee2e2; color:#991b1b; }
.log.log-compact > li.log-entry.prio-red .log-item > summary.log-line { background:#fee2e2; color:#991b1b; }
.log.log-compact > li.log-entry.prio-red .log-item > summary.log-line:hover,
.log.log-compact > li.log-entry.prio-red .log-item[open] > summary.log-line { background:#fecaca; }
.log.log-compact > li.log-entry.prio-red .log-preview,
.log.log-compact > li.log-entry.prio-red .log-when,
.log.log-compact > li.log-entry.prio-red .log-subject { color:#7f1d1d; }

.log.log-compact > li.log-entry.prio-yellow,
.log.log-compact > li.log-entry.prio-yellow .log-item,
.log.log-compact > li.log-entry.prio-yellow .log-full { background:#fef9c3; color:#713f12; }
.log.log-compact > li.log-entry.prio-yellow .log-item > summary.log-line { background:#fef9c3; color:#713f12; }
.log.log-compact > li.log-entry.prio-yellow .log-item > summary.log-line:hover,
.log.log-compact > li.log-entry.prio-yellow .log-item[open] > summary.log-line { background:#fde68a; }
.log.log-compact > li.log-entry.prio-yellow .log-preview,
.log.log-compact > li.log-entry.prio-yellow .log-when,
.log.log-compact > li.log-entry.prio-yellow .log-subject { color:#713f12; }

.log.log-compact > li.log-entry.prio-green,
.log.log-compact > li.log-entry.prio-green .log-item,
.log.log-compact > li.log-entry.prio-green .log-full { background:#dcfce7; color:#14532d; }
.log.log-compact > li.log-entry.prio-green .log-item > summary.log-line { background:#dcfce7; color:#14532d; }
.log.log-compact > li.log-entry.prio-green .log-item > summary.log-line:hover,
.log.log-compact > li.log-entry.prio-green .log-item[open] > summary.log-line { background:#bbf7d0; }
.log.log-compact > li.log-entry.prio-green .log-preview,
.log.log-compact > li.log-entry.prio-green .log-when,
.log.log-compact > li.log-entry.prio-green .log-subject { color:#14532d; }

.log.log-compact > li.log-entry.prio-purple,
.log.log-compact > li.log-entry.prio-purple .log-item,
.log.log-compact > li.log-entry.prio-purple .log-full { background:#ede9fe; color:#4c1d95; }
.log.log-compact > li.log-entry.prio-purple .log-item > summary.log-line { background:#ede9fe; color:#4c1d95; }
.log.log-compact > li.log-entry.prio-purple .log-item > summary.log-line:hover,
.log.log-compact > li.log-entry.prio-purple .log-item[open] > summary.log-line { background:#ddd6fe; }
.log.log-compact > li.log-entry.prio-purple .log-preview,
.log.log-compact > li.log-entry.prio-purple .log-when,
.log.log-compact > li.log-entry.prio-purple .log-subject { color:#4c1d95; }

@media (max-width:600px) {
  .log-search { margin-left:0; width:100%; }
  .log-search input[type="search"] { width:100%; max-width:none; }
}
