*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-text: #212529;
    --color-text-muted: #6c757d;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-border: #dee2e6;
    --color-nav: #1e293b;
    --radius: 6px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

.navbar {
    background: var(--color-nav);
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand a {
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.875rem;
}

.nav-links a:hover {
    color: #fff;
}

.container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

p {
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

/* Auth forms */
.auth-card {
    max-width: 420px;
    margin: 3rem auto;
    background: var(--color-surface);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.auth-card h1 {
    font-size: 1.5rem;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.75rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    width: 100%;
}

button {
    margin-top: 1rem;
    padding: 0.6rem 1rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

button:hover {
    background: var(--color-primary-hover);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.auth-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--color-primary);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Page header with action button */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
}

.table th {
    background: var(--color-bg);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table td a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.table td a:hover {
    text-decoration: underline;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.badge-intake { background: #dbeafe; color: #1e40af; }
.badge-evidence_gathering { background: #fef3c7; color: #92400e; }
.badge-guild_consultation { background: #e0e7ff; color: #3730a3; }
.badge-assembly { background: #fce7f3; color: #9d174d; }
.badge-filed { background: #d1fae5; color: #065f46; }
.badge-uscis_review { background: #f3e8ff; color: #6b21a8; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-denied { background: #fee2e2; color: #991b1b; }
.badge-rfe_pending { background: #ffedd5; color: #9a3412; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.empty-state p {
    margin-bottom: 1rem;
}

/* Form card (case create) */
.form-card {
    max-width: 600px;
    margin: 0 auto;
    background: var(--color-surface);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.form-card h1 {
    margin-bottom: 1rem;
}

.form-card h2 {
    font-size: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.25rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-card form {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

input[type="date"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    width: 100%;
}

/* Case detail */
.case-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.case-header h1 {
    display: inline;
    margin-right: 0.75rem;
    margin-bottom: 0;
}

.case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.card h2 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.card dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
}

.card dt {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.card dd {
    font-size: 0.875rem;
    margin: 0;
}

/* Activity log */
.activity-log ul {
    list-style: none;
}

.activity-log li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
}

.activity-log li:last-child {
    border-bottom: none;
}

.event-time {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    margin-left: 1rem;
}

/* Dashboard actions */
.dashboard-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* Active nav link */
.nav-links a.active {
    color: #fff;
}

/* Pipeline visualization */
.pipeline {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
}

.pipeline-phase {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    min-width: 100px;
}

.pipeline-phase::after {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--color-border);
}

.pipeline-phase:last-child::after {
    display: none;
}

.pipeline-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-border);
    border: 3px solid var(--color-bg);
    position: relative;
    z-index: 1;
    margin-bottom: 0.5rem;
}

.pipeline-phase--done .pipeline-dot {
    background: #22c55e;
}

.pipeline-phase--done::after {
    background: #22c55e;
}

.pipeline-phase--current .pipeline-dot {
    background: var(--color-primary);
    box-shadow: 0 0 0 4px #dbeafe;
}

.pipeline-label {
    font-size: 0.7rem;
    text-align: center;
    color: var(--color-text-muted);
    line-height: 1.3;
}

.pipeline-phase--current .pipeline-label {
    color: var(--color-primary);
    font-weight: 600;
}

.pipeline-phase--done .pipeline-label {
    color: #16a34a;
}

/* Phase instruction panel */
.phase-panel {
    margin-bottom: 1.5rem;
}

.phase-checklist {
    list-style: none;
    padding: 0;
}

.phase-checklist li {
    padding: 0.5rem 0 0.5rem 1.75rem;
    position: relative;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--color-border);
}

.phase-checklist li:last-child {
    border-bottom: none;
}

.phase-checklist li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.65rem;
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-border);
    border-radius: 3px;
}

/* Phase transition actions */
.phase-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 0.8rem;
    margin-bottom: 0;
}

.breadcrumb a {
    color: var(--color-primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Page header actions */
.page-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Small buttons */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Text muted */
.text-muted {
    color: var(--color-text-muted);
}

/* Document status badges */
.badge-doc-required { background: #fee2e2; color: #991b1b; }
.badge-doc-pending_upload { background: #ffedd5; color: #9a3412; }
.badge-doc-uploaded { background: #dbeafe; color: #1e40af; }
.badge-doc-under_review { background: #fef3c7; color: #92400e; }
.badge-doc-approved { background: #d1fae5; color: #065f46; }
.badge-doc-rejected { background: #fee2e2; color: #991b1b; }

/* Document progress */
.doc-progress {
    margin-bottom: 1.5rem;
}

.doc-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-progress-pct {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
}

.doc-progress-count {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.progress-bar {
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    margin: 0.5rem 0;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: #22c55e;
    border-radius: 4px;
    transition: width 0.3s;
}

/* Document category sections */
.doc-category {
    margin-bottom: 1.5rem;
}

/* File input */
input[type="file"] {
    font-size: 0.875rem;
    padding: 0.5rem 0;
}

/* Textarea */
textarea {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    width: 100%;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
}

/* Evidence matrix */
.evidence-score-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.evidence-score-card {
    text-align: center;
}

.evidence-score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.quality-gate {
    font-size: 1.25rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    display: inline-block;
}

.quality-gate--pass {
    background: #d1fae5;
    color: #065f46;
}

.quality-gate--fail {
    background: #fee2e2;
    color: #991b1b;
}

.evidence-criterion {
    margin-bottom: 1.5rem;
}

.evidence-criterion-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.evidence-criterion-header h2 {
    margin-bottom: 0;
}

.evidence-strength-bar {
    flex: 1;
    max-width: 150px;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.evidence-strength-fill {
    height: 100%;
    border-radius: 4px;
}

.evidence-strength--high { background: #22c55e; }
.evidence-strength--mid { background: #f59e0b; }
.evidence-strength--low { background: #ef4444; }

.evidence-strength-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    min-width: 2rem;
}

.evidence-summary {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.evidence-actions {
    white-space: nowrap;
}

/* Strength badges */
.badge-strength-1 { background: #fee2e2; color: #991b1b; }
.badge-strength-2 { background: #ffedd5; color: #9a3412; }
.badge-strength-3 { background: #fef3c7; color: #92400e; }
.badge-strength-4 { background: #d1fae5; color: #065f46; }
.badge-strength-5 { background: #bbf7d0; color: #14532d; }

/* Recommender cards */
.rec-card {
    margin-bottom: 1rem;
}

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.rec-header-right {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.rec-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.rec-details {
    display: flex;
    gap: 2rem;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.rec-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

/* Recommender status badges */
.badge-rec-identified { background: #e0e7ff; color: #3730a3; }
.badge-rec-contacted { background: #dbeafe; color: #1e40af; }
.badge-rec-draft_sent { background: #fef3c7; color: #92400e; }
.badge-rec-reviewing { background: #f3e8ff; color: #6b21a8; }
.badge-rec-signed { background: #d1fae5; color: #065f46; }
.badge-rec-declined { background: #fee2e2; color: #991b1b; }

.badge-rec-cat { background: #f1f5f9; color: #475569; }

.badge-criterion { background: #eff6ff; color: #1d4ed8; font-size: 0.7rem; }

/* Checkbox group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 400;
    margin-top: 0;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

/* --- Guild consultations --- */

.guild-dual-warning {
    background: #fef3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.guild-ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
}

.guild-ref-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
}

.guild-ref-card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.guild-ref-card dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.guild-ref-instructions {
    font-size: 0.8rem;
}

.guild-card {
    margin-bottom: 0.75rem;
}

.badge-guild-preparing { background: #e2e8f0; color: #475569; }
.badge-guild-submitted { background: #dbeafe; color: #1e40af; }
.badge-guild-awaiting_response { background: #fef3cd; color: #92400e; }
.badge-guild-received { background: #d1fae5; color: #065f46; }
.badge-guild-objection { background: #fee2e2; color: #991b1b; }

.badge-outcome-no_objection { background: #d1fae5; color: #065f46; }
.badge-outcome-favorable { background: #dbeafe; color: #1e40af; }
.badge-outcome-objection { background: #fee2e2; color: #991b1b; }

.inline-label {
    display: inline;
    font-size: 0.8rem;
    font-weight: 500;
    margin-right: 0.25rem;
}

/* --- Dashboard pipeline --- */

.dashboard-pipeline { padding: 1.5rem; }

.pipeline-bar {
    display: flex;
    gap: 2px;
    margin-bottom: 0.75rem;
}

.pipeline-segment {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.5rem;
    background: #f1f5f9;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--color-text);
    transition: background 0.15s;
    cursor: pointer;
}

.pipeline-segment:hover {
    background: #e2e8f0;
}

.pipeline-segment--active {
    background: var(--color-primary);
    color: #fff;
}

.pipeline-segment--active:hover {
    background: var(--color-primary-hover);
}

.pipeline-segment-count {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.pipeline-segment-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.25rem;
    text-align: center;
}

.pipeline-segment-avg {
    font-size: 0.65rem;
    opacity: 0.7;
    margin-top: 0.15rem;
}

.pipeline-terminal {
    display: flex;
    gap: 0.5rem;
}

.pipeline-terminal-badge {
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
}

/* --- Dashboard alerts --- */

.dashboard-alerts { padding: 1.5rem; }

.alert-list {
    list-style: none;
    padding: 0;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
}

.alert-item:last-child { border-bottom: none; }

.alert-icon { font-size: 1.1rem; }

.alert-item--deadline .alert-message strong { color: #b45309; }
.alert-item--overdue_docs .alert-message strong { color: #dc2626; }
.alert-item--guild_overdue .alert-message strong { color: #7c3aed; }

/* --- Case filter bar --- */

.case-filter-bar {
    margin-bottom: 1rem;
}

.case-filter-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.case-search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.case-status-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--color-surface);
}

/* --- Petition assembly --- */

.exhibit-tab {
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 0;
}

.exhibit-tab:last-child { border-bottom: none; }

.exhibit-tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.exhibit-tab-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.exhibit-doc-list {
    list-style: none;
    padding: 0;
    margin-top: 0.5rem;
}

.exhibit-doc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0 0.35rem 1rem;
    font-size: 0.85rem;
}

.exhibit-assign-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
}

.exhibit-assign-row:last-child { border-bottom: none; }

.exhibit-assign-label { flex: 1; }

.exhibit-assign-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.exhibit-assign-form select {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.exhibit-index-table td,
.exhibit-index-table th {
    vertical-align: top;
}

/* --- Participant portals --- */

.portal-status-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
}

.portal-doc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
    gap: 1rem;
}

.portal-doc-row:last-child { border-bottom: none; }

.portal-doc-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.portal-doc-label { font-size: 0.9rem; }

.portal-upload-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.portal-upload-form input[type="file"] {
    width: auto;
    font-size: 0.8rem;
}

.badge-portal-required { background: #fee2e2; color: #991b1b; }
.badge-portal-pending_upload { background: #fef3cd; color: #92400e; }
.badge-portal-uploaded { background: #dbeafe; color: #1e40af; }
.badge-portal-under_review { background: #e2e8f0; color: #475569; }
.badge-portal-approved { background: #d1fae5; color: #065f46; }
.badge-portal-rejected { background: #fee2e2; color: #991b1b; }

.portal-link-box {
    display: flex;
    gap: 0;
    margin-top: 0.5rem;
}

.portal-link-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 0.8rem;
    font-family: monospace;
    background: #f8f9fa;
    color: var(--color-text);
    cursor: text;
}

.portal-copy-btn {
    border-radius: 0 var(--radius) var(--radius) 0;
    white-space: nowrap;
}

/* --- Notification bell --- */

.nav-bell {
    position: relative;
    font-size: 1.1rem;
    text-decoration: none;
    color: #cbd5e1;
    padding: 0 0.25rem;
}

.nav-bell:hover { color: #fff; }

.notif-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    border-radius: 8px;
    text-align: center;
    padding: 0 4px;
}

/* --- Notification list --- */

.notif-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.notif-item:last-child { border-bottom: none; }

.notif-item--unread {
    background: #eff6ff;
    border-left: 3px solid var(--color-primary);
}

.notif-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    padding-top: 0.15rem;
}

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.notif-message {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 0.15rem;
}

.notif-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.35rem;
    font-size: 0.75rem;
}

.notif-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
    align-items: flex-start;
}

.badge-notif-filing_deadline_approaching { background: #fef3cd; color: #92400e; }
.badge-notif-document_overdue { background: #fee2e2; color: #991b1b; }
.badge-notif-recommender_no_response { background: #dbeafe; color: #1e40af; }
.badge-notif-guild_response_overdue { background: #f3e8ff; color: #6b21a8; }
.badge-notif-rfe_deadline { background: #fee2e2; color: #991b1b; }

/* --- Reports & Analytics --- */

.report-section {
    margin-bottom: 2rem;
}

.report-section h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--color-border);
}

.report-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
}

.report-grid--4 {
    grid-template-columns: repeat(4, 1fr);
}

.report-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
}

.report-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.report-card--wide {
    grid-column: span 2;
}

.report-grid--4 .report-card--wide {
    grid-column: span 4;
}

.report-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 0.5rem;
}

.report-stat:last-child { margin-bottom: 0; }

.report-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.report-stat-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.report-table th,
.report-table td {
    text-align: left;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--color-border);
}

.report-table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-bar-wrap .progress-bar {
    height: 8px;
    background: var(--color-primary);
    border-radius: 4px;
    flex: 1;
    max-width: 100px;
}

.progress-bar-wrap span {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

@media (max-width: 768px) {
    .report-grid,
    .report-grid--4 {
        grid-template-columns: 1fr;
    }
    .report-card--wide {
        grid-column: span 1;
    }
    .report-grid--4 .report-card--wide {
        grid-column: span 1;
    }
}

/* --- Agent Infrastructure --- */

.agent-panel {
    border-left: 3px solid var(--color-primary);
}

.agent-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.agent-panel-header h2 { margin: 0; }

.badge-agent {
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.7rem;
}

.agent-flow-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.agent-flow-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.agent-flow-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.agent-flow-info strong { font-size: 0.9rem; }
.agent-flow-info .text-muted { font-size: 0.8rem; }

.agent-status-area {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
}

.agent-task-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    border-radius: var(--radius);
}

.agent-task-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.agent-status--running { background: #eff6ff; }
.agent-status--queued { background: #fffbeb; }
.agent-status--completed { background: #f0fdf4; }
.agent-status--failed { background: #fef2f2; }

.agent-task-flow { font-weight: 600; }

.agent-badge-queued { background: #fef3cd; color: #92400e; }
.agent-badge-running { background: #dbeafe; color: #1e40af; }
.agent-badge-completed { background: #d1fae5; color: #065f46; }
.agent-badge-failed { background: #fee2e2; color: #991b1b; }
.agent-badge-cancelled { background: #e2e8f0; color: #475569; }

/* Spinner for running tasks */
@keyframes agent-spin {
    to { transform: rotate(360deg); }
}

.agent-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #93c5fd;
    border-top-color: #1e40af;
    border-radius: 50%;
    animation: agent-spin 0.8s linear infinite;
}

.agent-queued-icon { font-size: 0.85rem; }
.agent-done-icon { color: #059669; font-weight: bold; font-size: 0.95rem; }
.agent-fail-icon { color: #dc2626; font-weight: bold; font-size: 0.95rem; }

.agent-result-summary {
    font-size: 0.8rem;
    color: #374151;
    padding-left: 1.5rem;
}

.agent-error-summary {
    font-size: 0.8rem;
    color: #991b1b;
    padding-left: 1.5rem;
}

.agent-result-cell,
.agent-error-cell {
    padding: 0.5rem 0.6rem;
}

.agent-result-cell pre,
.agent-error-cell pre {
    background: #f8fafc;
    padding: 0.5rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    overflow-x: auto;
    margin: 0.25rem 0 0;
}

.agent-error-cell pre {
    background: #fef2f2;
    color: #991b1b;
}

/* --- Billing --- */

.billing-plan-current h3 {
    margin-bottom: 0.25rem;
}

.billing-badges {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.billing-table {
    width: 100%;
    border-collapse: collapse;
}

.billing-table td,
.billing-table th {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}

.billing-table th {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.billing-total-row td {
    border-top: 2px solid var(--color-text);
    border-bottom: none;
}

.billing-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.billing-plan-card {
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.billing-plan-card--active {
    border-color: var(--color-primary);
    background: #eff6ff;
}

.billing-plan-card h3 {
    margin-bottom: 0.25rem;
}

.billing-plan-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.billing-plan-price span {
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-text-muted);
}

.billing-plan-card p {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.billing-plan-card ul {
    list-style: none;
    padding: 0;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.billing-plan-card ul li {
    padding: 0.25rem 0;
}

.billing-plan-card form {
    margin: 0;
}

.billing-plan-card .btn {
    width: 100%;
}
