:root {
    --bg-start: #f9f4e9;
    --bg-end: #d8ecf5;
    --ink: #14213d;
    --ink-soft: #2b3c63;
    --panel: rgba(255, 255, 255, 0.72);
    --panel-border: rgba(20, 33, 61, 0.18);
    --accent: #0f6d7a;
    --accent-deep: #0b4f59;
    --danger: #9f2d2d;
    --chip: rgba(255, 255, 255, 0.58);
    --chip-active: #fef7d8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    color: var(--ink);
    background: linear-gradient(140deg, var(--bg-start), var(--bg-end));
    overflow-x: hidden;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.login-shell {
    width: min(28rem, 100%);
}

.login-card {
    animation-delay: 40ms;
}

.inline-error {
    margin: 0 0 0.8rem;
    color: var(--danger);
    font-weight: 700;
}

.backdrop-orb {
    position: fixed;
    width: 38rem;
    height: 38rem;
    border-radius: 50%;
    z-index: -1;
    filter: blur(10px);
    opacity: 0.42;
}

.backdrop-orb-left {
    background: #ffd4a6;
    top: -12rem;
    left: -10rem;
}

.backdrop-orb-right {
    background: #8ac4d0;
    right: -12rem;
    bottom: -14rem;
}

.top-shell {
    padding: 2rem clamp(1rem, 3vw, 3rem) 1.25rem;
    display: grid;
    gap: 1rem;
}

.top-shell-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.top-shell-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-left: auto;
}

.title-block {
    animation: rise-in 480ms ease-out;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    color: var(--ink-soft);
}

h1 {
    margin: 0.15rem 0 0;
    font-family: "Syne", "Trebuchet MS", sans-serif;
    font-size: clamp(1.7rem, 4vw, 2.8rem);
}

.top-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.nav-chip {
    text-decoration: none;
    color: var(--ink);
    background: var(--chip);
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    transition: transform 160ms ease, background-color 160ms ease;
}

.nav-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.65rem;
    height: 1.65rem;
    border-radius: 999px;
    font-size: 0.76rem;
    background: rgba(20, 33, 61, 0.12);
}

.nav-chip:hover {
    transform: translateY(-2px);
}

.nav-chip.is-active {
    background: var(--chip-active);
}

.nav-inline-form {
    margin: 0;
}

.logout-form {
    margin: 0;
}

.nav-chip-button {
    border: 1px solid var(--panel-border);
    background: var(--chip);
    color: var(--ink);
}

.data-modal {
    border: none;
    padding: 0;
    border-radius: 0.9rem;
    width: min(40rem, 92vw);
}

.data-modal::backdrop {
    background: rgba(20, 33, 61, 0.45);
    backdrop-filter: blur(2px);
}

.data-modal-card {
    margin: 0;
    padding: 1rem;
    max-height: 80vh;
    overflow-y: auto;
    background: white;
}

.data-modal-card h3 {
    margin-top: 0;
    font-family: "Syne", "Trebuchet MS", sans-serif;
}

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

.comment-block {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(20, 33, 61, 0.12);
}

.comment-block h4 {
    margin: 0 0 0.6rem;
}

.comment-form {
    display: grid;
    gap: 0.5rem;
}

textarea {
    border: 1px solid rgba(20, 33, 61, 0.2);
    border-radius: 0.65rem;
    padding: 0.6rem 0.7rem;
    font-family: inherit;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.85);
    resize: vertical;
}

.comment-list {
    margin: 0.8rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.6rem;
}

.comment-item {
    border: 1px solid rgba(20, 33, 61, 0.12);
    border-radius: 0.6rem;
    padding: 0.55rem 0.65rem;
    background: rgba(255, 255, 255, 0.75);
}

.comment-meta {
    margin: 0;
    font-size: 0.78rem;
    color: var(--ink-soft);
}

.comment-text {
    margin: 0.35rem 0 0;
    white-space: pre-wrap;
}

.page-content {
    padding: 0 1rem 2.5rem;
    max-width: 100%;
}

.panel-grid {
    width: min(1200px, 100%);
    max-width: 100%;
    margin: 0 auto;
    display: grid;
    gap: 1rem;
}

.panel-grid > * {
    min-width: 0;
}

.two-col {
    grid-template-columns: 1.2fr 0.8fr;
}

.panel {
    min-width: 0;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 1rem;
    padding: 1rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 22px rgba(20, 33, 61, 0.09);
    animation: rise-in 420ms ease-out both;
}

.reveal-delay-1 {
    animation-delay: 70ms;
}

.reveal-delay-2 {
    animation-delay: 140ms;
}

