/* Keep the legacy similarity radar compact; isolate the cross-case table. */
#enterprise-recurrence { padding: 0; }
#enterprise-recurrence-radar { margin: 0; border: 0; border-radius: 0; }
#enterprise-recurrence-matrix { container: recurrence-matrix / inline-size; padding: 12px 23px; border-top: 1px solid #27272a; background: #121215; color: #d4d4d8; }
#enterprise-recurrence-matrix * { box-sizing: border-box; }
#enterprise-recurrence-matrix summary { align-items: baseline; line-height: 1.6; }
#enterprise-recurrence-matrix summary strong { overflow-wrap: anywhere; }
#enterprise-recurrence-matrix p { line-height: 1.65; overflow-wrap: anywhere; margin: 9px 0; }
#enterprise-recurrence-matrix .recurrence-notice { max-width: 95ch; }
#enterprise-recurrence-matrix .recurrence-controls { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 13px; }
#enterprise-recurrence-matrix select { max-width: 100%; min-height: 40px; border: 1px solid #52525b; border-radius: 6px; padding: 7px; background: white; color: #f4f4f5; }
#enterprise-recurrence-matrix button { min-height: 40px; white-space: normal; overflow-wrap: anywhere; text-align: start; border: 1px solid #52525b; border-radius: 6px; padding: 7px 10px; background: white; color: #34d399; }
#enterprise-recurrence-matrix button:disabled { cursor: wait; opacity: .6; }
#enterprise-recurrence-matrix :focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }
#enterprise-recurrence-matrix .recurrence-table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid #3f3f46; border-radius: 8px; margin: 12px 0; }
#enterprise-recurrence-matrix .recurrence-table { border-collapse: collapse; width: 100%; background: white; font-size: 11px; }
#enterprise-recurrence-matrix caption { text-align: start; padding: 10px; font-weight: 600; }
#enterprise-recurrence-matrix th, #enterprise-recurrence-matrix td { border: 1px solid #27272a; padding: 8px; vertical-align: middle; min-width: 105px; }
#enterprise-recurrence-matrix th { text-align: start; max-width: 170px; background: #1c1c21; }
#enterprise-recurrence-matrix th:first-child { min-width: 150px; }
#enterprise-recurrence-matrix td { text-align: center; }
#enterprise-recurrence-matrix .recurrence-cell-label { display: none; }
#enterprise-recurrence-matrix td button { min-width: 44px; min-height: 44px; text-align: center; }
#enterprise-recurrence-matrix td button.recurrence-current { border: 2px solid #10b981; }
#enterprise-recurrence-matrix td button[aria-pressed="true"] { background: #059669; color: white; }
#enterprise-recurrence-matrix .recurrence-detail { border: 1px solid #3f3f46; border-radius: 8px; padding: 12px; margin-top: 13px; }
#enterprise-recurrence-matrix .recurrence-detail h4 { margin: 0 0 9px; font-size: 13px; overflow-wrap: anywhere; }
#enterprise-recurrence-matrix .recurrence-case-list { padding: 0; }
#enterprise-recurrence-matrix .recurrence-case-list li { display: block; padding: 12px 0; }
#enterprise-recurrence-matrix .recurrence-case-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#enterprise-recurrence-matrix .recurrence-source { border-left: 3px solid #3f3f46; padding-left: 10px; margin: 12px 0; white-space: pre-wrap; }
#enterprise-recurrence-matrix .recurrence-error { padding: 9px; background: rgba(255, 26, 92, 0.12); color: #963224; }
#enterprise-recurrence-matrix .recurrence-empty { padding: 9px 0; }
#enterprise-recurrence-matrix #recurrence-method { margin-top: 15px; border-top: 1px solid #27272a; padding-top: 10px; }
#enterprise-recurrence-matrix dt { font-weight: 650; margin-top: 9px; }
#enterprise-recurrence-matrix dd { margin: 3px 0 0; overflow-wrap: anywhere; line-height: 1.6; }
/* Keep every count in view when the matrix cannot fit its desktop columns.
   The same table, headers and buttons reflow; no cells are clipped or omitted. */
@container recurrence-matrix (max-width: 40rem) {
    #enterprise-recurrence-matrix .recurrence-table-scroll { overflow: visible; }
    #enterprise-recurrence-matrix :is(.recurrence-table, caption, thead, tbody, tr) { display: block; width: 100%; }
    #enterprise-recurrence-matrix :is(th, td) { display: block; min-width: 0; max-width: 100%; width: auto; overflow-wrap: anywhere; }
    #enterprise-recurrence-matrix th:first-child { min-width: 0; }
    #enterprise-recurrence-matrix tbody tr { margin-top: 12px; }
    #enterprise-recurrence-matrix td { display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: center; gap: 10px; text-align: start; }
    #enterprise-recurrence-matrix .recurrence-cell-label { display: block; min-width: 0; overflow-wrap: anywhere; }
    #enterprise-recurrence-matrix td button { min-width: 44px; min-height: 44px; }
}
/* At 200% text size, a phone leaves less than one glyph beside a 44px
   count after panel/cell padding. Give the label its own complete line;
   overflow-wrap cannot split a glyph to fit a near-zero grid track. */
