/* ZippCar Dashboard — shadcn/ui-inspired design system */

/* ─── Design Tokens ─── */
:root {
    --zinc-50: #fafafa;
    --zinc-100: #f4f4f5;
    --zinc-200: #e4e4e7;
    --zinc-300: #d4d4d8;
    --zinc-400: #a1a1aa;
    --zinc-500: #71717a;
    --zinc-600: #52525b;
    --zinc-700: #3f3f46;
    --zinc-800: #27272a;
    --zinc-900: #18181b;
    --zinc-950: #09090b;

    --white: #ffffff;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);

    /* Badge colors */
    --green-bg: #dcfce7; --green-text: #166534;
    --red-bg: #fee2e2; --red-text: #991b1b;
    --amber-bg: #fef3c7; --amber-text: #92400e;
    --blue-50: #eff6ff;
    --blue-bg: #dbeafe; --blue-text: #1e40af;
    --orange-bg: #ffedd5; --orange-text: #9a3412;
    --purple-bg: #f3e8ff; --purple-text: #6b21a8;
    --gray-bg: #f4f4f5; --gray-text: #3f3f46;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
    font-family: var(--font-mono);
    color: var(--zinc-900);
    background: var(--zinc-100);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--zinc-900); text-decoration: none; }
a:hover { color: var(--zinc-600); }

/* ─── Layout ─── */
.layout {
    display: grid;
    grid-template-columns: 480px 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.2s ease;
}

/* ─── Sidebar ─── */
.sidebar {
    background: var(--zinc-900);
    color: var(--zinc-300);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid var(--zinc-700);
    margin-bottom: 0.75rem;
}

.sidebar-brand h1 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.025em;
}

.sidebar-brand small {
    font-size: 0.75rem;
    color: var(--zinc-500);
}

.sidebar-nav {
    flex: 1;
    padding: 0 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--zinc-100);
    font-size: 0.9375rem;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: var(--zinc-800);
    color: var(--white);
}

.nav-item.active {
    background: var(--zinc-800);
    color: var(--white);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-section-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem 0.375rem;
    margin-top: 0.5rem;
    color: var(--zinc-300);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-top: 1px solid var(--zinc-800);
}
.nav-section-heading svg {
    width: 14px;
    height: 14px;
}

.nav-item.nav-saved {
    padding-left: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--zinc-200);
}
.nav-item.nav-saved .nav-saved-kind {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    background: var(--zinc-800);
    color: var(--zinc-400);
    padding: 0.125rem 0.3125rem;
    border-radius: 3px;
    min-width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}
.nav-item.nav-saved:hover {
    color: var(--zinc-100);
}
.nav-item.nav-saved.active {
    color: var(--white);
}
.nav-item.nav-saved.active .nav-saved-kind {
    background: var(--zinc-700);
    color: var(--zinc-200);
}

.status-multiselect {
    position: relative;
    display: inline-block;
}
.status-multiselect-toggle {
    cursor: pointer;
    text-align: left;
    min-width: 150px;
    padding-right: 1.75rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}
