:root {
    --ui-surface: #fff;
    --ui-surface-soft: #f7f9fb;
    --ui-text: #14263d;
    --ui-muted: #6b7788;
    --ui-border: #dce3ea;
    --ui-blue: #3457db;
    --ui-green: #22a979;
    --ui-orange: #e68a00;
    --ui-red: #e52d32;
    --ui-purple: #7b5ce1;
    --ui-shadow: 0 14px 36px #25364a12, 0 2px 8px #25364a0d
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0
}

.nav-toggle {
    display: none
}

.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 8px;
    color: var(--ui-muted);
    font-size: 13px
}

.breadcrumbs a {
    color: var(--ui-text);
    font-weight: 750;
    text-decoration: none
}

.breadcrumbs a:hover {
    color: var(--green-2, #1e5a40)
}

.breadcrumbs .separator {
    color: #9aa6b2;
    font-size: 17px
}

.page-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin: 4px 0 26px
}

.page-hero h1 {
    margin: 0
}

.page-hero p {
    max-width: 720px;
    margin: 7px 0 0;
    color: var(--ui-muted)
}

.page-hero-actions,
.dialog-actions,
.filter-actions,
.result-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px
}

.button,
a.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: 750 14px/1.2 system-ui, sans-serif;
    text-decoration: none;
    cursor: pointer
}

.button-primary {
    color: #fff !important;
    background: linear-gradient(135deg, #24694b, #123d2c)
}

.button-secondary {
    color: #24415a !important;
    border-color: var(--ui-border) !important;
    background: #fff !important;
    box-shadow: none !important
}

.button-soft {
    color: #70500c !important;
    border-color: #ead8a4 !important;
    background: #fff8df !important;
    box-shadow: none !important
}

.button-danger {
    color: #fff !important;
    background: linear-gradient(135deg, #e24949, #b91c1c) !important
}

.button-icon {
    width: 42px;
    padding: 0
}

.workflow-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 0 0 24px
}

.stat-card {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 12px;
    min-height: 132px;
    padding: 17px;
    overflow: hidden;
    color: var(--ui-text);
    border: 1px solid var(--ui-border);
    border-radius: 14px;
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow);
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease
}

.stat-card:hover,
.stat-card.active {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--stat-color, var(--ui-blue)) 38%, white);
    box-shadow: 0 18px 40px #25364a1a
}

.stat-card:after {
    content: "";
    position: absolute;
    right: -28px;
    bottom: -38px;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--stat-color, var(--ui-blue)) 9%, transparent)
}

.stat-card[data-tone="green"] { --stat-color: var(--ui-green) }
.stat-card[data-tone="orange"] { --stat-color: var(--ui-orange) }
.stat-card[data-tone="blue"] { --stat-color: var(--ui-blue) }
.stat-card[data-tone="red"] { --stat-color: var(--ui-red) }
.stat-card[data-tone="purple"] { --stat-color: var(--ui-purple) }

.stat-icon,
.dialog-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 11px;
    color: #fff;
    background: var(--stat-color, var(--ui-blue));
    font-weight: 900;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--stat-color, var(--ui-blue)) 25%, transparent)
}

.stat-copy {
    min-width: 0
}

.stat-copy strong,
.stat-copy span,
.stat-copy small {
    display: block
}

.stat-copy strong {
    margin-top: 1px;
    font-size: 16px;
    line-height: 1.18
}

.stat-value {
    margin-top: 18px;
    color: var(--ui-text);
    font-size: 26px;
    font-weight: 850
}

.stat-arrow {
    align-self: end;
    z-index: 1;
    color: var(--stat-color, var(--ui-blue));
    font-size: 22px;
    font-weight: 900
}

.filter-card {
    margin: 0 0 24px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--ui-border);
    border-radius: 15px;
    background: #fff;
    box-shadow: var(--ui-shadow)
}

.filter-card > header,
.filter-card > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 22px;
    border-bottom: 1px solid var(--ui-border)
}

.filter-card > summary {
    cursor: pointer;
    list-style: none
}

.filter-card > summary::-webkit-details-marker {
    display: none
}

.filter-card h2,
.filter-card h3 {
    margin: 0;
    font-size: 17px
}

.filter-card header p,
.filter-card summary p {
    margin: 2px 0 0;
    color: var(--ui-muted);
    font-size: 13px
}

.filter-body {
    padding: 20px 22px 22px
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px 16px
}

.filter-grid .field-wide {
    grid-column: span 2
}

.filter-grid label {
    margin: 0;
    color: #35475b;
    font-size: 13px
}

.filter-grid input,
.filter-grid select {
    width: 100%;
    min-height: 44px
}

.filter-actions {
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 17px;
    border-top: 1px solid #edf0f3
}

.result-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 26px 0 12px
}

.result-toolbar h2 {
    margin: 0;
    font-size: 19px
}

.result-toolbar p {
    margin: 3px 0 0;
    color: var(--ui-muted);
    font-size: 13px
}

.data-panel {
    margin: 0;
    padding: 0 !important;
    overflow: hidden
}

.data-table th {
    padding: 13px 15px;
    white-space: nowrap;
    font-size: 12px;
    letter-spacing: .025em;
    text-transform: uppercase
}

.data-table td {
    padding: 14px 15px
}

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

