/* Phase 2E - deliberately plain: server-rendered tables, no JS framework, no chart library yet.
   CLAUDE.md's own instruction: "Do not turn the web interface into a wall of graphs." */

/* Duress-PIN security block - mobile-first is now an explicit requirement (Andre: "so I can operate the
   entire CFO system from my phone"). box-sizing avoids padding pushing anything past the viewport width. */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f6f8;
    color: #1a1a1a;
}

nav {
    background: #1f2933;
    padding: 0.75rem 1.5rem;
}

nav a {
    color: #f5f6f8;
    text-decoration: none;
    margin-right: 1.5rem;
    font-weight: 600;
}

nav a:hover {
    text-decoration: underline;
}

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* A table wider than a phone screen scrolls horizontally within itself - the page never does. */
.table-scroll {
    width: 100%;
    overflow-x: auto;
}

@media (max-width: 480px) {
    nav {
        padding: 0.6rem 1rem;
    }
    nav a {
        margin-right: 1rem;
        font-size: 0.9rem;
    }
    main {
        padding: 1rem 0.85rem;
    }
    h1 {
        font-size: 1.25rem;
    }
    .card {
        padding: 0.85rem 1rem;
    }
    th, td {
        padding: 0.4rem 0.4rem;
        font-size: 0.82rem;
    }
}

h1 {
    font-size: 1.5rem;
}

h2 {
    font-size: 1.1rem;
    margin-top: 2rem;
    border-bottom: 2px solid #d7dbe0;
    padding-bottom: 0.25rem;
}

.as-of {
    color: #6b7280;
    font-size: 0.85rem;
}

.card {
    background: #ffffff;
    border: 1px solid #e2e5e9;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.attention-required {
    border-left: 4px solid #d1453b;
}