.status-multiselect-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 20;
    min-width: 320px;
    max-height: 420px;
    overflow-y: auto;
    padding: 0.5rem;
    background: #fff;
    border: 1px solid var(--zinc-200, #e4e4e7);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    font-size: 0.8125rem;
}
.status-multiselect-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.25rem 0.5rem;
    border-bottom: 1px solid var(--zinc-200, #e4e4e7);
    margin-bottom: 0.25rem;
}
.status-multiselect-actions button {
    background: none;
    border: 1px solid var(--zinc-300, #d4d4d8);
    border-radius: var(--radius-sm);
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
}
.status-multiselect-hint {
    color: var(--zinc-500, #71717a);
    font-size: 0.7rem;
}
.status-multiselect-group {
    margin: 0.25rem 0;
}
.status-multiselect-group-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--zinc-500, #71717a);
    padding: 0.25rem 0.25rem;
    margin-top: 0.25rem;
    border-top: 1px dashed var(--zinc-200, #e4e4e7);
}
.status-multiselect-group:first-child .status-multiselect-group-label {
    border-top: none;
    margin-top: 0;
}
.status-multiselect-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.375rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.status-multiselect-option:hover {
    background: var(--zinc-100, #f4f4f5);
}
.status-multiselect-option input[type="checkbox"] {
    margin: 0;
}
.status-multiselect-name {
    flex: 1;
}
.status-multiselect-id {
    color: var(--zinc-500, #71717a);
    font-variant-numeric: tabular-nums;
    font-size: 0.85em;
    margin-left: 0.25rem;
}
.status-multiselect-count {
    color: var(--zinc-500, #71717a);
    font-variant-numeric: tabular-nums;
}

.saved-view-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--zinc-100, #f4f4f5);
    border: 1px solid var(--zinc-200, #e4e4e7);
    border-left: 3px solid var(--zinc-500, #71717a);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--zinc-700, #3f3f46);
}
.saved-view-banner .label {
    color: var(--zinc-500, #71717a);
    font-weight: 500;
}
.saved-view-banner .name {
    font-weight: 600;
}
.saved-view-banner .desc {
    color: var(--zinc-600, #52525b);
    flex: 1;
    min-width: 0;
}
.saved-view-banner details.desc > summary {
    list-style: none;
    cursor: pointer;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.saved-view-banner details.desc > summary::-webkit-details-marker { display: none; }
.saved-view-banner details.desc[open] > summary { display: none; }
.saved-view-banner details.desc .more {
    color: var(--zinc-500, #71717a);
    text-decoration: underline;
    margin-left: 0.25rem;
    white-space: nowrap;
}
.saved-view-banner details.desc .desc-full {
    white-space: pre-wrap;
    line-height: 1.45;
}
.saved-view-banner .clear {
    color: var(--zinc-600, #52525b);
    text-decoration: underline;
    font-size: 0.75rem;
}

.sidebar-footer {
    padding: 1rem 1.25rem 0;
    border-top: 1px solid var(--zinc-700);
    margin-top: auto;
}

.sidebar-footer .user-info {
    font-size: 0.8rem;
    color: var(--zinc-400);
    margin-bottom: 0.5rem;
}

.sidebar-footer a {
    font-size: 0.8rem;
    color: var(--zinc-500);
}

.sidebar-footer a:hover { color: var(--zinc-300); }

.sidebar-footer .logout-form { margin: 0; }
.sidebar-footer .logout-form button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 0.8rem;
    color: var(--zinc-500);
    cursor: pointer;
}
.sidebar-footer .logout-form button:hover { color: var(--zinc-300); }

/* ─── Sidebar Toggle ─── */
.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: calc(480px - 52px);
    height: 32px;
    padding: 0 0.75rem 0 0.625rem;
    border-radius: 16px;
    background: var(--zinc-700);
    border: 1px solid var(--zinc-500);
    color: var(--white);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3125rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    z-index: 100;
    transition: background 0.15s, border-color 0.15s, left 0.2s ease, box-shadow 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.sidebar-toggle:hover {
    background: var(--zinc-600);
    border-color: var(--zinc-300);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}
.sidebar-toggle svg {
    width: 13px;
    height: 13px;
}
.sidebar-toggle-label {
    display: inline;
}
.sidebar-collapsed .sidebar-toggle {
    left: 14px;
    padding: 0;
    width: 32px;
    border-radius: 50%;
}
.sidebar-collapsed .sidebar-toggle-label {
    display: none;
}
/* Collapsed state */
.sidebar-collapsed .sidebar {
    width: 60px;
    padding: 1.5rem 0;
}
.sidebar-collapsed .sidebar-brand small,
.sidebar-collapsed .sidebar-nav .nav-item span,
.sidebar-collapsed .sidebar-footer .user-info,
.sidebar-collapsed .sidebar-footer a {
    display: none;
}
.sidebar-collapsed .sidebar-brand {
    padding: 0 0.5rem 1.5rem;
    text-align: center;
}
.sidebar-collapsed .sidebar-brand h1 {
    font-size: 0.875rem;
}
.sidebar-collapsed .sidebar-nav {
    padding: 0 0.375rem;
}
.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 0.625rem;
    gap: 0;
}
.sidebar-collapsed .sidebar-footer {
    padding: 0.75rem 0.5rem 0;
    text-align: center;
}
.sidebar-collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}
.sidebar-collapsed .layout {
    grid-template-columns: 60px 1fr;
}
.sidebar {
    transition: width 0.2s ease, padding 0.2s ease;
}

/* ─── Main Content ─── */
.main-content {
    padding: 2rem;
    overflow-y: auto;
    min-height: 100vh;
}

/* ─── Page Header ─── */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.page-header h2 small {
    font-weight: 400;
    color: var(--zinc-500);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.breadcrumb {
    font-size: 0.8rem;
    color: var(--zinc-500);
    margin-bottom: 0.75rem;
}

.breadcrumb a { color: var(--zinc-500); }
.breadcrumb a:hover { color: var(--zinc-900); }

/* ─── Cards ─── */
.card {
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 1.5rem; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--zinc-100);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-header small {
    color: var(--zinc-500);
    font-size: 0.8rem;
}

/* ─── Data Tables ─── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.data-table thead th.text-right,
.data-table tbody td.text-right {
    text-align: right;
}

.data-table thead th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--zinc-500);
    background: var(--zinc-50);
    border-bottom: 1px solid var(--zinc-200);
}

.data-table tbody td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--zinc-100);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--zinc-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr.client-group-start td {
    border-top: 2.5px solid var(--zinc-300);
}

/* Test accounts: subtle yellow stripe so they're impossible to confuse with
   real users. Excluded from auto_loc_submit + auto_validate_signatures. */
.data-table tbody tr.test-client-row {
    background: #fef9c3;  /* amber-100 */
}
.data-table tbody tr.test-client-row:hover {
    background: #fef08a;  /* amber-200 */
}
.data-table tbody tr.test-client-row td {
    color: var(--zinc-600);
    font-style: italic;
}

.data-table a {
    color: var(--blue-text);
    font-weight: 500;
}

/* ─── Signature Thumbnail + Hover Preview ─── */
.sig-thumb {
    width: 36px;
    height: 24px;
    object-fit: contain;
    border: 1px solid var(--zinc-200);
    border-radius: 3px;
    background: var(--white);
    cursor: pointer;
    transition: none;
}

.sig-preview-wrap {
    position: relative;
}

/* Hover zoom: show enlarged signature in a floating tooltip using the same img */
.sig-preview-wrap .sig-thumb-popup {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 400px;
    height: auto;
    padding: 6px;
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    object-fit: contain;
    pointer-events: none;
}

.sig-preview-wrap:hover .sig-thumb-popup {
    display: block;
}

/* Hover preview for photo ID + address proof: shows full image in a floating tooltip when hovering the badge. */
.photo-id-preview-wrap,
.address-proof-preview-wrap {
    position: relative;
    display: inline-block;
}

.photo-id-preview-wrap .photo-id-thumb-popup,
.address-proof-preview-wrap .address-proof-thumb-popup {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 400px;
    height: auto;
    padding: 6px;
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    object-fit: contain;
    pointer-events: none;
}

.photo-id-preview-wrap .photo-id-pdf-popup,
.address-proof-preview-wrap .address-proof-pdf-popup {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 500px;
    height: 600px;
    padding: 6px;
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.photo-id-preview-wrap .photo-id-pdf-popup iframe,
.address-proof-preview-wrap .address-proof-pdf-popup iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #fff;
}

.photo-id-preview-wrap:hover .photo-id-thumb-popup,
.photo-id-preview-wrap:hover .photo-id-pdf-popup,
.address-proof-preview-wrap:hover .address-proof-thumb-popup,
.address-proof-preview-wrap:hover .address-proof-pdf-popup {
    display: block;
}

/* ─── Document Preview Tooltip ─── */
.doc-preview-wrap {
    position: relative;
}

/* Dim unclassified row cells without affecting absolutely-positioned tooltip children.
   Using opacity on <tr> would cascade to .doc-preview-tooltip and make it translucent. */
.email-row-unclassified > td {
    color: var(--zinc-400);
}
.email-row-unclassified > td > a {
    opacity: 0.7;
}

.doc-preview-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    z-index: 100;
    /* Invisible bridge so mouse can travel from button to tooltip */
    padding-bottom: 8px;
    margin-bottom: -8px;
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    overflow: visible;
}

.doc-preview-tooltip iframe {
    width: 600px;
    height: 450px;
    border: none;
    display: block;
    resize: both;
    overflow: auto;
    background: #fff;
}

.doc-preview-wrap:hover .doc-preview-tooltip {
    display: block;
}

.data-table a:hover {
    text-decoration: underline;
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9999px;
    white-space: nowrap;
}

.badge-green  { background: var(--green-bg);  color: var(--green-text); }
.badge-red    { background: var(--red-bg);    color: var(--red-text); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber-text); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue-text); }
.badge-orange { background: var(--orange-bg); color: var(--orange-text); }
.badge-purple { background: var(--purple-bg); color: var(--purple-text); }
.badge-gray   { background: var(--gray-bg);   color: var(--gray-text); }

/* ─── Status filter option colors ─── */
.status-opt-green  { color: #166534; }
.status-opt-red    { color: #991b1b; }
.status-opt-amber  { color: #92400e; }
.status-opt-blue   { color: #1e40af; }
.status-opt-orange { color: #9a3412; }
.status-opt-gray   { color: #3f3f46; }

/* ─── Status Dots (client list) ─── */
.status-dots {
    display: flex;
    gap: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
}

.status-dot.missing {
    background: var(--zinc-300);
}

.status-legend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.65rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--zinc-400);
    white-space: nowrap;
}

/* ─── Avatar ─── */
.avatar-initials {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--zinc-200);
    color: var(--zinc-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

/* ─── Client Header ─── */
.client-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.client-header-info h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.125rem;
}

.client-header-info p {
    font-size: 0.8rem;
    color: var(--zinc-500);
}

/* ─── Detail Grid (key-value pairs) ─── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 2rem;
}

.detail-item label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--zinc-500);
    margin-bottom: 0.125rem;
}

.detail-item span {
    font-size: 0.875rem;
    color: var(--zinc-900);
}

/* ─── Claims Grid ─── */
.claims-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.claim-card {
    display: block;
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    padding: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.claim-card:hover {
    border-color: var(--zinc-400);
    box-shadow: var(--shadow);
    color: var(--zinc-900);
}

.claim-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.claim-card-header strong {
    font-size: 0.9rem;
}

.claim-card-body {
    font-size: 0.8rem;
    color: var(--zinc-600);
    line-height: 1.5;
}

.claim-card-body .row {
    display: flex;
    justify-content: space-between;
}

/* ─── Timeline ─── */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--zinc-200);
}

.timeline-item {
    position: relative;
    padding-bottom: 1rem;
    padding-left: 1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--zinc-300);
    border: 2px solid var(--white);
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-date {
    font-size: 0.7rem;
    color: var(--zinc-500);
}

.timeline-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--zinc-800);
}

.timeline-desc {
    font-size: 0.8rem;
    color: var(--zinc-600);
    margin-top: 0.125rem;
}

.timeline-actions {
    margin-top: 0.25rem;
}

/* ─── Timeline v2 (grouped, categorised) ─── */
.timeline-v2 { padding-left: 0; max-width: 720px; }

.tl-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: var(--zinc-500);
}

.tl-date-group {
    margin-bottom: 1.25rem;
    border: none;
}

.tl-date-header {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--zinc-500);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--zinc-200);
    margin-bottom: 0;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    user-select: none;
}
.tl-date-header::-webkit-details-marker { display: none; }
.tl-date-header::before {
    content: '\25B8';
    font-size: 1.1rem;
    transition: transform 0.15s ease;
    color: var(--zinc-400);
}
.tl-date-group[open] > .tl-date-header::before {
    transform: rotate(90deg);
}
.tl-date-header:hover { color: var(--zinc-700); }

.tl-date-body {
    padding-left: 1rem;
}

.tl-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.625rem 0;
    align-items: flex-start;
}

.tl-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 7px;
    background: var(--zinc-300);
}
.tl-dot-milestone { background: var(--green-text); }
.tl-dot-alert { background: var(--red-text); }
.tl-dot-todo { background: var(--amber-text); }
.tl-dot-communication { background: var(--blue-text); }
.tl-dot-document { background: var(--purple-text); }
.tl-dot-system { background: var(--zinc-300); }

.tl-content { flex: 1; min-width: 0; }

/* Bundled child events (e.g. Welcome Pack -> T&Cs, LOAs, Email) */
.tl-children-wrap {
    margin-top: 0.25rem;
}
.tl-children-wrap > summary.tl-children-summary {
    list-style: none;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--zinc-500);
    padding: 0.125rem 0;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.tl-children-wrap > summary.tl-children-summary::-webkit-details-marker { display: none; }
.tl-children-wrap > summary.tl-children-summary::before {
    content: "\25B8";
    font-size: 2rem;
    color: var(--zinc-400);
    transition: transform 0.15s ease;
    display: inline-block;
    line-height: 1;
}
.tl-children-wrap[open] > summary.tl-children-summary::before {
    transform: rotate(90deg);
}
.tl-children-wrap > summary.tl-children-summary:hover {
    color: var(--zinc-700);
}
.tl-children {
    margin-top: 0.25rem;
    margin-left: 0.5rem;
    padding-left: 1.75rem;
    border-left: 1.5px dashed var(--zinc-200);
    display: flex;
    flex-direction: column;
}
.tl-children .tl-item {
    padding: 0.25rem 0;
    gap: 0.5rem;
}
.tl-children .tl-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--zinc-700);
    letter-spacing: 0;
}
.tl-children .tl-dot {
    width: 7px;
    height: 7px;
    margin-top: 6px;
}