.primary-cell a {
    color: var(--ui-text);
    font-weight: 850;
    text-decoration: none
}

.primary-cell small,
.cell-stack small {
    display: block;
    margin-top: 3px
}

.cell-stack {
    display: grid;
    gap: 5px
}

.meta-chips,
.issue-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px
}

.meta-chip,
.issue-chip-ui {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 3px 8px;
    border-radius: 999px;
    color: #516174;
    background: #eef2f6;
    font-size: 11px;
    font-weight: 750
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800
}

.status-chip.final,
.status-chip.verified {
    color: #087653;
    background: #dff7ed
}

.status-chip.ready {
    color: #1854a2;
    background: #e4efff
}

.status-chip.needs_review,
.status-chip.unverified {
    color: #a1332d;
    background: #fee9e7
}

.status-chip.neutral {
    color: #5c6673;
    background: #edf0f3
}

.row-action {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid #d7e5dc;
    border-radius: 9px;
    color: #176342;
    background: #f4faf6;
    font-size: 18px;
    font-weight: 900;
    text-decoration: none
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 9px;
    min-height: 230px;
    padding: 36px;
    text-align: center
}

.empty-state h3,
.empty-state p {
    margin: 0
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
    padding: 18px
}

.pagination a,
.pagination span {
    display: grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    padding: 0 9px;
    border: 1px solid var(--ui-border);
    border-radius: 9px;
    color: #3d5064;
    background: #fff;
    text-decoration: none
}

.pagination a:hover,
.pagination .active {
    color: #fff;
    border-color: #1c6547;
    background: #1c6547
}

.section-nav {
    position: sticky;
    top: 86px;
    z-index: 20;
    display: flex;
    gap: 6px;
    margin: 0 0 18px;
    padding: 8px;
    overflow-x: auto;
    border: 1px solid var(--ui-border);
    border-radius: 12px;
    background: #ffffffed;
    box-shadow: 0 8px 24px #24374a10;
    backdrop-filter: blur(10px)
}

.section-nav a {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 8px;
    color: #536274;
    font-size: 12px;
    font-weight: 750;
    text-decoration: none
}

.section-nav a:hover,
.section-nav a.active {
    color: #fff;
    background: #1d6145
}

.ui-dialog {
    width: min(760px, calc(100vw - 28px));
    max-height: min(88vh, 920px);
    padding: 0;
    overflow: auto;
    color: var(--ui-text);
    border: 0;
    border-radius: 18px;
    background: transparent;
    box-shadow: 0 28px 80px #101b2b55
}

.ui-dialog::backdrop {
    background: #14203399;
    backdrop-filter: blur(3px)
}

.dialog-shell {
    position: relative;
    padding: 24px;
    background: #fff
}

.dialog-shell-small {
    max-width: 500px;
    margin: auto
}

.dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px
}

.dialog-heading small {
    color: #8a6a20;
    font-weight: 850;
    letter-spacing: .08em
}

.dialog-heading h2 {
    margin: 3px 0 0
}

.dialog-close {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    color: #596879;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: none;
    font-size: 23px
}

.dialog-actions {
    justify-content: flex-end;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--ui-border)
}

.dialog-icon.warning {
    margin-bottom: 14px;
    --stat-color: var(--ui-orange)
}

.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #e7d69c;
    box-shadow: 0 8px 24px #26374a12
}

.alert > button {
    width: 30px;
    height: 30px;
    padding: 0;
    color: currentColor;
    background: transparent;
    box-shadow: none;
    font-size: 20px
}

@media(max-width:1050px) {
    .workflow-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }

    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }

    .section-nav {
        top: 10px
    }
}

@media(max-width:760px) {
    .page-hero,
    .result-toolbar {
        align-items: stretch;
        flex-direction: column
    }

    .page-hero-actions,
    .result-actions {
        width: 100%
    }

    .page-hero-actions .button,
    .result-actions .button {
        flex: 1
    }

    .responsive-table thead {
        display: none
    }

    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
        width: 100%
    }

    .responsive-table tr {
        padding: 12px 14px;
        border-bottom: 1px solid var(--ui-border)
    }

    .responsive-table td {
        display: grid;
        grid-template-columns: minmax(90px, 32%) 1fr;
        gap: 10px;
        padding: 7px 0;
        border: 0
    }

    .responsive-table td:before {
        content: attr(data-label);
        color: var(--ui-muted);
        font-size: 11px;
        font-weight: 800;
        letter-spacing: .03em;
        text-transform: uppercase
    }

    .responsive-table td.primary-cell {
        display: block;
        padding-bottom: 10px
    }

    .responsive-table td.primary-cell:before {
        display: none
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 11px;
        order: 2
    }

    header nav#primary-navigation {
        display: none;
        order: 4;
        width: 100%;
        padding: 8px 0
    }

    header nav#primary-navigation.is-open {
        display: flex
    }

    .logout-form {
        order: 3
    }
}

@media(max-width:560px) {
    .workflow-stats,
    .filter-grid {
        grid-template-columns: 1fr
    }

    .filter-grid .field-wide {
        grid-column: auto
    }

    .stat-card {
        min-height: 112px
    }

    .filter-card > header,
    .filter-card > summary,
    .filter-body,
    .dialog-shell {
        padding: 16px
    }

    .dialog-actions .button,
    .filter-actions .button {
        flex: 1
    }
}
