/* Phase 2 area F3 styles — owned by agent F3.
   Cases list (neutral cards, filters popover, tabs) and the neutral case
   workspace (phase panels, milestone chain, reconciliation, modals, menus). */

/* ── Cases list ─────────────────────────────────────────────────────────── */
.f3-case-card { cursor: pointer; }
.f3-case-card .cc-top { gap: 8px; }
.f3-case-card .cc-top-left { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.f3-cc-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.f3-cc-sub { font-size: 11.5px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f3-rel { color: var(--text-3); font-size: 11px; font-weight: 400; }
.f3-late { color: var(--error-600, #B42318) !important; font-weight: 600; }
.f3-good { color: var(--success-600, #067647) !important; }
.f3-muted { color: var(--text-3); font-size: 12px; }
.f3-state-pill { font-size: 10.5px; }
.f3-mode-pill { display: inline-flex; align-items: center; gap: 4px; }
.f3-mode-ic { vertical-align: -2px; flex-shrink: 0; }
.f3-av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 9px; font-weight: 700; flex-shrink: 0; letter-spacing: .02em; }
.f3-illus { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: #FEF0C7; color: #93370D; margin-left: 6px; vertical-align: 1px; text-transform: none; letter-spacing: 0; }
.f3-empty { padding: 22px 16px; text-align: center; color: var(--text-3); font-size: 12.5px; }
.f3-empty-cell { padding: 22px 12px !important; text-align: center; color: var(--text-3); }
.co-chip.f3-on { outline: 2px solid var(--brand); outline-offset: 1px; }
.co-chip { cursor: pointer; }

.f3-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; width: 280px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14); padding: 14px; display: none; }
.f3-pop[data-open="true"] { display: block; }
.f3-pop-title { font-weight: 600; font-size: 13px; margin-bottom: 10px; color: var(--text); }
.f3-pop label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; color: var(--text-2); margin-bottom: 9px; }
.f3-pop select { font: inherit; font-weight: 400; font-size: 12.5px; padding: 6px 8px; border: 1px solid var(--border-strong, #D0D5DD); border-radius: 6px; background: #fff; color: var(--text); }
.f3-pop-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ── Shared building blocks ────────────────────────────────────────────── */
.f3-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 4px 0; margin-bottom: 14px; overflow-x: auto; }
.f3-card > .f3-muted { padding: 12px 16px; }
.f3-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.f3-table th, .f3-table td { padding: 8px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.f3-table th { font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--surface-2, #F9FAFB); }
.f3-table td { color: var(--text); }
.f3-table .r { text-align: right; }
.f3-table tbody tr:last-child td { border-bottom: none; }
.f3-table tfoot td { font-weight: 700; border-top: 1px solid var(--border-strong, #D0D5DD); border-bottom: none; }
.f3-link { color: var(--brand); text-decoration: none; font-weight: 500; cursor: pointer; }
.f3-link:hover { text-decoration: underline; }
.f3-input, .f3-select { font: inherit; font-size: 12.5px; padding: 7px 9px; border: 1px solid var(--border-strong, #D0D5DD); border-radius: 7px; background: #fff; color: var(--text); width: 100%; box-sizing: border-box; }
.f3-select { width: auto; }
.f3-lbl { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; }
.f3-static { cursor: default; }
.f3-breakdown { margin-top: 12px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.f3-card-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.f3-card-actions:empty { display: none; }
.f3-recon-note { padding: 10px 14px; }

/* Documents rows */
.f3-doc-row { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; color: var(--text-2); }
.f3-doc-row:last-child { border-bottom: none; }
.f3-doc-row:hover { background: var(--surface-2, #F9FAFB); }
.f3-doc-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.f3-doc-sub { font-size: 11px; color: var(--text-3); }
.f3-doc-go { font-size: 11.5px; color: var(--brand); font-weight: 600; }

/* Control tower alerts with actions */
.f3-ct-alert { grid-template-columns: 24px 1fr auto !important; }
.f3-ex-meta { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.f3-ex-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }

/* Milestone chain */
.f3-ms { padding: 6px 0; }
.f3-ms-row { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 9px 16px; position: relative; }
.f3-ms-row + .f3-ms-row::before { content: ''; position: absolute; left: 26px; top: -9px; height: 18px; width: 2px; background: var(--border); }
.f3-ms-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong, #D0D5DD); background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; box-sizing: border-box; }
.f3-ms-row.done .f3-ms-dot { background: var(--success-500, #17B26A); border-color: var(--success-500, #17B26A); }
.f3-ms-row.late .f3-ms-dot { background: var(--warning-500, #F79009); border-color: var(--warning-500, #F79009); }
.f3-ms-row.overdue .f3-ms-dot { border-color: var(--error-500, #F04438); }
.f3-ms-row.next .f3-ms-dot { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100, #F4EBFF); }
.f3-ms-label { font-size: 13px; font-weight: 600; color: var(--text); }
.f3-ms-row.pending .f3-ms-label { color: var(--text-2); font-weight: 500; }
.f3-ms-loc { font-weight: 400; color: var(--text-3); font-size: 11.5px; margin-left: 6px; }
.f3-ms-dates { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }

/* Event log + activity panel rows */
.f3-back { font-size: 12px; color: var(--brand); font-weight: 600; cursor: pointer; margin-bottom: 10px; display: inline-block; }
.f3-evlist { padding: 4px 0; }
.f3-ev { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--border); }
.f3-ev:last-child { border-bottom: none; }
.f3-ev[data-f3-doc] { cursor: pointer; }
.f3-ev-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); margin-top: 5px; }
.f3-ev.alert .f3-ev-dot { background: var(--warning-500, #F79009); }
.f3-ev.alert.sev-critical .f3-ev-dot, .f3-ev.alert.sev-high .f3-ev-dot { background: var(--error-500, #F04438); }
.f3-ev.action .f3-ev-dot { background: var(--brand); }
.f3-ev.update .f3-ev-dot { background: var(--success-500, #17B26A); }
.f3-ev-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text); }
.f3-ev-sub { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }

/* Case notes */
.f3-notes { padding: 6px 0 0; }
.f3-note { padding: 9px 16px; border-bottom: 1px solid var(--border); }
.f3-note-head { font-size: 11.5px; color: var(--text-3); }
.f3-note-head b { color: var(--text); }
.f3-note-body { font-size: 12.5px; color: var(--text); margin-top: 2px; white-space: pre-wrap; }
.f3-note-form { display: flex; gap: 8px; padding: 10px 14px; align-items: flex-end; }
.f3-note-form textarea { flex: 1; font: inherit; font-size: 12.5px; padding: 7px 9px; border: 1px solid var(--border-strong, #D0D5DD); border-radius: 7px; resize: vertical; }

/* Topbar controls (assign + actions menus) */
.f3-tb-wrap { position: relative; display: inline-flex; }
.f3-tb-wrap > .chip { display: inline-flex; align-items: center; gap: 6px; }
.f3-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 70; min-width: 220px; max-height: 360px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14); padding: 6px; display: none; }
.f3-menu[data-open="true"] { display: block; }
.f3-menu-h { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 6px 8px; text-transform: uppercase; letter-spacing: .04em; }
.f3-menu-item { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 6px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.f3-menu-item:hover { background: var(--surface-2, #F9FAFB); }
.f3-menu-item.active { background: var(--brand-50, #F9F5FF); }
.f3-menu-item .f3-muted { font-size: 11px; }
#f3CaseState { display: inline-flex; gap: 6px; margin-left: 6px; }
#f3CaseState:empty { display: none; }

/* Modal (note / email / ERP) */
.f3-modal { position: fixed; inset: 0; z-index: 400; display: none; }
.f3-modal[data-open="true"] { display: block; }
.f3-modal-bd { position: absolute; inset: 0; background: rgba(16, 24, 40, .45); }
.f3-modal-card { position: absolute; left: 50%; top: 12vh; transform: translateX(-50%); width: min(520px, calc(100vw - 32px)); background: #fff; border-radius: 12px; box-shadow: 0 24px 48px rgba(16, 24, 40, .22); display: flex; flex-direction: column; max-height: 76vh; }
.f3-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 10px; }
.f3-modal-title { font-weight: 600; font-size: 15px; color: var(--text); }
.f3-modal-x { cursor: pointer; font-size: 20px; color: var(--text-3); line-height: 1; }
.f3-modal-body { padding: 4px 18px 10px; overflow-y: auto; }
.f3-modal-body p { margin: 0 0 8px; }
.f3-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--border); }

/* Docs modal filters (neutral) */
#docsModal .fm-filters[data-f3] { display: flex; gap: 8px; align-items: center; }
#docsModal .fm-filters[data-f3] .f3-docs-q { flex: 1; }

/* Focus mode in the neutral workspace also hides the lifecycle rail. */
.view-case[data-focus="true"] .lifecycle { display: none; }

/* Topbar meta stays on one line in the neutral workspace. */
.view-case .route-center { min-width: 0; }
.view-case .route-center .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; justify-content: center; }
.view-case .route-center .meta > span { white-space: nowrap; }
.view-case .route-center .meta #tbCustomer { overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