@container recurrence-matrix (max-width: 20rem) {
    #enterprise-recurrence-matrix td { grid-template-columns: minmax(0, 1fr); }
    #enterprise-recurrence-matrix td > :not(.recurrence-cell-label) { justify-self: start; }
}
@media (max-width: 760px) {
    #enterprise-recurrence-matrix { padding: 12px 15px; }
    #enterprise-recurrence-matrix .recurrence-controls { align-items: stretch; }
    #enterprise-recurrence-matrix .recurrence-controls label { width: 100%; }
    #enterprise-recurrence-matrix summary { flex-wrap: wrap; gap: 4px; }
    #enterprise-recurrence-matrix .recurrence-detail { padding: 9px; }
}
/* Read-only prevention context: a calm review card, not an approval surface.
   Keep this local to the component; the cross-case matrix is unchanged. */
#recurrence-prevention-context { margin-top: 20px; padding-top: 20px; border-top: 1px solid #52525b; }
#enterprise-recurrence-matrix #recurrence-prevention-context { font-size: 16px; line-height: 1.6; color: #e4e4e7; }
#recurrence-prevention-context .prevention-heading { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; }
#recurrence-prevention-context .prevention-heading > div { flex: 1 1 22rem; min-width: 0; }
#recurrence-prevention-context h4 { margin: 0; font-size: 18px; line-height: 1.5; color: #f4f4f5; }
#recurrence-prevention-context h5 { margin: 0 0 12px; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; color: #f4f4f5; }
#enterprise-recurrence-matrix #recurrence-prevention-context p { font-size: 14px; margin: 6px 0; }
#recurrence-prevention-context .prevention-candidate { color: #e4e4e7; }
#recurrence-prevention-context .prevention-feedback:empty { margin: 0; }
#recurrence-prevention-context .prevention-feedback:not(:empty) { padding: 10px 0; font-weight: 600; }
#recurrence-prevention-context .prevention-snapshot { padding: 8px 0; color: #d4d4d8; }
#recurrence-prevention-context .prevention-proposal { margin: 12px 0; padding: 18px; border: 1px solid #52525b; border-radius: 8px; background: #1c1c21; }
#recurrence-prevention-context .prevention-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin: 0 0 16px; }
#recurrence-prevention-context .prevention-facts > div { min-width: 0; }
#enterprise-recurrence-matrix #recurrence-prevention-context dt { margin: 0; color: #d4d4d8; font-size: 14px; font-weight: 400; }
#enterprise-recurrence-matrix #recurrence-prevention-context dd { margin: 3px 0 0; color: #f4f4f5; font-size: 16px; font-family: inherit; line-height: 1.6; overflow-wrap: anywhere; }
#recurrence-prevention-context .prevention-state { padding-bottom: 14px; border-bottom: 1px solid #3f3f46; }
#recurrence-prevention-context .prevention-state dd { font-weight: 650; }
#recurrence-prevention-context .prevention-reasons { padding-inline-start: 22px; margin: 8px 0 16px; font-size: 14px; overflow-wrap: anywhere; }
#recurrence-prevention-context .prevention-proposal-action { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin: 4px 0 12px; }
#recurrence-prevention-context .prevention-proposal-action span { font-size: 14px; color: #d4d4d8; }
#enterprise-recurrence-matrix #recurrence-prevention-context button { min-width: 44px; min-height: 44px; max-width: 100%; padding: 9px 12px; background: #27272a; color: #f4f4f5; border: 1px solid #71717a; font-size: 16px; line-height: 1.5; text-decoration: none; }
#enterprise-recurrence-matrix #recurrence-prevention-context button:hover:not(:disabled) { background: #3f3f46; border-color: #a1a1aa; }
#enterprise-recurrence-matrix #recurrence-prevention-context button:disabled { opacity: 1; color: #a1a1aa; border-color: #52525b; }
#recurrence-prevention-context .prevention-disclosure { margin: 0; border-top: 1px solid #3f3f46; }
#enterprise-recurrence-matrix #recurrence-prevention-context summary { display: list-item; min-height: 44px; padding: 10px 2px; font-size: 14px; line-height: 1.7; color: #e4e4e7; cursor: pointer; overflow-wrap: anywhere; }
#recurrence-prevention-context .prevention-evidence { margin: 6px 0 12px; }
#recurrence-prevention-context .prevention-evidence > div + div { margin-top: 12px; }
#enterprise-recurrence-matrix #recurrence-prevention-context .prevention-evidence dd { font-family: var(--font-mono, ui-monospace, monospace); font-size: 14px; }
#recurrence-prevention-context .prevention-cpk { margin: 16px 0; }
#enterprise-recurrence-matrix #recurrence-prevention-context :is(button, summary, h4):focus-visible { outline: 3px solid #fbbf24; outline-offset: 3px; }
@container recurrence-matrix (max-width: 36rem) {
    #recurrence-prevention-context .prevention-facts { grid-template-columns: minmax(0, 1fr); }
    #recurrence-prevention-context .prevention-proposal { padding: 12px; }
}
