/* Base styles following the dashboard design system */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 400;
    font-size: 0.9rem;
    color: #595959;
    background-color: #f5f5f5;
}

/* Navbar */
.navbar {
    background-color: #B21F29;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar h1 {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
}

.navbar a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

/* App layout with sidebar */
.app-layout {
    display: flex;
    min-height: calc(100vh - 56px);
}

.sidebar {
    width: 220px;
    min-width: 220px;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 1.25rem 0;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #999;
    padding: 0 1.25rem;
    margin-bottom: 0.4rem;
}

.sidebar-link {
    display: block;
    padding: 0.45rem 1.25rem;
    color: #595959;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background-color 0.15s, color 0.15s;
}

.sidebar-link:hover {
    background-color: #f5f5f5;
    color: #333;
}

.sidebar-link.active {
    background-color: #fdf2f2;
    color: #B21F29;
    font-weight: 600;
    border-right: 3px solid #B21F29;
}

.sidebar-link.disabled {
    color: #ccc;
    cursor: default;
    font-size: 0.85rem;
}

.sidebar-link.disabled:hover {
    background-color: transparent;
    color: #ccc;
}

.main-content {
    flex: 1;
    overflow-y: auto;
}

/* Main content area */
.container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Card component */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.card-header {
    color: #B21F29;
    font-weight: 700;
    font-size: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 1.5rem;
}

/* Review type cards on dashboard */
.review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.review-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
    border: 2px solid transparent;
    text-decoration: none;
    color: inherit;
    display: block;
}

.review-card:hover {
    border-color: #B21F29;
    transform: translateY(-2px);
}

