/* filename: static/css/portal.css */

.portal-shell {
    min-height: 100vh;
    background: var(--bg);
}

.portal-topbar {
    min-height: 72px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
}

.portal-brand {
    font-size: 22px;
    font-weight: 900;
}

.portal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-user {
    color: var(--text-soft);
    font-size: 14px;
}

.portal-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px;
}

.portal-login-wrap {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-login-card {
    width: 100%;
    max-width: 520px;
}

.portal-form {
    display: grid;
    gap: 16px;
}

.portal-case-card {
    display: block;
}

.portal-case-card:hover {
    transform: translateY(-2px);
}

.portal-case-title {
    font-size: 20px;
    font-weight: 900;
    margin-bottom: 8px;
}

.portal-case-meta {
    color: var(--text-soft);
    margin-bottom: 12px;
}

.portal-case-summary {
    color: var(--text);
    line-height: 1.7;
}

.portal-auth-link-row {
    margin-top: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.portal-auth-link-text {
    font-size: 14px;
    color: var(--text-soft);
}

.portal-auth-link {
    font-size: 14px;
    font-weight: 800;
    color: var(--primary);
}

.portal-submit-button {
    width: 100%;
}

.portal-logout-form {
    margin: 0;
}

/* ============================================================
   CASE WORKSPACE BASE
   ============================================================ */

.portal-case-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(340px, 0.8fr);
    gap: 22px;
    margin-top: 22px;
}

.portal-case-main,
.portal-case-sidebar {
    min-width: 0;
}

.portal-case-sidebar {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

@media (max-width: 1100px) {
    .portal-case-workspace {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   CHAT
   ============================================================ */

.portal-chat-window {
    height: 680px;
    border: 1px solid #d9e5f5;
    border-radius: 20px;
    background: #f8fbff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.portal-chat-messages {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
}

.portal-chat-row {
    display: flex;
    gap: 12px;
    margin-bottom: 22px;
    align-items: flex-end;
}

.portal-chat-row.right {
    flex-direction: row-reverse;
}

.portal-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e5efff;
    color: #356fe5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    flex-shrink: 0;
}

.portal-chat-row.right .portal-chat-avatar {
    background: #356fe5;
    color: #fff;
}

.portal-chat-block {
    max-width: 72%;
}

.portal-chat-row.right .portal-chat-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.portal-chat-name {
    font-size: 12px;
    font-weight: 800;
    color: #6a768a;
    margin-bottom: 6px;
}

.portal-chat-bubble {
    background: #fff;
    border: 1px solid #dfe8f4;
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 15px;
    line-height: 1.65;
    box-shadow: 0 8px 20px rgba(18, 35, 63, 0.05);
}

.portal-chat-row.right .portal-chat-bubble {
    background: #356fe5;
    border-color: #356fe5;
    color: #fff;
}

.portal-chat-time {
    margin-top: 6px;
    font-size: 12px;
    color: #7b8798;
}

.portal-chat-form {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: #fff;
    border-top: 1px solid #dfe8f4;
}

.portal-chat-input {
    flex: 1;
    height: 52px;
    border: 1px solid #d7e4f5;
    border-radius: 14px;
    padding: 0 16px;
    font-size: 15px;
}

.portal-chat-send {
    height: 52px;
    border: 0;
    border-radius: 14px;
    padding: 0 24px;
    background: #356fe5;
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.portal-chat-empty {
    min-height: 320px;
    border: 1px dashed #c8daf4;
    border-radius: 18px;
    color: #6a768a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.portal-chat-attach-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
    transition: background 0.15s;
}

.portal-chat-attach-btn:hover {
    background: #e8f0fe;
}

.portal-chat-file-preview {
    font-size: 0.8rem;
    color: #4b7df3;
    padding: 4px 8px;
    background: #e8f0fe;
    border-radius: 8px;
    margin-top: 6px;
}

.chat-attachment-card {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0f4ff;
    border: 1px solid #c8d9f8;
    border-radius: 10px;
    font-size: 0.82rem;
}

.portal-chat-row.right .chat-attachment-card {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
}

.chat-attachment-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.chat-attachment-info {
    flex: 1;
    min-width: 0;
}

.chat-attachment-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-attachment-status {
    font-size: 0.75rem;
    color: #6a768a;
    margin-top: 2px;
}

.portal-chat-row.right .chat-attachment-status {
    color: rgba(255, 255, 255, 0.75);
}

.chat-attachment-download {
    flex-shrink: 0;
    color: #356fe5;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
}

/* ============================================================
   PORTAL EXTENSIONS
   ============================================================ */

.portal-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topbar-link {
    height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    transition: 0.15s ease;
}

.topbar-link:hover,
.topbar-link.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.portal-content-wrap {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.portal-narrow {
    max-width: 780px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.button-sm {
    min-height: 38px;
    padding: 0 16px;
    font-size: 14px;
    border-radius: 14px;
}

.button-lg {
    min-height: 60px;
    padding: 0 32px;
    font-size: 17px;
    border-radius: 20px;
}

.button-ghost {
    background: transparent;
    color: var(--text-soft);
    border: 1px solid transparent;
    font-size: 14px;
}

.button-ghost:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.button-danger {
    background: #fff0f0;
    color: #c0392b;
    border: 1px solid #f5c6cb;
}

.button-danger:hover {
    background: #ffe0e0;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-sm {
    padding: 3px 8px;
    font-size: 12px;
}

.badge-xs {
    padding: 2px 7px;
    font-size: 11px;
}

.badge-lg {
    padding: 8px 14px;
    font-size: 14px;
}

.badge-new { background: #e8f2ff; color: #1d5fc8; }
.badge-in-progress { background: #fff4e5; color: #b86900; }
.badge-review { background: #f5f0ff; color: #6d28d9; }
.badge-done { background: #edfbf3; color: #166534; }

.badge-waiting { background: #f1f5f9; color: #64748b; }
.badge-analyzing { background: #fff8e1; color: #b45309; }
.badge-success { background: #edfbf3; color: #166534; }
.badge-failed { background: #fff1f2; color: #be123c; }

.badge-pending { background: #fff8e1; color: #b45309; }
.badge-matched { background: #e8f2ff; color: #1d5fc8; }
.badge-contacted { background: #edfbf3; color: #166534; }
.badge-closed { background: #f1f5f9; color: #475569; }
.badge-cancelled { background: #fef2f2; color: #991b1b; }

/* ============================================================
   LIST / CARD UTILITIES
   ============================================================ */

.section-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.section-item {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    transition: 0.15s ease;
    text-decoration: none;
    color: var(--text);
    display: block;
}

a.section-item:hover {
    border-color: #b8d0f6;
    background: #f9fcff;
    transform: translateY(-1px);
}

.section-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.section-item-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.section-item-meta {
    font-size: 14px;
    color: var(--text-soft);
    margin-bottom: 4px;
}

.section-text {
    font-size: 15px;
    line-height: 1.65;
}

.card-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header-link {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.card-action-row {
    margin-top: 16px;
}

.card-warning-border {
    border-color: #f4bf48;
}

.card-highlight-border {
    border-color: #84b5f8;
}

.card-muted {
    border-color: var(--border);
    background: var(--surface-soft);
}

.text-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.field-error {
    color: #c0392b;
    font-size: 14px;
}

.field-hint {
    font-size: 13px;
    color: var(--text-soft);
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.required-mark {
    color: #be123c;
    margin-left: 2px;
}

/* ============================================================
   ALERTS / EMPTY
   ============================================================ */

.alert-box {
    padding: 14px 18px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 15px;
}

.alert-info {
    background: #eff8ff;
    border: 1px solid #c3dafc;
    color: #215c9f;
}

.alert-highlight {
    background: #fefce8;
    border: 1px solid #fde68a;
    color: #854d0e;
}

.alert-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
}

.alert-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.alert-link {
    margin-left: auto;
    font-weight: 800;
    color: inherit;
    text-decoration: underline;
    white-space: nowrap;
}

.info-box {
    padding: 16px 20px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 15px;
    color: var(--text-soft);
    line-height: 1.7;
}

.empty-inline {
    font-size: 15px;
    color: var(--text-soft);
    padding: 8px 0;
}

.portal-empty-preview {
    padding: 18px 20px;
    border: 1px dashed #c8daf4;
    border-radius: 16px;
    background: #f8fbff;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.7;
}

/* ============================================================
   ANALYSIS
   ============================================================ */

.analysis-pending-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 16px;
    font-size: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.analysis-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #fde68a;
    border-top-color: #d97706;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.analysis-section {
    padding: 18px;
    border-radius: 16px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    margin-bottom: 14px;
}

.analysis-section:last-child {
    margin-bottom: 0;
}

.analysis-section-warning {
    background: #fffdf5;
    border-color: #f6d860;
}

.analysis-section-highlight {
    background: #f0f7ff;
    border-color: #a8c8f8;
}

.analysis-section-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.analysis-section-content {
    font-size: 15px;
    line-height: 1.75;
    color: var(--text);
}

/* ============================================================
   TIMELINE
   ============================================================ */

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

.timeline-item {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding-bottom: 28px;
    position: relative;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-top: 5px;
    background: var(--primary);
    box-shadow: 0 0 0 7px rgba(47, 134, 246, 0.12);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.timeline-item:not(:last-child) .timeline-dot::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 22px;
    transform: translateX(-50%);
    width: 2px;
    height: calc(100% + 24px);
    background: #dbe7f7;
}

.timeline-date {
    font-size: 15px;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 8px;
}

.timeline-title {
    font-size: 17px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 6px;
}

.timeline-summary {
    font-size: 15px;
    color: var(--text-soft);
    line-height: 1.75;
}

.timeline-linked-facts {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-linked-fact {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-soft);
}

.timeline-linked-fact strong {
    display: block;
    color: var(--text);
    font-size: 13px;
    margin-bottom: 2px;
}

/* ============================================================
   ISSUE / CHECKLIST / STEP
   ============================================================ */

.issue-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.issue-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 16px;
    background: var(--surface-soft);
    border-radius: 14px;
    border: 1px solid var(--border);
}

.issue-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 13px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.issue-body {
    flex: 1;
    min-width: 0;
}

.issue-title {
    font-size: 15px;
    font-weight: 700;
}

.issue-desc {
    font-size: 14px;
    margin-top: 4px;
    line-height: 1.65;
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checklist-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fffdf5;
    border: 1px solid #f6d860;
}

.checklist-item-done {
    background: #edfbf3;
    border-color: #6ee7b7;
    opacity: 0.72;
}

.checklist-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1.5;
}

.checklist-body {
    flex: 1;
    min-width: 0;
}

.checklist-title {
    font-size: 15px;
    font-weight: 700;
}

.checklist-desc {
    font-size: 14px;
    margin-top: 3px;
    line-height: 1.6;
}

.step-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.step-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 16px;
    background: #f0f7ff;
    border-radius: 14px;
    border: 1px solid #a8c8f8;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 13px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-body {
    flex: 1;
    min-width: 0;
}

.step-title {
    font-size: 15px;
    font-weight: 700;
}

.step-desc {
    font-size: 14px;
    margin-top: 4px;
    line-height: 1.65;
}

.step-reason {
    font-size: 13px;
    color: #2563eb;
    margin-top: 6px;
}

/* ============================================================
   CONNECTION
   ============================================================ */

.connection-status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 20px;
    border-radius: 16px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.connection-status-pending { background: #fffbeb; border-color: #fde68a; }
.connection-status-matched { background: #eff8ff; border-color: #93c5fd; }
.connection-status-contacted { background: #f0fdf4; border-color: #86efac; }
.connection-status-closed { background: #f8fafc; border-color: var(--border); }
.connection-status-cancelled { background: #fff1f2; border-color: #fecdd3; }

.connection-status-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.connection-status-icon {
    font-size: 22px;
}

.connection-status-title {
    font-size: 15px;
    font-weight: 700;
}

.connection-status-lawyer,
.connection-status-note {
    font-size: 14px;
    margin-top: 2px;
}

.connection-status-detail {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.connection-status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.connection-status-row:last-child {
    border-bottom: 0;
}

.connection-status-row-col {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.connection-status-key {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
    min-width: 110px;
}

/* ============================================================
   SELECTORS
   ============================================================ */

.urgency-selector,
.contact-method-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.urgency-option,
.contact-option {
    cursor: pointer;
}

.urgency-option input[type="radio"],
.contact-option input[type="radio"] {
    display: none;
}

.urgency-option-label,
.contact-option-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.15s ease;
}

.urgency-option input[type="radio"]:checked + .urgency-option-label,
.contact-option input[type="radio"]:checked + .contact-option-label {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
}

.urgency-chip {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.urgency-low { background: #edfbf3; color: #166534; }
.urgency-medium { background: #fefce8; color: #854d0e; }
.urgency-high { background: #fff7ed; color: #9a3412; }
.urgency-critical { background: #fff1f2; color: #9f1239; }

/* ============================================================
   FILES
   ============================================================ */

.portal-upload-workspace {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.file-list,
.file-status-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-item,
.file-status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.file-item-info,
.file-status-info {
    flex: 1;
    min-width: 0;
}

.file-item-name,
.file-status-name {
    font-size: 14px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item-meta,
.file-status-meta {
    font-size: 13px;
    color: var(--text-soft);
    margin-top: 2px;
}

.file-item-action {
    font-size: 13px;
    white-space: nowrap;
}

.file-status-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.file-status-summary {
    padding: 8px 14px 12px;
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.6;
    margin-top: -2px;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    background: #fbfdff;
}

.file-status-summary-error {
    color: #9f1239;
    background: #fff8f8;
    border-color: #fecdd3;
}

/* ============================================================
   DASHBOARD
   ============================================================ */

.dashboard-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.section-title {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -0.03em;
    margin: 0;
}

.section-more {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.case-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.case-card {
    padding: 18px 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    display: block;
    text-decoration: none;
    color: var(--text);
    transition: 0.18s ease;
}

.case-card:hover {
    border-color: #93c5fd;
    transform: translateY(-2px);
    box-shadow: 0 22px 48px rgba(25, 42, 70, 0.12);
}

.case-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.case-card-title {
    font-size: 16px;
    font-weight: 800;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.case-card-firm {
    font-size: 13px;
    color: var(--text-soft);
    margin-bottom: 8px;
}

.case-card-meta {
    font-size: 13px;
    color: var(--text-soft);
}

.case-card-connection {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 6px;
}

.empty-dashboard {
    text-align: center;
    padding: 60px 28px;
    background: white;
    border: 1px dashed #c3dafc;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.empty-dashboard-icon {
    font-size: 48px;
}

.empty-dashboard-title {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.empty-dashboard-desc {
    font-size: 16px;
    color: var(--text-soft);
    line-height: 1.7;
}

/* ============================================================
   CTA / INTAKE
   ============================================================ */

.cta-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 28px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f0ff 100%);
    border: 1px solid #93c5fd;
    border-radius: 20px;
    flex-wrap: wrap;
}

.cta-card-title {
    font-size: 18px;
    font-weight: 900;
    margin-bottom: 6px;
}

.cta-card-desc {
    font-size: 15px;
    color: var(--text-soft);
}

.cta-card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.intake-guide {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.intake-guide-item {
    padding: 12px 14px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-soft);
}

/* ============================================================
   FLASH
   ============================================================ */

.flash-success {
    background: #edfbf3;
    border-color: #6ee7b7;
    color: #166534;
}

.flash-error,
.flash-danger {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #9f1239;
}

.flash-warning {
    background: #fefce8;
    border-color: #fde68a;
    color: #854d0e;
}

/* ============================================================
   QUOTA
   ============================================================ */

.portal-quota-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--color-text-muted, #6b7280);
    background: var(--color-surface-alt, #f3f4f6);
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.portal-quota-badge.portal-quota-empty {
    color: #c53030;
    background: #fff5f5;
}

/* ============================================================
   INVITATION / AUTH
   ============================================================ */

.portal-invite-security-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    font-size: 14px;
    color: #1e40af;
    margin-bottom: 20px;
}

.portal-invite-notice-icon {
    font-size: 16px;
    line-height: 1;
}

.portal-invite-verified-banner {
    padding: 12px 16px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 10px;
    font-size: 14px;
    color: #166534;
    margin-bottom: 20px;
}

.portal-invite-email-static {
    padding: 10px 14px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    color: #475569;
    font-weight: 600;
}

.portal-invite-email-readonly {
    background: #f8fafc !important;
    color: #64748b !important;
    cursor: default;
}

.portal-invite-btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.portal-invite-msg {
    margin-top: 10px;
    font-size: 14px;
    min-height: 20px;
}

.portal-invite-msg-ok {
    color: #16a34a;
}

.portal-invite-msg-error {
    color: #dc2626;
}

.portal-invite-context {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.portal-invite-firm-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
    width: fit-content;
}

.portal-invite-firm-icon {
    font-size: 13px;
    line-height: 1;
}

.portal-invite-case-box {
    background: var(--primary-soft);
    border: 1.5px solid #b8d8fd;
    border-radius: 14px;
    padding: 16px 18px;
}

.portal-invite-case-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--text);
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.portal-invite-inviter {
    font-size: 14px;
    color: var(--text-soft);
    font-weight: 600;
}

.portal-invite-what-next {
    padding: 12px 14px;
    border-left: 3px solid var(--primary);
    background: var(--surface);
    border-radius: 0 10px 10px 0;
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.6;
}

.portal-auth-shell {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

.portal-auth-header {
    height: 64px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.portal-auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.portal-auth-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    flex-shrink: 0;
    letter-spacing: -0.01em;
}

.portal-auth-brand-name {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.portal-auth-home-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-soft);
    text-decoration: none;
    transition: color 0.15s ease;
}

.portal-auth-home-link:hover {
    color: var(--text);
}

.portal-auth-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
}

.portal-auth-main .portal-login-wrap {
    min-height: unset;
    width: 100%;
    max-width: 560px;
}

.portal-auth-footer {
    padding: 16px 28px;
    text-align: center;
    font-size: 13px;
    color: var(--text-soft);
    flex-shrink: 0;
}

/* ============================================================
   INTAKE DONE / SIGNUP
   ============================================================ */

.intake-done-wrap {
    max-width: 560px;
    width: 100%;
}

.intake-done-case-box {
    background: var(--primary-soft);
    border: 1.5px solid #b8d8fd;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 20px;
}

.intake-done-case-title {
    font-size: 17px;
    font-weight: 900;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.intake-done-firm {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 5px;
}

.intake-analysis-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 20px;
}

.intake-analysis-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.intake-analysis-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: intake-dot-pulse 1.4s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes intake-dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.75); }
}

.intake-analysis-steps {
    display: grid;
    gap: 8px;
}

.intake-analysis-step {
    font-size: 13px;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: intake-step-fade 3.2s ease-in-out infinite;
}

.intake-analysis-step:nth-child(1) { animation-delay: 0s; }
.intake-analysis-step:nth-child(2) { animation-delay: 0.8s; }
.intake-analysis-step:nth-child(3) { animation-delay: 1.6s; }
.intake-analysis-step:nth-child(4) { animation-delay: 2.4s; }

@keyframes intake-step-fade {
    0%, 20% { opacity: 0.35; }
    30%, 60% { opacity: 1; font-weight: 700; color: var(--text); }
    80%, 100% { opacity: 0.35; }
}

.intake-analysis-step-icon {
    font-size: 12px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.intake-value-list {
    display: grid;
    gap: 6px;
    margin-bottom: 20px;
}

.intake-value-item {
    font-size: 14px;
    color: var(--text-soft);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}

.intake-value-check {
    color: var(--primary);
    font-weight: 900;
    flex-shrink: 0;
    margin-top: 1px;
}

.intake-defer-note {
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.6;
}

.intake-email-locked {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    padding: 15px 18px;
    font-size: 16px;
    color: var(--text);
    gap: 12px;
}

.intake-email-confirmed {
    font-size: 12px;
    font-weight: 800;
    color: #16a34a;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================================
   CLIENT CASE DETAIL — LAWYER WORKSPACE TERMINOLOGY PARITY
   ============================================================ */

.portal-detail-page {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.portal-case-hero {
    margin-bottom: 0;
}

.portal-case-hero .page-title {
    margin-bottom: 12px;
}

.portal-case-hero .page-subtitle {
    margin: 0;
    color: var(--text-soft);
}

.portal-case-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 4px 0 2px;
}

.portal-case-tab {
    min-height: 42px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.portal-case-tab:hover,
.portal-case-tab.active {
    background: var(--primary-soft);
    border-color: #b8d0f6;
    color: var(--primary);
}

.portal-case-workspace-detail {
    align-items: start;
    margin-top: 18px;
}

.portal-case-main-detail {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.portal-case-sidebar-detail {
    position: sticky;
    top: 92px;
}

.portal-case-main-detail > .card,
.portal-case-sidebar-detail > .card,
.portal-work-card {
    border-radius: 24px;
}

.portal-case-main-detail .card-header,
.portal-case-sidebar-detail .card-header {
    align-items: flex-start;
}

.portal-case-main-detail .card-title,
.portal-work-card .card-title {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -0.035em;
    line-height: 1.25;
    margin: 0;
}

.portal-case-sidebar-detail .card-title {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.25;
    margin: 0;
}

.portal-work-card .card-subtitle,
.portal-case-main-detail .card-subtitle,
.portal-case-sidebar-detail .card-subtitle {
    font-size: 15px;
    color: var(--text-soft);
    line-height: 1.65;
    margin-top: 8px;
}

.portal-submenu {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portal-submenu-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 15px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.portal-submenu-item:hover {
    border-color: #b8d0f6;
    background: #f8fbff;
    transform: translateY(-1px);
}

.portal-submenu-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    font-size: 17px;
    line-height: 1;
}

.portal-submenu-item strong {
    display: block;
    font-size: 15px;
    font-weight: 900;
    color: var(--text);
    line-height: 1.35;
}

.portal-submenu-item small {
    display: block;
    margin-top: 3px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-soft);
}

.portal-party-list,
.portal-fact-list,
.portal-conflict-list,
.portal-issue-structure-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portal-party-item,
.portal-fact-item,
.portal-issue-structure-item {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
}

.portal-party-name,
.portal-fact-title {
    font-size: 17px;
    font-weight: 900;
    color: var(--text);
}

.portal-party-meta,
.portal-fact-desc,
.portal-muted-text {
    margin-top: 6px;
    font-size: 15px;
    color: var(--text-soft);
    line-height: 1.7;
}

.portal-issue-structure-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
}

.portal-issue-structure-head h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
}

.portal-conflict-item {
    padding: 16px 18px;
    border: 1px solid #fecaca;
    border-radius: 16px;
    background: #fff7f7;
}

.portal-conflict-title {
    font-size: 16px;
    font-weight: 900;
    color: #991b1b;
}

.portal-conflict-desc {
    margin-top: 8px;
    font-size: 15px;
    color: #7f1d1d;
    line-height: 1.7;
}
/* filename: static/css/portal.css */

.portal-argument-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

.portal-argument-side-title {
    font-size: 18px;
    font-weight: 900;
    margin: 0 0 14px;
    color: var(--text);
}

.portal-argument-side-title-opposing {
    color: #b91c1c;
}

.portal-argument-item {
    padding: 18px 20px;
    border: 1px solid #d9e5f5;
    border-radius: 18px;
    background: #ffffff;
    margin-bottom: 14px;
}

.portal-argument-item-opposing {
    border-color: #fecaca;
    background: #fffafa;
}

.portal-argument-title {
    font-size: 17px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 10px;
}

.portal-argument-summary {
    font-size: 15px;
    line-height: 1.75;
    color: var(--text);
}

.portal-argument-note {
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid #d9e5f5;
    border-radius: 14px;
    background: #f8fbff;
}

.portal-argument-note strong {
    display: block;
    font-size: 14px;
    font-weight: 900;
    margin-bottom: 6px;
}

.portal-argument-note p {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text);
}

.portal-argument-note-warning {
    border-color: #fed7aa;
    background: #fff7ed;
}
/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1100px) {
    .portal-detail-page {
        max-width: none;
    }

    .portal-case-sidebar-detail {
        position: static;
    }
}

@media (max-width: 860px) {
    .portal-page {
        padding: 18px;
    }

    .page-title {
        font-size: 26px;
    }

    .form-grid-2 {
        grid-template-columns: 1fr;
    }

    .urgency-selector,
    .contact-method-selector {
        flex-direction: column;
    }

    .cta-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .case-card-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .portal-case-main-detail {
        gap: 16px;
    }

    .portal-case-main-detail .card-title,
    .portal-work-card .card-title {
        font-size: 21px;
    }

    .portal-case-sidebar-detail .card-title {
        font-size: 18px;
    }

    .portal-submenu-item {
        grid-template-columns: 30px minmax(0, 1fr);
        padding: 13px 14px;
    }

    .portal-submenu-icon {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }

    .timeline-item {
        grid-template-columns: 18px minmax(0, 1fr);
        gap: 14px;
    }

    .timeline-date {
        font-size: 14px;
    }

    .timeline-title {
        font-size: 16px;
    }

    .portal-auth-header {
        padding: 0 16px;
    }

    .portal-auth-main {
        padding: 24px 16px;
        justify-content: flex-start;
    }
}
