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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 13px;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* Global font consistency: titles 14px, content 13px */
h1 { font-size: 18px !important; }
h2 { font-size: 16px !important; }
h3 { font-size: 14px !important; }
h4, h5, h6 { font-size: 14px !important; }

* {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif !important;
}

*:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(.stat-number):not(.card-number):not(i) {
    font-size: 13px !important;
}

.card-number {
    font-size: 2rem !important;
}

.navbar-brand a {
    font-size: 16px !important;
}

.stat-number {
    font-size: 2rem !important;
}

/* Navbar (top bar) */
.navbar {
    background: #2c3e50;
    color: white;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    height: 60px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
}

.navbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-user span {
    color: rgba(255,255,255,0.8);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 200px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    padding: 0.75rem 0;
    z-index: 999;
}

.sidebar-link {
    display: block;
    padding: 0.5rem 0.8rem;
    margin: 0.3rem 0.6rem;
    color: #555;
    text-decoration: none;
    font-size: 0.85rem;
    background: #f5f7fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: all 0.15s;
}

.sidebar-link:hover {
    background: #e8ecf1;
    color: #2c3e50;
    border-color: #ccc;
}

/* Admin group - green */
.sidebar-link-admin {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #2e7d32;
}

.sidebar-link-admin:hover {
    background: #c8e6c9;
    border-color: #81c784;
    color: #1b5e20;
}

/* Audit group - navy blue */
.sidebar-link-audit {
    background: #e3e8f0;
    border-color: #9aa8c0;
    color: #1a237e;
}

.sidebar-link-audit:hover {
    background: #cdd5e4;
    border-color: #7986a8;
    color: #0d1452;
}

/* Guides group - light purple */
.sidebar-link-guide {
    background: #f3e5f5;
    border-color: #ce93d8;
    color: #7b1fa2;
}

.sidebar-link-guide:hover {
    background: #e1bee7;
    border-color: #ba68c8;
    color: #6a1b9a;
}

/* Dashboard - orange */
.sidebar-link-dashboard {
    background: #e67e22;
    color: #fff;
    font-weight: 600;
    border-left-color: #d35400;
    border-radius: 4px;
    margin: 0.4rem 0.6rem;
    padding: 0.5rem 0.8rem;
}

.sidebar-link-dashboard:hover {
    background: #d35400;
    color: #fff;
}

.sidebar-group-label {
    padding: 0.6rem 1.2rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.05em;
    margin-top: 0.4rem;
}

