/* NIST CSF Wiki - Tough Day Style System */
@import url("https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&display=swap");

/* Tough Day CSS Variables */
:root {
    --background: 60 25% 95%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 190, 71%, 7%, 1;
    --primary-foreground: 165, 74%, 38%;
    --secondary: 191, 48%, 16%, 1;
    --secondary-foreground: 165, 90%, 33%, 1;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0, 75%, 46%, 1;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 221.2 83.2% 53.3%;
    --radius: 0.5rem;
    --primary-font: "Lora", serif;
    --secondary-font: "Lexend", sans-serif;
}

/* Base Styles */
* {
    box-sizing: border-box;
    border: 0 solid hsl(var(--border));
    margin: 0;
    padding: 0;
}

body {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: var(--secondary-font);
    line-height: 1.6;
    font-weight: 400;
    display: flex;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--secondary-font); /* Changed to Lexend for consistency */
    font-weight: 600;
    color: hsl(var(--foreground));
}

/* New Single Sidebar Layout */
.sidebar {
    width: 260px;
    background-color: #0c1817; /* Dark teal/black from image */
    color: #e2e8f0; /* Light text color */
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    padding: 1rem;
    z-index: 1000;
}

.sidebar-header {
    padding: 0.5rem 0.25rem;
    margin-bottom: 1.5rem;
}

.sidebar-logo {
    width: 120px;
    height: auto;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
}

#categoryTree, .nav-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-link, .category-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-link:hover, .category-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-link.active, .category-link.active {
    background-color: #1a2c2a; /* Highlight color from image */
    color: #fff;
    font-weight: 600;
}

.category-tree ul {
    list-style: none;
    padding-left: 1.25rem;
}

.category-tree > ul {
    padding-left: 0;
}

.category-item { margin: 0.125rem 0; }

.root-label { font-weight: 700; color: #e2e8f0; margin: 0.25rem 0 0.5rem 0; display: flex; align-items: center; gap: 0.5rem; }

/* Main Content Area */
.content {
    flex: 1;
    margin-left: 260px; /* Width of the sidebar */
    padding: 2.5rem;
    max-width: calc(100% - 260px);
    display: flex;
    justify-content: center; /* Center the document */
}

/* Document & Category View Styling */
.category-content h1, .document-list h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 1rem;
}

.document-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.document-item h3 a {
    font-size: 1.25rem;
    font-weight: 600;
    color: #3b82f6; /* Blue link color */
    text-decoration: none;
}
.document-item h3 a:hover {
    text-decoration: underline;
}

