/* Call Logs (Story 3467) -- the board and the shared per-log view.
   One list, one card per call log; a card opens in place and shows the parties
   with their calls (date -> note -> status) and the inline forms. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: #F2F2F4; color: #222; font-family: "Segoe UI", system-ui, sans-serif; }

.page-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
#lwIconBand, .ct-header, .cl-filters { flex: 0 0 auto; }

.ct-header { background: #3C3C3C; color: #fff; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.ct-header h1 { margin: 0; font-size: 14pt; font-weight: 600; flex: 1; }
.ct-header button { color: #fff; background: #4F46E5; border: none; border-radius: 4px; padding: 7px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.ct-header button:hover { background: #6257F0; }

/* ---- filter row ---- */
.cl-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; background: #fff; border-bottom: 1px solid #E2E2E6; }
.cl-chip { border: 1px solid #D3D3D9; background: #F7F7F9; color: #444; border-radius: 999px; padding: 5px 13px; font: inherit; font-size: 13px; cursor: pointer; }
.cl-chip:hover { background: #EDEDF2; }
.cl-chip.is-on { background: #4F46E5; border-color: #4F46E5; color: #fff; }
.cl-search { flex: 1; min-width: 160px; padding: 7px 10px; font: inherit; font-size: 13px; border: 1px solid #D3D3D9; border-radius: 6px; background: #fff; }

/* ---- the list ---- */
.cl-body { flex: 1; overflow: auto; padding: 14px 16px 28px; }
.cl-status-line { font-size: 12px; color: #777; margin-bottom: 10px; min-height: 14px; }
.cl-list { display: flex; flex-direction: column; gap: 10px; }

.cl-card { background: #fff; border: 1px solid #E2E2E6; border-left: 4px solid #4F46E5; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.cl-card.is-closed { border-left-color: #7A8B7A; opacity: .82; }
.cl-card-head { padding: 12px 14px; cursor: pointer; }
.cl-card-head:hover { background: #FAFAFC; }
.cl-title { font-size: 15px; font-weight: 600; color: #1B1B1F; }
.cl-title a { color: #0A66C2; text-decoration: none; }
.cl-title a:hover { text-decoration: underline; }
.cl-sub { font-size: 13px; color: #555; margin-top: 2px; }
.cl-meta { font-size: 12px; color: #777; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 10px; }
.cl-badge { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 9px; background: #E5F0FF; color: #1F4E8C; }
.cl-badge.closed { background: #EEF0F5; color: #414553; }
.cl-card-body { border-top: 1px solid #EDEDF1; padding: 12px 14px 14px; }
.cl-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cl-more { margin: 14px auto 0; display: block; border: 1px solid #D3D3D9; background: #fff; border-radius: 6px; padding: 8px 18px; font: inherit; font-size: 13px; cursor: pointer; }

/* ---- the shared per-log view ---- */
.cl-about { font-size: 13px; color: #444; margin-bottom: 10px; white-space: pre-wrap; }
.cl-about.cl-notes { color: #666; }
.cl-links { font-size: 13px; margin-bottom: 10px; }
.cl-link-chip { display: inline-block; color: #0A66C2; background: #EEF3FB; border-radius: 999px; padding: 2px 10px; text-decoration: none; margin-right: 4px; }
.cl-link-chip:hover { text-decoration: underline; }
.cl-party.is-resolved { opacity: .75; }
.cl-who-fixed { font-size: 14px; font-weight: 600; padding: 8px 12px 0; }
.cl-toolbar { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; flex-wrap: wrap; }
.cl-view-toggle { margin-left: auto; display: inline-flex; gap: 4px; }
.cl-empty { font-size: 13px; color: #777; padding: 12px; background: #FAFAFC; border: 1px dashed #D3D3D9; border-radius: 8px; }

.cl-party { border: 1px solid #E7E7EC; border-radius: 8px; margin-bottom: 10px; background: #fff; }
.cl-party-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 12px; background: #F7F7FA; border-bottom: 1px solid #E7E7EC; border-radius: 8px 8px 0 0; }
.cl-party-name { font-size: 14px; font-weight: 600; color: #1B1B1F; }
.cl-phone { font-size: 13px; color: #0A66C2; text-decoration: none; }
.cl-phone:hover { text-decoration: underline; }
.cl-linked { font-size: 12px; color: #4F46E5; background: #EEF0FF; border-radius: 999px; padding: 1px 8px; }
.cl-party-status { font-size: 12px; font-weight: 600; color: #1F4E8C; background: #E5F0FF; border-radius: 999px; padding: 2px 9px; }
.cl-party-status.is-terminal { color: #414553; background: #EEF0F5; }
.cl-party-btns { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; }
.cl-party-notes { font-size: 12px; color: #666; padding: 6px 12px 0; }

.cl-entries { padding: 4px 12px 8px; }
.cl-entry { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px dotted #E7E7EC; font-size: 13px; }
.cl-entry:last-child { border-bottom: none; }
.cl-when { color: #7A7A83; font-size: 12px; min-width: 92px; white-space: nowrap; }
.cl-note { flex: 1; white-space: pre-wrap; }
.cl-status { font-size: 11px; font-weight: 600; color: #1F4E8C; background: #E5F0FF; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.cl-status.is-terminal { color: #414553; background: #EEF0F5; }
.cl-entry-btns { display: inline-flex; gap: 4px; }
.cl-dim { color: #8A8A93; }
.cl-bydate { border: 1px solid #E7E7EC; border-radius: 8px; background: #fff; }

.cl-btn { border: 1px solid #D3D3D9; background: #F7F7F9; color: #333; border-radius: 6px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.cl-btn:hover { background: #EDEDF2; }
.cl-btn.primary { background: #4F46E5; border-color: #4F46E5; color: #fff; }
.cl-btn.primary:hover { background: #6257F0; }
.cl-btn:disabled { opacity: .6; cursor: default; }
.cl-x { border: none; background: none; color: #555; cursor: pointer; font: inherit; font-size: 12px; padding: 0 4px; }
.cl-x:hover { text-decoration: underline; }
.cl-x.danger { color: #A33; }

/* ---- inline forms ---- */
.cl-inline:empty { display: none; }
.cl-form { padding: 10px 12px 12px; background: #FBFBFE; border-top: 1px solid #E7E7EC; }
.cl-toolbar + .cl-inline .cl-form { border: 1px solid #E7E7EC; border-radius: 8px; margin-bottom: 10px; }
.cl-form label { display: block; margin-bottom: 8px; }
.cl-form label > span { display: block; font-size: 12px; color: #666; margin-bottom: 3px; }
.cl-form input[type=text], .cl-form input[type=date], .cl-form textarea { width: 100%; padding: 7px 10px; font: inherit; font-size: 14px; border: 1px solid #D3D3D9; border-radius: 6px; background: #fff; }
.cl-form textarea { resize: none; overflow: hidden; min-height: 38px; }
.cl-form-row { display: flex; gap: 10px; }
.cl-form-row label.grow { flex: 1; }
.cl-form-btns { display: flex; gap: 8px; align-items: center; }
.cl-form-btns .spacer { flex: 1; }
.voice-mic-wrap { display: block; }

/* ---- modals (board) ---- */
.modal-back { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); align-items: center; justify-content: center; padding: 16px; z-index: 60; }
.modal-back.open { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 18px; width: 100%; max-width: 460px; max-height: 90dvh; overflow: auto; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.modal h2 { margin: 0 0 14px; font-size: 15pt; }
.cl-field { display: block; margin-bottom: 12px; }
.cl-field > span { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }
.cl-field input[type=text], .cl-field textarea { width: 100%; padding: 8px 10px; font: inherit; font-size: 14px; border: 1px solid #D3D3D9; border-radius: 6px; background: #fff; }
.cl-field textarea { resize: vertical; }
.cl-modal-btns { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.cl-modal-btns .spacer { flex: 1; }

@media (max-width: 520px) {
    .cl-form-row { flex-direction: column; gap: 0; }
    .cl-when { min-width: 0; }
    .cl-entry { flex-wrap: wrap; }
}

@media print {
    .cl-filters, .cl-toolbar, .cl-more, .ct-header button, .cl-party-btns, .cl-entry-btns, .cl-card-actions, .cl-inline { display: none !important; }
    .cl-card { break-inside: avoid; }
}

/* Header folds (2026-09-10): the about / notes text and the linked-record chips
   each collapse to one line so a phone reaches the parties without scrolling.
   Collapsed state is remembered per device; a fold with no memory opens expanded. */
.cl-fold { margin-bottom: 8px; }
.cl-fold-toggle {
    display: flex; align-items: flex-start; gap: 6px; width: 100%;
    background: none; border: 0; padding: 2px 0; font: inherit; font-size: 13px;
    color: #444; text-align: left; cursor: pointer;
}
.cl-fold-caret { flex: 0 0 auto; color: #8A8A93; width: 12px; }
.cl-fold-label { flex: 0 0 auto; }
.cl-fold-preview { display: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-fold.is-collapsed .cl-fold-label { display: none; }
.cl-fold.is-collapsed .cl-fold-preview { display: block; }
.cl-fold.is-collapsed .cl-fold-body { display: none; }
.cl-fold:not(.is-collapsed) .cl-fold-toggle { padding-bottom: 0; }
.cl-fold .cl-about, .cl-fold .cl-links { margin-bottom: 4px; }
.cl-links { display: flex; flex-wrap: wrap; gap: 4px; }

/* Long "what happened" notes (2026-09-10): two lines and a "more" link until
   tapped open. Short notes never get the link. The text keeps the entry's
   pre-wrap so a note typed on several lines still reads as typed when open. */
.cl-note { white-space: pre-wrap; }
.cl-note.is-clamped .cl-note-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cl-note.is-clamped.is-open .cl-note-text { display: inline; -webkit-line-clamp: unset; overflow: visible; }
.cl-note-more {
    background: none; border: 0; padding: 0 0 0 4px; font: inherit; font-size: 12px;
    color: #0A66C2; cursor: pointer;
}
.cl-note-more:hover { text-decoration: underline; }