/* Container (offset for fixed navbar + sidebar) */
body {
    padding-top: 60px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    margin-left: 200px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.back-link {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link:hover {
    color: #333;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn:hover {
    background: #f5f5f5;
}

.btn-primary {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-danger {
    background: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-info {
    background: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.file-icon {
    margin-right: 0.3rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.card h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.card p {
    color: #666;
    font-size: 0.9rem;
}

/* Tables */
.table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr.completed {
    opacity: 0.6;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 500px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row .form-group {
    margin-bottom: 0;
}

.flex-grow {
    flex: 1;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-in-progress,
.status-in\ progress {
    background: #cce5ff;
    color: #004085;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2c3e50, #3498db);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.login-box h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.login-box h2 {
    text-align: center;
    color: #666;
    font-weight: normal;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.login-box p {
    text-align: center;
    color: #666;
    margin-bottom: 1.5rem;
}

/* Sections */
.section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.section h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

/* Upload Form */
.upload-form,
.request-form {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Utilities */
.text-muted {
    color: #666;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

/* Working Papers Tree Hierarchy */
.workpaper-tree {
    margin-top: 1.5rem;
}

.tree-section {
    background: white;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.tree-section-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #2c3e50;
    color: white;
    gap: 0.5rem;
}

.tree-toggle {
    cursor: pointer;
    font-size: 0.8rem;
    width: 20px;
    user-select: none;
}

.section-name {
    font-weight: 600;
    flex: 1;
}

.section-actions {
    display: flex;
    gap: 0.5rem;
}

.tree-section-content {
    padding: 0.5rem;
}

.tree-schedule {
    margin: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.tree-schedule-header {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    gap: 0.5rem;
}

.schedule-name {
    font-weight: 500;
}

.schedule-desc {
    font-size: 0.85rem;
}

.schedule-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

.tree-schedule-content {
    padding: 0.5rem;
    background: #fafafa;
}

.tree-workpaper {
    padding: 0.25rem 0;
}

.workpaper-row {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    gap: 1rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.workpaper-row:hover {
    background: #eef2f7;
}

.workpaper-link {
    display: flex;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    flex: 1;
}

.wp-reference {
    font-family: monospace;
    background: #d5dde5;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    min-width: 55px;
    text-align: center;
    color: #555;
    font-weight: 600;
    flex-shrink: 0;
}

.wp-title {
    color: #2c3e50;
    font-weight: 500;
}

.workpaper-link:hover .wp-title {
    text-decoration: underline;
}

.wp-preparer {
    color: #666;
    font-size: 0.85rem;
    min-width: 100px;
}

.status-form {
    display: inline;
}

.status-select,
.status-select-sm {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}

.status-select-sm {
    font-size: 0.75rem;
}

.status-select-sm.status-not-started {
    background: #f8f9fa;
}

.status-select-sm.status-in-progress {
    background: #cce5ff;
    color: #004085;
}

.status-select-sm.status-review {
    background: #fff3cd;
    color: #856404;
}

.status-select-sm.status-complete {
    background: #d4edda;
    color: #155724;
}

/* Additional status badge styles */
.status-planning {
    background: #e2e3e5;
    color: #383d41;
}

.status-fieldwork {
    background: #cce5ff;
    color: #004085;
}

.status-review {
    background: #fff3cd;
    color: #856404;
}

.status-complete {
    background: #d4edda;
    color: #155724;
}

.status-not-started {
    background: #f8f9fa;
    color: #666;
}

/* Add forms in tree */
.add-form-container {
    margin-bottom: 1rem;
}

.add-form {
    margin-top: 0.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.tree-add-form {
    margin: 0.5rem;
    padding: 0.75rem;
}

.form-inline {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-inline .form-group {
    margin-bottom: 0;
}

.form-inline input,
.form-inline select {
    padding: 0.5rem;
}

.tree-empty {
    padding: 0.5rem 1rem;
    font-style: italic;
}

/* Workpaper Detail Card */
.workpaper-detail-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

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

.detail-item label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.detail-item span {
    font-weight: 500;
}

.status-update-form {
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.status-update-form .form-row {
    align-items: flex-end;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.tab-link {
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-link:hover {
    color: #333;
    background: #f8f9fa;
}

.tab-link.active {
    color: #3498db;
    border-bottom-color: #3498db;
    font-weight: 500;
}

.tab-content {
    padding-top: 1rem;
}

/* Section Card */
.section-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-card h2 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

/* Team Role Badges */
.role-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.role-partner {
    background: #9b59b6;
    color: white;
}

.role-manager {
    background: #3498db;
    color: white;
}

.role-senior {
    background: #27ae60;
    color: white;
}

.role-staff {
    background: #95a5a6;
    color: white;
}

/* Materiality Styles */
.materiality-form .form-row {
    margin-bottom: 1.5rem;
}

.materiality-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.mat-result {
    text-align: center;
}

.mat-result label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.mat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Risk Assessment Styles */
.risk-table {
    margin-top: 1rem;
}

.risk-table td {
    vertical-align: middle;
}

.risk-select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 100px;
}

.risk-notes {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.combined-risk {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.9rem;
}

.risk-low {
    background: #d4edda;
    color: #155724;
}

.risk-medium {
    background: #fff3cd;
    color: #856404;
}

.risk-high {
    background: #f8d7da;
    color: #721c24;
}

.risk-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.risk-standard {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Procedures Styles */
.procedures-container {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    max-height: 600px;
    overflow-y: auto;
}

.procedures-text {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    color: #333;
}

.procedures-text .proc-title {
    font-weight: 700;
    font-size: 1rem;
    color: #2471a3;
    text-decoration: underline;
    text-underline-offset: 3px;
    display: inline;
    letter-spacing: 0.3px;
}

.procedures-textarea,
.conclusion-textarea {
    width: 100%;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: vertical;
}

.procedures-textarea:focus,
.conclusion-textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Sampling Styles */
.sampling-table {
    margin-top: 1rem;
}

.sampling-table td {
    vertical-align: middle;
    padding: 0.75rem;
}

.sampling-table th {
    font-size: 0.85rem;
    padding: 0.75rem;
}

.sampling-select {
    padding: 0.4rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    min-width: 100px;
}

.sampling-select-sm {
    padding: 0.35rem 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8rem;
    min-width: 70px;
}

.sampling-input {
    width: 80px;
    padding: 0.4rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: right;
}

.sampling-interval {
    background: #f0f0f0;
    color: #666;
}

.sampling-notes {
    width: 100%;
    min-width: 150px;
    padding: 0.4rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.sampling-legend {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.sampling-legend h4 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.sampling-legend ul {
    margin: 0;
    padding-left: 1.5rem;
}

.sampling-legend li {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.25rem;
}

/* Sampling Guide Styles */
.sampling-guide {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e0e0e0;
}

.sampling-guide h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.sampling-method-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border-left: 4px solid #95a5a6;
}

.sampling-method-card h4 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.sampling-method-card.highlight-recommended {
    border-left-color: #27ae60;
    background: #f0fff4;
}

.sampling-method-card.highlight-recommended h4::after {
    content: " (Recommended for Most Substantive Tests)";
    font-size: 0.8rem;
    color: #27ae60;
    font-weight: normal;
}

.method-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.method-section {
    font-size: 0.9rem;
}

.method-section strong {
    display: block;
    color: #555;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.method-section ul {
    margin: 0;
    padding-left: 1.25rem;
}

.method-section li {
    color: #666;
    margin-bottom: 0.15rem;
}

.sampling-decision-guide,
.sample-size-guide {
    background: #fff;
    border: 2px solid #3498db;
    border-radius: 8px;
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.sampling-decision-guide h4,
.sample-size-guide h4 {
    color: #3498db;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.decision-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.decision-table th,
.decision-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.decision-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.decision-table tr:last-child td {
    border-bottom: none;
}

.decision-table tr:hover {
    background: #f8f9fa;
}

/* Dashboard Stats */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #3498db;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Engagements Table */
.engagements-table .client-link {
    color: #2c3e50;
    text-decoration: none;
}

.engagements-table .client-link:hover {
    color: #3498db;
    text-decoration: underline;
}

/* Status Legend */
.status-legend {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

/* Permanent File Styles */
.permanent-file-table .file-link {
    color: #3498db;
    text-decoration: none;
}

.permanent-file-table .file-link:hover {
    text-decoration: underline;
}

.category-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #555;
}

.edit-row {
    background: #f8f9fa;
}

.edit-form {
    padding: 0.5rem;
}

.permanent-file-guide {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.permanent-file-guide h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.guide-item {
    background: white;
    padding: 1rem;
    border-radius: 6px;
}

.guide-item strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.guide-item ul {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.9rem;
    color: #666;
}

.guide-item li {
    margin-bottom: 0.25rem;
}

/* PBC Styles */
.pbc-summary {
    display: flex;
    gap: 2rem;
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.pbc-stat {
    font-size: 0.95rem;
    color: #666;
}

.pbc-stat strong {
    font-size: 1.25rem;
    color: #2c3e50;
    margin-right: 0.25rem;
}

.pbc-table .completed td,
.pbc-table .received td {
    opacity: 0.7;
}

.pbc-table .received td:first-child {
    text-decoration: line-through;
}

.pbc-table .completed td:last-child,
.pbc-table .received td:last-child {
    text-decoration: none;
}

.pbc-received strong {
    color: #27ae60;
}

.status-received {
    background: #d4edda;
    color: #155724;
}

.status-requested {
    background: #fff3cd;
    color: #856404;
}

.status-received---needs-modification {
    background: #fce4ec;
    color: #c0392b;
}

.pbc-needs-modification strong {
    color: #c0392b;
}

tr.needs-modification {
    background: #fef5f5;
}

.pbc-overdue strong {
    color: #e74c3c;
}

tr.pbc-overdue-row {
    background: #fff5f5;
    border-left: 3px solid #e74c3c;
}

.overdue-badge {
    display: inline-block;
    background: #e74c3c;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 600;
}

.required-docs-guide {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.file-link {
    color: #3498db;
    text-decoration: none;
}

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

/* Procedure Steps Checklist */
.checklist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.checklist-header h2 {
    margin-bottom: 0;
}

.checklist-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.progress-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.progress-bar {
    width: 160px;
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #27ae60;
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* Procedure Steps - Card Layout */
.procedure-steps-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.step-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.step-card:hover {
    border-color: #b0c4de;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.step-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px 8px 14px;
}

.step-card-header .step-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #27ae60;
    margin-top: 3px;
    flex-shrink: 0;
}

.step-number-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: #2471a3;
    color: #fff;
    border-radius: 14px;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-description-text {
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    color: #2c3e50;
    font-weight: 600;
    flex: 1;
}

.step-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 14px 10px 52px;
    flex-wrap: wrap;
}

.step-assertions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 150px;
}

.assertion-pill {
    display: inline-block;
    padding: 2px 10px;
    background: #eaf2f8;
    color: #2471a3;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
    border: 1px solid #d4e6f1;
}

.step-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.step-actions .step-notes-input {
    width: 120px;
    padding: 3px 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.8rem;
    background: transparent;
    transition: border-color 0.2s;
}

.step-actions .step-notes-input:focus {
    border-color: #2471a3;
    background: #fff;
    outline: none;
}

.step-actions .exc-btn {
    padding: 2px 7px;
    font-size: 0.75rem;
}

/* Completed step card */
.step-card.completed {
    background: #f5fbf5;
    border-color: #b8e6b8;
}

.step-card.completed .step-number-badge {
    background: #27ae60;
}

.step-card.completed .step-description-text {
    color: #27ae60;
}

/* Reviewed step card */
.step-card.reviewed {
    background: #eef8ee;
    border-color: #8fd18f;
}

.step-card.reviewed .step-number-badge {
    background: #1e8449;
}

.step-card.reviewed .step-description-text {
    color: #1e8449;
    font-weight: 500;
}

/* Legacy assertion-badge (used elsewhere) */
.assertion-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: #eaf2f8;
    color: #2471a3;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.inline-edit {
    width: 100%;
    padding: 0.3rem 0.4rem;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 0.8rem;
    background: transparent;
    transition: border-color 0.2s;
}

.inline-edit:hover {
    border-color: #ddd;
}

.inline-edit:focus {
    outline: none;
    border-color: #3498db;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.wp-ref-wrapper {
    position: relative;
}

.wp-ref-link {
    display: inline-block;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2980b9;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
}

.wp-ref-link:hover {
    color: #1a5276;
    background: #ebf5fb;
    border-color: #aed6f1;
    text-decoration: underline;
}

.wp-ref-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.wp-ref-edit-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 3px;
}

.wp-ref-edit-btn:hover {
    color: #e74c3c;
}

.completed-by {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #27ae60;
}

.completed-date {
    display: block;
    font-size: 0.75rem;
    color: #999;
}

/* Sign-off workflow styles */
.step-signoff {
    text-align: center;
    white-space: nowrap;
}

.signoff-initials {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: #d4edda;
    color: #155724;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.signoff-initials.reviewed {
    background: #cce5ff;
    color: #004085;
}

.signoff-date {
    display: block;
    font-size: 0.7rem;
    color: #999;
    margin-top: 2px;
}

.btn-review {
    background: #f0f4f8;
    color: #2471a3;
    border: 1px solid #bdd5ea;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

.btn-review:hover {
    background: #cce5ff;
    border-color: #2471a3;
}

/* Legacy step-row classes kept for backward compat */
.step-row.reviewed { background: #e8f8e8; }
.step-row.reviewed .step-description { color: #1e8449; font-weight: 500; }
.step-row.reviewed .step-num { color: #1e8449; font-weight: 600; }

.upgrade-steps-prompt {
    text-align: center;
    padding: 1.5rem;
    background: #fef9e7;
    border: 1px dashed #f0c040;
    border-radius: 8px;
}

.upgrade-steps-prompt p {
    margin-bottom: 1rem;
    color: #666;
}

/* Workpaper step counts in tree */
.wp-steps-count {
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    background: #eee;
    border-radius: 3px;
    color: #666;
    font-family: monospace;
    white-space: nowrap;
}

.wp-steps-count.steps-done {
    background: #d4edda;
    color: #155724;
}

/* Engagement Progress Summary */
.engagement-progress-summary {
    display: flex;
    gap: 2rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
}

.progress-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.progress-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    font-weight: 600;
}

.progress-numbers {
    font-size: 0.85rem;
    color: #333;
    font-weight: 500;
}

/* Section Active/Inactive */
.section-badge-active {
    background: #27ae60;
    color: white;
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-inactive .tree-section-content {
    opacity: 0.6;
}

.section-inactive.hidden-section {
    display: none;
}

/* Section Status Summary Chips */
.section-status-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.section-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: default;
}

.chip-label {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chip-pct {
    font-family: monospace;
    font-weight: 600;
}

.chip-done {
    background: #d5f5e3;
    color: #1e8449;
    border: 1px solid #a9dfbf;
}

.chip-progress {
    background: #fdebd0;
    color: #b9770e;
    border: 1px solid #f5cba7;
}

.chip-pending {
    background: #eaecee;
    color: #7f8c8d;
    border: 1px solid #d5d8dc;
}

/* Section Progress */
.section-progress {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: 0.5rem;
}

.section-progress-text {
    font-size: 0.7rem;
    color: #aaa;
    font-weight: 500;
}

.section-progress-bar {
    display: inline-block;
    width: 60px;
    height: 6px;
    background: #444;
    border-radius: 3px;
    overflow: hidden;
}

.section-progress-fill {
    display: block;
    height: 100%;
    background: #27ae60;
    border-radius: 3px;
    transition: width 0.3s;
}

.section-progress-pct {
    font-size: 0.7rem;
    color: #aaa;
    font-family: monospace;
}

/* Workpaper Inline Progress Bar */
.wp-progress-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.wp-progress-bar-mini {
    display: inline-block;
    width: 40px;
    height: 5px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.wp-progress-fill-mini {
    display: block;
    height: 100%;
    background: #27ae60;
    border-radius: 3px;
    transition: width 0.3s;
}

/* Responsive */
/* Print Styles */
@media print {
    /* Hide everything except the printable content */
    .navbar, .sidebar, .tab-nav, .no-print, .status-legend, .stats-row, .card-grid {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 11pt !important;
        line-height: 1.4 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .container {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .section-card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Show only the controls guide tab when printing from it */
    .tab-content {
        display: none !important;
    }
    .tab-content.print-active {
        display: block !important;
    }

    h1 {
        font-size: 18pt !important;
        margin-bottom: 0.5rem !important;
    }

    h2 {
        font-size: 16pt !important;
        margin-top: 1rem !important;
    }

    h3 {
        font-size: 12pt !important;
        color: black !important;
        background: #ddd !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    h4 {
        font-size: 11pt !important;
    }

    .table {
        font-size: 9pt !important;
        border-collapse: collapse !important;
    }

    .table th, .table td {
        border: 1px solid #999 !important;
        padding: 4px 8px !important;
    }

    .table thead th {
        background: #eee !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Preserve background colors for info boxes */
    div[style*="background"] {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Page breaks */
    div[style*="margin-bottom: 2rem"] {
        page-break-inside: avoid !important;
    }

    .page-break-before { page-break-before: always !important; }
    .page-break-after { page-break-after: always !important; }
    .no-page-break { page-break-inside: avoid !important; }

    /* Workpaper detail page - show all content, clean layout */
    .workpaper-detail-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        page-break-inside: avoid !important;
    }

    .procedure-checklist {
        font-size: 8pt !important;
    }

    .procedure-checklist th,
    .procedure-checklist td {
        border: 1px solid #bbb !important;
        padding: 3px 5px !important;
    }

    /* Compact progress bars for print */
    .progress-bar, .section-progress-bar, .wp-progress-bar-mini {
        border: 1px solid #ccc !important;
    }

    /* Status badges print with color */
    .status-badge, .combined-risk, .risk-badge, .assertion-badge {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        border: 1px solid #999 !important;
    }

    @page {
        margin: 1.5cm;
        size: A4;
    }

    hr {
        border-top: 1px solid #ccc !important;
    }

    a {
        color: black !important;
        text-decoration: none !important;
    }

    code {
        background: #eee !important;
        padding: 1px 4px !important;
        font-size: 9pt !important;
    }
}

/* Archived status badge */
.status-archived {
    background: #e2e3e5;
    color: #383d41;
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }

    .sidebar {
        display: none;
    }

    .container {
        margin-left: 0;
        padding: 1rem;
    }

    .form-row {
        flex-direction: column;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
    }
}

