/* ──────────────────────────────────────────────
   Report Checker — Renew Brand System
   ────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Surfaces — clean white + soft lavender tint */
    --bg: #f5f4f8;
    --surface: #ffffff;
    --surface-hover: #f8f7fc;
    --surface-raised: #ffffff;
    --border: #d8d4e8;
    --border-light: #eceaf5;

    /* Text — deep indigo ink */
    --text: #2a2545;
    --text-secondary: #4a4570;
    --text-muted: #9994b8;

    /* Accent / Brand — deep indigo purple (from wordmark) */
    --accent: #3d3262;
    --accent-hover: #2d254e;
    --accent-light: #eeedf8;
    --accent-subtle: rgba(61, 50, 98, 0.08);

    /* Semantic */
    --success: #2d7a3a;
    --success-bg: #e8f5e9;
    --success-border: #a5d6a7;
    --warning: #c97c2a;
    --warning-bg: #fdf3e3;
    --warning-border: #f5cfa0;
    --danger: #c0392b;
    --danger-bg: #fdecea;
    --danger-border: #f5c6c2;

    /* Brand Palette Extras */
    --coral: #f07060;
    --coral-light: #fef0ee;
    --lavender: #9b8fd4;
    --sky: #a8cce8;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    /* Shadows — indigo-tinted */
    --shadow-xs: 0 1px 2px rgba(61, 50, 98, 0.06);
    --shadow-sm: 0 1px 3px rgba(61, 50, 98, 0.08), 0 1px 2px rgba(61, 50, 98, 0.05);
    --shadow-md: 0 4px 12px rgba(61, 50, 98, 0.09), 0 1px 3px rgba(61, 50, 98, 0.05);
    --shadow-lg: 0 10px 30px rgba(61, 50, 98, 0.11), 0 4px 8px rgba(61, 50, 98, 0.06);
    --shadow-accent: 0 4px 14px rgba(61, 50, 98, 0.30);

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ─────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

/* ── Page Shell ────────────────────────── */

.page-shell {
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
    padding: 24px 0 60px;
}

/* ── Login Shell ───────────────────────── */

.login-shell {
    width: min(440px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    align-items: center;
    padding: 24px 0;
}

/* ── Panel (base card) ─────────────────── */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s var(--ease);
}

/* ── Topbar ────────────────────────────── */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 14px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    color: var(--accent);
}

.topbar-icon svg {
    width: 20px;
    height: 20px;
}

.topbar-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1px;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    background: var(--accent-subtle);
    border: 1px solid rgba(59, 130, 246, 0.12);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 600;
}

/* ── Hero Section ──────────────────────── */

.hero {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    padding: 32px;
    animation: rise-in 0.5s var(--ease);
}

.eyebrow,
.step-label {
    margin: 0 0 8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
}

.hero h1,
.section-head h2 {
    margin: 0;
    font-weight: 800;
    line-height: 1.15;
}

.hero h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.02em;
    color: var(--text);
}

.section-head h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.lead {
    margin-top: 12px;
    max-width: 52ch;
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

/* ── Hero Stats ────────────────────────── */

.hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-content: start;
}

