/* Reset & Base System Fonts */
:root {
    --bg-app: #f4f5f7;
    --bg-header: #1a1f2c;
    /* Serious dark navy/slate */
    --bg-panel: #ffffff;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --border-strong: #d1d5db;

    --accent-blue: #2563eb;
    --accent-blue-dark: #1d4ed8;

    --status-success-bg: #ecfdf5;
    --status-success-text: #047857;
    --status-success-border: #a7f3d0;

    --status-fail-bg: #fef2f2;
    --status-fail-text: #b91c1c;
    --status-fail-border: #fecaca;

    --status-neutral-bg: #f9fafb;
    --status-neutral-text: #374151;

    --font-heading: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-heading);
    background: var(--bg-app);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* App style */
}

/* Header - System Bar Style */
.app-header {
    background: var(--bg-header);
    color: #fff;
    height: 60px;
    flex-shrink: 0;
    border-bottom: 1px solid #0f172a;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Logo */
.brand-logo {
    height: 36px;
    width: auto;
    border-radius: 2px;
    /* Optional: filter to make it look like a monochrome seal if needed, 
       but if the logo is already distinct, maybe just standard. 
       User asked for monochrome or single muted accent. */
    filter: grayscale(100%) opacity(0.9);
}

/* Header Badge adjustments */
.brand-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    margin-top: 2px;
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1px 4px;
    border-radius: 2px;
    width: fit-content;
    background: transparent;
}

/* ... existing code ... */

/* Audit Log / Trace */
.audit-log {
    border: 1px solid var(--border-color);
    border-radius: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.log-row {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    align-items: flex-start;
    border-left: 4px solid transparent;
    /* Indicator slot */
    transition: background 0.1s;
}

.log-row:last-child {
    border-bottom: none;
}

.log-row:hover {
    background: #fcfcfc;
}

/* Left Border Indicators */
.log-row.row-pass {
    border-left-color: var(--status-success-text);
    /* Muted Forest Green */
}

.log-row.row-fail {
    border-left-color: var(--status-fail-text);
    /* Muted Red */
}

.log-row.row-neutral {
    border-left-color: var(--text-muted);
}

/* Final row specific styling - Neutral background */
.log-row.final-row {
    background-color: #fff;
    border-top: 2px solid var(--border-color);
    margin-top: -1px;
    /* collapse border */
}

.log-row.final-row:hover {
    background: #fff;
}


.log-icon {
    font-size: 0.8rem;
    display: flex;
    justify-content: center;
    margin-top: 2px;
    color: var(--text-muted);
    /* Neutralize icons */
}

.row-pass .log-icon {
    color: var(--status-success-text);
}

.row-fail .log-icon {
    color: var(--status-fail-text);
}

.log-content h4 {
    font-size: 0.9rem;
    margin-bottom: 4px;
    font-weight: 600;
    color: var(--text-primary);
}

.log-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-family: var(--font-mono);
    /* Data feel */
}

.log-status {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 0;
    white-space: nowrap;
}

/* Text only status, no badges */
.status-pass {
    color: var(--status-success-text);
    background: transparent;
}

.status-fail {
    color: var(--status-fail-text);
    background: transparent;
}

.status-neutral {
    color: var(--text-muted);
    background: transparent;
}

.brand-text h1 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
    line-height: 1;
}

.brand-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
    margin-top: 2px;
    display: block;
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 4px;
    border-radius: 2px;
    width: fit-content;
}

.header-meta {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    opacity: 0.8;
}

.meta-value.online::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 4px;
}

/* Main Layout - Split Pane */
.main-layout {
    flex: 1;
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    overflow: hidden;
}

/* Left Sidebar - Inputs */
.record-panel {
    width: 400px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: var(--spacing-xl);
}

.panel-header {
    margin-bottom: var(--spacing-lg);
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.panel-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
    letter-spacing: 0.02em;
}

input,
select {
    width: 100%;
    padding: 0.75rem;
    background: #f9fafb;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    /* Formal boxy look */
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: #fff;
    box-shadow: 0 0 0 1px var(--accent-blue);
}

.action-btn {
    width: 100%;
    padding: 0.85rem;
    background: var(--bg-header);
    /* Use header color for continuity */
    color: #fff;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
    margin-top: var(--spacing-sm);
}

.action-btn:hover:not(:disabled) {
    background: #0f172a;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.security-notice {
    margin-top: auto;
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.security-notice p {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.4;
    background: #f3f4f6;
    padding: 0.75rem;
    border-radius: 4px;
}

/* Right Content - Explanation */
.explanation-panel {
    flex: 1;
    background: #f8fafc;
    /* Very light slate */
    overflow-y: auto;
    padding: var(--spacing-xl);
    position: relative;
    display: flex;
    justify-content: center;
}

/* Empty State */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    color: var(--text-muted);
}

.state-content {
    text-align: center;
    max-width: 400px;
}

.state-content h3 {
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary);
}

/* Report Styles - The "Audit" Look */
/* Report Styles - The "Audit" Look */
.audit-report {
    background: #fff;
    width: 100%;
    max-width: 800px;
    /* A4-ish width feel */
    min-height: 800px;
    height: fit-content;
    margin-bottom: auto;
    border: 1px solid var(--border-color);
    /* No shadow, purely flat document */
    display: flex;
    flex-direction: column;
    position: relative;
}

.report-header {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: #fdfdfd;
}

/* Report Body */
.report-body {
    padding: var(--spacing-xl);
    flex: 1;
    /* allow expansion */
    width: 100%;
}

.report-section {
    margin-bottom: var(--spacing-xl);
}

.section-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-md);
    border-left: 3px solid var(--accent-blue);
    /* Accent marker */
    padding-left: var(--spacing-sm);
    line-height: 1;
}

.outcome-basis {
    font-size: 1.0rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: #f8fafc;
    padding: var(--spacing-md);
    border-radius: 0px;
    /* Sharp corners */
    border: 1px solid var(--border-color);
    border-left: 1px solid var(--border-strong);
}

.outcome-basis strong {
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
}

h2#decisionTitle {
    font-size: 1.4rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: var(--spacing-xl) 0;
}

/* Audit Log / Trace */
.audit-log {
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.log-row {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    /* Icon, Content, Status */
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    align-items: flex-start;
}

.log-row:last-child {
    border-bottom: none;
}

.log-row.final-row {
    background-color: #fafafa;
}

.log-icon {
    font-size: 0.9rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    margin-top: 2px;
}

.log-content h4 {
    font-size: 0.9rem;
    margin-bottom: 4px;
    font-weight: 600;
}

.log-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.log-status {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 2px;
    white-space: nowrap;
}

.status-pass {
    color: var(--status-success-text);
    background: var(--status-success-bg);
}

.status-fail {
    color: var(--status-fail-text);
    background: var(--status-fail-bg);
}

/* Data Grid */
.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
}

.data-point {
    background: #f9fafb;
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
}

.data-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: var(--spacing-xs);
}

.data-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Policy & Guidance */
.policy-block {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: var(--spacing-md);
}

.policy-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.ref-link {
    font-size: 0.75rem;
    color: var(--accent-blue);
    text-decoration: none;
}

.ref-link:hover {
    text-decoration: underline;
}

.policy-text {
    font-family: 'Georgia', serif;
    font-size: 0.95rem;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-xs);
}

.policy-note {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.guidance-intro {
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
}

.guidance-list {
    padding-left: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.guidance-list li {
    margin-bottom: var(--spacing-sm);
}

.report-footer {
    margin-top: auto;
    background: #f3f4f6;
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.report-footer p {
    font-size: 0.7rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

.input-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