.tl-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tl-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--zinc-900);
    letter-spacing: -0.005em;
}
.tl-cat-system {
    opacity: 0.45;
}
.tl-cat-system .tl-label {
    font-weight: 400;
    color: var(--zinc-400);
}
.tl-cat-alert .tl-label { color: var(--red-text); }
.tl-cat-todo .tl-label { color: var(--amber-text); }

.tl-time {
    font-size: 0.65rem;
    color: var(--zinc-400);
    white-space: nowrap;
}

.tl-desc {
    font-size: 0.75rem;
    color: var(--zinc-500);
    margin-top: 0.125rem;
    line-height: 1.4;
}

.tl-actions { margin-top: 0.25rem; }

/* Inline document eye-icon (replaces full-width View button) */
.tl-doc-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 0.125rem;
    position: relative;
}
.tl-doc-icon a {
    color: var(--zinc-400);
    display: inline-flex;
    align-items: center;
    padding: 1px;
    border-radius: 3px;
    transition: color 0.12s ease, background 0.12s ease;
}
.tl-doc-icon a:hover {
    color: var(--zinc-800);
    background: var(--zinc-100);
}

/* Burst row (multiple same-type parents collapsed) */
.tl-burst .tl-burst-label {
    font-size: 1rem;
    font-weight: 700;
}
.tl-burst > .tl-content > .tl-row {
    padding: 0.125rem 0;
}

/* Compact child mode: clickable summary row that expands description/email meta */
.tl-row-details {
    margin: 0;
}
.tl-row-details > summary.tl-row-summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    border-radius: 3px;
    padding: 1px 2px;
    margin: -1px -2px;
}
.tl-row-details > summary.tl-row-summary::-webkit-details-marker { display: none; }
.tl-row-details > summary.tl-row-summary:hover {
    background: var(--zinc-50);
}
.tl-row-details > summary.tl-row-summary::after {
    content: "\25B8";
    font-size: 1.7rem;
    color: var(--zinc-300);
    margin-left: 0.125rem;
    transition: transform 0.15s ease;
    display: inline-block;
    line-height: 1;
}
.tl-row-details[open] > summary.tl-row-summary::after {
    transform: rotate(90deg);
}
.tl-row-body {
    padding-left: 0.125rem;
    margin-top: 0.125rem;
}

/* Compact child base: tighter rows, no internal padding */
.tl-child .tl-label {
    font-weight: 500;
    font-size: 0.78rem;
    color: var(--zinc-700);
}

/* Email-specific */
.tl-direction {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    margin-right: 0.125rem;
}
.tl-dir-in { background: var(--blue-bg); color: var(--blue-text); }
.tl-dir-out { background: var(--zinc-200); color: var(--zinc-500); }

.tl-email-meta {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.125rem;
    flex-wrap: wrap;
}
.tl-sender {
    font-size: 0.7rem;
    color: var(--zinc-500);
    font-style: italic;
}
.tl-subject {
    font-size: 0.7rem;
    color: var(--zinc-600);
}

/* Legend tooltip */
.tl-legend-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 0.25rem;
    vertical-align: middle;
}
.tl-legend-icon {
    color: var(--zinc-400);
    cursor: help;
}
.tl-legend-icon:hover { color: var(--zinc-600); }
.tl-legend-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.375rem;
    background: white;
    border: 1px solid var(--zinc-200);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    z-index: 20;
    white-space: nowrap;
}
.tl-legend-wrap:hover .tl-legend-tooltip { display: block; }
.tl-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--zinc-600);
    padding: 0.2rem 0;
}
.tl-legend-item .tl-dot {
    position: static;
}

/* System actions collapse */
/* System actions: hidden by default, shown via header toggle */
.tl-system-item {
    display: none;
}
/* Date groups whose only contents are system actions: also hidden by
   default. The toggle JS sets a body class to reveal them. */
.tl-date-group-system-only {
    display: none;
}
body.show-system-actions .tl-date-group-system-only {
    display: block;
}
/* Future-dated actions (scheduled but not yet fired — e.g. an LOC
   chaser that's already on the schedule for next week). Dim the whole
   row so it's visually distinct from things that have already happened
   and add a dashed left rail / "Scheduled" date-header chip. */
.tl-future {
    opacity: 0.6;
}
.tl-future .tl-dot {
    background: transparent !important;
    border: 1.5px dashed var(--zinc-400) !important;
}
.tl-date-group-future > .tl-date-header {
    color: var(--zinc-400);
    font-style: italic;
}
.tl-date-group-future > .tl-date-header::after {
    content: "Scheduled";
    margin-left: 0.5rem;
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--zinc-500);
    background: var(--zinc-100);
    padding: 0.0625rem 0.4rem;
    border-radius: 9999px;
    border: 1px dashed var(--zinc-300);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-style: normal;
    vertical-align: middle;
}
.tl-system-dots {
    display: flex;
    justify-content: flex-end;
    padding: 0.125rem 0;
    user-select: none;
}
.tl-system-dots .tl-dots {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--zinc-400);
    background: var(--zinc-100);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    border: 1px dashed var(--zinc-200);
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.tl-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--zinc-500);
    cursor: pointer;
    user-select: none;
}
.tl-toggle-label input[type="checkbox"] {
    accent-color: var(--zinc-500);
}

