/* Matters -- open business with another party (Story 2464).
   One list, one card per matter, and the card opens in place: there is no detail
   pane to leave empty, which is the point. */

*, *::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; }

/* Full-height shell: only .mt-body scrolls, so the injected icon band, the black
   header and the filter row stay pinned. 100dvh, not 100vh -- on a phone 100vh is
   the URL-bar-expanded height and the tool bar strip slides off. */
.page-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
#lwIconBand, .ct-header, .mt-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 ---- */
.mt-filters {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 10px 16px; background: #fff; border-bottom: 1px solid #E2E2E6;
}
.mt-chip {
    border: 1px solid #D3D3D9; background: #F7F7F9; color: #444;
    border-radius: 999px; padding: 5px 13px; font: inherit; font-size: 13px; cursor: pointer;
}
.mt-chip:hover { background: #EDEDF2; }
.mt-chip.is-on { background: #4F46E5; border-color: #4F46E5; color: #fff; }
.mt-chip .mt-chip-n { opacity: .75; margin-left: 5px; font-size: 12px; }

.mt-search {
    flex: 1; min-width: 160px; padding: 7px 10px; font: inherit; font-size: 13px;
    border: 1px solid #D3D3D9; border-radius: 6px; background: #fff;
}
.mt-search.wide { width: 100%; flex: none; margin-bottom: 10px; }

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

.mt-card {
    background: #fff; border: 1px solid #E2E2E6; border-left: 4px solid #9AA0AA;
    border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.mt-card.is-overdue { border-left-color: #D14343; }
.mt-card.is-theirs  { border-left-color: #C98A16; }
.mt-card.is-closed  { border-left-color: #7A8B7A; opacity: .82; }

.mt-card-head { padding: 12px 14px; cursor: pointer; }
.mt-card-head:hover { background: #FAFAFC; }
.mt-title { font-size: 15px; font-weight: 600; color: #1B1B1F; }
.mt-title a { color: #0A66C2; text-decoration: none; }
.mt-title a:hover { text-decoration: underline; }
.mt-parties { font-size: 13px; color: #555; margin-top: 2px; }
.mt-meta { font-size: 12px; color: #777; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 10px; }

.mt-badge {
    display: inline-block; font-size: 11px; font-weight: 600; border-radius: 999px;
    padding: 2px 9px; background: #EEF0F5; color: #414553;
}
.mt-badge.mine   { background: #E5F0FF; color: #1F4E8C; }
.mt-badge.theirs { background: #FFF3DC; color: #8A5D06; }
.mt-badge.over   { background: #FDE7E7; color: #A32020; }

/* ---- the opened card ---- */
.mt-card-body { border-top: 1px solid #EDEDF1; padding: 12px 14px 14px; }
.mt-about { font-size: 13px; color: #444; margin-bottom: 10px; white-space: pre-wrap; }
.mt-sub { font-size: 11px; font-weight: 700; letter-spacing: .04em;
          text-transform: uppercase; color: #8A8A93; margin: 12px 0 6px; }
.mt-party-row, .mt-event-row {
    display: flex; align-items: baseline; gap: 8px; padding: 5px 0;
    border-bottom: 1px dotted #E7E7EC; font-size: 13px;
}
.mt-party-row .mt-role { font-size: 12px; color: #7A7A83; }
.mt-event-row .mt-when { color: #7A7A83; font-size: 12px; min-width: 88px; }
.mt-event-row .mt-what { flex: 1; }
.mt-event-row .mt-type { font-size: 11px; color: #8A8A93; }
.mt-x {
    border: none; background: none; color: #A33; cursor: pointer;
    font: inherit; font-size: 12px; padding: 0 4px;
}
.mt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mt-actions button {
    border: 1px solid #D3D3D9; background: #F7F7F9; color: #333;
    border-radius: 6px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.mt-actions button:hover { background: #EDEDF2; }
.mt-actions button.primary { background: #4F46E5; border-color: #4F46E5; color: #fff; }
.mt-actions button.primary:hover { background: #6257F0; }

.mt-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;
}

/* ---- modals ---- */
.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.modal-tall { max-width: 560px; }
.modal h2 { margin: 0 0 14px; font-size: 15pt; }

.mt-field { display: block; margin-bottom: 12px; }
.mt-field > span { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }
.mt-field input[type=text], .mt-field input[type=date], .mt-field textarea, .mt-field select {
    width: 100%; padding: 8px 10px; font: inherit; font-size: 14px;
    border: 1px solid #D3D3D9; border-radius: 6px; background: #fff;
}
.mt-field textarea { resize: vertical; }
.mt-row { display: flex; gap: 12px; }
.mt-row .mt-field { flex: 1; }

.mt-event-list { max-height: 46dvh; overflow: auto; border: 1px solid #E2E2E6; border-radius: 8px; }
.mt-event-list .mt-pick {
    display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left;
    border: none; border-bottom: 1px solid #EFEFF3; background: #fff;
    padding: 9px 11px; font: inherit; font-size: 13px; cursor: pointer;
}
.mt-event-list .mt-pick:hover { background: #F4F4F8; }

.mt-modal-btns { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.mt-modal-btns .spacer { flex: 1; }
.mt-btn-cancel, .mt-btn-save {
    border-radius: 6px; padding: 8px 16px; font: inherit; font-size: 14px; cursor: pointer;
}
.mt-btn-cancel { border: 1px solid #D3D3D9; background: #F7F7F9; color: #333; }
.mt-btn-save { border: none; background: #4F46E5; color: #fff; }
.mt-btn-save:hover { background: #6257F0; }

@media (max-width: 520px) {
    .mt-row { flex-direction: column; gap: 0; }
}

@media print {
    .mt-filters, .mt-actions, .mt-more, .ct-header button { display: none; }
    .mt-card { break-inside: avoid; }
}

/* ---- the status filter (unobtrusive, next to the chips) ---- */
.mt-status-filter { min-width: 150px; }
.mt-status-filter .picker-input {
    width: 100%; padding: 6px 10px; font: inherit; font-size: 13px;
    border: 1px solid #D3D3D9; border-radius: 999px; background: #F7F7F9;
}

/* ---- the new-event fields in the Add an event modal ---- */
.mt-field-btn { display: flex; align-items: flex-end; }
.mt-field-btn .mt-btn-save { width: 100%; border: none; }

/* ---- the matter report ---- */
.modal.modal-report { max-width: 640px; }
.mt-report { font-size: 13px; color: #222; }
.mt-rp-title { margin: 0 0 4px; font-size: 16pt; }
.mt-rp-line { font-size: 12px; color: #666; margin-bottom: 10px; }
.mt-rp-about { margin-bottom: 10px; white-space: pre-wrap; }
.mt-rp-head { font-size: 11px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: #8A8A93; margin: 14px 0 6px;
    border-bottom: 1px solid #E7E7EC; padding-bottom: 3px; }
.mt-rp-row { padding: 4px 0; }
.mt-rp-when { color: #7A7A83; font-size: 12px; margin-right: 6px; }
.mt-rp-dim { color: #8A8A93; }
.mt-rp-desc { font-size: 12px; color: #555; margin: 2px 0 2px 14px; white-space: pre-wrap; }