.stat-block,
.mini-stat,
.result-card {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border-light);
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.stat-block:hover,
.mini-stat:hover,
.result-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.stat-label,
.result-label,
.mini-stat span {
    display: block;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.stat-value,
.mini-stat strong,
.result-card strong {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
}

.stat-block-wide {
    grid-column: span 2;
}

/* Color-coded stat blocks */
.stat-approved {
    background: var(--success-bg);
    border-color: var(--success-border);
}
.stat-approved .stat-value,
.stat-approved strong {
    color: var(--success);
}

.stat-rejected {
    background: var(--danger-bg);
    border-color: var(--danger-border);
}
.stat-rejected .stat-value,
.stat-rejected strong {
    color: var(--danger);
}

.stat-pending {
    background: var(--warning-bg);
    border-color: var(--warning-border);
}
.stat-pending .stat-value,
.stat-pending strong {
    color: var(--warning);
}

/* ── Flash Messages ────────────────────── */

.message-stack {
    display: grid;
    gap: 8px;
    margin: 16px 0;
}

.message {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-success {
    color: var(--success);
    background: var(--success-bg);
    border-color: var(--success-border);
}

.message-warning {
    color: var(--warning);
    background: var(--warning-bg);
    border-color: var(--warning-border);
}

.message-error {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: var(--danger-border);
}

/* ── Dashboard Grid ────────────────────── */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    margin-top: 32px;   /* adds gap below overview cards */
    padding-bottom: 20px;
}

.action-panel,
.guidance-panel,
.registry-panel,
.library-panel,
.result-panel {
    padding: 24px;
    animation: rise-in 0.5s var(--ease);
}

.action-panel {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 35px rgba(0,0,0,0.12);
}

.user-action-panel {
    grid-column: span 7;
}

.accent-panel {
    background: linear-gradient(135deg, #eff6ff, #f0f9ff);
    border-color: rgba(59, 130, 246, 0.15);
}

.guidance-panel {
    grid-column: span 6;
}

.user-guidance-panel {
    grid-column: span 5;
}

.registry-panel {
    grid-column: span 12;
}

.library-panel,
.result-panel {
    grid-column: span 12;
}

/* ── Section Head with Icons ───────────── */

.section-head {
    margin-bottom: 18px;
}

.section-head-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.section-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    color: var(--accent);
}

.section-icon svg {
    width: 22px;
    height: 22px;
}

.section-icon.icon-success {
    background: var(--success-bg);
    color: var(--success);
}

.section-icon.icon-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.section-icon.icon-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ── Forms ─────────────────────────────── */

.stack-form {
    display: grid;
    gap: 16px;
}

.input-group {
    display: grid;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.input-group small {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.78rem;
    line-height: 1.5;
}

.guidance-note,
.empty-state,
.result-note {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* ── File Upload Zone ──────────────────── */

.upload-zone {
    border: 2px dashed #2f855a;
    background: rgba(47,133,90,0.05);
    border-radius: 14px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-zone:hover {
    background: rgba(47,133,90,0.1);
    border-color: #276749;
}

input[type="file"]#document_file {
    display: none;
}

.upload-zone svg {
    width: 28px;
    height: 28px;
    color: var(--text-muted);
    transition: color 0.2s var(--ease);
}

.upload-zone:hover svg {
    color: var(--accent);
}

.upload-zone-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
}

.upload-zone-text strong {
    color: var(--accent);
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ── Standard Text Inputs ──────────────── */

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.88rem;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
    outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* ── Buttons ───────────────────────────── */

.button-primary {
    appearance: none;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    background: linear-gradient(135deg, #2d7a3a 0%, #1f5c2a 100%);
    color: white;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.15s var(--ease);
    box-shadow: 0 2px 8px rgba(45, 122, 58, 0.30);
}

.button-primary:hover {
    background: linear-gradient(135deg, #1f5c2a 0%, #163d1a 100%);
    box-shadow: 0 4px 16px rgba(45, 122, 58, 0.40);
    transform: translateY(-1px);
}

.button-primary:active {
    transform: translateY(0);
}

.button-secondary {
    appearance: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    background: var(--surface);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.button-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

/* ── Guidance List ─────────────────────── */

.guidance-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.guidance-list li {
    position: relative;
    padding-left: 20px;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.guidance-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

/* ── Registry Stats ────────────────────── */

.registry-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* ── Result Panel ──────────────────────── */

.result-panel {
    border-width: 2px;
}

.result-panel.status-approved {
    border-color: var(--success-border);
    background: linear-gradient(135deg, var(--surface), var(--success-bg));
}

.result-panel.status-rejected {
    border-color: var(--danger-border);
    background: linear-gradient(135deg, var(--surface), var(--danger-bg));
}

.result-panel.status-pending {
    border-color: var(--warning-border);
    background: linear-gradient(135deg, var(--surface), var(--warning-bg));
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.user-result-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* ── Decision Badge ────────────────────── */

.decision-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.decision-badge.badge-approved {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.decision-badge.badge-rejected {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.decision-badge.badge-pending {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

/* ── Match Summary ─────────────────────── */

.match-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.match-summary p {
    margin: 0;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-hover);
    border: 1px solid var(--border-light);
    font-size: 0.85rem;
}

/* ── Table ─────────────────────────────── */

.matches-table {
    display: grid;
    gap: 4px;
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-hover);
    font-size: 0.85rem;
    transition: background 0.15s var(--ease);
}

.table-row:not(.table-head):hover {
    background: var(--accent-light);
}

.table-head {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Skipped Box ───────────────────────── */

.skipped-box {
    margin-top: 14px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    font-size: 0.85rem;
}

.skipped-box strong {
    font-size: 0.82rem;
    color: var(--warning);
}

.skipped-box ul {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

/* ── Code Tag ──────────────────────────── */

code {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 0.82em;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

/* ── Login Panel ───────────────────────── */

.login-panel {
    padding: 36px 32px;
    animation: rise-in 0.5s var(--ease);
}

.login-copy {
    margin-bottom: 24px;
}

.login-copy h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-bottom: 10px;
}

.login-copy .lead {
    margin-top: 0;
    font-size: 0.85rem;
}

.login-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    border-radius: var(--radius-md);
    color: var(--accent);
    margin-bottom: 20px;
}

.login-icon svg {
    width: 26px;
    height: 26px;
}

.login-role-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.login-role-strip .user-chip {
    font-size: 0.75rem;
    padding: 6px 12px;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Animations ────────────────────────── */

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Responsive: Tablet ────────────────── */

@media (max-width: 980px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .action-panel,
    .user-action-panel,
    .guidance-panel,
    .user-guidance-panel,
    .registry-panel,
    .library-panel,
    .result-panel {
        grid-column: span 1;
    }

    .hero-stats,
    .registry-stats,
    .result-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .match-summary {
        grid-template-columns: 1fr;
    }
}

/* ── Responsive: Mobile ────────────────── */

@media (max-width: 640px) {
    .page-shell {
        width: calc(100% - 24px);
        padding-top: 12px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }

    .topbar-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero,
    .action-panel,
    .user-action-panel,
    .guidance-panel,
    .user-guidance-panel,
    .registry-panel,
    .library-panel,
    .result-panel,
    .login-panel {
        padding: 18px;
        border-radius: var(--radius-md);
    }

    .hero h1 {
        font-size: 1.3rem;
    }

    .hero-stats,
    .registry-stats,
    .result-grid,
    .table-row {
        grid-template-columns: 1fr;
    }

    .stat-block-wide {
        grid-column: span 1;
    }
}

/* ── Decision Buttons ──────────────────── */

.decision-btn-group {
    display: flex;
    gap: 12px;
}

.decision-btn-group input[type="radio"] {
    display: none;
}

.decision-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--surface);
    color: var(--text-color);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.decision-btn:hover {
    background: var(--surface-hover);
}

/* Checked States */
input[type="radio"][value="accept"]:checked + .decision-btn {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

input[type="radio"][value="reject"]:checked + .decision-btn {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* Disabled State */
input[type="radio"]:disabled + .decision-btn {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--surface-hover);
}


/* Shared admin/calculation table functions */
.table-scroll-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.dataset-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    white-space: nowrap;
}
.dataset-table thead { background: var(--accent); }
.dataset-table thead th {
    color: #fff;
    padding: 12px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dataset-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}
.dataset-table tr:last-child td { border-bottom: none; }

/* Decision labels in folder lists */
.decision-text {
    font-weight: 800;
}
.decision-text.decision-accept,
.decision-text.decision-accepted {
    color: var(--success);
}
.decision-text.decision-reject,
.decision-text.decision-rejected {
    color: var(--danger);
}

.evidence-table thead th:first-child {
    color: white !important;
}
/* Calculation result range cards */
.credit-range-card {
    grid-column: span 2;
}
.credit-range {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr) 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
.credit-range-point {
    min-width: 0;
    text-align: center;
}
.credit-range-point strong {
    display: block;
    overflow-wrap: anywhere;
}
.credit-range-point-mid strong {
    font-size: 1.55rem;
}
.credit-range-line {
    height: 2px;
    background: var(--border);
    border-radius: 999px;
}
@media (max-width: 760px) {
    .credit-range-card {
        grid-column: span 1;
    }
    .credit-range {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .credit-range-line {
        width: 2px;
        height: 18px;
        justify-self: center;
    }
}