/* ─── Buttons ─── */
.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--zinc-700);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-sm:hover {
    background: var(--zinc-50);
    color: var(--zinc-900);
}

.btn-primary {
    background: var(--zinc-900);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover { background: var(--zinc-700); }

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-danger {
    background: var(--red-bg);
    color: var(--red-text);
    border: 1px solid #fca5a5;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-danger:hover { background: #fecaca; }

.btn-secondary {
    background: var(--zinc-100);
    color: var(--zinc-800);
    border: 1px solid var(--zinc-300);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-secondary:hover { background: var(--zinc-200); }

/* ─── Address Cards ─── */
.address-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.address-card {
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    background: var(--zinc-50);
}

/* Action tiles share the .address-card grid slot but tint themselves
   so they read as actions rather than yet-another-address. The tint
   colour also tells the two tiles apart at a glance: blue = add,
   amber = re-run credit. */
.address-card.add-address-tile {
    background: var(--blue-bg);
    border-color: #bfdbfe;
}
.address-card.add-address-tile .address-card-header {
    border-bottom-color: #bfdbfe;
    color: var(--blue-text);
}
.address-card.missing-loans-tile {
    background: var(--amber-bg);
    border-color: #fde68a;
}
.address-card.missing-loans-tile .address-card-header {
    border-bottom-color: #fde68a;
    color: var(--amber-text);
}

.address-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--zinc-200);
}

.address-card-header strong { font-size: 0.8rem; }

.address-card-body .address-line {
    font-size: 0.8rem;
    line-height: 1.5;
}

.address-card-body .address-line label {
    color: var(--zinc-500);
    font-size: 0.7rem;
    margin-right: 0.25rem;
}

/* ─── Actions Toolbar ─── */
.actions-toolbar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.action-result {
    margin-top: 0.75rem;
}

/* ─── Alerts ─── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.alert strong { display: block; margin-bottom: 0.25rem; }

.alert-success {
    background: var(--green-bg);
    color: var(--green-text);
    border: 1px solid #86efac;
}

.alert-error {
    background: var(--red-bg);
    color: var(--red-text);
    border: 1px solid #fca5a5;
}

.result-details {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    margin-top: 0.25rem;
    font-size: 0.8rem;
}

.text-error { color: var(--red-text); font-weight: 600; }

/* ─── HTMX Spinner ─── */
.spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid var(--zinc-300);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.htmx-request .spinner,
.htmx-request.spinner { display: inline-block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Sortable Columns ─── */
.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sortable:hover { color: var(--zinc-600); }

.sort-icon {
    display: inline-block;
    margin-left: 0.25rem;
    font-size: 0.75rem;
    font-style: normal;
    opacity: 0.35;
    font-family: var(--font-sans);
}

.sortable.sorted-desc .sort-icon,
.sortable.sorted-asc .sort-icon { opacity: 1; }

/* ─── Status Flags ─── */
.status-flags {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-flag {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8rem;
    color: var(--zinc-600);
}

.status-flag .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--zinc-300);
}

.status-flag.active .dot {
    background: #22c55e;
}

/* ─── Search Input ─── */
.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    background: var(--white);
    color: var(--zinc-900);
    outline: none;
    transition: border-color 0.15s;
}

.search-input:focus {
    border-color: var(--zinc-400);
    box-shadow: 0 0 0 3px rgba(113, 113, 122, 0.1);
}

.search-input::placeholder { color: var(--zinc-400); }

/* ─── Select ─── */
.form-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    background: var(--white);
    color: var(--zinc-900);
    outline: none;
}

.form-select:focus {
    border-color: var(--zinc-400);
}

/* ─── Filter Bar ─── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-bar label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--zinc-600);
    cursor: pointer;
}

/* Group a filter control with its info-icon so they stay together when wrapping. */
.filter-group {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* The "?" glyph after each filter. Native `title` tooltip shows the
   technical description (Q-question / SQL clause / Django ORM lookup). */
.filter-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--zinc-100);
    color: var(--zinc-500);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: help;
    user-select: none;
    border: 1px solid var(--zinc-300);
    line-height: 1;
}

.filter-info:hover,
.filter-info:focus {
    background: var(--zinc-200);
    color: var(--zinc-700);
    outline: none;
}

/* ─── Pagination ─── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--zinc-500);
}

.pagination a {
    color: var(--blue-text);
    font-weight: 500;
}

.pagination a:hover { text-decoration: underline; }

/* ─── Summary Stats ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--zinc-900);
}

.stat-card .stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--zinc-500);
    margin-top: 0.25rem;
}

/* ─── Login Page ─── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--zinc-100);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 380px;
}

.login-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.25rem;
}

.login-card .subtitle {
    text-align: center;
    color: var(--zinc-500);
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--zinc-700);
    margin-bottom: 0.25rem;
}

.form-group input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: var(--zinc-400);
    box-shadow: 0 0 0 3px rgba(113, 113, 122, 0.1);
}

.login-card .btn-primary {
    width: 100%;
    margin-top: 0.5rem;
}

.login-forgot {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.85rem;
}

.login-forgot a {
    color: var(--zinc-500);
    text-decoration: none;
}

.login-forgot a:hover { color: var(--zinc-700); }

.alert-error {
    background: var(--red-bg);
    color: var(--red-text);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

/* ─── Notes Block ─── */
.notes-block {
    background: var(--zinc-50);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.875rem;
    white-space: pre-wrap;
    color: var(--zinc-700);
}

/* ─── Hamburger (mobile) ─── */
.hamburger {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1000;
    background: var(--zinc-900);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.625rem;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        width: 240px;
        z-index: 900;
        transition: left 0.2s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .hamburger {
        display: block;
    }

    .sidebar-toggle {
        display: none;
    }

    .main-content {
        padding: 3.5rem 1rem 1rem;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .claims-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .card {
        padding: 1rem;
    }
}

/* Table wrapper for horizontal scroll on small screens */
.table-wrapper {
    overflow-x: auto;
}

/* ─── Bulk action bar (claims list) ─────────────────────────────── */
.bulk-actions-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0 0.25rem;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
}
.bulk-actions-hint {
    color: #64748b;
    font-size: 0.875rem;
    margin-left: auto;
}

/* HTMX in-flight indicator next to the bulk action button.
   Hidden by default; HTMX adds .htmx-request to the form during the
   request, which flips this element to visible. */