.panel-head h2 {
    margin: 0;
    font-family: "Syne", "Trebuchet MS", sans-serif;
    font-size: 1.3rem;
}

.panel-head p {
    margin: 0.35rem 0 1rem;
    color: var(--ink-soft);
}

.upload-head {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(20, 33, 61, 0.12);
}

.inline-form {
    margin-bottom: 1rem;
}

.scan-run-summary {
    margin: 0 0 1rem;
    font-size: 0.92rem;
    color: var(--ink-soft);
}

.table-shell {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: scroll;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable both-edges;
}

.table-shell table {
    display: table;
    max-width: none;
    width: max-content;
    min-width: 100%;
}

.table-shell::-webkit-scrollbar {
    height: 12px;
}

.table-shell::-webkit-scrollbar-track {
    background: rgba(20, 33, 61, 0.12);
    border-radius: 999px;
}

.table-shell::-webkit-scrollbar-thumb {
    background: rgba(20, 33, 61, 0.32);
    border-radius: 999px;
}

table {
    border-collapse: collapse;
    font-size: 0.94rem;
}

.table-grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
}

.table-page-size-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--ink-soft);
}

.table-page-size-select {
    border: 1px solid rgba(20, 33, 61, 0.2);
    border-radius: 0.45rem;
    padding: 0.25rem 0.4rem;
    background: rgba(255, 255, 255, 0.92);
    font-size: 0.82rem;
    color: var(--ink);
}

.table-page-summary {
    margin: 0;
    font-size: 0.82rem;
    color: var(--ink-soft);
}

.table-pager {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.table-pager-button {
    border: 1px solid rgba(20, 33, 61, 0.22);
    border-radius: 0.4rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

.table-pager-button:disabled {
    opacity: 0.5;
    cursor: default;
}

.table-page-indicator {
    min-width: 5.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--ink-soft);
}

th,
td {
    text-align: left;
    padding: 0.65rem;
    border-bottom: 1px solid rgba(20, 33, 61, 0.12);
    white-space: nowrap;
}

th {
    color: var(--ink-soft);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

th.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.4rem;
}

th.sortable-header::after {
    content: "⇅";
    position: absolute;
    right: 0.5rem;
    opacity: 0.45;
}

th.sortable-header.sort-asc::after {
    content: "↑";
    opacity: 1;
}

th.sortable-header.sort-desc::after {
    content: "↓";
    opacity: 1;
}

.table-filter-row th {
    padding-top: 0.4rem;
    padding-bottom: 0.55rem;
}

.table-filter-input {
    width: 100%;
    min-width: 7rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid rgba(20, 33, 61, 0.2);
    border-radius: 0.45rem;
    background: rgba(255, 255, 255, 0.92);
    font-size: 0.82rem;
}

.status-pill {
    border-radius: 999px;
    display: inline-block;
    padding: 0.22rem 0.58rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(15, 109, 122, 0.16);
    color: var(--accent-deep);
}

.status-reviewed,
.status-completed,
.status-active {
    background: rgba(15, 109, 122, 0.16);
    color: var(--accent-deep);
}

.status-excluded {
    background: rgba(159, 45, 45, 0.14);
    color: var(--danger);
}

.status-unreviewed {
    background: rgba(196, 143, 13, 0.16);
    color: #8a6200;
}

.status-denied {
    background: rgba(159, 45, 45, 0.14);
    color: var(--danger);
}

.form-stack {
    display: grid;
    gap: 0.8rem;
}

label {
    display: grid;
    gap: 0.3rem;
    font-weight: 500;
}

input {
    border: 1px solid rgba(20, 33, 61, 0.2);
    border-radius: 0.65rem;
    padding: 0.6rem 0.7rem;
    font-family: inherit;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.85);
}

.cta,
.text-btn {
    border: 0;
    border-radius: 0.55rem;
    padding: 0.5rem 0.85rem;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    color: white;
    background: var(--accent);
    transition: transform 140ms ease, opacity 140ms ease;
}

.text-btn {
    font-size: 0.82rem;
    padding: 0.4rem 0.72rem;
}

.cta:hover,
.text-btn:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

.text-btn.danger {
    background: var(--danger);
}

.empty-state {
    color: var(--ink-soft);
    text-align: center;
    padding: 1rem;
}

@media (max-width: 960px) {
    .two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .top-shell {
        padding-top: 1.2rem;
    }

    .top-shell-head {
        flex-direction: column;
        align-items: stretch;
    }

    .logout-form {
        margin-left: 0;
    }

    .top-shell-actions {
        margin-left: 0;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .brand-mark img {
        width: min(19rem, 100%);
    }

    th,
    td {
        padding: 0.5rem;
    }
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