.review-card .icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.review-card h3 {
    color: #B21F29;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.review-card p {
    color: #595959;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Buttons */
.btn-primary {
    background-color: #B21F29;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #8a1820;
}

.btn-outline {
    background-color: white;
    color: #B21F29;
    border: 2px solid #B21F29;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background-color: #B21F29;
    color: white;
}

/* Upload zone */
.step-description {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.upload-zone {
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: #B21F29;
    background-color: #fdf2f2;
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.upload-text {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.upload-subtext {
    font-size: 0.8rem;
    color: #999;
}

.file-list {
    margin-bottom: 1.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.file-name {
    font-weight: 500;
    color: #333;
}

.btn-remove {
    background: none;
    border: none;
    color: #B21F29;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-full {
    width: 100%;
    margin-top: 0.5rem;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 0;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #B21F29;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-weight: 500;
    color: #595959;
}

/* Forms */
.section-note {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
    flex: 1;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
    margin-bottom: 0.35rem;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    color: #333;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #B21F29;
}

.form-group textarea {
    resize: vertical;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group-small {
    flex: 0 0 120px;
}

.form-group-checkbox {
    display: flex;
    align-items: center;
}

.form-group-checkbox label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
}

.form-group-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #B21F29;
}

/* Section titles (used in pipeline views) */
.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #334155;
    margin: 1.5rem 0 0.75rem;
}

.subtitle {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 1.5rem;
}

/* ── Estate Planning Pipeline & Follow-Ups ─────────────────── */
.ep-summary-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.ep-summary-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    flex: 1;
    text-align: center;
}
.ep-summary-label { font-size: 0.8rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
.ep-summary-value { font-size: 2rem; font-weight: 700; color: #1e293b; margin-top: 0.25rem; }

.section-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: #B21F29;
    text-decoration: none;
    margin-left: 0.75rem;
}
.section-link:hover { text-decoration: underline; }
.ep-pipeline-compact { display: flex; flex-direction: column; gap: 0.35rem; }
.ep-compact-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0;
}
.ep-compact-name { font-size: 0.82rem; color: #475569; min-width: 200px; }
.ep-compact-count { font-weight: 700; font-size: 0.85rem; color: #1e293b; min-width: 25px; text-align: right; }
.ep-compact-row .ep-phase-bar-track { flex: 1; }
.ep-pipeline { display: flex; flex-direction: column; gap: 0.5rem; }
.ep-phase-row {
    background: #fff;
    border-radius: 10px;
    padding: 0.6rem 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.ep-phase-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 0.75rem;
}
.ep-phase-name { flex: 1; font-weight: 600; font-size: 0.88rem; color: #334155; }
.ep-phase-count {
    font-weight: 700;
    font-size: 1rem;
    color: #1e293b;
    min-width: 30px;
    text-align: right;
}
.ep-phase-toggle {
    color: #94a3b8;
    font-size: 0.8rem;
    transition: transform 0.2s;
}
.ep-phase-row.expanded .ep-phase-toggle { transform: rotate(180deg); }
.ep-phase-bar-track {
    height: 6px;
    background: #f1f5f9;
    border-radius: 999px;
    margin-top: 0.4rem;
    overflow: hidden;
}
.ep-phase-bar-fill {
    height: 100%;
    background: #B21F29;
    border-radius: 999px;
    min-width: 4px;
}
.ep-phase-names {
    display: none;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
}
.ep-phase-row.expanded .ep-phase-names { display: block; }
.ep-phase-name-item {
    font-size: 0.8rem;
    color: #64748b;
    padding: 0.15rem 0;
}
.ep-phase-case {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.8rem;
    color: #64748b;
}
.ep-case-overdue { color: #B21F29; font-weight: 600; }
.ep-case-name { flex: 1; }
.ep-case-age {
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    min-width: 40px;
    text-align: right;
}
.ep-case-overdue .ep-case-age { color: #B21F29; }
.ep-overdue-flag {
    display: inline-block;
    background: #B21F29;
    color: #fff;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    margin-right: 0.3rem;
}
.ep-overdue-badge {
    background: #B21F29;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    margin-left: 0.25rem;
}
.ep-overdue-banner {
    background: #fef2f2;
    border-left: 4px solid #B21F29;
    color: #B21F29;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.ep-attention-alert { border-left: 3px solid #ef4444; }
.ep-attention-alert .ep-summary-value { color: #ef4444; }
.ep-attention { display: flex; flex-direction: column; gap: 0.5rem; }
.ep-attention-group {
    background: #fff;
    border-radius: 10px;
    padding: 0.6rem 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.ep-attention-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
}
.ep-attention-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ep-attention-label { flex: 1; font-weight: 600; font-size: 0.88rem; color: #334155; }
.ep-attention-count {
    font-weight: 700;
    font-size: 1rem;
    color: #1e293b;
    min-width: 25px;
    text-align: right;
}
.ep-attention-cases {
    display: none;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
}
.ep-attention-group.expanded .ep-attention-cases { display: block; }
.ep-attention-group.expanded .ep-phase-toggle { transform: rotate(180deg); }
.ep-attention-case {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    font-size: 0.8rem;
}
.ep-attention-case-name { color: #333; font-weight: 500; }
.ep-attention-case-phase { color: #888; font-size: 0.75rem; }

.ep-followup-table-wrap { overflow-x: auto; }
.ep-followup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.ep-followup-table th {
    background: #2a2a2a;
    color: #fff;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ep-followup-table td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #555;
}
.ep-followup-table .fu-name { font-weight: 600; color: #333; }
.ep-followup-table tr:hover { background: #fafafa; }

.ep-engagements { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.ep-engagement-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    border-radius: 10px;
    padding: 0.6rem 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.ep-engagement-label { font-weight: 600; font-size: 0.85rem; color: #334155; min-width: 80px; }
.ep-engagement-bar-track {
    flex: 1;
    height: 8px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}
.ep-engagement-bar-fill {
    height: 100%;
    background: #22c55e;
    border-radius: 999px;
    min-width: 4px;
}
.ep-engagement-count { font-weight: 700; font-size: 0.95rem; color: #1e293b; min-width: 30px; text-align: right; }
.ep-closed-bar-fill {
    height: 100%;
    background: #B21F29;
    border-radius: 999px;
    min-width: 4px;
}
.ep-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}
@media (max-width: 900px) {
    .ep-two-col { grid-template-columns: 1fr; }
}

/* Responsive */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 0.75rem 0;
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
    }
    .sidebar-section {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        margin-bottom: 0;
        padding: 0 0.5rem;
    }
    .sidebar-heading {
        padding: 0;
        margin-bottom: 0;
        white-space: nowrap;
    }
    .sidebar-link {
        padding: 0.35rem 0.75rem;
        white-space: nowrap;
    }
    .sidebar-link.active {
        border-right: none;
        border-bottom: 3px solid #B21F29;
    }
    .container {
        padding: 0 1rem;
    }
    .card {
        padding: 1.25rem;
    }
}