.bulk-action-indicator {
    display: none;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.625rem;
    background: var(--blue-50, #eff6ff);
    color: var(--blue-text, #1d4ed8);
    border: 1px solid var(--blue-200, #bfdbfe);
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
}
.bulk-action-indicator::before {
    content: "";
    width: 0.75rem;
    height: 0.75rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: bulk-spin 0.7s linear infinite;
}
.htmx-request .bulk-action-indicator,
.htmx-request.bulk-action-indicator {
    display: inline-flex;
}
@keyframes bulk-spin {
    to { transform: rotate(360deg); }
}

/* hx-disabled-elt: HTMX adds the `disabled` attribute on the matched
   element while the request is in flight. Browsers grey out disabled
   buttons natively, but bump the cursor too. */
.bulk-actions-bar button[disabled] {
    cursor: not-allowed;
    opacity: 0.65;
}
.bulk-select-col {
    width: 28px;
    text-align: center;
}

/* ─── Bulk action result panel ──────────────────────────────────── */
.bulk-result, .bulk-result-error {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}
.bulk-result-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.bulk-result-summary {
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.bulk-result-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.bulk-result-list li {
    padding: 0.25rem 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.875rem;
}
.bulk-result-submitted { color: #166534; }
.bulk-result-skipped   { color: #92400e; }
.bulk-result-error     { color: #991b1b; }

/* ─── Lifecycle stepper (claim detail) ─── */
.lifecycle-stepper {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0.75rem 0.25rem;
    overflow-x: auto;
}
.lc-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--zinc-200);
    background: var(--white);
    transition: all 0.15s;
}
.lc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--zinc-200);
    border: 2px solid var(--zinc-200);
    flex-shrink: 0;
    transition: all 0.15s;
}
.lc-dot-done    { background: var(--green-text); border-color: var(--green-text); }
.lc-dot-current { background: var(--white); border-color: var(--zinc-900); box-shadow: 0 0 0 3px var(--zinc-100); }
.lc-dot-branch  { background: var(--amber-text); border-color: var(--amber-text); }
.lc-dot-pending { background: var(--zinc-100); border-color: var(--zinc-300); }
.lc-step .lc-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--zinc-500);
    white-space: nowrap;
}
/* Step box variants */
.lc-step-done {
    background: var(--green-bg);
    border-color: var(--green-text);
}
.lc-step-done .lc-label { color: var(--green-text); font-weight: 600; }
.lc-step-current {
    background: var(--white);
    border-color: var(--zinc-900);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.lc-step-current .lc-label { color: var(--zinc-900); font-weight: 700; }
.lc-step-branch {
    background: var(--amber-bg);
    border-color: var(--amber-text);
    border-style: dashed;
}
.lc-step-branch .lc-label { color: var(--amber-text); font-weight: 600; }
.lc-step-pending {
    background: var(--zinc-50);
    border-color: var(--zinc-200);
    border-style: dashed;
}
.lc-step-pending .lc-label { color: var(--zinc-400); }

/* Arrow connectors between step boxes */
.lc-connector {
    align-self: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: var(--zinc-300);
    font-size: 1.1rem;
    padding: 0 0.375rem;
    line-height: 1;
}
.lc-connector::before {
    content: "\2192"; /* → */
}
.lc-connector-done { color: var(--green-text); }

/* ─── Operational hint line ─── */
.op-hint {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-top: 0.25rem;
    border: 1px solid transparent;
}
.op-hint-info  { background: var(--blue-bg);  color: var(--blue-text);  border-color: rgba(30,64,175,0.15); }
.op-hint-warn  { background: var(--amber-bg); color: var(--amber-text); border-color: rgba(146,64,14,0.18); }
.op-hint-alert { background: var(--red-bg);   color: var(--red-text);   border-color: rgba(153,27,27,0.18); }

/* ─── Blockers strip ─── */
.blockers-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.25rem 0;
}
.blocker-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
}
.blocker-chip-alert { background: var(--red-bg);   color: var(--red-text);   border-color: rgba(153,27,27,0.2); }
.blocker-chip-warn  { background: var(--amber-bg); color: var(--amber-text); border-color: rgba(146,64,14,0.2); }

/* ─── LOC Submit Gate Status card ─── */
.loc-gate-summary {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}
.loc-gate-summary-success { background: var(--emerald-bg); color: var(--emerald-text); }
.loc-gate-summary-blocked { background: var(--amber-bg);   color: var(--amber-text); }
.loc-gate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.loc-gate-row td {
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--zinc-100);
    vertical-align: top;
}
.loc-gate-row:last-child td { border-bottom: none; }
.loc-gate-icon {
    width: 1.5rem;
    text-align: center;
    font-weight: 700;
}
.loc-gate-pass .loc-gate-icon { color: var(--emerald-text); }
.loc-gate-fail .loc-gate-icon { color: var(--red-text); }
.loc-gate-label {
    font-weight: 600;
    white-space: nowrap;
    width: 10rem;
}
.loc-gate-fail .loc-gate-label { color: var(--red-text); }
.loc-gate-detail { color: var(--zinc-500); }
.loc-gate-error {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--red-bg);
    color: var(--red-text);
    border-radius: 6px;
    font-size: 0.8125rem;
}
.loc-gate-success-detail {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--emerald-bg);
    color: var(--emerald-text);
    border-radius: 6px;
    font-size: 0.8125rem;
}

/* ─── LOC status chips (claims list) ─── */
.loc-status-chip {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
}
.loc-status-success { background: var(--emerald-bg); color: var(--emerald-text); }
.loc-status-alert   { background: var(--red-bg);     color: var(--red-text); }
.loc-status-muted   { background: var(--zinc-100);   color: var(--zinc-400); }

/* ─── Recipient icon (timeline outgoing emails) ─── */
.tl-recipient-icon {
    display: inline-flex;
    align-items: center;
    color: var(--zinc-400);
    margin-right: 0.125rem;
    vertical-align: middle;
}
.tl-subject-inline {
    font-size: 0.72rem;
    color: var(--zinc-600);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

/* ─── View tabs (claims list ↔ board) ─── */
.view-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--zinc-200);
}
.view-tab {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--zinc-500);
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}
.view-tab:hover { color: var(--zinc-900); }
.view-tab.active {
    color: var(--zinc-900);
    border-color: var(--zinc-900);
    font-weight: 700;
}

/* ─── Kanban board ─── */
.kanban-board {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    align-items: flex-start;
}
.kanban-col {
    flex: 0 0 260px;
    background: var(--zinc-100);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.kanban-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--blue-text);
    background: var(--blue-bg);
    border-bottom: 1px solid var(--zinc-200);
}
.kanban-col-count {
    color: var(--blue-text);
    font-weight: 700;
    background: var(--white);
    border-radius: 999px;
    padding: 0.05rem 0.55rem;
    font-size: 0.7rem;
    border: 1px solid rgba(30, 64, 175, 0.2);
    font-family: var(--font-mono);
}
.kanban-col-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem 0.625rem;
    background: var(--zinc-50);
    border-bottom: 1px solid var(--zinc-200);
    font-family: var(--font-sans);
}
.kanban-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 100%;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: var(--white);
    border: 1px solid var(--zinc-300);
    font-size: 0.68rem;
    color: var(--zinc-600);
    text-decoration: none;
    line-height: 1.3;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    font-family: var(--font-sans);
}
.kanban-pill:hover {
    background: var(--blue-bg);
    border-color: var(--blue-text);
    color: var(--blue-text);
}
.kanban-pill.active {
    background: var(--blue-text);
    border-color: var(--blue-text);
    color: var(--white);
    font-weight: 600;
}
.kanban-pill.active:hover { color: var(--white); }
.kanban-pill.active .kanban-pill-count { color: rgba(255,255,255,0.75); }
.kanban-pill-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 130px;
}
.kanban-pill-count {
    color: var(--zinc-400);
    font-weight: 700;
    font-size: 0.62rem;
    font-family: var(--font-mono);
}
.kanban-pill-more {
    background: transparent;
    border: 1px dashed var(--zinc-300);
    color: var(--zinc-500);
    cursor: default;
}

