/* C.14f: Matter-tag sidebar + session chips */

.matter-panel-body {
    display: flex;
    min-height: 0;
    flex: 1;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */

.matter-sidebar {
    width: 160px;
    flex-shrink: 0;
    border-right: 1px solid var(--vc-border, rgba(150,145,175,0.1));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.matter-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--vc-border, rgba(150,145,175,0.1));
}

.matter-sidebar-header h3 {
    font-size: 10px;
    font-weight: 600;
    color: var(--ip-text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0;
}

.matter-new-btn {
    background: none;
    border: 1px solid var(--vc-border, rgba(150,145,175,0.2));
    border-radius: 4px;
    color: var(--ip-text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 5px 1px;
    transition: color .15s, border-color .15s;
}

.matter-new-btn:hover {
    color: var(--ip-accent, #5B8EC9);
    border-color: var(--ip-accent, #5B8EC9);
}

.matter-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    overflow-y: auto;
    flex: 1;
}

.matter-list-item {
    display: block;
    padding: 5px 10px;
    font-size: 11px;
    color: var(--ip-text-secondary, #aaa);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: background .12s, color .12s;
    user-select: none;
}

.matter-list-item:hover {
    background: rgba(91,142,201,.08);
    color: var(--ip-text, #e0e0e0);
}

.matter-list-item.active {
    background: rgba(91,142,201,.15);
    color: var(--ip-accent, #5B8EC9);
    font-weight: 600;
}

.matter-count {
    font-size: 10px;
    opacity: .6;
    margin-left: 2px;
}

.matter-last-date {
    display: block;
    font-size: 9px;
    color: var(--ip-text-muted);
    padding: 0 10px 4px;
    margin-top: -3px;
}

.matter-empty-hint {
    padding: 10px;
    font-size: 10px;
    color: var(--ip-text-muted);
    font-style: italic;
    line-height: 1.4;
}

/* ── Sessions column ────────────────────────────────────────────────────── */

.matter-sessions-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* ── Session matter chip ────────────────────────────────────────────────── */

.matter-chip {
    display: inline-block;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(91,142,201,.12);
    color: var(--ip-accent, #5B8EC9);
    border: 1px solid rgba(91,142,201,.25);
    cursor: pointer;
    margin-top: 5px;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    transition: background .12s;
}

.matter-chip:hover,
.matter-chip:focus {
    background: rgba(91,142,201,.22);
    outline: 2px solid rgba(91,142,201,.3);
    outline-offset: 1px;
}

.matter-chip--empty {
    background: transparent;
    color: var(--ip-text-muted);
    border-color: rgba(150,145,175,.15);
    font-style: italic;
}

/* ── Popover ────────────────────────────────────────────────────────────── */

.matter-popover {
    position: fixed;
    z-index: 10000;
    background: var(--vc-bg, #1a1a2e);
    border: 1px solid var(--vc-border, rgba(150,145,175,.22));
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,.45);
    padding: 6px 0;
    min-width: 200px;
    max-width: 260px;
}

.matter-popover-input {
    display: block;
    width: calc(100% - 24px);
    margin: 6px 12px 4px;
    padding: 5px 8px;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--vc-border, rgba(150,145,175,.2));
    border-radius: 5px;
    color: var(--ip-text, #e0e0e0);
    font-size: 12px;
    outline: none;
    font-family: inherit;
}

.matter-popover-input:focus {
    border-color: var(--ip-accent, #5B8EC9);
}

.matter-popover-list {
    list-style: none;
    margin: 0;
    padding: 2px 0;
    max-height: 150px;
    overflow-y: auto;
    border-top: 1px solid var(--vc-border, rgba(150,145,175,.1));
}

.matter-popover-list li button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 6px 14px;
    font-size: 12px;
    color: var(--ip-text, #e0e0e0);
    cursor: pointer;
    font-family: inherit;
}

.matter-popover-list li button:hover {
    background: rgba(91,142,201,.1);
    color: var(--ip-accent, #5B8EC9);
}

.matter-popover-divider {
    border: none;
    border-top: 1px solid var(--vc-border, rgba(150,145,175,.1));
    margin: 4px 0;
}

.matter-popover-apply {
    display: block;
    width: calc(100% - 24px);
    margin: 2px 12px 4px;
    padding: 5px 8px;
    background: var(--ip-accent, #5B8EC9);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.matter-popover-apply:hover {
    opacity: .88;
}

.matter-popover-remove {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 6px 14px;
    font-size: 12px;
    color: #e07070;
    cursor: pointer;
    font-family: inherit;
}

.matter-popover-remove:hover {
    background: rgba(224,112,112,.08);
}

.matter-popover-cancel {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 5px 14px 7px;
    font-size: 12px;
    color: var(--ip-text-muted);
    cursor: pointer;
    border-top: 1px solid var(--vc-border, rgba(150,145,175,.1));
    font-family: inherit;
}

.matter-popover-cancel:hover {
    background: rgba(150,145,175,.06);
}

/* ── F.6: Matter Dashboard ──────────────────────────────────────────────── */

#matter-dashboard {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.matter-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.matter-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--ip-text, #e0e0e0);
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.matter-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
    flex-shrink: 0;
}

.status-active { background: rgba(22,101,52,.35); color: #86efac; border: 1px solid rgba(134,239,172,.25); }
.status-archived { background: rgba(107,114,128,.2); color: var(--ip-text-muted); border: 1px solid rgba(107,114,128,.2); }
.status-closed { background: rgba(220,38,38,.15); color: #fca5a5; border: 1px solid rgba(252,165,165,.2); }

.matter-client {
    font-size: 10px;
    color: var(--ip-text-muted);
    background: rgba(255,255,255,.05);
    padding: 2px 6px;
    border-radius: 3px;
    flex-shrink: 0;
}

.matter-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--vc-border, rgba(150,145,175,.1));
}

.meta-item { display: flex; flex-direction: column; gap: 4px; }

.meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ip-text-muted);
    font-weight: 600;
}

.meta-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--ip-text, #e0e0e0);
}

.meta-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.meta-tags .tag {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(91,142,201,.12);
    color: var(--ip-accent, #5B8EC9);
    border: 1px solid rgba(91,142,201,.25);
}

.matter-changes {
    background: rgba(59,130,246,.08);
    border: 1px solid rgba(59,130,246,.3);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    font-size: 11px;
}

.matter-changes h4 {
    font-size: 11px;
    font-weight: 600;
    color: #93c5fd;
    margin: 0 0 6px 0;
}

.matter-changes ul {
    margin: 0;
    padding-left: 14px;
    color: var(--ip-text-secondary, #ccc);
    line-height: 1.6;
}

.matter-sessions h4,
.matter-sources h4 {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ip-text-muted);
    font-weight: 600;
    margin: 0 0 6px 0;
}

.matter-sessions {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--vc-border, rgba(150,145,175,.1));
}

.session-item {
    padding: 7px 8px;
    border-bottom: 1px solid var(--vc-border, rgba(150,145,175,.06));
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    border-radius: 4px;
    transition: background .12s;
}

.session-item:hover { background: rgba(91,142,201,.08); }

.session-date {
    font-size: 10px;
    color: var(--ip-text-muted);
    flex-shrink: 0;
}

.session-title {
    font-size: 11px;
    color: var(--ip-text-secondary, #ccc);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.source-list { display: flex; flex-direction: column; gap: 2px; }

.source-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 11px;
    border-bottom: 1px solid var(--vc-border, rgba(150,145,175,.05));
}

.source-title {
    color: var(--ip-text-secondary, #ccc);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    margin-right: 6px;
}

.source-count {
    color: var(--ip-text-muted);
    font-size: 10px;
    flex-shrink: 0;
}

/* ── F.6: Add to Matter dropdown ────────────────────────────────────────── */

.add-to-matter {
    display: inline-flex;
    align-items: center;
    margin-top: 6px;
}

.add-to-matter select {
    font-size: 11px;
    padding: 3px 8px;
    background: var(--vc-bg2, #1a1a2e);
    border: 1px solid var(--vc-border, rgba(150,145,175,.2));
    border-radius: 5px;
    color: var(--ip-text-secondary, #ccc);
    cursor: pointer;
    font-family: inherit;
    max-width: 200px;
}

.add-to-matter select:focus { outline: none; border-color: var(--ip-accent, #5B8EC9); }

/* ── F.9: Export buttons + citation selector ────────────────────────────── */

.export-btn {
    background: rgba(255,255,255,.05);
    border: 1px solid var(--vc-border, rgba(150,145,175,.2));
    border-radius: 5px;
    color: var(--ip-text-secondary, #ccc);
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    font-weight: 500;
    padding: 4px 10px;
    transition: background .12s, border-color .12s, color .12s;
}

.export-btn:hover {
    background: rgba(91,142,201,.12);
    border-color: rgba(91,142,201,.4);
    color: var(--ip-accent, #5B8EC9);
}

.citation-select {
    font-size: 11px;
    padding: 4px 8px;
    background: var(--vc-bg2, #1a1a2e);
    border: 1px solid var(--vc-border, rgba(150,145,175,.2));
    border-radius: 5px;
    color: var(--ip-text-secondary, #ccc);
    cursor: pointer;
    font-family: inherit;
    max-width: 140px;
}

.citation-select:focus { outline: none; border-color: var(--ip-accent, #5B8EC9); }