.document-meta {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.document {
    width: 100%;
    max-width: 1200px; /* Allow up to 1200px on wide screens */
    font-family: var(--secondary-font); /* Ensure all document text is sans-serif */
}

.document h1, .document h2, .document h3, .document h4 {
    font-family: var(--secondary-font); /* Ensure headers are sans-serif */
    font-weight: 700;
    margin-bottom: 1rem;
    color: #1e293b;
}

.document h1 {
    font-size: 2rem;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

.document h2 {
    font-size: 1.5rem;
    margin-top: 2.5rem;
}

.document h3 {
    font-size: 1.25rem;
    margin-top: 2rem;
}

.document p, .document li {
    line-height: 1.75;
    font-size: 0.985rem;
    color: #334155;
    margin-bottom: 1rem;
    font-family: var(--secondary-font);
}

.document ul, .document ol {
    list-style-position: outside;
    padding-left: 1.5rem;
}

.document ol {
    list-style-type: decimal;
    margin-left: 0;
    padding-left: 1.5rem;
}

.document ol ol {
    list-style-type: decimal;
    margin-left: 1rem;
    padding-left: 1.5rem;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.document ol ol li {
    display: list-item;
    margin-bottom: 0.25rem;
}

.document a {
    color: #0f766e; /* journal green */
    text-decoration: none;
    font-weight: 600;
}

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

.document hr {
    border: 0;
    border-top: 1px solid hsl(var(--border));
    margin: 2.5rem 0;
}

.document-actions {
    margin-bottom: 2rem;
    display: flex;
    gap: 0.5rem;
}

/* Card Components */
.welcome-message,
.document,
.login-box {
    background-color: hsl(var(--card));
    padding: 2rem;
    border-radius: calc(var(--radius) + 2px);
    box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid hsl(var(--border));
}

.welcome-message h2,
.document h1 { font-size: 2rem; margin-bottom: 1rem; color: hsl(var(--foreground)); font-family: var(--secondary-font); font-weight: 700; }

.document h2 {
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: hsl(var(--foreground));
    font-family: var(--secondary-font);
    font-weight: 700;
}

.document h3 {
    font-size: 1.15rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-family: var(--secondary-font);
    font-weight: 600;
}

.document p { margin-bottom: 1rem; line-height: 1.8; color: hsl(var(--foreground)); font-size: 1rem; }

/* Constrain images within documents (logos were rendering too large) */
.document img {
    display: block;
    max-width: 600px;
    width: 100%;
    height: auto;
    object-fit: contain;
    margin: 1rem 0;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    color: #374151;
    cursor: pointer;
    padding: 0.55rem 1rem;
    text-decoration: none;
    font-family: var(--secondary-font);
}

.btn:hover {
    background-color: #f9fafb;
    border-color: #cbd5e1;
}

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.btn-primary:hover {
    background-color: hsl(var(--primary));
    opacity: 0.9;
    border-color: hsl(var(--primary));
}

.btn:focus {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

/* Login Interface */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    background-color: hsl(var(--background));
    padding: 1rem;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.login-box {
    max-width: 500px;
    width: 100%;
    text-align: center;
    background-color: #0f766e; /* journal green */
    color: white;
}

.login-box h1 {
    color: white;
    margin-bottom: 0.5rem;
    font-family: var(--primary-font);
}

/* Centered logo on login card */
.login-logo {
    width: 64px;
    height: 64px;
    margin: 0.25rem auto 0.75rem auto;
    display: block;
}

/* Login stacked brand */
.login-logo-cone {
    width: 48px;
    height: 48px;
    display: block;
    margin: 0.25rem auto 0.5rem auto;
}

.login-wordmark {
    width: 180px;
    max-width: 90%;
    height: auto;
    display: block;
    margin: 0 auto 0.75rem auto;
}

.login-wordmark-centered {
    width: 66.67%; /* Two-thirds width */
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0 auto 1.5rem auto;
}

.login-box .company-name {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

.login-content {
    margin: 2rem 0;
}

.login-content p {
    color: white;
}

.login-info {
    color: white;
}

.login-info ul {
    color: white;
}

.login-info li {
    color: white;
}

.login-btn {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.login-info {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid hsl(var(--border));
    text-align: left;
}

.login-info p {
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.login-info ul {
    list-style-position: inside;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.login-info li {
    margin-bottom: 0.5rem;
}

/* User Menu */
.user-menu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-info {
    font-size: 0.875rem;
    color: white;
    opacity: 0.9;
    font-family: var(--secondary-font);
}

/* Error and Loading States */
.error {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid hsl(var(--destructive));
}

.loading {
    text-align: center;
    padding: 2rem;
    color: hsl(var(--muted-foreground));
    font-family: var(--secondary-font);
}

/* Code and Pre Styles */
.document pre {
    background-color: hsl(var(--muted));
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid hsl(var(--border));
}

.document code {
    background-color: hsl(var(--muted));
    padding: 0.125rem 0.25rem;
    border-radius: calc(var(--radius) - 2px);
    font-family: ui-monospace, SFMono-Regular, 'Courier New', monospace;
    font-size: 0.875em;
}

.document pre code {
    background-color: transparent;
    padding: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: static;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid hsl(var(--border));
    }
    
    .content {
        margin-left: 0;
        padding: 1rem;
        max-width: 100%;
    }
    
    .container {
        flex-direction: column;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: 1rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

/* Focus and Accessibility */
.btn:focus-visible,
.category-link:focus-visible,
.nav-link:focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
}

/* Transitions */
* {
    transition-property: color, background-color, border-color, opacity, transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Admin & Search Page Layout */
.admin-page, .search-page {
    max-width: 1000px;
}

.admin-page h1, .search-page h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 1rem;
}

.admin-section {
    background-color: hsl(var(--card));
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid hsl(var(--border));
    margin-bottom: 2rem;
}

.admin-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Table styling for Admin Page */
.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table thead th {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: #f8fafc;
}

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

.table td .btn, .table td .input {
    margin-right: 0.5rem;
    height: 38px;
}

/* Form & Input Styling */
.input {
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    padding: 0 0.75rem;
    height: 42px;
    font-family: var(--secondary-font);
    font-size: 0.9rem;
}

.input:focus {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 1px;
    border-color: hsl(var(--ring));
}

/* Textarea specific styling */
textarea.input {
    height: auto;
    min-height: 120px;
    padding: 0.75rem;
    line-height: 1.5;
    resize: vertical;
    font-family: var(--secondary-font);
}

.form-inline {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.form-inline .input {
    flex: 1;
}

/* Vertical forms for Admin */
.form-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Comment styles */
.comments {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.comment {
    padding: 0.75rem 0;
    border-bottom: 1px solid hsl(var(--border));
}

.comment:last-child {
    border-bottom: none;
}

.comment-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.5rem;
}

.comment-body {
    font-size: 0.9rem;
    line-height: 1.5;
    color: hsl(var(--foreground));
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.25rem;
    margin-left: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.875rem;
    opacity: 0.6;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.btn-icon:hover {
    opacity: 1;
    background-color: hsl(var(--muted));
}

.delete-comment {
    color: #dc2626;
}

.delete-comment:hover {
    background-color: #fef2f2;
}

/* Document Summary Styles */
.document-summary {
    margin: 1rem 0 1.5rem 0;
}

.summary-toggle {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    background-color: hsl(var(--background));
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
    outline: none;
}

.summary-toggle:hover {
    background-color: hsl(var(--muted));
    color: hsl(var(--foreground));
    border-color: hsl(var(--muted-foreground));
}

.summary-toggle:focus {
    outline: none;
    box-shadow: none;
}

.summary-icon {
    margin-right: 0.5rem;
}

.toggle-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.summary-content {
    padding: 1rem 0;
}

.summary-content h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.summary-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: hsl(var(--muted-foreground));
    font-style: italic;
    padding: 1rem;
    background-color: hsl(var(--muted));
    border-radius: 6px;
    border-left: 4px solid hsl(var(--primary));
}

/* Acknowledgment Section */
.acknowledgment-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
}

.acknowledgment-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.acknowledgment-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.acknowledgment-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: hsl(var(--primary));
}

.acknowledgment-confirmed {
    color: #16a34a;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#acknowledgeBtn {
    align-self: flex-start;
    padding: 0.75rem 1.5rem;
}

#acknowledgeBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Acknowledgments Table */
.acknowledgments-table {
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    overflow: hidden;
    margin-top: 1rem;
}

.acknowledgments-header {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1.5fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: hsl(var(--muted));
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid hsl(var(--border));
}

.acknowledgments-body {
    max-height: 400px;
    overflow-y: auto;
}

.acknowledgment-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1.5fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
    transition: background-color 0.2s ease;
}

.acknowledgment-row:hover {
    background-color: hsl(var(--muted) / 0.3);
}

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

.ack-col-employee,
.ack-col-document,
.ack-col-category,
.ack-col-date {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
}

.ack-col-document .document-link {
    color: hsl(var(--primary));
    text-decoration: none;
    font-weight: 500;
}

.ack-col-document .document-link:hover {
    text-decoration: underline;
}

.ack-col-date {
    color: hsl(var(--muted-foreground));
    font-family: monospace;
    font-size: 0.8rem;
}

.ack-col-employee strong {
    color: hsl(var(--foreground));
}

.ack-col-category {
    color: hsl(var(--muted-foreground));
    font-style: italic;
}

/* Compliance Overview */
.compliance-overview {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: stretch;
}

.compliance-card {
    flex: 1;
    padding: 1.5rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
}

.compliance-metric {
    text-align: center;
    margin-bottom: 1rem;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: hsl(var(--primary));
    line-height: 1;
}

.metric-label {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

.metric-details {
    text-align: center;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.5rem;
}

.compliance-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    min-width: 120px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.stat-label {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

/* Progress Bars */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: hsl(var(--muted));
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background-color: hsl(var(--primary));
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Employee Compliance */
.employee-compliance-list,
.document-compliance-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.employee-compliance-row,
.document-compliance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.employee-compliance-row:hover,
.document-compliance-row:hover {
    background-color: hsl(var(--muted) / 0.3);
}

.employee-info,
.document-info {
    flex: 1;
    min-width: 0;
}

.employee-name,
.document-title {
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 0.25rem;
}

.document-title .document-link {
    color: hsl(var(--primary));
    text-decoration: none;
}

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

.employee-role,
.document-category {
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
    font-style: italic;
}

.employee-progress,
.document-progress {
    flex: 1;
    max-width: 300px;
    margin-left: 1rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.progress-text {
    color: hsl(var(--muted-foreground));
}

.progress-percentage {
    font-weight: 600;
    color: hsl(var(--foreground));
}

.missing-count {
    font-size: 0.75rem;
    color: #dc2626;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* User Compliance Styles */
.user-compliance-overview {
    margin-bottom: 2rem;
}

.user-compliance-card {
    max-width: 500px;
    padding: 2rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
}

.user-documents-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.user-document-row {
    padding: 1rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.user-document-row:hover {
    background-color: hsl(var(--muted) / 0.3);
}

.user-document-row.acknowledged {
    border-left: 4px solid #16a34a;
}

.user-document-row.pending {
    border-left: 4px solid #f59e0b;
}

.document-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.status-badge.acknowledged {
    background-color: #dcfce7;
    color: #16a34a;
}

.status-badge.pending {
    background-color: #fef3c7;
    color: #d97706;
}

.document-meta {
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
    font-style: italic;
}

.success {
    color: #16a34a;
    font-weight: 600;
    padding: 1rem;
    text-align: center;
    background-color: #dcfce7;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
}

/* Spinner Animation */
.spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

.btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

/* NIST CSF Function Grouping */
.document-compliance-grouped {
    margin-top: 1rem;
}

.function-group {
    margin-bottom: 2rem;
}

.function-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: hsl(var(--primary));
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid hsl(var(--primary));
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.function-header::before {
    content: "📋";
    font-size: 1rem;
}

/* Clickable Document Compliance Cards */
.document-compliance-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.document-compliance-link:hover .document-compliance-row {
    background-color: hsl(var(--muted) / 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px hsl(var(--muted-foreground) / 0.15);
}

.document-compliance-row {
    transition: all 0.2s ease;
    cursor: pointer;
}

/* Clickable Root Label */
.root-label.category-item {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.root-label.category-item:hover {
    background-color: hsl(var(--muted) / 0.5);
}

/* User Compliance Grouping */
.user-compliance-grouped {
    margin-top: 1rem;
}

.user-document-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.user-document-link:hover .user-document-row {
    background-color: hsl(var(--muted) / 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px hsl(var(--muted-foreground) / 0.15);
}

/* User Approval Interface */
.approval-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.approval-role-select {
    min-width: 140px;
}

.role-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-pending {
    background-color: #fef3c7;
    color: #d97706;
}

.role-denied {
    background-color: #fecaca;
    color: #dc2626;
}

.role-admin {
    background-color: #ddd6fe;
    color: #7c3aed;
}

.role-employee {
    background-color: #dcfce7;
    color: #16a34a;
}

.role-hr {
    background-color: #e0e7ff;
    color: #3730a3;
}

.role-legal {
    background-color: #fef3c7;
    color: #92400e;
}

.role-contractor {
    background-color: #f3e8ff;
    color: #7c2d12;
}

.role-advisor {
    background-color: #ecfdf5;
    color: #065f46;
}

.user-denied {
    opacity: 0.7;
    background-color: hsl(var(--muted) / 0.3);
}

/* Document Navigation */
.document-navigation {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid hsl(var(--border));
}

.nav-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    max-width: 100%;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    min-width: 200px;
    max-width: 300px;
    text-align: left;
}

.nav-btn:hover:not(.disabled) {
    background-color: hsl(var(--muted));
    border-color: hsl(var(--primary));
    transform: translateY(-1px);
    box-shadow: 0 2px 8px hsl(var(--muted-foreground) / 0.15);
}

.nav-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: hsl(var(--muted-foreground));
}

.nav-prev {
    justify-content: flex-start;
}

.nav-next {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.nav-arrow {
    font-size: 1.25rem;
    font-weight: bold;
    color: hsl(var(--primary));
}

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

.nav-next .nav-info {
    text-align: right;
}

.nav-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.nav-title {
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-category {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-position {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: hsl(var(--muted));
    border-radius: 6px;
    min-width: 80px;
    justify-content: center;
}

.position-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

/* Responsive navigation */
@media (max-width: 768px) {
    .nav-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .nav-btn {
        min-width: 100%;
        max-width: 100%;
    }
    
    .nav-position {
        order: -1;
        min-width: 120px;
    }
}

.form-vertical label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #334155;
}

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

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.status-line {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Status messages and spinner (style-guide friendly) */
.status-msg { font-size: 0.95rem; margin-top: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.status-msg.info { color: #374151; }
.status-msg.success { color: #065f46; }
.status-msg.error { color: #b91c1c; }
.spinner { width: 16px; height: 16px; border: 2px solid #cbd5e1; border-top-color: #111827; border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }

/* Search Results Styling */
.search-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.result-item {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

.result-item:last-child {
    border-bottom: 0;
}

.result-item a {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
}
.result-item a:hover {
    text-decoration: underline;
}

.snippet {
    font-family: var(--primary-font); /* Serif for snippet readability */
    color: #475569;
    margin-top: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.7;
}

.result-item .muted {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.75rem;
}

/* Make radio buttons in forms stack vertically */
.form-group label {
    display: block;
    margin-bottom: 0.75rem;
}

#importStatusContainer {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
}

#importStatusContainer p {
    margin: 0;
    display: flex;
    align-items: center;
}

#importStatusContainer p.info {
    color: var(--primary);
}

#importStatusContainer p.success {
    color: var(--success);
}

#importStatusContainer p.error {
    color: white;
    background-color: #dc2626;
    border: 1px solid #dc2626;
    padding: 1rem;
    border-radius: var(--radius);
    font-weight: 500;
}

.import-status-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    align-items: center;
    font-size: 0.875rem;
}

.import-status-grid.error {
    color: var(--destructive);
}

/* Admin Page Specifics */
.admin-page {
    max-width: 800px;
}