.kanban-col-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 75vh;
    overflow-y: auto;
    padding: 0.625rem;
    background: var(--zinc-100);
}
.kanban-card {
    display: block;
    background: var(--white);
    padding: 0.5rem 0.625rem;
    border-radius: 4px;
    border: 1px solid var(--zinc-200);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.12s, transform 0.12s;
}
.kanban-card:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transform: translateY(-1px);
    color: inherit;
}
.kanban-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.kanban-card-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--zinc-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kanban-card-id {
    font-size: 0.68rem;
    color: var(--zinc-500);
    font-family: var(--font-mono);
    flex-shrink: 0;
}
.kanban-card-meta {
    margin-top: 0.125rem;
}
.kanban-card-bank {
    font-size: 0.72rem;
    color: var(--zinc-600);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kanban-col-empty {
    font-size: 0.7rem;
    color: var(--zinc-400);
    text-align: center;
    padding: 0.5rem;
}
.kanban-col-more {
    font-size: 0.7rem;
    color: var(--zinc-500);
    text-align: center;
    padding: 0.25rem;
    font-style: italic;
}
.kanban-col-closed { opacity: 0.6; }
.kanban-col-closed .kanban-card { background: var(--zinc-100); }

/* "Other / Unmapped" catch-all — amber warning when it has claims
   (signals that a new LogiCAN status needs mapping), muted when empty. */
.kanban-col-other { border-color: var(--amber-text); }
.kanban-col-other .kanban-col-header {
    background: var(--amber-bg);
    color: var(--amber-text);
}
.kanban-col-other .kanban-col-count {
    color: var(--amber-text);
    border-color: rgba(146,64,14,0.3);
}
.kanban-col-other.kanban-col-empty {
    border-color: var(--zinc-300);
    border-style: dashed;
    opacity: 0.6;
}
.kanban-col-other.kanban-col-empty .kanban-col-header {
    background: var(--zinc-100);
    color: var(--zinc-500);
}
.kanban-col-other.kanban-col-empty .kanban-col-count {
    color: var(--zinc-500);
    border-color: var(--zinc-300);
}
.kanban-col-other-hint {
    font-size: 0.7rem;
    color: var(--amber-text);
    padding: 0.75rem;
    text-align: center;
    font-style: italic;
}
.kanban-col-other.kanban-col-empty .kanban-col-other-hint {
    color: var(--zinc-500);
}

/* ─── Status chip (on kanban cards + legend) ─── */
.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.42rem;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.3;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    flex-shrink: 0;
}
.status-chip-green  { background: var(--green-bg);  color: var(--green-text);  border-color: rgba(22,101,52,0.2); }
.status-chip-red    { background: var(--red-bg);    color: var(--red-text);    border-color: rgba(153,27,27,0.2); }
.status-chip-amber  { background: var(--amber-bg);  color: var(--amber-text);  border-color: rgba(146,64,14,0.2); }
.status-chip-blue   { background: var(--blue-bg);   color: var(--blue-text);   border-color: rgba(30,64,175,0.2); }
.status-chip-orange { background: var(--orange-bg); color: var(--orange-text); border-color: rgba(154,52,18,0.2); }
.status-chip-purple { background: var(--purple-bg); color: var(--purple-text); border-color: rgba(107,33,168,0.2); }
.status-chip-gray   { background: var(--gray-bg);   color: var(--gray-text);   border-color: var(--zinc-300); }

/* Per-client claim-status chips on the clients list */
.status-chip-row {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}
.claim-statuses-cell { white-space: normal; max-width: 220px; }
.status-chip-count {
    margin-left: 0.25rem;
    opacity: 0.75;
    font-weight: 600;
}

/* ─── Status pills row in kanban column header ─── */
.kanban-col-pills-status {
    background: var(--white);
    border-top: 1px solid var(--zinc-200);
    padding: 0.375rem 0.625rem;
}
.kanban-pill-status {
    font-family: var(--font-mono);
    padding: 0.12rem 0.42rem;
    font-size: 0.62rem;
    font-weight: 700;
    border-radius: 4px;
}
.kanban-pill-status.active {
    background: var(--zinc-900) !important;
    border-color: var(--zinc-900) !important;
    color: var(--white) !important;
}
.kanban-pill-status.active .kanban-pill-count {
    color: rgba(255,255,255,0.75);
}

/* ─── Status legend (collapsible) ─── */
.status-legend {
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
}
.status-legend > summary {
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    color: var(--zinc-700);
    list-style: none;
}
.status-legend > summary::-webkit-details-marker { display: none; }
.status-legend > summary::before {
    content: "\25B8";
    color: var(--zinc-400);
    margin-right: 0.5rem;
    transition: transform 0.15s;
    display: inline-block;
}
.status-legend[open] > summary::before { transform: rotate(90deg); }
.status-legend > summary:hover { color: var(--zinc-900); }
.status-legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.375rem 1rem;
    margin-top: 0.625rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--zinc-200);
}
.status-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: var(--zinc-700);
}
.status-legend-name { flex: 1; }
.status-legend-count {
    color: var(--zinc-400);
    font-family: var(--font-mono);
    font-size: 0.68rem;
}

/* ─── Timeline per-item doc action bar (hover-reveals Preview / Open buttons;
       Preview click toggles an inline iframe below). Uses collapsible transitions
       so rows beneath are pushed down cleanly instead of overlapping. ─── */
