/* Case selection uses the application's panels, fields, buttons and dialog tokens. */
.case-working-selector .case-picker-trigger { flex: 1 1 300px; max-width: 680px; min-width: 0; display: grid; gap: 6px; color: var(--sa-color-navy); font-size: 12px; font-weight: 600; }
.case-picker-trigger > button { width: 100%; justify-content: flex-start; min-height: var(--sa-control-height); text-align: left; }
.case-picker-trigger [data-working-case-picker-label] { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-picker-dialog { width: min(1320px, calc(100vw - 40px)); max-width: none; height: min(860px, calc(100dvh - 40px)); max-height: calc(100dvh - 40px); padding: 22px; overflow: hidden; }
.case-picker-dialog[open] { gap: 18px; }
.case-picker-dialog [hidden] { display: none !important; }
.case-picker-dialog :where(button, input, select):focus-visible { outline: 2px solid var(--sa-color-blue); outline-offset: 3px; }
.case-picker-dialog button:disabled { cursor: default; opacity: .55; }
.case-picker-filters { display: grid; grid-template-columns: minmax(240px, 2.6fr) repeat(4, minmax(115px, 1fr)); gap: 12px; flex: 0 0 auto; }
.case-picker-filters .legal-field { min-width: 0; gap: 5px; font-size: 11px; }
.case-picker-filters :where(input, select) { width: 100%; min-width: 0; }
.case-picker-search input { padding-left: 12px; }
.case-picker-navigation { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 0 0 auto; border-bottom: 1px solid var(--sa-color-border); }
.case-picker-scopes { display: flex; align-items: stretch; gap: 4px; min-width: 0; overflow-x: auto; }
.case-picker-scopes > button { display: inline-flex; align-items: center; gap: 9px; min-height: 40px; padding: 8px 13px; border: 0; border-bottom: 2px solid transparent; border-radius: var(--sa-radius-control) var(--sa-radius-control) 0 0; background: transparent; color: var(--sa-color-navy); font: 600 12px/1.35 var(--sa-font-main); cursor: pointer; white-space: nowrap; }
.case-picker-scopes > button:hover { background: var(--sa-color-control-bg); }
.case-picker-scopes > button[aria-pressed="true"] { color: var(--sa-color-blue); background: var(--sa-color-blue-soft); border-bottom-color: var(--sa-color-blue); }
.case-picker-scopes .case-icon { width: 18px; height: 18px; flex-basis: 18px; }
.case-picker-scopes [data-picker-count] { padding: 2px 7px; border-radius: 20px; background: var(--sa-color-control-bg); font-size: 10px; font-weight: 500; }
.case-picker-scope-star { font-size: 23px; line-height: 18px; }
.case-picker-navigation > button { flex: 0 0 auto; font-size: 11px; }
.case-picker-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 18px; flex: 1; min-height: 0; }
.case-picker-results { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.case-picker-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.case-picker-toolbar .case-fabula-meta { font-size: 11px; }
.case-picker-sort { display: flex; align-items: center; gap: 7px; }
.case-picker-sort .legal-field { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.case-picker-sort-label { color: var(--sa-color-muted); font-weight: 400; }
.case-picker-sort select { min-height: 30px; height: 30px; padding: 4px 24px 4px 8px; font-size: 11px; }
.case-picker-sort > .sa-button { width: 30px; min-height: 30px; padding: 0; font-size: 18px; }
.case-picker-list-wrap { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 3px; margin: -3px; }
.case-picker-list { list-style: none; padding: 0; margin: 0; }
.case-picker-row { display: flex; align-items: center; gap: 3px; padding: 9px 7px; border: 1px solid transparent; border-bottom-color: var(--sa-color-border); border-radius: var(--sa-radius-control); min-width: 0; }
.case-picker-row:hover { background: var(--sa-color-control-bg); }
.case-picker-row.is-selected { border-color: var(--sa-color-blue); background: var(--sa-color-blue-soft); }
.case-picker-star { flex: 0 0 28px; display: inline-flex; align-items: center; justify-content: center; width: 28px; min-height: 32px; padding: 0; border: 0; border-radius: var(--sa-radius-control); background: transparent; color: var(--sa-color-muted); font: 23px/1 var(--sa-font-main); cursor: pointer; }
.case-picker-star:hover { background: var(--sa-color-card); }
.case-picker-star.is-favorite { color: #c58c18; }
.case-picker-star svg { width: 20px; height: 20px; }
.case-picker-row-select { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(220px, 1fr); align-items: center; gap: 14px; padding: 0 3px; border: 0; border-radius: 2px; background: transparent; color: var(--sa-color-text); font: inherit; text-align: left; cursor: pointer; }
.case-picker-row-main { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.case-picker-row-main > strong { color: var(--sa-color-navy); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.case-picker-subtitle { display: block; max-width: 100%; color: var(--sa-color-muted); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.case-picker-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.case-picker-tags > * { display: inline-block; max-width: 100%; border-radius: 7px; padding: 3px 7px; color: var(--sa-color-blue); background: var(--sa-color-blue-soft); font-size: 10px; line-height: 1.3; overflow-wrap: anywhere; }
.case-picker-row-meta { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.case-picker-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; color: var(--sa-color-blue); background: var(--sa-color-blue-soft); font-size: 10px; line-height: 1.5; }
.case-picker-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.case-picker-badge[data-status="SUSPENDED"] { color: #99651b; background: #fff4dc; }
.case-picker-badge[data-status="COMPLETED"] { color: #16784e; background: #e8f4ed; }
.case-picker-badge[data-status="ARCHIVED"] { color: var(--sa-color-muted); background: var(--sa-color-control-bg); }
.case-picker-row-meta dl { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(65px, .8fr); gap: 4px 8px; width: 100%; margin: 0; font-size: 10px; line-height: 1.4; }
.case-picker-row-meta dl > div { min-width: 0; }
.case-picker-row-meta dt { margin-bottom: 3px; color: var(--sa-color-muted); font-size: 9px; }
.case-picker-row-meta dd { margin: 0; overflow-wrap: anywhere; }
.case-picker-pagination { display: flex; align-items: center; justify-content: space-between; gap: 9px; flex-wrap: wrap; padding-top: 5px; }
.case-picker-pages { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.case-picker-pages .sa-button { min-width: 29px; min-height: 30px; padding: 4px 7px; font-size: 11px; }
.case-picker-pages .is-current { color: #fff; border-color: var(--sa-color-blue); background: var(--sa-color-blue); }
.case-picker-pagination .case-fabula-meta { font-size: 10px; }
.case-picker-size.legal-field { display: flex; align-items: center; gap: 7px; color: var(--sa-color-muted); font-size: 10px; white-space: nowrap; }
.case-picker-size select { width: 60px; height: 30px; min-height: 30px; padding: 3px 20px 3px 7px; font-size: 11px; }
.case-picker-detail { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }
.case-picker-preview { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--sa-color-border); border-radius: var(--sa-radius); padding: 16px; overflow-wrap: anywhere; }
.case-picker-preview-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.case-picker-preview h3 { font-size: 23px; line-height: 1.3; margin: 0 0 10px; color: var(--sa-color-navy); }
.case-picker-preview h4 { margin: 0 0 10px; font-size: 13px; line-height: 1.5; color: var(--sa-color-navy); }
.case-picker-description { margin-bottom: 18px !important; font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.case-picker-facts { display: grid; grid-template-columns: minmax(90px, .8fr) minmax(0, 1.2fr); gap: 11px; margin: 16px 0 20px; font-size: 12px; }
.case-picker-facts dt { color: var(--sa-color-muted); }
.case-picker-facts dd { margin: 0; color: var(--sa-color-navy); }
.case-picker-event { display: grid; gap: 5px; padding: 13px; border-radius: var(--sa-radius-control); background: var(--sa-color-blue-soft); font-size: 12px; line-height: 1.5; margin-top: 16px; }
.case-picker-event strong { font-size: 11px; }
.case-picker-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.case-picker-stats > * { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--sa-color-border); border-radius: var(--sa-radius-control); font-size: 11px; }
.case-picker-stats strong { font-size: 14px; }
.case-picker-actions { display: flex; flex-wrap: wrap; gap: 8px; flex: 0 0 auto; }
.case-picker-actions .sa-button { flex: 1 1 140px; min-height: 38px; padding: 8px; font-size: 11px; white-space: normal; }
.case-picker-actions .case-icon { width: 16px; height: 16px; flex-basis: 16px; }
.case-picker-empty { padding: 32px 12px; text-align: center; color: var(--sa-color-muted); font-size: 13px; line-height: 1.6; }
.case-picker-empty:empty { display: none; }
.case-picker-list-wrap > [data-picker-retry] { display: flex; margin: 0 auto 16px; }
@media (max-width: 1150px) {
    .case-picker-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .case-picker-search { grid-column: 1 / -1; }
    .case-picker-body { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 12px; }
    .case-picker-row-select { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .case-picker-row-meta { flex-direction: row; align-items: flex-start; }
    .case-picker-row-meta .case-picker-badge { flex: 0 0 auto; }
    .case-picker-row-meta dl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 65px; }
    .case-picker-scopes > button { padding: 8px 10px; gap: 6px; }
    .case-picker-sort-label { display: none; }
}
@media (max-width: 800px) {
    .case-picker-dialog { width: calc(100vw - 24px); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); padding: 16px; overflow-y: auto; }
    .case-picker-dialog[open] { gap: 14px; }
    .case-picker-body { display: flex; flex-direction: column; flex: 0 0 auto; gap: 20px; }
    .case-picker-list-wrap { flex: 0 0 auto; max-height: 410px; }
    .case-picker-preview { flex: 0 0 auto; max-height: 420px; }
    .case-picker-detail { min-height: 0; }
    .case-picker-navigation { align-items: stretch; flex-direction: column; gap: 5px; }
    .case-picker-navigation > button { align-self: flex-end; padding-bottom: 8px; }
    .case-picker-row-select { grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr); }
    .case-picker-row-meta { flex-direction: column; }
    .case-picker-actions { position: sticky; bottom: -16px; padding: 10px 0 0; background: var(--sa-color-card); }
}
@media (max-width: 600px) {
    .case-picker-dialog { width: calc(100vw - 12px); height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); padding: 14px; }
    .case-picker-dialog h2 { font-size: 18px; }
    .case-picker-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .case-picker-scopes > button { padding: 8px; font-size: 11px; }
    .case-picker-scopes > button .case-icon, .case-picker-scope-star { display: none; }
    .case-picker-scopes [data-picker-count] { padding: 1px 5px; font-size: 9px; }
    .case-picker-row { padding: 10px 4px; align-items: flex-start; }
    .case-picker-row-select { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .case-picker-row-meta { flex-direction: column; }
    .case-picker-row-meta dl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 65px; }
    .case-picker-toolbar { align-items: flex-start; flex-direction: column; }
    .case-picker-sort { align-self: flex-end; }
    .case-picker-pagination { justify-content: flex-start; }
    .case-picker-pagination > [data-picker-range] { flex: 1; }
    .case-picker-pages { width: 100%; }
    .case-picker-preview { padding: 13px; }
    .case-picker-preview h3 { font-size: 20px; }
    .case-picker-actions { bottom: -14px; padding-bottom: env(safe-area-inset-bottom); }
    .case-picker-dialog .legal-field :where(input, select) { font-size: 16px; }
    .case-picker-size select { width: 68px; }
}