.attention-clear {
    border-left: 4px solid #2f9e44;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

th, td {
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid #e2e5e9;
    font-size: 0.9rem;
}

th {
    background: #eef0f3;
}

.figure-label {
    color: #4b5563;
}

.figure-value {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-business {
    background: #e7f5ec;
    color: #1c7a3d;
}

.badge-confidence {
    background: #fff4e5;
    color: #a15c00;
}

.empty-state {
    color: #6b7280;
    font-style: italic;
}

/* /exceptions redesign - presentation only, see docs/status/exceptions-ui-redesign-2026-09-20.md.
   Wider container than the rest of the app: this is an investigation screen (CLAUDE.md Sec23), not a
   single-figure card layout, and a 960px column wastes horizontal space on desktop for a six-field row. */
.exceptions-main {
    max-width: 1180px;
}

.exceptions-summary {
    font-size: 1rem;
    color: #1f2933;
    margin: 0 0 1rem;
}

.exceptions-summary-note {
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 400;
}

.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #ffffff;
    border: 1px solid #d7dbe0;
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    white-space: nowrap;
}

.chip:hover {
    border-color: #9aa2ab;
}

.chip-active {
    background: #1f2933;
    border-color: #1f2933;
    color: #ffffff;
}

.chip-active .chip-count {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.chip-count {
    background: #eef0f3;
    color: #4b5563;
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    font-size: 0.75rem;
}

.chip-sm {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    max-width: 420px;
}

.search-form input[type="search"] {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid #c8cdd3;
    border-radius: 6px;
    font-size: 0.85rem;
}

.search-form button {
    padding: 0.4rem 0.9rem;
    border: 1px solid #1f2933;
    background: #1f2933;
    color: #ffffff;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.exception-list {
    background: #ffffff;
    border: 1px solid #e2e5e9;
    border-radius: 8px;
    overflow: hidden;
}

:root {
    --ex-grid: 150px 1fr 140px 3fr 80px 90px;
}

.exception-row {
    border-bottom: 1px solid #e2e5e9;
}

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

.exception-header {
    display: grid;
    grid-template-columns: var(--ex-grid);
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: #eef0f3;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #4b5563;
    position: sticky;
    top: 0;
    z-index: 1;
}

.exception-summary {
    display: grid;
    grid-template-columns: var(--ex-grid);
    align-items: start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    list-style: none;
}

.exception-summary::-webkit-details-marker {
    display: none;
}

.exception-summary:hover {
    background: #f8f9fb;
}

.ex-type {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ex-subtype {
    font-size: 0.75rem;
    color: #6b7280;
}

.ex-subject {
    font-weight: 600;
    color: #1f2933;
    overflow-wrap: anywhere;
}

.ex-subject-muted {
    font-weight: 400;
    color: #6b7280;
    font-style: italic;
}

.ex-value {
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-weight: 600;
}

.ex-reason {
    color: #374151;
    white-space: normal;
    overflow-wrap: anywhere;
}

.ex-date {
    color: #6b7280;
    font-size: 0.85rem;
    white-space: nowrap;
}

.ex-chevron {
    color: #1f2933;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

details[open] .ex-chevron::after {
    content: " \25B4";
}

.exception-summary .ex-chevron::after {
    content: " \25BE";
}

.exception-detail {
    padding: 0 1rem 1rem 1rem;
    background: #f8f9fb;
    border-top: 1px dashed #d7dbe0;
}

.exception-detail dl {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.4rem 1rem;
    margin: 0.75rem 0 0;
}

.exception-detail dt {
    color: #6b7280;
    font-size: 0.8rem;
    font-weight: 600;
}

.exception-detail dd {
    margin: 0;
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.ex-natural-key {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.78rem;
    color: #4b5563;
}

.badge-type-bank { background: #e7f0ff; color: #1c4c96; }
.badge-type-stock { background: #fef3e7; color: #a15c00; }
.badge-type-sales { background: #e7f5ec; color: #1c7a3d; }
.badge-type-margin { background: #f3e8ff; color: #6b21a8; }
.badge-type-payment { background: #fde7ec; color: #a11d4c; }
.badge-type-supplier { background: #e7f9f7; color: #0f7a6e; }
.badge-type-intercompany { background: #eef0ff; color: #3730a3; }
.badge-type-liquidity { background: #e0f2fe; color: #075985; }
.badge-type-payroll { background: #fff7e6; color: #92600a; }
.badge-type-archive { background: #f1f2f4; color: #374151; }
.badge-type-data-quality { background: #fff1f0; color: #b42318; }
.badge-type-working-capital { background: #eefbf3; color: #166534; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
    font-size: 0.9rem;
}

.pagination a {
    color: #1f2933;
    font-weight: 600;
    text-decoration: none;
}

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

@media (max-width: 720px) {
    .exception-header {
        display: none;
    }

    .exception-summary {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "type chevron"
            "subject subject"
            "value value"
            "reason reason"
            "date date";
        gap: 0.35rem 0.5rem;
    }

    .ex-type { grid-area: type; flex-direction: row; align-items: center; gap: 0.5rem; }
    .ex-subject { grid-area: subject; }
    .ex-value { grid-area: value; text-align: left; }
    .ex-reason { grid-area: reason; }
    .ex-date { grid-area: date; }
    .ex-chevron { grid-area: chevron; }

    .exception-detail dl {
        grid-template-columns: 1fr;
    }

    .exception-detail dt {
        margin-top: 0.5rem;
    }
}

/* Login page - deliberately generic. No wording anywhere hints that a second, duress PIN exists. */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: #ffffff;
    border: 1px solid #e2e5e9;
    border-radius: 10px;
    padding: 2rem 1.5rem;
    text-align: center;
}

.login-card h1 {
    font-size: 1.15rem;
    margin: 0 0 1.5rem;
}

.login-card input[type="password"] {
    width: 100%;
    font-size: 1.5rem;
    letter-spacing: 0.4rem;
    text-align: center;
    padding: 0.75rem;
    border: 1px solid #c8cdd3;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.login-card button {
    width: 100%;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.85rem;
    border: none;
    border-radius: 8px;
    background: #1f2933;
    color: #ffffff;
}

.login-error {
    color: #d1453b;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}