.tl-has-doc > .tl-doc-bar {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    padding-left: 1.25rem;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.15s ease, opacity 0.15s ease,
                padding-top 0.15s ease, padding-bottom 0.15s ease;
}
.tl-has-doc:hover > .tl-doc-bar,
.tl-has-doc.doc-preview-open > .tl-doc-bar {
    max-height: 34px;
    opacity: 1;
    padding-top: 0.3rem;
    padding-bottom: 0.1rem;
}
.tl-doc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 3px 9px;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.2;
    border: 1px solid;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.1s ease, border-color 0.1s ease, color 0.1s ease;
}
.tl-doc-btn svg { flex-shrink: 0; }
.tl-doc-btn-preview {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}
.tl-doc-btn-preview:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e3a8a;
    text-decoration: none;
}
.tl-has-doc.doc-preview-open > .tl-doc-bar .tl-doc-btn-preview {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
}
.tl-doc-btn-open {
    color: var(--zinc-700, #374151);
    background: var(--zinc-50, #f9fafb);
    border-color: var(--zinc-200, #e5e7eb);
}
.tl-doc-btn-open:hover {
    background: var(--zinc-100, #f3f4f6);
    color: var(--zinc-900, #111827);
    border-color: var(--zinc-300, #d1d5db);
    text-decoration: none;
}
.tl-has-doc > .tl-doc-inline-preview {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-left: 1.25rem;
    transition: max-height 0.2s ease, opacity 0.2s ease,
                margin-top 0.2s ease, margin-bottom 0.2s ease,
                border-color 0.2s ease;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fff;
}
.tl-has-doc.doc-preview-open > .tl-doc-inline-preview {
    max-height: 520px;
    opacity: 1;
    margin-top: 0.4rem;
    margin-bottom: 0.25rem;
    border-color: var(--zinc-200, #e5e7eb);
}
.tl-has-doc > .tl-doc-inline-preview iframe {
    width: 100%;
    height: 500px;
    border: 0;
    display: block;
    background: #fff;
}

/* ─── LogiCAN edit hint (client detail header) ─── */
.logican-edit-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0.375rem 0 0;
    padding: 0.3rem 0.625rem;
    font-size: 0.75rem;
    color: var(--zinc-600);
    background: var(--zinc-50, #fafafa);
    border: 1px dashed var(--zinc-200);
    border-radius: var(--radius-sm, 6px);
}
.logican-edit-hint svg { flex-shrink: 0; color: var(--zinc-500); }

/* Client banner on email detail */
.client-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1rem;
    background: var(--purple-bg, #faf5ff);
    border: 1px solid var(--purple-border, #e9d5ff);
    border-radius: var(--radius-sm, 6px);
}
.client-banner-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--zinc-900);
}
.client-banner-id {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--zinc-500);
    margin-left: 0.4rem;
}
.client-banner-contact {
    display: flex;
    gap: 1.25rem;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--zinc-600);
}

/* ---- Email-detail link-status banner (Client > Claim chip chain) ---- */
.link-banner {
    background: var(--purple-bg, #faf5ff);
    border: 1px solid var(--purple-border, #e9d5ff);
    border-radius: var(--radius-sm, 6px);
    padding: 0.7rem 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.link-banner.link-banner-unlinked {
    background: #fff7ed; /* amber-50 */
    border-color: #fed7aa; /* amber-200 */
}
.link-banner-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.link-banner-chain {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.95rem;
}
.link-chain-arrow {
    color: var(--zinc-400);
    font-weight: 600;
    font-size: 1.1rem;
    user-select: none;
}
.link-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    background: #fff;
    border: 1px solid var(--zinc-200);
    border-radius: 999px;
    text-decoration: none;
    color: var(--zinc-900);
    font-weight: 500;
    line-height: 1.2;
    transition: border-color 0.15s ease, background 0.15s ease;
}
a.link-chip:hover {
    border-color: var(--purple-text, #7c3aed);
    background: #fdfaff;
}
.link-chip-icon { font-size: 0.95em; }
.link-chip-name { color: var(--zinc-900); }
.link-chip-id {
    font-family: var(--font-mono);
    font-size: 0.82em;
    color: var(--zinc-500);
}
/* Client chip — purple (matches the rest of the client treatment in the UI) */
.link-chip-client {
    background: #faf5ff;          /* purple-50 */
    border-color: #d8b4fe;        /* purple-300 */
}
.link-chip-client .link-chip-id {
    color: #7c3aed;               /* purple-600 */
    font-weight: 600;
}
a.link-chip-client:hover {
    border-color: #7c3aed;
    background: #f3e8ff;          /* purple-100 */
}
/* Claim chip — blue, distinct from client purple */
.link-chip-claim {
    background: #eff6ff;          /* blue-50 */
    border-color: #93c5fd;        /* blue-300 */
}
.link-chip-claim .link-chip-id {
    color: #2563eb;               /* blue-600 */
    font-weight: 600;
}
a.link-chip-claim:hover {
    border-color: #2563eb;
    background: #dbeafe;          /* blue-100 */
}
.link-chip-missing {
    background: #fffbeb; /* amber-50 */
    border-color: #fcd34d; /* amber-300 */
    color: #92400e; /* amber-800 */
    font-weight: 600;
}
.link-chip-missing .link-chip-icon { color: #b45309; }
.link-chip-sm {
    font-size: 0.8rem;
    padding: 0.15rem 0.45rem;
}
.link-banner-edit { position: relative; }
.link-banner-edit summary.btn-edit-link {
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.link-banner-edit summary::-webkit-details-marker { display: none; }
.link-attach-form {
    position: absolute;
    right: 0;
    top: calc(100% + 0.3rem);
    z-index: 5;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: #fff;
    border: 1px solid var(--zinc-300);
    border-radius: var(--radius-sm, 6px);
    padding: 0.65rem 0.75rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    white-space: nowrap;
}
.link-attach-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.78rem;
    color: var(--zinc-600);
    font-weight: 500;
}
.link-attach-label input {
    padding: 0.32rem 0.5rem;
    border: 1px solid var(--zinc-300);
    border-radius: 4px;
    font-size: 0.9rem;
    width: 9rem;
}
.link-attach-hint {
    font-size: 0.75rem;
    align-self: center;
}
.link-banner-extras {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--purple-border, #e9d5ff);
    font-size: 0.85rem;
}
.link-banner-extras-label {
    color: var(--zinc-600);
    font-weight: 600;
}
.link-banner-extra {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.link-banner-feedback {
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-weight: 500;
}
.link-banner-feedback-ok {
    background: #ecfdf5; /* emerald-50 */
    border: 1px solid #a7f3d0; /* emerald-200 */
    color: #065f46; /* emerald-800 */
}
.link-banner-feedback-err {
    background: #fef2f2; /* red-50 */
    border: 1px solid #fecaca; /* red-200 */
    color: #991b1b; /* red-800 */
}

/* Client link affordance — used on prominent client-name links
   (banners, breadcrumbs, detail-page headers). Tables keep the
   plain-text + table-hover-underline style. */
.client-link {
    color: var(--zinc-900);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed #c4b5fd; /* purple-300 */
    padding-bottom: 1px;
    transition: border-color 0.15s ease, border-style 0.15s ease;
}
.client-link::before {
    content: "👤";
    margin-right: 0.35rem;
    color: var(--purple-text);
    font-size: 0.85em;
}
/* Hover only applies to anchors — the <span class="client-link-current">
   variant on the current-page breadcrumb keeps the static treatment. */
a.client-link:hover {
    color: var(--zinc-900);
    border-bottom: 1px solid var(--purple-text);
}
.client-link-current { cursor: default; }

/* Client emails list — two-line FROM cell */
.email-from-name { font-weight: 600; color: var(--zinc-900); }
.email-from-addr { font-size: 0.78rem; color: var(--zinc-500); margin-top: 0.1rem; }

/* ─── Status History (claim detail) ─── */
.sh-details > .sh-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    user-select: none;
}
.sh-details > .sh-summary::-webkit-details-marker { display: none; }
.sh-details > .sh-summary::before {
    content: "▸";
    font-size: 2.2rem;
    color: var(--zinc-500);
    transition: transform 0.15s ease;
    display: inline-block;
    line-height: 1;
}
.sh-details[open] > .sh-summary::before { transform: rotate(90deg); }
.sh-count {
    font-size: 0.75rem;
    color: var(--zinc-500);
    background: var(--zinc-100);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
}

.sh-timeline {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0 0 0 0.25rem;
}
.sh-step {
    position: relative;
    padding-left: 1.75rem;
}
.sh-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.35rem 0;
}
.sh-dot {
    position: absolute;
    left: 0;
    top: 0.6rem;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 50%;
    border: 2px solid var(--white);
    box-shadow: 0 0 0 1px var(--zinc-300);
    z-index: 1;
}
.sh-dot-green  { background: var(--green-bg);  box-shadow: 0 0 0 1px var(--green-text); }
.sh-dot-red    { background: var(--red-bg);    box-shadow: 0 0 0 1px var(--red-text); }
.sh-dot-amber  { background: var(--amber-bg);  box-shadow: 0 0 0 1px var(--amber-text); }
.sh-dot-blue   { background: var(--blue-bg);   box-shadow: 0 0 0 1px var(--blue-text); }
.sh-dot-orange { background: var(--orange-bg); box-shadow: 0 0 0 1px var(--orange-text); }
.sh-dot-purple { background: var(--purple-bg); box-shadow: 0 0 0 1px var(--purple-text); }
.sh-dot-gray   { background: var(--gray-bg);   box-shadow: 0 0 0 1px var(--zinc-400); }

.sh-step-current .sh-dot {
    animation: sh-pulse 2s ease-in-out infinite;
}
@keyframes sh-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.15); }
}

.sh-connector {
    position: absolute;
    left: 0.4rem;
    top: -0.35rem;
    width: 2px;
    height: 1.75rem;
    background: var(--zinc-300);
}
.sh-connector-break {
    background: transparent;
    border-left: 2px dashed var(--zinc-400);
    width: 0;
}
.sh-gap-label {
    position: absolute;
    left: 1rem;
    top: 0.2rem;
    font-size: 0.7rem;
    color: var(--zinc-500);
    background: var(--white);
    padding: 0 0.35rem;
    white-space: nowrap;
    font-style: italic;
}

.sh-body { flex: 1; min-width: 0; }
.sh-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.sh-name {
    font-weight: 600;
    color: var(--zinc-900);
    font-size: 0.9rem;
}
.sh-time {
    color: var(--zinc-500);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}
.sh-meta {
    font-size: 0.78rem;
    color: var(--zinc-500);
    margin-top: 0.1rem;
}
.sh-dwell-current {
    color: var(--green-text);
    font-weight: 500;
}
.sh-empty {
    color: var(--zinc-500);
    font-size: 0.875rem;
    margin: 0.75rem 0 0;
}

/* ----- Email focus card ----- */
.email-detail .focus-card { padding: 1rem 1.25rem; }
.focus-card-title-row {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; margin-bottom: 0.5rem;
}
.focus-card-subject { margin: 0; font-size: 1.15rem; line-height: 1.3; flex: 1; }
.focus-card-chips { display: flex; gap: 0.25rem; flex-wrap: wrap; align-items: center; }
.bucket-chip {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 2px 8px; border-radius: 999px;
    font: 600 0.72rem/1.4 var(--font-mono); letter-spacing: 0.01em;
    background: var(--zinc-100); color: var(--zinc-800);
    border: 1px solid var(--zinc-200);
}
.bucket-chip .bucket-chip-prefix {
    font: 700 0.6rem/1 ui-sans-serif, system-ui, sans-serif;
    text-transform: uppercase; letter-spacing: 0.06em;
    opacity: 0.65;
}
.focus-card-from-to { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 0.5rem; }
.focus-card-line { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; font-size: 0.9rem; }
.focus-card-arrow { color: var(--zinc-400); }
.focus-card-side-icon { width: 14px; height: 14px; color: var(--zinc-500); }
.focus-card-party-name { color: var(--zinc-800); }
.focus-card-address { color: var(--zinc-500); font-family: var(--font-mono); font-size: 0.8rem; }
.focus-card-date { margin-left: auto; color: var(--zinc-500); font-size: 0.8rem; }
.focus-card-summary {
    background: linear-gradient(135deg, #faf5ff, #f5f3ff);
    border: 1px solid #e9d5ff;
    border-left: 3px solid #8b5cf6;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    font-size: 0.85rem;
}
.focus-card-summary-label {
    display: inline-flex; align-items: center; gap: 0.25rem;
    color: #6d28d9; font-weight: 600;
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
    margin-right: 0.5rem;
}
.focus-card-summary-label svg { width: 12px; height: 12px; }
.focus-card-summary-text { color: var(--zinc-700); font-style: italic; }
.focus-card-cc {
    font-size: 0.8rem; color: var(--zinc-600);
    margin: 0.25rem 0; font-family: var(--font-mono);
}
.focus-card-toolbar {
    display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
    padding: 0.5rem 0; border-top: 1px solid var(--zinc-100); border-bottom: 1px solid var(--zinc-100);
    margin: 0.5rem 0;
}
.tech-info-fire-recommended {
    margin-top: 0.5rem; padding-top: 0.5rem;
    border-top: 1px solid var(--zinc-200);
}
.focus-card-iframe {
    width: 100%; min-height: 320px; border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm); background: #fff;
}
/* ----- Tech info collapsible ----- */
.tech-info { display: inline-block; }
.tech-info-summary {
    cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 0.25rem;
    color: var(--zinc-600); font-size: 0.8rem; padding: 0.25rem 0.5rem;
    border: 1px solid var(--zinc-200); border-radius: var(--radius-sm); background: var(--zinc-50);
}
.tech-info[open] .tech-info-summary svg { transform: rotate(90deg); }
.tech-info-body {
    margin-top: 0.5rem; padding: 0.5rem 0.75rem;
    background: var(--zinc-50); border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm); font-size: 0.85rem;
}
.tech-info-grid {
    display: grid; grid-template-columns: max-content 1fr;
    gap: 0.25rem 0.75rem; margin: 0;
}
.tech-info-grid dt {
    color: var(--zinc-500); font-size: 0.75rem; text-transform: uppercase; padding-top: 0.15rem;
}
.tech-info-grid dd { margin: 0; color: var(--zinc-800); }
.tech-info-engine-reason { color: var(--zinc-600); margin-top: 0.15rem; }
.tech-info-have-check { margin-top: 0.15rem; }
.tech-info-fire-other {
    margin-top: 0.5rem; display: flex; gap: 0.4rem; align-items: center;
    flex-wrap: wrap; padding-top: 0.5rem; border-top: 1px solid var(--zinc-200);
}
.tech-info-fire-other select { font-size: 0.8rem; padding: 0.2rem 0.4rem; }

/* Density override — only inside email-detail; do not leak globally */
.email-detail .card { padding: 0.875rem 1.125rem; }
.email-detail + .comms-thread-merged { margin-top: 0.75rem; }

/* ---------------------------------------------------------------------- */
/* Peek / collapse — used to keep long sections (timeline, conversation   */
/* list) from dominating the page. Show a short preview by default; user  */
/* clicks the toggle to reveal the rest.                                  */
/* ---------------------------------------------------------------------- */
.peek-collapsible { position: relative; }
.peek-content { position: relative; }
.peek-collapsible[data-peek="collapsed"] > .peek-content {
    max-height: var(--peek-height, 360px);
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 56px), transparent);
            mask-image: linear-gradient(to bottom, #000 calc(100% - 56px), transparent);
}
.peek-toggle {
    display: flex; align-items: center; justify-content: center; gap: 0.35rem;
    margin: 0.6rem auto 0.25rem; padding: 0.4rem 0.95rem;
    background: var(--zinc-50); color: var(--zinc-700);
    border: 1px solid var(--zinc-200); border-radius: 999px;
    font-size: 0.8rem; font-weight: 500; cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.peek-toggle:hover { background: var(--zinc-100); border-color: var(--zinc-300); }
.peek-toggle .peek-caret {
    display: inline-block; transition: transform 0.18s ease;
    font-size: 0.7rem; line-height: 1;
}
.peek-collapsible[data-peek="expanded"] .peek-caret { transform: rotate(180deg); }
.peek-collapsible[data-peek="collapsed"] .peek-label-expanded,
.peek-collapsible[data-peek="expanded"] .peek-label-collapsed { display: none; }
/* Auto-hide the toggle when JS has marked the content short enough to fit */
.peek-collapsible[data-peek-fits="true"] > .peek-toggle { display: none; }
.peek-collapsible[data-peek-fits="true"] > .peek-content {
    max-height: none;
    -webkit-mask-image: none;
            mask-image: none;
}

/* ─── Pipeline pathway trace (View 1 — per-email classification audit) ─── */
.pipeline-pathway .trace-stepper { list-style: none; margin: 0; padding: 0; }
.pipeline-pathway .trace-stepper > li { border-left: 2px solid var(--border, #e2e8f0); padding: 6px 0 6px 12px; margin-left: 6px; }
.pipeline-pathway .trace-node { font-weight: 600; margin-right: 8px; }
.pipeline-pathway .trace-out { color: #475569; }
.pipeline-pathway .trace-reasoning { color: #334155; font-style: italic; margin-top: 4px; }
.pipeline-pathway details > pre { white-space: pre-wrap; font-size: 12px; background: #f8fafc; padding: 6px; border-radius: 4px; }

details.assessment-timeline > .assessment-timeline-summary { cursor: pointer; user-select: none; list-style-position: inside; }
details.assessment-timeline > .assessment-timeline-summary:hover { color: var(--zinc-700, #334155); }
details.assessment-timeline:not([open]) > .assessment-timeline-summary { margin: 0; }
.assessment-timeline .timeline { list-style: none; margin: 0; padding: 0; }
.assessment-timeline .timeline > li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f1f5f9; }
.assessment-timeline .tl-ts { color: #94a3b8; font-variant-numeric: tabular-nums; min-width: 84px; }
.assessment-timeline .tl-assessment { background: #f8fafc; }
.assessment-timeline .tl-link { margin-left: auto; text-decoration: none; }
