:root {
    --bg-app: #f3f6fb;
    --bg-surface: #ffffff;
    --bg-muted: #f8fafc;
    --bg-subtle: #eef2f7;
    --bg-hero: linear-gradient(135deg, rgba(255, 255, 255, 0.99) 0%, rgba(247, 250, 252, 0.99) 100%);
    --text-main: #172033;
    --text-muted: #5f6f85;
    --text-soft: #7f8ca0;
    --border-soft: #d8e0ea;
    --border-strong: #c5d0dd;
    --shadow-soft: 0 16px 34px rgba(15, 23, 42, 0.06);
    --shadow-header: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-card-light: 0 10px 22px rgba(15, 23, 42, 0.04);
    --primary: #0f766e;
    --primary-dark: #0d5f58;
    --secondary: #334155;
    --secondary-dark: #243244;
    --danger: #b91c1c;
    --warning: #c2410c;
    --info: #1d4ed8;
    --success: #15803d;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --info-bg: #dbeafe;
    --info-text: #1d4ed8;
    --neutral-bg: #e2e8f0;
    --neutral-text: #334155;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.06), transparent 28%),
        linear-gradient(180deg, #f6f9fc 0%, var(--bg-app) 100%);
    color: var(--text-main);
    overflow-x: hidden;
}

body.app-layout-body {
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.05), transparent 24%),
        linear-gradient(180deg, #f7fafc 0%, var(--bg-app) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    max-width: 100%;
}

img,
svg,
canvas {
    max-width: 100%;
}

.container,
.page-shell {
    width: min(1320px, calc(100% - 2.5rem));
    margin: 0 auto;
    max-width: 100%;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: 3.55rem;
    display: grid;
    grid-template-columns: minmax(220px, auto) minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 0.42rem clamp(0.9rem, 1.7vw, 1.35rem);
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(216, 224, 234, 0.92);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(14px);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.72rem;
    min-width: 0;
}

.app-brand-mark {
    width: 2rem;
    height: 2rem;
    display: inline-grid;
    place-items: center;
    border-radius: 0.72rem;
    background: var(--primary);
    color: #ffffff;
    font-weight: 900;
    box-shadow: 0 14px 24px rgba(15, 118, 110, 0.2);
}

.app-brand-text {
    display: grid;
    gap: 0.05rem;
    line-height: 1.1;
}

.app-brand-text strong {
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.app-brand-text small,
.app-header-context {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 650;
}

.app-header-context {
    min-width: 0;
}

.app-user-session {
    grid-area: auto;
}

.app-layout {
    width: 100%;
    min-height: calc(100vh - 3.55rem);
    display: grid;
    grid-template-columns: 16.5rem minmax(0, 1fr);
    gap: 0;
}

.app-sidebar {
    position: sticky;
    top: 3.55rem;
    align-self: start;
    height: calc(100vh - 3.55rem);
    padding: 1rem 0.8rem;
    border-right: 1px solid rgba(216, 224, 234, 0.92);
    background: rgba(255, 255, 255, 0.76);
    backdrop-filter: blur(10px);
    overflow-y: auto;
}

.app-sidebar-nav {
    display: grid;
    gap: 0.45rem;
}

.app-sidebar-nav a,
.app-sidebar-nav a:hover,
.app-sidebar-nav a.active {
    transform: none;
}

.app-sidebar-nav a {
    display: grid;
    gap: 0.15rem;
    padding: 0.78rem 0.88rem;
    border-radius: 1rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    white-space: normal;
}

.app-sidebar-nav a span {
    font-weight: 800;
}

.app-sidebar-nav a small {
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 650;
}

.app-sidebar-nav a:hover {
    background: rgba(15, 118, 110, 0.06);
    border-color: rgba(15, 118, 110, 0.14);
    color: var(--text-main);
}

.app-sidebar-nav a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(15, 118, 110, 0.18);
}

.app-sidebar-nav a.active small {
    color: rgba(255, 255, 255, 0.78);
}

.app-main {
    min-width: 0;
    padding: 1.35rem clamp(1rem, 2vw, 1.75rem) 2.5rem;
}

.app-main > .page-shell,
.app-main > .director-shell {
    width: 100%;
    margin: 0;
    padding-top: 0;
}

.workspace-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.workspace-header h1,
.workspace-header h2 {
    margin: 0;
}

.workspace-content {
    display: grid;
    gap: 1.2rem;
    min-width: 0;
}

.workspace-split {
    display: grid;
    grid-template-columns: minmax(26rem, 1.05fr) minmax(22rem, 0.95fr);
    gap: 1rem;
    align-items: start;
    min-width: 0;
}

.workspace-list,
.workspace-detail {
    min-width: 0;
}

.workspace-detail {
    position: sticky;
    top: 5.2rem;
}

.container {
    padding-inline: 0;
}

.page-shell {
    display: grid;
    gap: 1.5rem;
    padding: 2rem 0 2.75rem;
}

.home-shell,
.detail-shell,
.admin-shell,
.worklist-shell {
    gap: 1.25rem;
}

.admin-shell {
    width: min(1680px, calc(100% - 2.5rem));
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, auto);
    grid-template-areas:
        "brand session"
        "nav session";
    gap: 0.75rem 1rem;
    align-items: center;
    padding: 0.9rem clamp(1rem, 2vw, 1.75rem);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-main);
    border-bottom: 1px solid rgba(216, 224, 234, 0.84);
    box-shadow: var(--shadow-header);
    backdrop-filter: blur(14px);
    transition: padding 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.brand-block h1,
.brand-block p,
.page-header-copy h1,
.page-header-copy p,
.page-title,
.card-title {
    margin: 0;
}

.brand-block h1,
.page-header-copy h1,
.page-title {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-block h1 {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.brand-block h1::before {
    content: "";
    width: 2.05rem;
    height: 2.05rem;
    flex: 0 0 auto;
    border-radius: 12px 12px 14px 14px;
    border: 2px solid rgba(15, 118, 110, 0.72);
    border-top-width: 4px;
    background:
        linear-gradient(135deg, transparent 18%, rgba(15, 118, 110, 0.18) 18% 25%, transparent 25%),
        linear-gradient(45deg, transparent 31%, rgba(30, 64, 175, 0.22) 31% 38%, transparent 38%),
        radial-gradient(circle at 68% 28%, rgba(15, 118, 110, 0.22) 0 13%, transparent 14%),
        linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%);
    box-shadow: 0 10px 26px rgba(15, 118, 110, 0.14);
}

.brand-block h1 span {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.brand-block p,
.page-header-copy p {
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.brand-block {
    grid-area: brand;
    min-width: 0;
}

.brand-block p,
.top-nav,
.user-session {
    transition: opacity 0.2s ease, max-height 0.2s ease, transform 0.2s ease;
}

.brand-block p {
    display: none;
}

.main-nav,
.top-nav,
.nav-links {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.top-nav {
    grid-area: nav;
}

.main-nav a,
.top-nav a,
.nav-links a {
    padding: 0.56rem 0.82rem;
    border-radius: 999px;
    background: #f8fafc;
    color: var(--text-main);
    border: 1px solid var(--border-soft);
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.main-nav a:hover,
.top-nav a:hover,
.nav-links a:hover,
.main-nav a.active,
.top-nav a.active,
.nav-links a.active {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #ffffff;
    transform: translateY(-1px);
}

.user-session {
    grid-area: session;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.header-user-avatar {
    display: inline-grid;
    place-items: center;
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.14), rgba(30, 64, 175, 0.12));
    border: 1px solid rgba(15, 118, 110, 0.24);
    color: var(--secondary);
    font-weight: 850;
    letter-spacing: 0.03em;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.user-meta {
    display: grid;
    gap: 0.18rem;
    text-align: right;
}

.superadmin-organization-switcher {
    display: grid;
    gap: 0.25rem;
}

.header-user-switcher {
    display: grid;
    gap: 0.25rem;
}

.context-select {
    width: min(100%, 21rem);
    min-width: min(15rem, 100%);
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: #ffffff;
    color: var(--text-main);
}

.organization-context-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: rgba(15, 23, 42, 0.48);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.organization-context-dialog {
    width: min(32rem, 100%);
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-strong);
    padding: 1.5rem;
    display: grid;
    gap: 1rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.6rem 1.8rem;
    border-radius: 20px;
    background: var(--bg-hero);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
    max-width: 100%;
}

.page-header-copy {
    max-width: 820px;
}

.page-title {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.page-header-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.home-hero,
.detail-hero,
.worklist-hero,
.admin-hero {
    padding: 1.8rem 2rem;
}

.detail-hero-copy {
    display: grid;
    gap: 0.9rem;
}

.detail-header-actions,
.worklist-toolbar,
.action-row,
.section-actions,
.table-actions,
.form-actions,
.inline-actions,
.toolbar,
.filter-actions,
.worklist-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.toolbar {
    margin-bottom: 1rem;
}

.card,
.dashboard-card {
    min-width: 0;
    max-width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 1.4rem 1.5rem;
    box-shadow: var(--shadow-soft);
}

.card-header,
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.card-title,
.section-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.section-copy {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.section-header h2,
.section-header h3,
.section-header p {
    margin: 0;
}

.section-header h2 {
    font-size: 1.15rem;
}

.section-header h3 {
    font-size: 1rem;
}

.section-header p {
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.94rem;
}

.eyebrow {
    display: inline-flex;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
}

.page-grid,
.grid,
.stats-grid,
.dashboard-grid,
.stack,
.section-stack,
.worklist-grid,
.detail-list,
.timeline-list,
.ocr-layout,
.admin-section,
.admin-form-panel,
.admin-table-panel,
.admin-audit-panel,
.home-form-card {
    display: grid;
    gap: 1rem;
}

[hidden] {
    display: none !important;
}

.dashboard-grid,
.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
}

.dashboard-card {
    position: relative;
    overflow: hidden;
}

.dashboard-card::after {
    content: "";
    position: absolute;
    inset: auto -30px -35px auto;
    width: 90px;
    height: 90px;
    background: radial-gradient(circle, rgba(15, 118, 110, 0.08), transparent 70%);
}

.dashboard-card-link {
    cursor: pointer;
}

.dashboard-card.accent-primary {
    border-top: 4px solid var(--primary);
}

.dashboard-card.accent-warning {
    border-top: 4px solid #d97706;
}

.dashboard-card.accent-danger {
    border-top: 4px solid var(--danger);
}

.dashboard-card.accent-info {
    border-top: 4px solid var(--info);
}

.dashboard-card.accent-success {
    border-top: 4px solid var(--success);
}

.dashboard-label {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.65rem;
}

.dashboard-value {
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 700;
    color: #0f172a;
}

.dashboard-value-link {
    display: inline-block;
}

.dashboard-value-link:hover {
    text-decoration: underline;
}

.home-hero-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.home-chip,
.admin-context-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.38rem 0.78rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

.home-chip {
    background: rgba(15, 118, 110, 0.1);
    color: var(--primary);
}

.admin-context-chip {
    background: rgba(29, 78, 216, 0.1);
    color: var(--info-text);
}

.hero-metrics {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.hero-metric {
    min-width: 150px;
}

.hero-metric-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
}

.hero-metric-label {
    display: block;
    margin-top: 0.18rem;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.layout-split {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
    gap: 1.5rem;
    align-items: start;
}

.home-entry-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 1.5rem;
    align-items: start;
}

.split-card-grid,
.budget-grid,
.role-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.detail-summary-grid {
    display: grid;
    grid-template-columns: 1.2fr minmax(280px, 0.8fr);
    gap: 1.25rem;
    align-items: start;
}

.admin-section-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
    gap: 1.25rem;
    align-items: start;
}

.admin-users-layout {
    grid-template-columns: minmax(0, 1fr);
}

.admin-team-budgets-layout {
    grid-template-columns: minmax(0, 1fr);
}

.admin-team-budgets-layout .admin-table-panel {
    width: 100%;
    min-width: 0;
    max-width: none;
}

.admin-team-budgets-layout .table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.admin-team-budgets-table {
    width: 100%;
    min-width: 1080px;
}

.admin-users-layout .admin-table-panel {
    min-width: 0;
    width: 100%;
    max-width: none;
}

.admin-users-layout .table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.admin-user-team-roles-layout {
    grid-template-columns: minmax(0, 1fr);
}

.admin-organizations-layout {
    grid-template-columns: minmax(0, 1fr);
}

.admin-teams-layout {
    grid-template-columns: minmax(0, 1fr);
}

.admin-teams-layout .admin-table-panel {
    min-width: 0;
    width: 100%;
    max-width: none;
}

.admin-teams-layout .table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.admin-teams-table {
    min-width: 0;
    table-layout: fixed;
}

.admin-teams-table th:nth-child(1),
.admin-teams-table td:nth-child(1) {
    width: 24%;
}

.admin-teams-table th:nth-child(2),
.admin-teams-table td:nth-child(2) {
    width: 24%;
}

.admin-teams-table th:nth-child(3),
.admin-teams-table td:nth-child(3) {
    width: 12%;
}

.admin-teams-table th:nth-child(4),
.admin-teams-table td:nth-child(4) {
    width: 22%;
}

.admin-teams-table th:nth-child(5),
.admin-teams-table td:nth-child(5) {
    width: 8%;
}

.admin-teams-table th:nth-child(6),
.admin-teams-table td:nth-child(6) {
    width: 10%;
}

.admin-organizations-layout .admin-table-panel {
    min-width: 0;
    width: 100%;
    max-width: none;
}

.admin-organizations-layout .table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.admin-organizations-table {
    min-width: 0;
    table-layout: fixed;
}

.admin-organizations-table th:nth-child(1),
.admin-organizations-table td:nth-child(1) {
    width: 24%;
}

.admin-organizations-table th:nth-child(2),
.admin-organizations-table td:nth-child(2) {
    width: 18%;
}

.admin-organizations-table th:nth-child(3),
.admin-organizations-table td:nth-child(3) {
    width: 34%;
}

.admin-organizations-table th:nth-child(4),
.admin-organizations-table td:nth-child(4) {
    width: 10%;
}

.admin-organizations-table th:nth-child(5),
.admin-organizations-table td:nth-child(5) {
    width: 14%;
}

.admin-user-team-roles-layout .admin-table-panel {
    min-width: 0;
    width: 100%;
    max-width: none;
}

.admin-user-team-roles-layout .table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.admin-flow-definitions-layout,
.admin-team-flow-config-layout,
.admin-budget-lines-layout,
.admin-analytic-codes-layout {
    grid-template-columns: minmax(0, 1fr);
}

.admin-flow-definitions-layout .admin-table-panel,
.admin-team-flow-config-layout .admin-table-panel,
.admin-budget-lines-layout .admin-table-panel,
.admin-analytic-codes-layout .admin-table-panel {
    min-width: 0;
    width: 100%;
    max-width: none;
}

.admin-flow-definitions-layout .table-wrapper,
.admin-team-flow-config-layout .table-wrapper,
.admin-budget-lines-layout .table-wrapper,
.admin-analytic-codes-layout .table-wrapper {
    width: 100%;
    overflow-x: auto;
}

#admin-analytic-code-table-wrapper {
    max-height: min(72vh, 52rem);
    overflow: auto;
}

.admin-analytic-codes-workspace {
    display: grid;
    gap: 0.75rem;
}

.admin-analytic-codes-workspace .admin-analytic-code-heading {
    align-items: center;
    margin-bottom: 0;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid rgba(216, 224, 234, 0.9);
}

.admin-analytic-codes-workspace .admin-analytic-code-heading .section-copy {
    display: grid;
    gap: 0.15rem;
}

.admin-analytic-codes-workspace .admin-analytic-code-heading .section-title {
    margin: 0;
}

.admin-analytic-code-table-panel {
    padding: 0.85rem;
    border-color: rgba(216, 227, 232, 0.95);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: none;
}

.admin-analytic-code-table-panel #admin-analytic-code-table-wrapper {
    border-radius: 12px;
    border-color: rgba(216, 227, 232, 0.95);
    box-shadow: none;
}

.admin-app-body {
    min-height: 100vh;
}

.admin-app-main {
    min-width: 0;
}

.admin-app-layout > .admin-app-main {
    padding: 0.75rem;
}

.admin-console-frame {
    min-height: 0;
    display: block;
}

.admin-context-sidebar {
    display: none;
}

.admin-context-sidebar .admin-view-nav-card {
    position: sticky;
    top: 4.45rem;
    display: grid;
    gap: 0.9rem;
    padding: 0.9rem;
    border: 1px solid rgba(216, 224, 234, 0.95);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: none;
}

.admin-context-sidebar .admin-view-nav-header {
    gap: 0.65rem;
}

.admin-context-sidebar .admin-domain-select-field {
    width: 100%;
}

.admin-context-sidebar .admin-domain-select-field select {
    min-height: 2.55rem;
    padding-block: 0.55rem;
    border-radius: 11px;
    box-shadow: none;
}

.admin-context-sidebar .admin-subnav-card {
    gap: 0.55rem;
}

.admin-context-sidebar .admin-view-nav {
    display: grid;
    gap: 0.45rem;
}

.admin-context-sidebar .admin-subnav .button {
    justify-content: flex-start;
    min-height: 2.35rem;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    font-size: 0.86rem;
    box-shadow: none;
}

.admin-workspace-panel {
    min-width: 0;
    min-height: 0;
    display: grid;
    align-content: start;
    gap: 0.85rem;
}

.admin-workspace-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-soft);
}

.admin-workspace-heading .section-title {
    margin: 0.1rem 0 0;
}

.admin-workspace-heading .muted {
    margin: 0.2rem 0 0;
}

.admin-back-to-hub {
    white-space: nowrap;
}

.admin-hub {
    display: grid;
    gap: 0.75rem;
}

.admin-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75rem;
}

.admin-domain-card {
    display: grid;
    align-content: start;
    gap: 0.3rem;
    min-height: 7rem;
    padding: 0.9rem;
    text-align: left;
    color: var(--text-main);
    background: #ffffff;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.05);
}

.admin-domain-card:hover {
    border-color: rgba(8, 118, 108, 0.32);
    background: #f8fbfb;
}

.admin-domain-card:focus-visible {
    outline: 3px solid rgba(8, 118, 108, 0.24);
    outline-offset: 2px;
}

.admin-domain-card strong {
    font-size: 1.05rem;
}

.admin-domain-card .muted {
    line-height: 1.32;
}

.admin-domain-card.is-active {
    border-color: rgba(8, 118, 108, 0.45);
    background: #eef9f6;
}

.admin-task-nav {
    min-width: 0;
}

.admin-workspace-panel > .admin-section-divider {
    display: none;
}

.admin-data-management-workspace {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.65rem;
}

.admin-data-management-heading {
    align-items: center;
    margin-bottom: 0;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid rgba(216, 224, 234, 0.9);
}

.admin-data-management-heading .section-copy {
    display: grid;
    gap: 0.12rem;
}

.admin-data-management-heading .section-title,
.admin-data-management-heading .muted {
    margin: 0;
}

.admin-data-table-panel {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.55rem;
}

.table-toolbar.admin-data-toolbar {
    display: flex;
    justify-content: flex-start;
    align-items: end;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin: 0;
    padding: 0.65rem;
    border: 1px solid rgba(216, 227, 232, 0.95);
    border-radius: 12px;
    background: #f8fafc;
}

.admin-data-toolbar .form-field {
    flex: 0 1 22rem;
}

.admin-data-toolbar input {
    min-height: 2.45rem;
}

.admin-role-assignment-toolbar .form-field {
    flex: 1 1 11rem;
}

.admin-role-assignment-toolbar .form-field:first-child {
    flex-basis: 16rem;
}

.admin-toolbar-feedback {
    align-self: center;
    margin: 0;
    color: var(--success-text);
    font-size: 0.9rem;
    font-weight: 700;
}

.admin-data-toolbar-actions {
    margin-left: auto;
    align-self: end;
}

.admin-data-toolbar-actions .button {
    min-height: 2.45rem;
    padding-block: 0.5rem;
}

.admin-data-table-wrapper {
    min-height: 0;
    width: 100%;
    overflow: auto;
    border: 1px solid rgba(216, 227, 232, 0.95);
    border-radius: 12px;
    background: #ffffff;
}

.admin-data-table-wrapper table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    box-shadow: 0 1px 0 rgba(203, 213, 225, 0.9);
}

.admin-data-table-wrapper .admin-users-table th,
.admin-data-table-wrapper .admin-users-table td,
.admin-data-table-wrapper .admin-user-team-roles-table th,
.admin-data-table-wrapper .admin-user-team-roles-table td,
.admin-data-table-wrapper .admin-approval-flows-table th,
.admin-data-table-wrapper .admin-approval-flows-table td {
    padding-top: 0.48rem;
    padding-bottom: 0.48rem;
}

.admin-data-table-wrapper .admin-users-table .table-actions,
.admin-data-table-wrapper .admin-user-team-roles-table .table-actions,
.admin-data-table-wrapper .admin-approval-flows-table .table-actions {
    justify-content: flex-end;
    gap: 0.4rem;
    flex-wrap: nowrap;
}

.admin-data-table-wrapper .admin-users-table .table-actions .button,
.admin-data-table-wrapper .admin-user-team-roles-table .table-actions .button,
.admin-data-table-wrapper .admin-approval-flows-table .table-actions .button {
    white-space: nowrap;
}

.admin-app-body .admin-analytic-codes-workspace {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.65rem;
}

.admin-app-body .admin-analytic-codes-layout {
    min-height: 0;
}

.admin-app-body .admin-analytic-code-table-panel {
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 0.65rem;
}

.admin-app-body .admin-analytic-code-table-panel #admin-analytic-code-table-wrapper {
    min-height: 0;
    max-height: none;
}

@media (min-width: 800px) {
    .admin-app-body {
        overflow: hidden;
    }

    .admin-app-layout {
        height: calc(100vh - 3.55rem);
        min-height: 0;
    }

    .admin-app-layout > .admin-app-main {
        min-height: 0;
        overflow: hidden;
        padding: 0.9rem 1rem 1rem;
    }

    .admin-app-main > .admin-shell {
        height: 100%;
        min-height: 0;
        padding: 0;
        overflow: hidden;
    }

    .admin-console-frame,
    .admin-workspace-panel {
        height: 100%;
    }

    .admin-workspace-panel {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        overflow: hidden;
        padding-right: 0.1rem;
    }

    .admin-workspace-heading,
    .admin-hub {
        grid-column: 1 / -1;
    }

    .admin-workspace-panel.is-admin-hub {
        grid-template-rows: auto auto;
        align-content: start;
    }

    .admin-workspace-panel.is-admin-hub .admin-hub {
        grid-row: 2;
    }

    .admin-task-nav {
        grid-column: 1;
        grid-row: 2;
        padding-right: 0.75rem;
        border-right: 1px solid var(--border-soft);
        overflow-y: auto;
    }

    .admin-task-nav .admin-subnav-card,
    .admin-task-nav .admin-subnav {
        display: grid;
        gap: 0.25rem;
    }

    .admin-task-nav .admin-subnav .button {
        justify-content: flex-start;
        min-height: 2.3rem;
        padding: 0.48rem 0.62rem;
        border: 0;
        border-radius: 8px;
        background: transparent;
        box-shadow: none;
        text-align: left;
    }

    .admin-task-nav .admin-subnav .button:hover {
        background: #f2f7f6;
    }

    .admin-task-nav .admin-subnav .button.is-active {
        color: var(--primary);
        background: #e8f5f2;
    }

    .admin-task-nav [data-admin-active-subview-note] {
        display: none;
    }

    .admin-workspace-panel > .admin-section:not([hidden]) {
        grid-column: 1;
        grid-row: 2;
    }

    .admin-workspace-panel > .admin-analytic-codes-workspace:not([hidden]) {
        height: 100%;
        overflow: hidden;
    }

    .admin-workspace-panel > .admin-data-management-workspace:not([hidden]) {
        height: 100%;
        overflow: hidden;
    }

    .admin-workspace-panel > .admin-roles-workspace:not([hidden]) {
        grid-template-rows: auto minmax(0, 0.3fr) minmax(0, 0.7fr);
    }

    .admin-workspace-panel > .admin-analytic-codes-workspace:not([hidden]) .admin-analytic-codes-layout,
    .admin-workspace-panel > .admin-analytic-codes-workspace:not([hidden]) .admin-analytic-code-table-panel {
        height: 100%;
    }

    .admin-workspace-panel > .admin-data-management-workspace:not([hidden]) .admin-users-layout,
    .admin-workspace-panel > .admin-data-management-workspace:not([hidden]) .admin-user-team-roles-layout,
    .admin-workspace-panel > .admin-data-management-workspace:not([hidden]) .admin-data-table-panel {
        height: 100%;
        min-height: 0;
    }

    .admin-workspace-panel > .admin-roles-workspace:not([hidden]) > .admin-user-team-roles-layout {
        height: auto;
        min-height: 0;
        overflow: hidden;
    }

    .admin-workspace-panel > .admin-analytic-codes-workspace:not([hidden]) #admin-analytic-code-table-wrapper {
        overflow: auto;
    }
}

@media (max-width: 799px) {
    .admin-analytic-codes-workspace,
    .admin-analytic-codes-layout,
    .admin-analytic-code-table-panel,
    #admin-analytic-code-table-wrapper {
        min-width: 0;
        max-width: 100%;
    }

    .admin-analytic-code-toolbar {
        flex-wrap: wrap;
    }

    .admin-analytic-code-toolbar .form-field,
    .admin-analytic-code-toolbar .form-field:first-child {
        flex: 1 1 14rem;
        min-width: 0;
    }

    .admin-analytic-code-toolbar-actions {
        margin-left: 0;
    }
}

.admin-financial-comparison-layout {
    grid-template-columns: minmax(300px, 0.38fr) minmax(0, 0.62fr);
}

.admin-financial-comparison-layout .admin-form-panel,
.admin-financial-comparison-layout .admin-table-panel {
    min-width: 0;
    width: 100%;
}

.comparison-chart {
    display: grid;
    gap: 1rem;
    padding: 1rem 0;
}

.comparison-chart-row {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(120px, auto);
    align-items: center;
    gap: 0.75rem;
}

.comparison-chart-label {
    font-weight: 600;
    color: var(--text-muted);
}

.comparison-chart-bar {
    background: var(--surface-muted);
    border-radius: 999px;
    overflow: hidden;
    height: 1rem;
    min-width: 0;
}

.comparison-chart-value {
    height: 100%;
    border-radius: 999px;
}

.comparison-chart-value.expense {
    background: var(--danger);
}

.comparison-chart-value.income {
    background: var(--success);
}

.comparison-chart-amount {
    text-align: right;
    white-space: nowrap;
}

.comparison-chart-summary {
    display: grid;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: 1rem;
}

.section-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}

.form-grid,
.toolbar-grid,
.form-subgrid,
.info-grid,
.approval-step-meta,
.worklist-meta-grid,
.budget-metrics {
    display: grid;
    gap: 1rem 1.1rem;
}

.form-grid,
.toolbar-grid,
.form-subgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.info-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.approval-step-meta,
.worklist-meta-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.budget-metrics {
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    margin-top: 0.75rem;
}

.form-group,
.form-field {
    display: grid;
    gap: 0.42rem;
}

.role-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 0.45rem;
}

.role-toggle-card {
    display: grid;
    grid-template-columns: 1fr minmax(62px, 72px);
    align-items: center;
    gap: 0.45rem;
    min-height: 46px;
    padding: 0.42rem 0.52rem;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #f8fafc;
    opacity: 0.72;
    transition: background-color 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.role-toggle-card.is-enabled {
    border-color: rgba(15, 118, 110, 0.4);
    background: #e8f7f2;
    opacity: 1;
}

.role-toggle-card strong {
    color: var(--ink);
    font-size: 0.88rem;
    line-height: 1.15;
}

.role-toggle-button {
    min-height: 32px;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
}

.role-toggle-button[data-active="true"] {
    border-color: rgba(15, 118, 110, 0.48);
    background: var(--primary);
    color: #ffffff;
}

.boolean-toggle-source {
    display: none;
}

.boolean-toggle-card {
    grid-template-columns: 1fr minmax(62px, 82px);
    align-items: center;
    gap: 0.45rem;
    min-height: 46px;
    padding: 0.42rem 0.52rem;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #f8fafc;
    opacity: 0.72;
    transition: background-color 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.boolean-toggle-card.is-enabled {
    border-color: rgba(15, 118, 110, 0.4);
    background: #e8f7f2;
    opacity: 1;
}

.boolean-toggle-card label {
    color: var(--ink);
    font-size: 0.88rem;
    line-height: 1.15;
}

.boolean-toggle-button {
    width: fit-content;
    min-width: 72px;
    min-height: 32px;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.boolean-toggle-button[data-active="true"] {
    border-color: rgba(15, 118, 110, 0.48);
    background: var(--primary);
    color: #ffffff;
}

.form-group label,
.form-field label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #334155;
}

.form-field label.label-with-meta {
    align-items: baseline;
    display: flex;
    gap: 0.65rem;
}

.label-meta {
    color: var(--success);
    font-size: 0.86rem;
    font-weight: 800;
    white-space: nowrap;
}

.form-field-wide {
    grid-column: 1 / -1;
}

.input,
.select,
.textarea,
.toolbar input,
.form-field input,
.form-field select,
.form-field textarea,
.approval-actions textarea {
    width: 100%;
    padding: 0.78rem 0.85rem;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: #ffffff;
    color: var(--text-main);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input:focus,
.select:focus,
.textarea:focus,
.toolbar input:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.approval-actions textarea:focus {
    border-color: rgba(15, 118, 110, 0.65);
    outline: none;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.btn,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    max-width: 100%;
    min-height: 42px;
    padding: 0.72rem 1rem;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    transition: transform 0.16s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn-primary,
.button {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover,
.button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary,
.button.secondary {
    background: var(--secondary);
    color: #ffffff;
}

.btn-secondary:hover,
.button.secondary:hover {
    background: var(--secondary-dark);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #166534;
}

.btn-danger,
.button.reject {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover,
.button.reject:hover {
    background: #991b1b;
}

.button.return {
    background: var(--warning);
    color: #ffffff;
}

.button.return:hover {
    background: #9a3412;
}

.btn-light,
.button.ghost {
    background: #f8fafc;
    color: var(--text-main);
    border-color: var(--border-soft);
}

.btn-light:hover,
.button.ghost:hover {
    background: #eef2f7;
}

.btn:disabled,
.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.button.small {
    min-height: 34px;
    padding: 0.48rem 0.72rem;
    font-size: 0.84rem;
}

.feedback,
.message-info,
.message-success,
.message-error {
    min-height: 1.3rem;
    margin: 0 0 1rem;
    font-size: 0.93rem;
    color: var(--text-muted);
}

.feedback.success,
.message-success {
    color: var(--success-text);
    font-weight: 600;
}

.feedback.error,
.message-error {
    color: var(--danger-text);
    font-weight: 600;
}

.message-info {
    color: var(--info-text);
    font-weight: 600;
}

.muted {
    color: var(--text-muted);
}

.empty-state {
    padding: 1rem 1.1rem;
    border: 1px dashed var(--border-strong);
    border-radius: 14px;
    color: var(--text-muted);
    background: var(--bg-muted);
}

.helper-text,
.home-empty-note,
.worklist-note,
.admin-panel-note {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.admin-compact-settings-form {
    display: grid;
    gap: 0.85rem;
    max-width: 42rem;
    margin-top: 1rem;
}

.admin-compact-settings-list {
    display: grid;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-soft);
    border-radius: 0.65rem;
}

.admin-compact-settings-list label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.helper-text {
    color: var(--text-soft);
    font-size: 0.88rem;
}

.text-nowrap {
    white-space: nowrap;
}

.intake-supplier-hint {
    display: grid;
    gap: 0.55rem;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: #f8fbff;
}

.home-empty-note,
.worklist-note,
.admin-panel-note {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: #f8fbff;
    border: 1px solid var(--border-soft);
}

.detail-grid,
.summary-side-panel,
.summary-meta-list,
.detail-list,
.approval-group,
.approval-step-list,
.summary-amount-card,
.role-summary-card,
.worklist-card,
.worklist-card-title,
.admin-mode-copy {
    display: grid;
    gap: 0.75rem;
}

.detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    margin: 0;
}

.detail-grid div,
.info-grid .info-tile,
.budget-metric,
.summary-tile,
.approval-step-meta-item,
.worklist-meta-item {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: var(--bg-muted);
    border: 1px solid var(--border-soft);
}

.detail-grid dt,
.info-grid dt {
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.detail-grid dd,
.info-grid dd {
    margin: 0;
    font-weight: 700;
}

.info-tile-action {
    width: fit-content;
    margin-top: 0.65rem;
    padding: 0.4rem 0.65rem;
    min-height: auto;
}

.summary-amount-card {
    padding: 1.1rem;
    background: linear-gradient(135deg, #f8fbff 0%, #edf7f6 100%);
}

.summary-amount-main {
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 800;
    color: #0f172a;
}

.summary-meta-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: var(--bg-muted);
    border: 1px solid var(--border-soft);
}

.summary-meta-item span:first-child {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.summary-meta-item strong {
    color: var(--text-main);
}

.approval-card,
.history-card,
.document-card,
.budget-card,
.list-card,
.compact-card,
.worklist-card,
.role-summary-card,
.approval-group,
.surface-card {
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 1rem 1.05rem;
    background: #fcfdff;
    box-shadow: var(--shadow-card-light);
}

.approval-card header,
.history-card header,
.document-card header,
.budget-card header,
.worklist-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.approval-card h3,
.history-card h3,
.document-card h3,
.budget-card h3,
.worklist-card-title h3,
.role-summary-title {
    margin: 0;
    font-size: 1rem;
}

.document-card {
    gap: 0.9rem;
}

.document-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.approval-step-item {
    display: grid;
    gap: 0.7rem;
    padding: 1rem;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: #ffffff;
}

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

.approval-step-meta-item strong,
.worklist-meta-item strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.approval-flow-timeline {
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: rgba(248, 251, 253, 0.95);
    padding: 14px 16px;
    margin: 14px 0;
}

.approval-flow-timeline-title {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.approval-flow-step-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.approval-flow-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: #ffffff;
    padding: 10px;
}

.approval-flow-step[data-status="approved"] {
    border-color: #b7f3ce;
    background: #f1fff6;
}

.approval-flow-step.is-current {
    border-color: #f1cc71;
    background: #fff9e8;
    box-shadow: 0 0 0 2px rgba(241, 204, 113, 0.2);
}

.approval-flow-step-bullet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #e8eef7;
    color: var(--text-main);
    font-weight: 800;
}

.approval-flow-step[data-status="approved"] .approval-flow-step-bullet {
    background: #d8f8e4;
    color: #047857;
}

.approval-flow-step.is-current .approval-flow-step-bullet {
    background: #ffe9a8;
    color: #9a5b00;
}

.approval-flow-step-body {
    display: grid;
    gap: 4px;
}

.approval-flow-step-body strong {
    font-size: 0.92rem;
}

.approval-flow-step-body span {
    color: var(--text-muted);
    font-size: 0.86rem;
}

.ocr-summary-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #f8fbff 0%, #f1f8ff 100%);
    border: 1px solid var(--border-soft);
}

.ocr-confidence-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 0.85rem;
}

.ocr-confidence-item {
    display: grid;
    gap: 0.25rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: var(--bg-muted);
    border: 1px solid var(--border-soft);
}

.ocr-confidence-item strong {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.ocr-confidence-item span {
    font-weight: 700;
    color: var(--text-main);
}

.ocr-warning-list,
.ocr-candidate-context {
    display: grid;
    gap: 0.85rem;
}

.ocr-warning-item,
.ocr-candidate-item {
    padding: 0.95rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: #fcfdff;
}

.ocr-warning-item {
    background: #fffaf0;
    border-color: #f6d7a8;
}

.ocr-warning-item strong,
.ocr-candidate-item strong {
    display: block;
    margin-bottom: 0.28rem;
    color: var(--text-main);
}

.ocr-warning-item p,
.ocr-candidate-item p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.ocr-candidate-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-top: 0.65rem;
}

.ocr-summary-badges,
.role-badges,
.data-badge-row,
.admin-badge-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.ocr-preview-empty {
    margin-bottom: 0.9rem;
    padding: 0.85rem 1rem;
    border: 1px dashed var(--border-soft);
    border-radius: 14px;
    color: var(--text-muted);
    background: var(--bg-muted);
}

.ocr-preview-canvas {
    position: relative;
    width: 100%;
    height: calc(100vh - 11rem);
    min-height: 680px;
    max-height: 980px;
    overflow: auto;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: #f8fbff;
}

.ocr-preview-canvas img {
    display: block;
    width: 100%;
    height: auto;
}

.ocr-preview-overlay {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
}

.ocr-preview-box {
    position: absolute;
    display: block;
    border: 2px solid #1d4ed8;
    border-radius: 4px;
    background: rgba(29, 78, 216, 0.16);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.82);
}

.apply-panel {
    display: grid;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: var(--bg-muted);
    border: 1px solid var(--border-soft);
}

.invoice-detail-page .page-shell {
    width: min(1760px, calc(100% - 2rem));
}

.ocr-review-workspace {
    display: grid;
    grid-template-columns: minmax(640px, 1.05fr) minmax(460px, 0.95fr);
    gap: 1rem;
    align-items: start;
}

.ocr-review-editor {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.ocr-preview-panel {
    position: sticky;
    top: 1rem;
    min-width: 0;
    margin-top: 0;
}

.card-subsection {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--bg-muted);
}

.card-subsection.nested-white {
    background: #ffffff;
}

.allocation-budget-meta {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-soft);
}

.timeline-item {
    position: relative;
    padding: 1rem 1rem 1rem 1.2rem;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: #fcfdff;
}

.timeline-item::before {
    content: "";
    position: absolute;
    top: 1rem;
    left: 0;
    bottom: 1rem;
    width: 4px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.35);
}

.budget-card.warning {
    border-color: #f6cd75;
    background: #fffaf0;
}

.budget-card.over-budget {
    border-color: #f2a5a5;
    background: #fff5f5;
}

.budget-metric-label {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.budget-metric-value {
    font-weight: 700;
    color: var(--text-main);
}

.budget-flag,
.status-pill,
.badge,
.role-badge,
.document-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 28px;
    padding: 0.28rem 0.72rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge,
.status-pill,
.role-badge,
.document-indicator {
    background: var(--neutral-bg);
    color: var(--neutral-text);
}

.badge-success,
.status-pill.approved,
.document-indicator.has-documents,
.role-badge.active {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-warning,
.status-pill.pending,
.budget-flag.warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.badge-danger,
.status-pill.rejected,
.budget-flag.over-budget,
.role-badge.missing {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info-text);
}

.badge-neutral {
    background: var(--neutral-bg);
    color: var(--neutral-text);
}

.status-pill.returned,
.badge-return {
    background: #fed7aa;
    color: #9a3412;
}

.document-indicator {
    font-weight: 600;
}

.table-wrapper,
.table-wrap {
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: #ffffff;
}

.table-wrap.card-wrap {
    box-shadow: var(--shadow-card-light);
}

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

.admin-toolbar-row {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-toolbar-row .form-field {
    min-width: 16rem;
    margin: 0;
}

.admin-analytic-code-toolbar {
    justify-content: flex-start;
    align-items: flex-end;
    gap: 0.7rem;
    margin-bottom: 0.7rem;
    padding: 0.7rem;
    border: 1px solid rgba(216, 227, 232, 0.95);
    border-radius: 12px;
    background: #f8fafc;
}

.admin-analytic-code-toolbar .form-field {
    flex: 0 1 20rem;
}

.admin-analytic-code-toolbar .form-field:first-child {
    flex-basis: 24rem;
}

.admin-analytic-code-toolbar-actions {
    margin-left: auto;
    align-self: end;
}

.admin-analytic-code-toolbar-actions .button {
    min-height: 2.45rem;
    padding-block: 0.5rem;
}

.admin-analytic-code-toolbar label {
    color: #405467;
    font-size: 0.78rem;
    font-weight: 850;
}

.admin-analytic-code-toolbar select,
.admin-analytic-code-toolbar input {
    min-height: 2.45rem;
}

.admin-analytic-code-toolbar select:focus-visible,
.admin-analytic-code-toolbar input:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.35);
    outline-offset: 2px;
}

.table-meta {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.list-table,
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 920px;
}

.budget-overview-table {
    min-width: 1240px;
}

.admin-users-table {
    width: 100%;
    min-width: 60rem;
    table-layout: fixed;
}

.admin-users-table td {
    vertical-align: top;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.admin-users-table th:nth-child(1),
.admin-users-table td:nth-child(1) {
    width: 28%;
    min-width: 13rem;
}

.admin-users-table th:nth-child(2),
.admin-users-table td:nth-child(2) {
    width: 24%;
    min-width: 11rem;
}

.admin-users-table th:nth-child(3),
.admin-users-table td:nth-child(3) {
    width: 28%;
    min-width: 12rem;
}

.admin-users-table th:nth-child(4),
.admin-users-table td:nth-child(4) {
    white-space: nowrap;
    width: 10%;
}

.admin-users-table th:nth-child(5),
.admin-users-table td:nth-child(5) {
    width: 10%;
    min-width: 9rem;
}

.admin-users-table td {
    word-break: break-word;
}

.admin-user-team-roles-table {
    width: 100%;
    min-width: 64rem;
    table-layout: fixed;
}

.admin-user-team-roles-table td {
    vertical-align: top;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    word-break: break-word;
}

.admin-user-team-roles-table th:nth-child(1),
.admin-user-team-roles-table td:nth-child(1) {
    width: 18%;
    min-width: 11rem;
}

.admin-user-team-roles-table th:nth-child(2),
.admin-user-team-roles-table td:nth-child(2) {
    width: 18%;
    min-width: 11rem;
}

.admin-user-team-roles-table th:nth-child(3),
.admin-user-team-roles-table td:nth-child(3) {
    width: 18%;
    min-width: 10rem;
}

.admin-user-team-roles-table th:nth-child(4),
.admin-user-team-roles-table td:nth-child(4),
.admin-user-team-roles-table th:nth-child(5),
.admin-user-team-roles-table td:nth-child(5),
.admin-user-team-roles-table th:nth-child(6),
.admin-user-team-roles-table td:nth-child(6) {
    white-space: nowrap;
}

.admin-user-team-roles-table th:nth-child(7),
.admin-user-team-roles-table td:nth-child(7) {
    width: 18%;
    min-width: 10rem;
}

.admin-approval-flows-table,
.admin-approval-steps-table,
.admin-team-flow-config-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.admin-analytic-codes-table {
    width: min(100%, 100rem);
    min-width: 1120px;
    table-layout: auto;
}

.admin-analytic-codes-table thead {
    position: relative;
    z-index: 8;
}

.admin-analytic-codes-table thead th {
    position: sticky;
    top: 0;
    z-index: 9;
    background: #f8fafc;
    background-clip: padding-box;
    box-shadow: inset 0 -1px 0 var(--border), 0 0.55rem 0.9rem rgba(248, 250, 252, 0.96);
}

.admin-budget-lines-table {
    width: max(100%, 1120px);
    min-width: 1120px;
    table-layout: fixed;
}

.admin-approval-flows-table td,
.admin-approval-steps-table td,
.admin-team-flow-config-table td,
.admin-budget-lines-table td,
.admin-analytic-codes-table td {
    vertical-align: top;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    word-break: break-word;
}

.flow-definition-table th:nth-child(1),
.flow-definition-table td:nth-child(1) {
    width: 23%;
}

.flow-definition-table th:nth-child(2),
.flow-definition-table td:nth-child(2) {
    width: 42%;
}

.flow-definition-table th:nth-child(3),
.flow-definition-table td:nth-child(3) {
    width: 10%;
    white-space: nowrap;
}

.flow-definition-table th:nth-child(4),
.flow-definition-table td:nth-child(4) {
    width: 25%;
    min-width: 18rem;
    text-align: right;
    white-space: nowrap;
    word-break: normal;
}

.flow-definition-table .admin-actions-cell {
    min-width: 18rem;
}

.flow-definition-table .table-actions {
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: nowrap;
}

.flow-definition-table .table-actions .button {
    white-space: nowrap;
}

.admin-approval-steps-table th:nth-child(1),
.admin-approval-steps-table td:nth-child(1) {
    width: 22%;
}

.admin-approval-steps-table th:nth-child(2),
.admin-approval-steps-table td:nth-child(2) {
    width: 10%;
    white-space: nowrap;
}

.admin-approval-steps-table th:nth-child(3),
.admin-approval-steps-table td:nth-child(3) {
    width: 22%;
}

.admin-approval-steps-table th:nth-child(4),
.admin-approval-steps-table td:nth-child(4) {
    width: 18%;
}

.admin-approval-steps-table th:nth-child(5),
.admin-approval-steps-table td:nth-child(5) {
    width: 18%;
}

.admin-approval-steps-table th:nth-child(6),
.admin-approval-steps-table td:nth-child(6) {
    width: 10%;
    min-width: 9rem;
}

.admin-team-flow-config-table th:nth-child(1),
.admin-team-flow-config-table td:nth-child(1) {
    width: 14%;
}

.admin-team-flow-config-table th:nth-child(2),
.admin-team-flow-config-table td:nth-child(2) {
    width: 16%;
}

.admin-team-flow-config-table th:nth-child(3),
.admin-team-flow-config-table td:nth-child(3) {
    width: 14%;
}

.admin-team-flow-config-table th:nth-child(4),
.admin-team-flow-config-table td:nth-child(4) {
    width: 20%;
}

.admin-team-flow-config-table th:nth-child(5),
.admin-team-flow-config-table td:nth-child(5),
.admin-team-flow-config-table th:nth-child(6),
.admin-team-flow-config-table td:nth-child(6),
.admin-team-flow-config-table th:nth-child(7),
.admin-team-flow-config-table td:nth-child(7),
.admin-team-flow-config-table th:nth-child(8),
.admin-team-flow-config-table td:nth-child(8) {
    white-space: nowrap;
}

.admin-team-flow-config-table th:nth-child(9),
.admin-team-flow-config-table td:nth-child(9) {
    width: 12%;
    min-width: 10rem;
}

.admin-budget-lines-table th:nth-child(1),
.admin-budget-lines-table td:nth-child(1) {
    width: 10%;
    white-space: nowrap;
}

.admin-budget-lines-table th:nth-child(2),
.admin-budget-lines-table td:nth-child(2) {
    width: 28%;
}

.admin-budget-lines-table th:nth-child(3),
.admin-budget-lines-table td:nth-child(3),
.admin-budget-lines-table th:nth-child(4),
.admin-budget-lines-table td:nth-child(4),
.admin-budget-lines-table th:nth-child(5),
.admin-budget-lines-table td:nth-child(5),
.admin-budget-lines-table th:nth-child(6),
.admin-budget-lines-table td:nth-child(6) {
    width: 12%;
    white-space: nowrap;
    text-align: right;
}

.admin-budget-lines-table th:nth-child(7),
.admin-budget-lines-table td:nth-child(7) {
    width: 14%;
    min-width: 11rem;
    white-space: normal;
}

.admin-budget-lines-table td:nth-child(7) {
    text-align: right;
}

.admin-budget-lines-table tr.admin-budget-parent-line td {
    font-weight: 800;
    background: rgba(241, 245, 249, 0.72);
}

.admin-budget-lines-table tr.admin-budget-parent-line.is-clickable {
    cursor: pointer;
}

.admin-budget-lines-table tr.admin-budget-parent-line.is-clickable:hover td {
    background: rgba(226, 232, 240, 0.92);
}

.admin-budget-lines-table tr.admin-budget-parent-line td:nth-child(7) {
    font-weight: 700;
}

.admin-budget-lines-table tr.admin-budget-leaf-line td {
    background: #ffffff;
}

.budget-line-indent {
    display: inline-block;
    width: calc(var(--budget-line-level, 0) * 1.05rem);
    flex: 0 0 auto;
}

.budget-line-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.budget-line-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    color: var(--text-muted);
}

.budget-line-code-text {
    white-space: nowrap;
}

.admin-analytic-codes-table th:nth-child(1),
.admin-analytic-codes-table td:nth-child(1) {
    width: 8%;
    white-space: nowrap;
}

.admin-analytic-codes-table th:nth-child(2),
.admin-analytic-codes-table td:nth-child(2) {
    width: 17%;
    min-width: 14rem;
    word-break: normal;
}

.admin-analytic-codes-table th:nth-child(3),
.admin-analytic-codes-table td:nth-child(3) {
    width: 10%;
    white-space: nowrap;
    text-align: right;
}

.admin-analytic-codes-table th:nth-child(4),
.admin-analytic-codes-table td:nth-child(4) {
    width: 10%;
    white-space: nowrap;
    text-align: right;
}

.admin-analytic-codes-table th:nth-child(5),
.admin-analytic-codes-table td:nth-child(5) {
    width: 10%;
    white-space: nowrap;
    text-align: right;
}

.admin-analytic-codes-table th:nth-child(6),
.admin-analytic-codes-table td:nth-child(6) {
    width: 10%;
    white-space: nowrap;
    text-align: right;
}

.admin-analytic-codes-table th:nth-child(7),
.admin-analytic-codes-table td:nth-child(7) {
    width: 7%;
    white-space: nowrap;
    text-align: center;
}

.admin-analytic-codes-table th:nth-child(8),
.admin-analytic-codes-table td:nth-child(8) {
    width: 5%;
    white-space: nowrap;
    text-align: center;
}

.admin-analytic-codes-table th:nth-child(9),
.admin-analytic-codes-table td:nth-child(9) {
    width: 23%;
    min-width: 22rem;
}

.admin-analytic-codes-table .admin-actions-cell {
    min-width: 22rem;
    text-align: left;
}

.admin-analytic-codes-table .table-actions {
    justify-content: flex-start;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: nowrap;
}

.admin-analytic-codes-table .table-actions .button {
    white-space: nowrap;
    padding: 0.5rem 0.65rem;
}

.admin-allocation-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    border: 1px solid currentColor;
    border-radius: 0.7rem;
    color: #64748b;
    background: #f1f5f9;
    cursor: help;
}

.admin-allocation-indicator svg { width: 1.25rem; height: 1.25rem; }
.admin-allocation-indicator.is-students { color: #0369a1; background: #e0f2fe; }
.admin-allocation-indicator.is-equal { color: #0f766e; background: #ccfbf1; }
.admin-allocation-indicator.is-fixed { color: #7e22ce; background: #f3e8ff; }

.admin-analytic-codes-table td {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.admin-allocation-team-list {
    min-width: 0;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
}

[data-admin-drawer-panel="allocation-rule"] {
    gap: 0.75rem;
}

[data-admin-drawer-panel="allocation-rule"] p {
    margin: 0;
}

#admin-allocation-rule-form {
    gap: 0.75rem;
}

.admin-allocation-team-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.25rem 0.75rem;
    padding: 0.7rem;
    margin-top: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    color: var(--text-muted);
    background: #f8fafc;
    transition: background 0.15s, border-color 0.15s;
}

.admin-allocation-team-row.is-selected { background: #ecfdf5; border-color: #75baa8; color: #115e59; }
.admin-allocation-team-row.is-unavailable { background: #f1f5f9; color: #64748b; }
.admin-allocation-team-choice { min-width: 0; }
.admin-allocation-team-choice label {
    display: grid;
    grid-template-columns: 1.25rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
}
.admin-allocation-team-choice input {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    border: 2px solid #94a3b8;
    border-radius: 0.35rem;
    background: #fff;
    display: grid;
    place-content: center;
    cursor: pointer;
}
.admin-allocation-team-choice input:checked { background: #0f766e; border-color: #0f766e; }
.admin-allocation-team-choice input:checked::after {
    content: "";
    width: 0.3rem;
    height: 0.6rem;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translateY(-1px) rotate(45deg);
}
.admin-allocation-team-choice input:focus-visible { outline: 3px solid #7dd3fc; outline-offset: 3px; }
.admin-allocation-team-choice input:disabled { cursor: not-allowed; opacity: 0.55; }
.admin-allocation-team-choice small { display: block; }
.admin-allocation-team-count { max-width: 13rem; font-size: 0.78rem; font-weight: 400; text-align: right; }
.admin-allocation-team-row > .form-field { width: 7rem; }

.admin-allocation-method-picker { position: relative; }
.admin-allocation-method-picker summary {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    cursor: pointer;
    list-style: none;
    background: #fff;
}
.admin-allocation-method-picker summary::-webkit-details-marker { display: none; }
.admin-allocation-method-picker summary:focus-visible { outline: 3px solid #7dd3fc; outline-offset: 2px; }
.admin-allocation-method-picker summary[aria-disabled="true"] { opacity: 0.6; cursor: wait; }
.admin-allocation-method-chevron { margin-left: auto; }
.admin-allocation-method-picker[open] .admin-allocation-method-chevron { transform: rotate(180deg); }
.admin-allocation-method-options {
    display: grid;
    gap: 0.25rem;
    position: absolute;
    inset: 100% 0 auto;
    z-index: 10;
    margin: 0.35rem 0 0;
    padding: 0.4rem;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.15);
}
.admin-allocation-method-options label { display: flex; align-items: center; gap: 0.7rem; padding: 0.45rem; border-radius: 8px; cursor: pointer; }
.admin-allocation-method-options label:has(:checked) { background: #ecfdf5; color: #115e59; }
.admin-allocation-method-options label:hover { background: #f1f5f9; }
.admin-allocation-method-options input { width: 1rem; height: 1rem; margin: 0; padding: 0; accent-color: #0f766e; }
.admin-allocation-method-picker .admin-allocation-indicator { width: 1.9rem; height: 1.9rem; flex-basis: 1.9rem; cursor: inherit; }

@media (forced-colors: active) {
    .admin-allocation-team-choice input { appearance: auto; }
    .admin-allocation-team-choice input:checked::after { display: none; }
}

@media (max-width: 480px) {
    .admin-allocation-team-row { grid-template-columns: minmax(0, 1fr); }
}

.admin-analytic-codes-table .admin-analytic-main-code-row td {
    background: #f5f8fa;
    font-weight: 800;
}

.admin-analytic-codes-table tr[data-tree-depth="1"] .admin-analytic-code-name {
    display: inline-block;
    padding-left: 1rem;
}

.admin-analytic-codes-table tr[data-tree-depth="2"] .admin-analytic-code-name,
.admin-analytic-codes-table tr[data-tree-depth="3"] .admin-analytic-code-name {
    display: inline-block;
    padding-left: 2rem;
}

.admin-inline-switch {
    position: relative;
    width: 2.35rem;
    height: 1.3rem;
    padding: 0;
    border: 1px solid #9aabb8;
    border-radius: 999px;
    background: #dce4e8;
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.admin-inline-switch span {
    position: absolute;
    top: 0.16rem;
    left: 0.18rem;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(20, 37, 48, 0.25);
    transition: transform 0.16s ease;
}

.admin-inline-switch.is-active {
    border-color: var(--primary);
    background: var(--primary);
}

.admin-inline-switch.is-active span {
    transform: translateX(1rem);
}

.admin-inline-switch:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.28);
    outline-offset: 2px;
}

.admin-inline-switch:disabled {
    cursor: wait;
    opacity: 0.65;
}

.admin-analytic-budget-value.is-editable {
    border-radius: 0.55rem;
    cursor: pointer;
    display: inline-flex;
    padding: 0.18rem 0.35rem;
    transition: background 0.16s ease, color 0.16s ease;
}

.admin-analytic-budget-value.is-editable:hover {
    background: rgba(20, 184, 166, 0.12);
    color: var(--primary);
}

.admin-analytic-budget-edit-input {
    max-width: 9rem;
}

.admin-danger-zone {
    align-items: center;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 1rem;
    padding: 1rem;
}

.admin-danger-zone h3 {
    margin: 0 0 0.25rem;
}

.admin-danger-zone p {
    color: var(--text-muted);
    margin: 0;
}

.admin-analytic-team-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.admin-analytic-team-label {
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.compact-button {
    min-height: 38px;
    padding: 0.55rem 0.8rem;
    white-space: nowrap;
}

.admin-users-table .table-cell-stack {
    gap: 0;
}

.admin-users-table .table-secondary-text {
    font-size: 0.82rem;
    line-height: 1.15;
}

.admin-users-table .role-badges {
    gap: 0.35rem;
    margin-bottom: 0;
}

.budget-overview-table th:nth-child(3),
.budget-overview-table th:nth-child(4),
.budget-overview-table th:nth-child(5),
.budget-overview-table th:nth-child(6),
.budget-overview-table td:nth-child(3),
.budget-overview-table td:nth-child(4),
.budget-overview-table td:nth-child(5),
.budget-overview-table td:nth-child(6) {
    white-space: nowrap;
}

th,
td {
    padding: 0.95rem 0.85rem;
    border-bottom: 1px solid #e7edf4;
    text-align: left;
    vertical-align: top;
}

thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: #425268;
    font-size: 0.84rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    z-index: 1;
}

tbody tr:hover {
    background: #fbfdff;
}

tbody tr.row-link:hover td:first-child a {
    text-decoration: underline;
}

tbody tr:last-child td {
    border-bottom: none;
}

.table-primary-link {
    font-weight: 700;
    color: #0f172a;
}

.progress-indicator {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.65rem;
    align-items: start;
}

.progress-indicator.compact {
    gap: 0.4rem;
}

.progress-step {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 0.35rem;
    text-align: center;
}

.progress-step::after {
    content: "";
    position: absolute;
    top: 0.75rem;
    left: calc(50% + 0.9rem);
    width: calc(100% - 1.1rem);
    height: 2px;
    background: var(--border-strong);
}

.progress-step:last-child::after {
    display: none;
}

.progress-step-bullet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 999px;
    border: 2px solid var(--border-strong);
    background: #ffffff;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
    z-index: 1;
}

.progress-step-label {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.25;
}

.progress-step.is-completed .progress-step-bullet,
.progress-step.is-active .progress-step-bullet {
    border-color: var(--primary);
    background: rgba(15, 118, 110, 0.12);
    color: var(--primary);
}

.progress-step.is-completed::after {
    background: rgba(15, 118, 110, 0.38);
}

.progress-step.is-completed .progress-step-label,
.progress-step.is-active .progress-step-label {
    color: var(--text-main);
}

.progress-step.outcome-rejected .progress-step-bullet {
    border-color: #fca5a5;
    background: var(--danger-bg);
    color: var(--danger-text);
}

.progress-step.outcome-returned .progress-step-bullet {
    border-color: #fdba74;
    background: #ffedd5;
    color: #9a3412;
}

.progress-cell {
    display: grid;
    gap: 0.45rem;
    min-width: 220px;
}

.progress-cell-summary {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.detail-progress-card {
    gap: 1rem;
}

.tabbed-detail-layout .layout-split {
    display: block;
}

.tabbed-detail-layout .section-stack {
    display: contents;
}

.detail-workspace-nav {
    position: sticky;
    top: 0.75rem;
    z-index: 10;
    gap: 1rem;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(238, 251, 247, 0.95));
}

.detail-workspace-nav .compact-header {
    margin-bottom: 0;
}

.detail-tab-list {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.detail-tab-button {
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: #f8fbff;
    color: var(--text-main);
    min-height: 46px;
    padding: 0.75rem 1rem;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.detail-tab-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.08);
}

.detail-tab-button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 14px 30px rgba(15, 118, 110, 0.18);
}

.reporting-toggle-row {
    display: flex;
    justify-content: flex-start;
}

.reporting-toggle-button {
    border-radius: 999px;
    font-weight: 800;
}

.ocr-raw-text-panel {
    width: 100%;
}

.ocr-raw-text-panel textarea {
    margin-top: 0.5rem;
    background: var(--surface-subtle, #f7f9fc);
}

.ocr-edit-table-wrapper {
    overflow-x: auto;
}

.ocr-edit-table {
    min-width: 760px;
}

.ocr-edit-table th {
    padding: 0.55rem 0.65rem;
    font-size: 0.76rem;
}

.ocr-edit-table td {
    padding: 0.38rem 0.65rem;
    vertical-align: middle;
}

.ocr-edit-table th:first-child,
.ocr-edit-table td:first-child {
    width: 5.75rem;
    text-align: center;
}

.ocr-edit-table th:nth-child(2),
.ocr-edit-table td:nth-child(2) {
    width: 13rem;
}

.ocr-edit-table .ocr-edit-input {
    width: 100%;
    min-width: 11rem;
    min-height: 36px;
    padding: 0.42rem 0.65rem;
}

.ocr-edit-table input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
}

.ocr-field-preview-button {
    width: 100%;
    padding: 0.35rem 0.45rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-main);
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.ocr-field-preview-button:hover,
.ocr-field-preview-button:focus-visible,
.ocr-field-preview-button.active {
    background: rgba(29, 78, 216, 0.09);
    color: var(--info);
    outline: none;
}

.ocr-field-preview-button:disabled {
    color: var(--text-muted);
    cursor: default;
    opacity: 0.75;
}

.ocr-edit-table tr.is-preview-active td {
    background: rgba(29, 78, 216, 0.045);
}

.reporting-sections {
    display: grid;
    gap: 1rem;
}

.table-secondary-text {
    color: var(--text-muted);
    font-size: 0.87rem;
}

.table-cell-stack {
    display: grid;
    gap: 0.25rem;
}

.admin-table-group-row td {
    background: var(--bg-muted);
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

.admin-table-group-title {
    color: var(--text-main);
}

.admin-table-subgroup-row td {
    background: #f8fbff;
    border-top: 1px solid var(--border-soft);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.admin-table-subgroup-title {
    color: var(--text-main);
    font-size: 0.95rem;
}

.admin-mode-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: var(--bg-muted);
    border: 1px solid var(--border-soft);
}

.admin-mode-title {
    font-size: 0.84rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.admin-mode-value {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-main);
}

.admin-actions-cell {
    min-width: 170px;
}

.admin-section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--border-soft) 20%, var(--border-soft) 80%, transparent 100%);
}

.admin-view-nav-card {
    display: grid;
    gap: 0.85rem;
}

.admin-subnav-card {
    display: grid;
    gap: 0.75rem;
    width: auto;
    max-width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.admin-subnav-card::before {
    display: none;
}

@keyframes adminSubnavReveal {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-subnav-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-subnav-header p {
    display: none;
}

.admin-view-nav-header {
    display: grid;
    justify-items: start;
    gap: 0.8rem;
}

.admin-domain-select-field {
    display: grid;
    gap: 0.35rem;
    width: min(100%, 420px);
}

.admin-domain-select-field span {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.admin-domain-select-field select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 0.75rem 2.6rem 0.75rem 1rem;
    background-color: #ffffff;
    color: var(--text-main);
    font-weight: 800;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.admin-view-nav-header p {
    display: none;
}

[data-admin-active-subview-note] {
    display: none;
}

.admin-view-nav-card > .admin-view-nav-header .eyebrow,
.admin-subnav-header {
    display: none;
}

.admin-view-nav {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.admin-view-button-source {
    display: none !important;
}

.table-toolbar {
    display: grid;
    gap: 0.75rem;
    margin: 0 0 1rem;
}

.admin-view-nav .button.is-active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: none;
    transform: translateY(-1px);
}

.admin-subnav .button {
    min-height: 42px;
    padding: 0.72rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
}

.admin-subnav .button:not(.is-active) {
    background: #f8fafc;
}

.admin-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    padding: 1rem;
    z-index: 60;
}

.admin-drawer-overlay[hidden] {
    display: none !important;
}

.admin-drawer {
    width: min(760px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    background: #ffffff;
    border: 1px solid var(--border-soft);
    border-radius: 28px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
}

.school-year-confirm-dialog {
    width: min(980px, calc(100vw - 2rem));
}

.school-year-confirm-dialog .admin-drawer-body {
    display: grid;
    gap: 0.9rem;
}

.school-year-confirm-dialog .admin-panel-note {
    font-size: 0.92rem;
    line-height: 1.45;
}

.school-year-confirm-table-wrapper {
    max-height: min(52vh, 520px);
}

.school-year-confirm-table-wrapper .budget-overview-table th,
.school-year-confirm-table-wrapper .budget-overview-table td {
    padding: 0.7rem 0.75rem;
    vertical-align: top;
}

.school-year-confirm-table-wrapper .admin-badge-row {
    gap: 0.28rem;
}

.school-year-confirm-table-wrapper .status-pill {
    min-height: 23px;
    padding: 0.18rem 0.48rem;
    font-size: 0.74rem;
    white-space: nowrap;
}

.school-year-confirm-row strong {
    display: inline-block;
    margin-bottom: 0.2rem;
}

.admin-drawer-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    background: linear-gradient(180deg, rgba(244, 250, 250, 0.95), #ffffff);
}

.admin-drawer-body {
    overflow: auto;
    padding: 1.25rem;
    background: #ffffff;
}

.admin-drawer-panel {
    box-shadow: none;
    border: 0;
    background: transparent;
    padding: 0;
}

body.drawer-open {
    overflow: hidden;
}

html.admin-preload-scope-organization .admin-section,
html.admin-preload-scope-organization .admin-subnav-card,
html.admin-preload-scope-organization [data-admin-view-button="all"],
html.admin-preload-scope-organization [data-admin-view-button="onboarding"] {
    display: none !important;
}

html.admin-preload-scope-organization.admin-preload-view-all #admin-overview-grid {
    display: grid !important;
}

html.admin-preload-scope-organization.admin-preload-view-organizations [data-admin-view-button="organizations"],
html.admin-preload-scope-organization [data-admin-view-button="users"],
html.admin-preload-scope-organization [data-admin-view-button="flows"],
html.admin-preload-scope-organization [data-admin-view-button="financial"] {
    display: inline-flex !important;
}

html.admin-preload-scope-organization.admin-preload-view-organizations .admin-subnav-card[data-admin-subnav-view="organizations"],
html.admin-preload-scope-organization.admin-preload-view-users .admin-subnav-card[data-admin-subnav-view="users"],
html.admin-preload-scope-organization.admin-preload-view-flows .admin-subnav-card[data-admin-subnav-view="flows"],
html.admin-preload-scope-organization.admin-preload-view-financial .admin-subnav-card[data-admin-subnav-view="financial"] {
    display: grid !important;
}

html.admin-preload-scope-organization.admin-preload-view-organizations.admin-preload-subview-organizations-teams .admin-section[data-admin-view="organizations"][data-admin-subview="teams"],
html.admin-preload-scope-organization.admin-preload-view-organizations.admin-preload-subview-organizations-audit .admin-section[data-admin-view="organizations"][data-admin-subview="audit"],
html.admin-preload-scope-organization.admin-preload-view-users.admin-preload-subview-users-users-list .admin-section[data-admin-view="users"][data-admin-subview="users-list"],
html.admin-preload-scope-organization.admin-preload-view-users.admin-preload-subview-users-roles .admin-section[data-admin-view="users"][data-admin-subview="roles"],
html.admin-preload-scope-organization.admin-preload-view-flows.admin-preload-subview-flows-definitions .admin-section[data-admin-view="flows"][data-admin-subview="definitions"],
html.admin-preload-scope-organization.admin-preload-view-flows.admin-preload-subview-flows-configs .admin-section[data-admin-view="flows"][data-admin-subview="configs"],
html.admin-preload-scope-organization.admin-preload-view-financial.admin-preload-subview-financial-categories .admin-section[data-admin-view="financial"][data-admin-subview="categories"],
html.admin-preload-scope-organization.admin-preload-view-financial.admin-preload-subview-financial-budgets .admin-section[data-admin-view="financial"][data-admin-subview="budgets"],
html.admin-preload-scope-organization.admin-preload-view-financial.admin-preload-subview-financial-analytic-codes .admin-section[data-admin-view="financial"][data-admin-subview="analytic-codes"],
html.admin-preload-scope-organization.admin-preload-view-financial.admin-preload-subview-financial-budget-lines .admin-section[data-admin-view="financial"][data-admin-subview="budget-lines"] {
    display: block !important;
}

.admin-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--bg-surface);
    overflow: hidden;
}

.admin-overview-summary {
    display: grid;
    gap: 0.3rem;
    align-content: start;
    min-width: 0;
    padding: 1rem 1.1rem;
    border-right: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
}

.admin-overview-summary:nth-child(2n) {
    border-right: 0;
}

.admin-overview-summary:nth-last-child(-n + 2) {
    border-bottom: 0;
}

.admin-overview-label {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.admin-overview-summary strong {
    font-size: 1rem;
    line-height: 1.3;
    color: var(--text-main);
}

@media (max-width: 720px) {
    .admin-overview-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-overview-summary {
        border-right: 0;
        border-bottom: 1px solid var(--border-soft);
    }

    .admin-overview-summary:nth-last-child(2) {
        border-bottom: 1px solid var(--border-soft);
    }

    .admin-overview-summary:last-child {
        border-bottom: 0;
    }
}

.worklist-table th,
.worklist-table td {
    white-space: nowrap;
}

.worklist-table td:last-child,
.worklist-table th:last-child {
    text-align: right;
}

.open-link-button {
    min-width: 110px;
}

.invoice-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.invoice-row-actions .button {
    white-space: nowrap;
}

.auth-shell {
    min-height: 100vh;
    align-content: center;
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 0.85fr);
    gap: 1.5rem;
    align-items: center;
}

.auth-panel {
    padding: 2rem;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 251, 255, 0.98) 100%);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

.auth-card {
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
}

.auth-brand-panel {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.14), transparent 34%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(239, 246, 255, 0.98) 100%);
}

.auth-brand-panel::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -40px;
    width: 160px;
    height: 160px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(15, 118, 110, 0.08), transparent 70%);
}

.auth-form-panel {
    position: relative;
    z-index: 1;
}

.auth-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    margin: 0;
}

.auth-copy {
    color: var(--text-muted);
    margin: 0.85rem 0 0;
    font-size: 1rem;
}

.auth-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.auth-list-item {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--border-soft);
}

.auth-list-item strong {
    display: block;
    margin-bottom: 0.25rem;
}

.auth-form-note {
    padding: 0.95rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: #f8fbff;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.login-meta-list {
    display: grid;
    gap: 0.9rem;
    margin-top: 1.5rem;
}

.login-meta-item {
    display: grid;
    gap: 0.25rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--border-soft);
}

.login-meta-item span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.content-intro {
    display: grid;
    gap: 0.45rem;
}

.content-intro p {
    margin: 0;
    color: var(--text-muted);
}

.panel-stack {
    display: grid;
    gap: 1.25rem;
}

@media (max-width: 1100px) {
    .app-layout {
        grid-template-columns: 13.75rem minmax(0, 1fr);
    }

    .workspace-split {
        grid-template-columns: 1fr;
    }

    .workspace-detail {
        position: static;
    }

    .site-header {
        grid-template-columns: 1fr;
        grid-template-areas:
            "brand"
            "nav"
            "session";
        justify-items: start;
        padding-inline: 1rem;
    }

    .user-session {
        justify-content: flex-start;
    }

    .user-meta {
        text-align: left;
    }

    .layout-split,
    .home-entry-grid,
    .detail-summary-grid,
    .admin-section-layout,
    .auth-layout {
        grid-template-columns: 1fr;
    }

    .ocr-review-workspace {
        grid-template-columns: 1fr;
    }

    .ocr-preview-panel {
        position: static;
    }

    .ocr-preview-canvas {
        height: auto;
        min-height: 0;
        max-height: 76vh;
    }

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

@media (max-width: 820px) {
    .app-header {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .app-header-context {
        display: none;
    }

    .app-user-session {
        justify-content: flex-start;
    }

    .app-layout {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
        height: auto;
        padding: 0.75rem 1rem;
        border-right: 0;
        border-bottom: 1px solid var(--border-soft);
        overflow-x: auto;
    }

    .app-sidebar-nav {
        display: flex;
        gap: 0.55rem;
        min-width: max-content;
    }

    .app-sidebar-nav a {
        min-width: 9.5rem;
    }

    .app-main {
        padding-inline: 1rem;
    }

    .container,
    .page-shell {
        width: min(100% - 1.25rem, 1320px);
    }

    .page-shell {
        padding-top: 1.2rem;
        padding-bottom: 1.5rem;
    }

    .toolbar-grid,
    .form-grid,
    .form-subgrid,
    .filters-row,
    .info-grid,
    .approval-step-meta,
    .worklist-meta-grid,
    .progress-indicator {
        grid-template-columns: 1fr;
    }

    .section-header,
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-table,
    table {
        min-width: 640px;
    }

    .site-header {
        gap: 0.75rem;
    }

    .top-nav {
        justify-content: flex-start;
        max-width: 100%;
        overflow-x: auto;
        padding-bottom: 0.15rem;
    }

    .user-session,
    .user-meta,
    .header-user-switcher,
    .superadmin-organization-switcher {
        width: 100%;
    }

    .context-select,
    .user-session .button {
        width: 100%;
    }

    .admin-drawer {
        width: min(100vw - 1rem, 100%);
        max-height: calc(100vh - 1rem);
        border-radius: 22px;
    }
}

/* The older contract and expense pages use a horizontal nav; expose it through
   the same temporary navigation drawer as the shared app shell. */
body.legacy-nav-collapsible .site-header {
    grid-template-columns: minmax(0, 1fr) minmax(240px, auto);
    grid-template-areas: "brand session";
}
body.legacy-nav-collapsible .brand-block {
    display: flex;
    align-items: center;
    gap: .75rem;
}
body.legacy-nav-collapsible .top-nav {
    position: fixed;
    z-index: 45;
    top: 4.25rem;
    left: .75rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .35rem;
    width: min(15.5rem, 85vw);
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    padding: .65rem;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: .65rem;
    box-shadow: 8px 0 24px rgba(15, 23, 42, .14);
    transform: translateX(calc(-100% - 1rem));
    visibility: hidden;
    transition: transform .18s ease, visibility 0s linear .18s;
}
body.legacy-nav-collapsible .top-nav.is-expanded {
    transform: translateX(0);
    visibility: visible;
    transition-delay: 0s;
}
body.legacy-nav-collapsible .top-nav a { border-radius: .4rem; }
@media (max-width: 1100px) {
    body.legacy-nav-collapsible .site-header {
        grid-template-columns: minmax(0, 1fr) minmax(240px, auto);
        grid-template-areas: "brand session";
    }
}
@media (max-width: 820px) {
    body.legacy-nav-collapsible .site-header {
        grid-template-columns: 1fr;
        grid-template-areas: "brand" "session";
    }
}

@media (min-width: 821px) and (max-width: 960px) {
    .app-brand-text small,
    .app-header-context,
    .app-header .app-user-session .user-meta,
    .header-user-switcher > label,
    .superadmin-organization-switcher > label {
        display: none !important;
    }
}

/* Purchase requests use the same calm master/detail hierarchy as invoice workspaces. */
.purchase-request-workspace {
    height: calc(100dvh - var(--app-header-height, 56px));
    min-height: 0;
    padding: 0;
}

.purchase-request-workspace-frame {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: #fff;
}

.purchase-request-list-pane,
.purchase-request-detail-pane {
    min-width: 0;
    min-height: 0;
}

.purchase-request-list-pane {
    display: flex;
    flex-direction: column;
}

.purchase-request-list-header,
.purchase-request-detail-header {
    padding: 1rem;
    border-bottom: 1px solid #d8e3e8;
    background: #fff;
}

.purchase-request-title-row,
.purchase-request-detail-title-row,
.purchase-request-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.purchase-request-title-row h1,
.purchase-request-detail-header h2,
.purchase-request-detail-section h3 {
    margin: 0;
}

.purchase-request-title-row h1,
.purchase-request-detail-header h2 {
    font-size: 1rem;
}

.purchase-request-toolbar {
    display: grid;
    grid-template-areas:
        "search search search create"
        "status team analytic analytic";
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: .5rem;
    margin-top: .8rem;
}

.purchase-request-toolbar #purchase-request-filter-search {
    grid-area: search;
}

.purchase-request-toolbar #purchase-request-filter-status {
    grid-area: status;
}

.purchase-request-toolbar #purchase-request-filter-team {
    grid-area: team;
}

.purchase-request-toolbar #purchase-request-filter-analytic-code {
    grid-area: analytic;
}

.purchase-request-toolbar #purchase-request-create-button {
    grid-area: create;
}

.purchase-request-toolbar input,
.purchase-request-toolbar select {
    min-width: 0;
    height: 2.35rem;
}

.purchase-request-list-feedback:empty,
.purchase-request-detail-feedback:empty,
.purchase-request-feedback:empty {
    display: none;
}

.purchase-request-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.purchase-request-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: .8rem 1rem;
    border: 0;
    border-bottom: 1px solid #e5ecef;
    border-left: 3px solid transparent;
    border-radius: 0;
    background: #fff;
    color: #172033;
    text-align: left;
    cursor: pointer;
}

.purchase-request-row:hover {
    background: #f3f8f8;
}

.purchase-request-row[aria-selected="true"] {
    border-left-color: #0b8077;
    background: #e4f3f1;
}

.purchase-request-row-main,
.purchase-request-row-meta,
.purchase-request-document-row span {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: .2rem;
}

.purchase-request-row-main strong,
.purchase-request-row-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.purchase-request-row small,
.purchase-request-document-row small {
    color: #607087;
}

.purchase-request-row-meta {
    align-items: flex-end;
}

.purchase-request-detail-pane {
    overflow-y: auto;
    border-left: 1px solid #cbd7e2;
    background: #fbfcfc;
}

.purchase-request-empty-state {
    display: grid;
    align-content: center;
    justify-items: center;
    min-height: 100%;
    padding: 2rem;
    color: #607087;
    text-align: center;
}

.purchase-request-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 3;
}

.purchase-request-detail-header p {
    margin: .3rem 0 0;
    color: #607087;
}

.purchase-request-create-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.purchase-request-summary,
.purchase-request-financial-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    margin: 0;
    padding: 1rem;
    background: #d8e3e8;
}

.purchase-request-summary > div,
.purchase-request-financial-summary > div {
    min-width: 0;
    padding: .7rem;
    background: #fff;
}

.purchase-request-summary dt,
.purchase-request-financial-summary span {
    color: #607087;
    font-size: .75rem;
    font-weight: 700;
}

.purchase-request-summary dd {
    margin: .2rem 0 0;
    font-weight: 700;
}

.purchase-request-detail-section {
    padding: 1rem;
    border-top: 1px solid #d8e3e8;
    background: #fff;
}

.purchase-request-detail-section h3 {
    margin-bottom: .75rem;
    font-size: .82rem;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.purchase-request-document-list,
.purchase-request-approval-row,
.purchase-request-linked-invoices {
    display: grid;
    gap: .5rem;
}

.purchase-request-document-row,
.purchase-request-approval-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem .75rem;
    border: 1px solid #d8e3e8;
    border-radius: .4rem;
    color: inherit;
    text-decoration: none;
}

.purchase-request-document-row:hover {
    border-color: #0b8077;
    background: #f3f8f8;
}

.purchase-request-row:focus-visible,
.purchase-request-document-row:focus-visible {
    outline: 3px solid rgba(11, 128, 119, .28);
    outline-offset: -3px;
}

@media (max-width: 1100px) {
    .purchase-request-summary,
    .purchase-request-financial-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .purchase-request-workspace {
        height: auto;
        min-height: calc(100dvh - var(--app-header-height, 56px));
    }

    .purchase-request-workspace-frame {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        overflow: visible;
    }

    .purchase-request-list {
        max-height: 36dvh;
    }

    .purchase-request-detail-pane {
        border-top: 1px solid #cbd7e2;
        border-left: 0;
    }

    .purchase-request-detail-header {
        position: static;
    }
}

@media (max-width: 820px) {
    .purchase-request-toolbar,
    .purchase-request-create-form,
    .purchase-request-summary,
    .purchase-request-financial-summary {
        grid-template-columns: minmax(0, 1fr);
    }

    .purchase-request-toolbar {
        grid-template-areas: "search" "status" "team" "analytic" "create";
    }

    .purchase-request-toolbar #purchase-request-create-button {
        justify-self: start;
    }
}

/* Rustige, taakgerichte directeurswerkruimte. */
.director-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% 12%, rgba(16, 135, 124, 0.09), transparent 28rem),
        #f4f7f8;
}

.director-header {
    min-height: 72px;
    padding: 0.8rem clamp(1rem, 4vw, 3rem);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid #d9e3e8;
    box-shadow: 0 8px 30px rgba(25, 47, 62, 0.06);
}

.director-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: #15273b;
    font-size: 1.2rem;
    font-weight: 900;
    text-decoration: none;
}

.director-brand-mark {
    display: grid;
    place-items: center;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 12px;
    color: white;
    background: #10877c;
}

.director-nav { display: flex; gap: 0.4rem; }
.director-nav a, .director-back {
    color: #43576a;
    text-decoration: none;
    font-weight: 750;
}
.director-nav a { padding: 0.6rem 0.8rem; border-radius: 10px; }
.director-nav a:hover { background: #edf7f5; color: #08766c; }
.director-session { display: flex; align-items: center; gap: 0.8rem; color: #637487; }

.director-shell { width: 100%; margin: 0; padding: 1.5rem 0 3rem; }
.app-main > .director-home { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }
.app-main-start {
    min-height: calc(100vh - 4.4rem);
    display: grid;
    place-items: center;
    padding: 1.5rem clamp(1rem, 3vw, 2.5rem);
    background:
        radial-gradient(circle at 50% 43%, rgba(15, 118, 110, 0.08), transparent 22rem),
        linear-gradient(135deg, #eaf4f5 0%, #f7fafb 48%, #eef5f7 100%);
}
.director-home { min-height: calc(100vh - 74px); display: grid; align-content: center; }
.director-welcome { text-align: center; margin-bottom: 2.2rem; }
.director-welcome h1 { margin: 0.45rem 0; font-size: clamp(1.9rem, 4vw, 3.2rem); color: #14283d; }
.director-welcome p { color: #66788b; }

.director-tile-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 263px));
    justify-content: center;
    gap: 1.1rem;
}
.director-tile {
    position: relative;
    min-height: 224px;
    padding: 1.45rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #15273b;
    text-decoration: none;
    background: white;
    border: 1px solid #d7e2e8;
    border-radius: 24px;
    box-shadow: 0 18px 50px rgba(22, 49, 65, 0.08);
    transition: transform 180ms ease, box-shadow 180ms ease;
}
.director-tile:hover { transform: translateY(-5px); box-shadow: 0 24px 60px rgba(22, 49, 65, 0.14); }
.director-tile-icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 15px; background: #e4f5f2; color: #08766c; font-weight: 900; }
.director-tile strong { display: block; margin: 1.1rem 0 0.25rem; font-size: 1.45rem; }
.director-tile small { display: block; color: #66788b; line-height: 1.45; }
.director-tile-metrics { display: flex; align-items: baseline; gap: 0.45rem; padding-top: 1rem; border-top: 1px solid #e6edf0; color: #52677a; }
.director-tile-metrics b { font-size: 1.6rem; color: #15273b; }
.director-tile-metrics i { margin-left: auto; color: #08766c; font-style: normal; font-weight: 800; }

.director-page-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.5rem; }
.director-page-heading h1 { margin: 0.4rem 0; color: #14283d; font-size: 2.15rem; }
.director-page-heading p { margin: 0; color: #66788b; }
.director-readonly { padding: 0.55rem 0.8rem; border-radius: 99px; background: #e8eef2; color: #52677a; font-weight: 800; }
.director-action-panel { margin-bottom: 1.25rem; padding: 1.2rem 1.35rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-radius: 18px; background: #fff8dd; border: 1px solid #f1d985; }
.director-action-panel h2 { margin: 0.25rem 0 0; font-size: 1.15rem; }
.director-list-card { overflow: hidden; background: white; border: 1px solid #d8e3e8; border-radius: 20px; box-shadow: 0 16px 42px rgba(22, 49, 65, 0.06); }
.director-list-heading { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.25rem; border-bottom: 1px solid #e2eaee; }
.director-list-heading h2 { margin: 0; font-size: 1.15rem; }
.director-list-heading span { color: #68798a; }
.director-list-row { padding: 1rem 1.25rem; display: grid; grid-template-columns: minmax(220px, 1.6fr) 1fr 0.7fr auto; align-items: center; gap: 1rem; color: #17293d; text-decoration: none; border-bottom: 1px solid #e7edf0; }
.director-list-row:hover { background: #f3f9f8; }
.director-list-row small { display: block; margin-bottom: 0.2rem; color: #708191; }
.director-empty { padding: 2.5rem; text-align: center; color: #6b7d8d; background: white; border-radius: 18px; }
.director-detail-grid { margin-bottom: 1rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.director-detail-grid article { min-height: 105px; padding: 1rem; background: white; border: 1px solid #d8e3e8; border-radius: 16px; }
.director-detail-grid small, .director-approval-list small { display: block; margin-bottom: 0.35rem; color: #708191; }
.director-detail-section { margin-top: 1rem; }
.director-document-list { padding: 1rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.director-approval-list > div { padding: 0.9rem 1.1rem; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.8rem; border-bottom: 1px solid #e5ecef; }
.approval-order { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: #e6f4f2; color: #08766c; font-weight: 900; }
.director-modal {
    width: min(720px, calc(100% - 2rem));
    padding: 0;
    color: #17293d;
    background: white;
    border: 1px solid #d5e1e7;
    border-radius: 22px;
    box-shadow: 0 32px 90px rgba(17, 39, 54, 0.28);
}
.director-modal::backdrop { background: rgba(15, 34, 48, 0.48); backdrop-filter: blur(3px); }
.director-modal-header { padding: 1.25rem 1.4rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e1e9ed; }
.director-modal-header h2 { margin: 0.3rem 0 0; }
.director-modal-close { width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; color: #405467; background: #eef3f5; font-size: 1.6rem; cursor: pointer; }
.director-upload-form { padding: 1.35rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.director-upload-form label { color: #405467; font-weight: 800; }
.director-upload-form select, .director-upload-form input { width: 100%; margin-top: 0.4rem; }
.director-upload-file, .director-upload-form .feedback, .director-modal-actions { grid-column: 1 / -1; }
.director-upload-file small { display: block; margin-top: 0.35rem; color: #748493; font-weight: 400; }
.director-modal-actions { display: flex; justify-content: flex-end; gap: 0.65rem; }

.director-filterbar { margin-bottom: 1rem; padding: 1rem; display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr 1.2fr auto; align-items: end; gap: 0.75rem; background: white; border: 1px solid #d8e3e8; border-radius: 18px; }
.director-filterbar label { color: #43576a; font-size: 0.8rem; font-weight: 800; }
.director-filterbar select, .director-filterbar input { width: 100%; margin-top: 0.35rem; }
.director-budget-totals { margin-bottom: 1rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.director-budget-totals article,
.director-budget-kpi { height: auto; align-self: start; padding: 1rem 1.15rem; background: white; border: 1px solid #d8e3e8; border-radius: 16px; }
.director-budget-kpi {
    position: relative;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

/* OCR workspace redesign: scoped to the review worklist and OCR detail mode. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ocr-review-page .app-main,
.ocr-workspace-mode .app-main {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.ocr-review-page .app-layout,
.ocr-workspace-mode .app-layout {
    height: calc(100dvh - 2.35rem);
    min-height: 0;
}

.ocr-worklist-workspace {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #fff;
}

.ocr-worklist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem 0.85rem;
    border-bottom: 1px solid #d7e1e7;
}

.ocr-worklist-heading-row {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
}

.ocr-worklist-heading-row h1 {
    margin: 0;
    font-size: 1.3rem;
}

.ocr-worklist-header p,
.ocr-worklist-count {
    margin: 0.2rem 0 0;
    color: #64748b;
    font-size: 0.83rem;
}

.ocr-worklist-feedback {
    margin: 0 1.25rem;
}

.ocr-worklist-table-region,
.ocr-worklist-table-scroll {
    min-height: 0;
}

.ocr-worklist-table-region {
    flex: 1;
    overflow: hidden;
}

.ocr-worklist-table-scroll {
    height: 100%;
    overflow: auto;
}

.ocr-worklist-table {
    width: 100%;
    margin: 0;
}

.ocr-worklist-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f4f7f9;
    box-shadow: 0 1px 0 #d7e1e7;
}

.ocr-worklist-table th,
.ocr-worklist-table td {
    padding: 0.65rem 0.8rem;
    vertical-align: middle;
}

.ocr-worklist-table tbody tr:hover {
    background: #f7fbfa;
}

.ocr-worklist-table .numeric-column {
    text-align: right;
    white-space: nowrap;
}

.ocr-worklist-table .open-link-button {
    white-space: nowrap;
}

.ocr-workspace-mode .detail-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    padding: 0;
    gap: 0;
    overflow: hidden;
}

.ocr-workspace-mode .detail-hero,
.ocr-workspace-mode .detail-workspace-nav,
.ocr-workspace-mode .layout-split > .section-stack:first-child {
    display: none;
}

.ocr-workspace-mode #detail-feedback:empty {
    display: none;
}

.ocr-workspace-mode #detail-feedback:not(:empty) {
    margin: 0.5rem 0.75rem 0;
}

.ocr-workspace-mode .layout-split,
.ocr-workspace-mode .layout-split > .section-stack:last-child {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.ocr-workspace-mode .layout-split {
    align-items: stretch;
    overflow: hidden;
}

.ocr-workspace-mode .layout-split > .section-stack:last-child {
    overflow: hidden;
}

.ocr-workspace-panel {
    min-width: 0;
}

.ocr-workspace-mode .ocr-workspace-panel {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

.ocr-workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #d7e1e7;
}

.ocr-workspace-heading h1,
.ocr-workspace-heading h2,
.ocr-document-header h2 {
    margin: 0;
}

.ocr-workspace-heading h1,
.ocr-workspace-heading h2 {
    font-size: 1.2rem;
}

.ocr-workspace-heading p {
    margin: 0.15rem 0 0;
    color: #64748b;
    font-size: 0.82rem;
}

.ocr-workspace-actions,
.ocr-document-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.ocr-context-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
    border-bottom: 1px solid #d7e1e7;
    background: #f8fafb;
}

.ocr-context-strip > div {
    min-width: 0;
    padding: 0.55rem 0.8rem;
    border-right: 1px solid #e2e8ec;
}

.ocr-context-strip > div:last-child {
    border-right: 0;
}

.ocr-context-strip dt {
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ocr-context-strip dd {
    margin: 0.15rem 0 0;
    overflow: hidden;
    font-size: 0.82rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ocr-workspace-panel > #ocr-feedback,
.ocr-workspace-panel > #ocr-role-note {
    margin: 0 1rem;
}

.ocr-workspace-panel > #ocr-feedback:empty {
    display: none;
}

.ocr-workspace-panel .ocr-review-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    flex: 1;
    gap: 0;
    align-items: stretch;
    min-height: 0;
    margin: 0;
}

.ocr-workspace-panel .ocr-review-editor {
    min-width: 0;
    min-height: 0;
    padding: 0.75rem 1rem 1rem;
    overflow: auto;
    border-right: 1px solid #cbd7e2;
}

.ocr-workspace-panel .ocr-layout {
    display: grid;
    gap: 0.55rem;
}

.ocr-workspace-mode .ocr-summary-panel,
.ocr-workspace-mode .ocr-confidence-panel,
.ocr-workspace-mode .ocr-warning-panel,
.ocr-workspace-mode .apply-panel,
.ocr-workspace-mode .ocr-review-editor .card-subsection {
    border-radius: 0;
    box-shadow: none;
}

.ocr-workspace-mode .ocr-summary-panel,
.ocr-workspace-mode .ocr-review-editor .card-subsection {
    padding: 0.65rem 0.75rem;
}

.ocr-workspace-mode .ocr-quality-summary-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.2rem 0.65rem;
}

.ocr-workspace-mode .ocr-quality-primary {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex-wrap: wrap;
    color: #334155;
    font-size: 0.83rem;
    font-weight: 650;
}

.ocr-workspace-mode .ocr-quality-primary[hidden],
.ocr-workspace-mode .ocr-quality-secondary[hidden] {
    display: none;
}

.ocr-workspace-mode .ocr-quality-document-type {
    color: #0f172a;
    font-weight: 800;
}

.ocr-workspace-mode .ocr-quality-semantic.warning,
.ocr-workspace-mode .ocr-quality-semantic.conflict {
    color: #92400e;
}

.ocr-workspace-mode .ocr-quality-separator,
.ocr-workspace-mode .ocr-quality-secondary {
    color: #64748b;
}

.ocr-workspace-mode .ocr-quality-secondary {
    min-width: 0;
    font-size: 0.78rem;
}

.ocr-workspace-mode .ocr-quality-details-toggle {
    min-height: auto;
    padding: 0.12rem 0.35rem;
    font-size: 0.75rem;
}

.ocr-workspace-mode .ocr-quality-details {
    display: grid;
    grid-column: 1 / -1;
    gap: 0.15rem;
    margin: 0.2rem 0 0;
    padding: 0.35rem 0 0 1.05rem;
    border-top: 1px solid #dce5ea;
    color: #475569;
    font-size: 0.76rem;
    line-height: 1.35;
}

.ocr-workspace-mode .ocr-quality-details[hidden] {
    display: none;
}

.ocr-workspace-mode .apply-panel {
    margin-top: 0.65rem;
    padding: 0;
    border: 0;
}

.ocr-workspace-mode .apply-panel > .section-header {
    margin-bottom: 0.45rem;
}

.ocr-workspace-mode .apply-panel .section-copy p,
.ocr-workspace-mode .ocr-review-editor .card-subsection .section-copy p {
    display: none;
}

.ocr-workspace-mode .ocr-apply-table th,
.ocr-workspace-mode .ocr-apply-table td {
    padding: 0.45rem 0.5rem;
}

.ocr-preview-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #eef3f5;
    overflow: hidden;
}

.ocr-workspace-mode .ocr-preview-panel {
    position: static;
    top: auto;
    height: 100%;
}

.ocr-document-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 2.9rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #cbd7e2;
    background: #fff;
}

.ocr-document-header h2 {
    font-size: 0.95rem;
}

.ocr-document-frame {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 0;
    background: #eef3f5;
}

.ocr-highlight-view {
    flex: 1;
    min-height: 0;
    padding: 0.65rem;
    background: #eef3f5;
    overflow: auto;
}

.ocr-preview-pages {
    display: grid;
    gap: 0.75rem;
    width: 100%;
}

.ocr-preview-page {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.ocr-preview-page img {
    display: block;
    width: 100%;
    height: auto;
}

.ocr-document-empty {
    display: grid;
    flex: 1;
    place-items: center;
    min-height: 12rem;
    color: #64748b;
}

.ocr-preview-page .ocr-preview-overlay {
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

.ocr-preview-page .ocr-preview-box {
    border: 1.5px solid #0f766e;
    border-radius: 2px;
    background: rgba(15, 118, 110, 0.13);
    box-shadow: none;
}

.ocr-preview-page .ocr-preview-box.is-low-confidence {
    border-color: #b45309;
    background: rgba(245, 158, 11, 0.14);
}

.ocr-preview-page .ocr-preview-box.is-active {
    border-width: 2px;
    background: rgba(15, 118, 110, 0.22);
}

.ocr-workspace-mode .director-pdf-modal {
    padding: 0;
    border: 1px solid #cbd7e2;
}

.ocr-workspace-mode .director-pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #d7e1e7;
}

.ocr-workspace-mode .director-pdf-modal-header h2 {
    margin: 0;
    font-size: 1rem;
}

@media (max-width: 1050px) {
    .ocr-review-page .app-main,
    .ocr-workspace-mode .app-main {
        overflow: auto;
    }

    .ocr-workspace-mode .detail-shell {
        height: auto;
        overflow: visible;
    }

    .ocr-workspace-panel .ocr-review-workspace {
        grid-template-columns: 1fr;
    }

    .ocr-workspace-panel .ocr-review-editor {
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid #cbd7e2;
    }

    .ocr-preview-panel {
        min-height: 70vh;
    }
}

@media (max-width: 720px) {
    .ocr-worklist-header,
    .ocr-workspace-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .ocr-context-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ocr-context-strip > div:nth-child(2) {
        border-right: 0;
    }

    .ocr-context-strip > div:nth-child(-n + 2) {
        border-bottom: 1px solid #e2e8ec;
    }

    .ocr-workspace-actions {
        flex-wrap: wrap;
    }
}
.director-budget-kpi:hover {
    border-color: #a9c7c2;
    background: #f6fbfa;
}
.director-budget-kpi.is-active {
    border-color: rgba(15, 118, 110, 0.78);
    background: linear-gradient(180deg, #edf8f6 0%, #ffffff 100%);
    box-shadow: inset 0 3px 0 #0f766e, 0 0 0 1px rgba(15, 118, 110, 0.12);
}
.director-budget-kpi.is-active small {
    color: #0f766e;
}
.director-budget-kpi:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.42);
    outline-offset: 3px;
}

.director-budget-shell {
    height: calc(100vh - 2.35rem);
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    overflow: hidden;
}

.director-module-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) minmax(180px, 240px);
    gap: 0.75rem;
    align-items: end;
    padding: 0.85rem 1rem;
    border: 1px solid #d8e3e8;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
}

.director-module-toolbar label {
    display: grid;
    gap: 0.35rem;
    color: #405467;
    font-size: 0.8rem;
    font-weight: 850;
}

.director-module-toolbar input,
.director-module-toolbar select {
    min-height: 2.55rem;
}

.approval-module-toolbar {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.director-master-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.85fr);
    gap: 1rem;
    align-items: start;
}

.director-compact-list .director-list-row {
    grid-template-columns: minmax(180px, 1.45fr) minmax(170px, 1fr) minmax(110px, 0.65fr) auto;
    min-height: 3.8rem;
    padding: 0.72rem 1rem;
}

.director-data-grid {
    display: grid;
    align-content: start;
}

.director-data-grid-head,
.director-data-grid .director-list-row {
    display: grid;
    grid-template-columns: minmax(9.5rem, 1fr) minmax(11rem, 1.15fr) minmax(10rem, 1fr) minmax(7rem, 0.6fr) minmax(8rem, 0.72fr);
    align-items: center;
}

.director-data-grid-head {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 2.25rem;
    padding: 0.35rem 0.65rem;
    gap: 0.55rem;
    color: #475569;
    background: #f8fafc;
    border-bottom: 1px solid #d8e3e8;
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.director-data-grid-head span:nth-child(4),
.director-data-grid .director-list-row > span:nth-child(4) {
    text-align: right;
}

.director-data-grid .director-list-row {
    border-radius: 0;
}

.director-master-row {
    cursor: pointer;
}

.director-master-row.is-selected,
.director-master-row:focus-visible {
    background: #e9f6f4;
    box-shadow: inset 4px 0 0 var(--primary);
}

.director-detail-pane {
    position: sticky;
    top: 4.4rem;
    min-height: 22rem;
    padding: 1.05rem;
    border: 1px solid #d8e3e8;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: var(--shadow-card-light);
}

.director-detail-pane-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: start;
    padding-bottom: 0.85rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid #e3ebf1;
}

.director-detail-pane h2 {
    margin: 0.25rem 0 0;
}

.director-detail-list {
    display: grid;
    gap: 0.55rem;
    margin: 0 0 1rem;
}

.director-detail-list div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.62rem 0;
    border-bottom: 1px solid #edf2f6;
}

.director-detail-list dt {
    color: #65768a;
    font-size: 0.82rem;
    font-weight: 780;
}

.director-detail-list dd {
    margin: 0;
    text-align: right;
    font-weight: 760;
}

.director-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.director-preview-placeholder {
    margin: 0.85rem 0;
    padding: 0.85rem;
    border: 1px dashed #cbd7e2;
    border-radius: 14px;
    color: #62758a;
    background: #f8fafc;
}

.director-budget-table-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #d8e3e8;
    border-radius: 16px;
    background: #ffffff;
}

.director-budget-table-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
}

.compact-financial-table table {
    min-width: 860px;
}

.director-budget-table-wrapper thead th {
    z-index: 4;
    background: #f8fafc;
    background-clip: padding-box;
    box-shadow: inset 0 -1px 0 var(--border), 0 0.45rem 0.75rem rgba(248, 250, 252, 0.96);
}

.compact-financial-table th,
.compact-financial-table td {
    padding: 0.66rem 0.8rem;
}

.compact-financial-table td:nth-child(n+3),
.compact-financial-table th:nth-child(n+3) {
    text-align: right;
}

.compact-financial-table td:first-child,
.compact-financial-table th:first-child,
.compact-financial-table td:nth-child(2),
.compact-financial-table th:nth-child(2),
.compact-financial-table td:last-child,
.compact-financial-table th:last-child {
    text-align: left;
}

.budget-group-row {
    background: #f2f6f9;
    font-weight: 900;
}

.budget-leaf-row:hover {
    background: #f8fbfb;
}

.budget-leaf-row td:first-child {
    padding-left: 1.65rem;
}

.budget-inline-drill summary {
    cursor: pointer;
    list-style-position: inside;
}

.budget-inline-drill summary:hover {
    color: var(--primary);
}

.budget-inline-invoices {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.55rem;
    padding: 0.6rem;
    border: 1px solid #dbe5ee;
    border-radius: 12px;
    background: #f8fafc;
}

.budget-inline-invoices a {
    display: grid;
    grid-template-columns: 5.8rem minmax(120px, 1fr) minmax(90px, 0.8fr) auto;
    gap: 0.6rem;
    color: #24384f;
}

.budget-inline-invoices a:hover {
    color: var(--primary);
}

.budget-inline-invoices p {
    margin: 0;
    color: #68798b;
}

.compact-section-title {
    margin-bottom: 0.7rem;
    color: #0f766e;
    font-size: 0.78rem;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.approval-task-table-wrapper {
    overflow-x: auto;
    border: 1px solid #d8e3e8;
    border-radius: 14px;
    background: #ffffff;
}

.approval-task-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.approval-task-table th,
.approval-task-table td {
    padding: 0.72rem 0.8rem;
    border-bottom: 1px solid #e4ebf2;
    vertical-align: top;
    text-align: left;
}

.approval-task-table th {
    color: #33475f;
    background: #f7fafc;
    font-size: 0.74rem;
    font-weight: 950;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.approval-task-table tr:last-child td {
    border-bottom: 0;
}

.approval-task-table textarea {
    min-height: 2.4rem;
    resize: vertical;
}

.approval-table-actions {
    display: grid;
    gap: 0.45rem;
    min-width: 230px;
}

.approval-table-actions > div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.approval-table-actions .button {
    min-height: 2.25rem;
    padding: 0.5rem 0.75rem;
}

/* KOVA app-shell: console-style workspace */
.app-sidebar {
    width: 15.5rem;
    padding: 0.85rem 0;
    background: #ffffff;
}

.app-sidebar-nav {
    gap: 0.1rem;
}

.app-sidebar-nav a {
    min-height: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.05rem;
    margin: 0;
    padding: 0.68rem 1rem 0.68rem 1.15rem;
    border: 0;
    border-left: 4px solid transparent;
    border-radius: 0;
    box-shadow: none;
}

.app-sidebar-nav a span {
    font-size: 0.95rem;
    font-weight: 820;
}

.app-sidebar-nav a small {
    font-size: 0.72rem;
}

.app-sidebar-nav a:hover {
    background: #f3f8f7;
    border-left-color: rgba(15, 118, 110, 0.35);
}

.app-sidebar-nav a:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.45);
    outline-offset: -2px;
    background: #f3f8f7;
}

.app-sidebar-nav a.active {
    background: #e9f6f4;
    border-left-color: var(--primary);
    color: #0f2f3f;
    box-shadow: none;
}

.app-sidebar-nav a.active small {
    color: #51706d;
}

.app-sidebar-context-label {
    margin: 0.25rem 1.15rem 0.55rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.admin-sidebar-nav {
    align-content: start;
}

.admin-sidebar-nav .admin-sidebar-return {
    min-height: 2.65rem;
    margin-bottom: 0.35rem;
}

.admin-sidebar-domain {
    display: grid;
}

.admin-sidebar-domain-toggle,
.admin-sidebar-direct,
.admin-sidebar-children button {
    width: 100%;
    border: 0;
    border-left: 4px solid transparent;
    border-radius: 0;
    color: var(--text-main);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.admin-sidebar-domain-toggle,
.admin-sidebar-direct {
    min-height: 3rem;
    padding: 0.68rem 0.85rem 0.68rem 1.15rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
}

.admin-sidebar-domain-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.admin-sidebar-domain-toggle:hover,
.admin-sidebar-direct:hover,
.admin-sidebar-children button:hover {
    border-left-color: rgba(15, 118, 110, 0.35);
    background: #f3f8f7;
}

.admin-sidebar-domain-toggle:focus-visible,
.admin-sidebar-direct:focus-visible,
.admin-sidebar-children button:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.45);
    outline-offset: -2px;
}

.admin-sidebar-domain-toggle.is-active,
.admin-sidebar-direct.is-active {
    border-left-color: rgba(15, 118, 110, 0.45);
    background: #f3f8f7;
}

.admin-sidebar-domain-toggle[aria-expanded="true"] .admin-sidebar-chevron {
    transform: rotate(90deg);
}

.admin-sidebar-chevron {
    flex: 0 0 auto;
    transition: transform 140ms ease;
}

.admin-sidebar-children {
    display: grid;
    gap: 0;
    padding: 0 0 0.25rem;
}

.admin-sidebar-children[hidden] {
    display: none;
}

.admin-sidebar-children button {
    min-height: 2.35rem;
    padding: 0.48rem 0.8rem 0.48rem 2rem;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 680;
}

.admin-sidebar-children button.is-active {
    border-left-color: var(--primary);
    color: #0f2f3f;
    background: #e9f6f4;
    font-weight: 820;
}

.app-layout {
    grid-template-columns: 15.5rem minmax(0, 1fr);
}

.app-main {
    padding: 1.25rem clamp(1.15rem, 2.4vw, 2.4rem) 2.5rem;
}

.app-main > .page-shell,
.app-main > .director-shell,
.workspace-module {
    width: 100%;
    max-width: none;
}

.workspace-module {
    display: grid;
    gap: 1rem;
}

.workspace-module > .workspace-header,
.workspace-module > .director-page-heading {
    margin-bottom: 0.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(216, 224, 234, 0.9);
}

.workspace-table-panel,
.director-list-card.workspace-table-panel {
    width: 100%;
    border-radius: 0;
    border-inline: 0;
    box-shadow: none;
    background: transparent;
}

.workspace-table-panel .director-list-heading,
.director-list-card.workspace-table-panel .director-list-heading {
    padding-inline: 0;
    background: transparent;
}

.director-list-card.workspace-table-panel .director-list {
    overflow: hidden;
    border: 1px solid #d8e3e8;
    border-radius: 14px;
    background: #ffffff;
}

.director-list-card.workspace-table-panel .director-list-row {
    padding: 0.78rem 1rem;
    min-height: 4.2rem;
}

.compact-workspace-section {
    padding: 1rem 0;
    border-top: 1px solid rgba(216, 224, 234, 0.9);
}

.compact-workspace-section .section-header {
    padding-inline: 0;
}

.worklist-shell .worklist-grid,
.worklist-shell .role-summary-grid {
    width: 100%;
}

.director-budget-shell .director-filterbar {
    border-radius: 12px;
    box-shadow: none;
}

.director-budget-shell .director-budget-group {
    border-radius: 12px;
}

@media (max-width: 1100px) {
    .app-layout {
        grid-template-columns: 13.75rem minmax(0, 1fr);
    }

    .app-sidebar {
        width: 13.75rem;
    }

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

    .director-master-detail {
        grid-template-columns: 1fr;
    }

    .director-detail-pane {
        position: static;
    }

    .approval-module-toolbar,
    .director-module-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .app-sidebar {
        width: auto;
        padding: 0.5rem 0.75rem;
    }

    .app-sidebar-nav {
        flex-direction: row;
    }

    .app-sidebar-nav a {
        min-width: 9rem;
        border-left: 0;
        border-bottom: 3px solid transparent;
        border-radius: 0.6rem;
        padding: 0.65rem 0.8rem;
    }

    .app-sidebar-nav a.active {
        border-bottom-color: var(--primary);
    }

    .director-tile-grid {
        grid-template-columns: 1fr;
    }

    .director-list-card.workspace-table-panel .director-list-row {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .approval-module-toolbar,
    .director-module-toolbar {
        grid-template-columns: 1fr;
    }
}
.director-budget-totals small { display: block; color: #718291; }
.director-budget-totals strong { display: block; margin-top: 0.3rem; font-size: 1.25rem; }
.director-budget-groups { display: grid; gap: 0.7rem; }
.director-budget-group { overflow: hidden; background: white; border: 1px solid #d8e3e8; border-radius: 17px; }
.director-budget-group[data-warning="true"] { border-left: 5px solid #df9d13; }
.director-budget-group > summary { padding: 1rem 1.15rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; cursor: pointer; list-style-position: inside; }
.director-budget-group > summary small { display: block; margin: 0.2rem 0 0 1.25rem; color: #6c7d8d; }
.director-budget-table { border-top: 1px solid #e1e9ed; }
.budget-row { padding: 0.8rem 1rem; display: grid; grid-template-columns: minmax(230px, 1.5fr) repeat(4, minmax(100px, 0.7fr)); gap: 0.75rem; align-items: center; }
.budget-head { background: #f5f8fa; color: #5c6f80; font-size: 0.76rem; font-weight: 900; text-transform: uppercase; }
.budget-child { border-top: 1px solid #e7edf0; }
.budget-child > summary { cursor: pointer; list-style-position: inside; }
.budget-invoices { padding: 0 1rem 0.8rem 2rem; background: #f8fafb; }
.budget-invoices a { padding: 0.7rem 0.4rem; display: grid; grid-template-columns: 100px 1fr 1fr 1fr auto; gap: 0.7rem; color: #263b4e; text-decoration: none; border-bottom: 1px solid #e0e7eb; }
.budget-invoices a:hover { color: #08766c; }
.director-upload-shell .dashboard-grid,
.director-upload-shell .reporting-section,
.director-upload-shell [data-reporting-section] { display: none !important; }

@media (max-width: 900px) {
    .director-header { grid-template-columns: 1fr auto; gap: 0.75rem; }
    .director-nav { grid-column: 1 / -1; order: 3; overflow-x: auto; }
    .director-session #current-user-label { display: none; }
    .director-tile-grid { grid-template-columns: 1fr; }
    .director-tile { min-height: 185px; }
    .director-list-row { grid-template-columns: 1fr 1fr; }
    .director-detail-grid { grid-template-columns: repeat(2, 1fr); }
    .director-filterbar { grid-template-columns: repeat(2, 1fr); }
    .director-budget-totals { grid-template-columns: repeat(2, 1fr); }
    .budget-row { min-width: 760px; }
    .director-budget-table { overflow-x: auto; }
}

@media (max-width: 560px) {
    .director-page-heading, .director-action-panel { align-items: stretch; flex-direction: column; }
    .director-list-row { grid-template-columns: 1fr; }
    .director-detail-grid { grid-template-columns: 1fr; }
    .director-filterbar, .director-budget-totals { grid-template-columns: 1fr; }
    .director-upload-form { grid-template-columns: 1fr; }
}

/* Director console density pass: compact SaaS workspaces */
.app-header {
    min-height: 2.35rem;
    height: 2.35rem;
    padding: 0.12rem clamp(0.55rem, 0.9vw, 0.8rem);
    grid-template-columns: minmax(12rem, auto) minmax(0, 1fr) auto;
    gap: 0.7rem;
    align-items: center;
}

.app-brand {
    gap: 0.55rem;
}

.app-brand-text {
    display: flex;
    align-items: baseline;
    gap: 0.34rem;
}

.app-brand-text small::before {
    content: "\2014";
    margin-right: 0.34rem;
    color: #8ba0b2;
}

.app-brand-mark {
    width: 1.42rem;
    height: 1.42rem;
    border-radius: 0.44rem;
    font-size: 0.76rem;
}

.app-brand-text strong {
    font-size: 1rem;
}

.app-brand-text small,
.app-header-context {
    font-size: 0.72rem;
}

.app-user-session {
    grid-area: auto;
    grid-column: 3;
    grid-row: 1;
    gap: 0.5rem;
    align-items: center;
    align-self: center;
    justify-content: flex-end;
    height: 100%;
    flex-wrap: nowrap;
}

.app-user-session .user-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    line-height: 1;
    margin: 0;
    text-align: right;
}

.app-user-session .header-user-avatar {
    width: 1.65rem;
    height: 1.65rem;
    font-size: 0.74rem;
    flex: 0 0 1.65rem;
    box-shadow: none;
}

.app-user-session #current-user-roles {
    display: none;
}

.app-user-session .button {
    min-height: 1.72rem;
    padding: 0.26rem 0.58rem;
    margin: 0;
}

.app-user-session form {
    display: flex;
    align-items: center;
    margin: 0;
}

.app-layout {
    min-height: calc(100vh - 2.35rem);
}

.app-sidebar {
    top: 2.35rem;
    height: calc(100vh - 2.35rem);
}

.app-main {
    width: 100%;
    padding: 0;
    background: #ffffff;
}

.app-main > .page-shell,
.app-main > .director-shell,
.workspace-module,
.director-console-module {
    width: 100%;
    max-width: none;
    margin-inline: 0;
}

.director-shell {
    padding: 0;
}

.workspace-module {
    gap: 0;
}

.director-compact-heading,
.workspace-module > .director-compact-heading {
    margin: 0;
    padding: 0 0 0.35rem;
    border-bottom: 0;
    align-items: center;
}

.director-compact-heading h1 {
    margin: 0;
    font-size: 1.24rem;
    letter-spacing: -0.02em;
}

.director-compact-heading p {
    margin-top: 0.15rem;
    font-size: 0.8rem;
}

.director-action-panel {
    margin: 0;
    padding: 0.72rem 0.85rem;
    border-radius: 12px;
}

.director-action-panel h2 {
    font-size: 0.98rem;
}

.director-workspace-toolbar {
    display: grid;
    grid-template-columns: auto minmax(24rem, 1fr) auto auto;
    gap: 0.5rem;
    align-items: end;
    padding: 0.52rem 0.65rem;
    border-bottom: 1px solid #d8e3e8;
}

.director-workspace-toolbar h2 {
    white-space: nowrap;
    font-size: 0.98rem;
}

.director-workspace-toolbar > span {
    white-space: nowrap;
    color: #64748b;
    font-size: 0.9rem;
}

.director-workspace-toolbar .button {
    white-space: nowrap;
}

.director-workspace-toolbar #director-upload-open {
    min-height: 2.1rem;
    padding: 0.38rem 0.78rem;
    border-radius: 0.7rem;
    font-size: 0.86rem;
}

.director-workspace-toolbar .director-module-toolbar {
    display: grid;
    grid-template-columns: minmax(13rem, 1fr) minmax(10rem, 0.65fr) minmax(10rem, 0.65fr);
    gap: 0.55rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.director-workspace-toolbar .director-module-toolbar label {
    gap: 0.2rem;
}

.director-workspace-toolbar .director-module-toolbar label > span {
    color: #405467;
    font-size: 0.7rem;
    font-weight: 850;
}

.director-workspace-toolbar .director-module-toolbar input,
.director-workspace-toolbar .director-module-toolbar select {
    min-height: 1.95rem;
    padding-block: 0.32rem;
}

.director-master-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(20rem, 0.9fr);
    gap: 0;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid #d8e3e8;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: none;
    min-height: clamp(24rem, calc(100vh - 9rem), 42rem);
}

.director-console-module > .director-master-detail {
    min-height: calc(100vh - 2.35rem);
    border-top: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
}

.director-master-detail .director-list-card,
.director-master-detail .director-list-card.workspace-table-panel,
.director-master-detail .director-detail-pane {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #ffffff;
}

.director-master-detail .director-list-card {
    min-width: 0;
    border-right: 2px solid #c3d0dc;
    box-shadow: 8px 0 18px -18px rgba(15, 23, 42, 0.55);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.director-list-card.workspace-table-panel .director-list-heading {
    padding-inline: 0.8rem;
}

.director-list-card.workspace-table-panel .director-list {
    border: 0;
    border-radius: 0;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    overflow: auto;
}

.director-compact-list .director-list-row,
.director-list-card.workspace-table-panel .director-list-row {
    min-height: 2.7rem;
    padding: 0.42rem 0.65rem;
    gap: 0.55rem;
}

.director-list-card.workspace-table-panel .director-data-grid-head,
.director-list-card.workspace-table-panel .director-data-grid .director-list-row {
    grid-template-columns: minmax(9.5rem, 1fr) minmax(11rem, 1.15fr) minmax(10rem, 1fr) minmax(7rem, 0.6fr) minmax(8rem, 0.72fr);
}

.director-list-card.workspace-table-panel .director-data-grid-head {
    min-height: 2.15rem;
    padding: 0.34rem 0.65rem;
}

.director-list-row small {
    margin-bottom: 0.08rem;
    font-size: 0.75rem;
}

.director-detail-pane {
    position: sticky;
    top: 3.15rem;
    align-self: stretch;
    height: 100%;
    min-height: 0;
    padding: 0.68rem;
}

.director-detail-pane-header {
    padding-bottom: 0.68rem;
    margin-bottom: 0.62rem;
    border-bottom: 2px solid #d8e3e8;
}

.director-detail-pane h2 {
    margin: 0.08rem 0 0;
    font-size: 1rem;
}

.director-detail-pane .form-actions .button {
    min-height: 2.1rem;
    padding: 0.38rem 0.78rem;
    border-radius: 0.7rem;
    font-size: 0.86rem;
}

.director-detail-list {
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.director-detail-list div {
    padding: 0.34rem 0;
}

.director-preview-placeholder {
    margin: 0.6rem 0;
    padding: 0.62rem;
    border-radius: 10px;
    font-size: 0.86rem;
}

.director-detail-hint {
    margin: 0.35rem 0 0.75rem;
    color: #64748b;
    font-size: 0.86rem;
    line-height: 1.35;
}

.director-filterbar {
    margin-bottom: 0.65rem;
    padding: 0.65rem;
    border-radius: 12px;
}

.director-budget-totals {
    margin-bottom: 0.65rem;
    gap: 0.55rem;
}

.director-budget-totals article,
.director-budget-kpi {
    padding: 0.72rem 0.85rem;
    border-radius: 12px;
}

.director-budget-table-panel {
    border-radius: 12px;
}

.compact-workspace-section {
    padding: 0.65rem 0;
}

.worklist-shell .worklist-hero {
    margin: 0;
    padding: 0 0 0.45rem;
}

.worklist-shell {
    gap: 0.65rem;
}

.worklist-shell .workspace-table-panel {
    border-inline: 0;
    border-radius: 0;
    background: transparent;
}

.worklist-shell .role-summary-grid {
    gap: 0.5rem;
}

.worklist-shell .approval-module-toolbar {
    padding: 0;
    border: 0;
    background: transparent;
    grid-template-columns: repeat(4, minmax(10rem, 1fr));
}

.invoice-workspace-frame {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    align-items: stretch;
    width: 100%;
    min-height: calc(100vh - 2.35rem);
    min-width: 0;
    border: 1px solid #cbd7e2;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

.invoice-list-pane,
.invoice-detail-pane {
    min-width: 0;
    min-height: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.invoice-list-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.invoice-detail-pane {
    border-left: 1px solid #cbd7e2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0.68rem;
}

.invoice-list-header {
    display: grid;
    flex: 0 0 auto;
    gap: 0.38rem;
    min-height: 5.85rem;
    padding: 0.48rem 0.65rem 0.5rem;
    border-bottom: 1px solid #d8e3e8;
    background: #ffffff;
}

.invoice-list-heading-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    min-width: 0;
}

.invoice-list-title-group {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.55rem;
    min-width: 0;
}

.invoice-list-heading-row .invoice-list-create {
    width: auto;
    min-height: 1.9rem;
    padding: 0.3rem 0.65rem;
    border-radius: 0.5rem;
    font-size: 0.86rem;
    font-weight: 850;
    white-space: nowrap;
    justify-self: end;
}

.invoice-list-heading-row h1,
.invoice-list-heading-row h2 {
    margin: 0;
    white-space: nowrap;
    font-size: 1.1rem;
    font-weight: 920;
}

.invoice-count {
    white-space: nowrap;
    color: #64748b;
    font-size: 0.84rem;
    font-weight: 650;
}

.invoice-list-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.48rem;
    align-items: center;
    width: 100%;
    max-width: 100%;
}

.invoice-list-filter-row input,
.invoice-list-filter-row select {
    min-height: 1.75rem;
    padding: 0.24rem 0.58rem;
    border-radius: 0.5rem;
    font-size: 0.86rem;
}

.invoice-list-filter-row input {
    width: clamp(20rem, 24vw, 22.5rem);
}

.invoice-list-filter-row select {
    width: clamp(10.625rem, 14vw, 12.5rem);
}

.invoice-dossier-filters > input[type="search"] {
    flex: 1 1 16rem;
    width: auto;
    min-width: 0;
    max-width: 100%;
}

.invoice-dossier-filters > select {
    flex: 1 1 10rem;
    width: auto;
    min-width: 0;
    max-width: 100%;
}

.invoice-dossier-filters .invoice-work-year-filter {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 13rem;
    min-width: 0;
    margin: 0;
}

.invoice-dossier-filters .invoice-work-year-filter select {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

.invoice-list-extra-filters {
    flex: 0 0 100%;
    min-width: 0;
    font-size: 0.82rem;
}

.invoice-list-extra-filters > summary {
    width: fit-content;
    padding: 0.15rem 0;
    color: var(--primary);
    cursor: pointer;
}

.invoice-list-extra-filters:has(input:checked) > summary::after {
    content: " · Archief inbegrepen";
    font-weight: 700;
}

.invoice-list-extra-filter-options {
    padding: 0.4rem 0;
}

.invoice-list-extra-filter-options .compact-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    cursor: pointer;
}

.invoice-list-extra-filter-options input[type="checkbox"] {
    flex: 0 0 1rem;
    width: 1rem;
    min-width: 1rem;
    height: 1rem;
    min-height: 1rem;
    padding: 0;
    margin: 0;
}

.invoice-detail-pane .form-actions .button {
    min-height: 2.1rem;
    padding: 0.38rem 0.78rem;
    border-radius: 0.7rem;
    font-size: 0.86rem;
    white-space: nowrap;
}

.invoice-list-table {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.invoice-list-section {
    min-width: 0;
}

.invoice-list-section-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2rem;
    margin: 0;
    padding: 0.38rem 0.65rem;
    color: #334e68;
    background: #e5edf3;
    border-bottom: 1px solid #cbd7e2;
    font-size: 0.82rem;
    font-weight: 900;
}

.invoice-list-section-title span {
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 650;
}

.invoice-section-empty {
    margin: 0;
    padding: 0.65rem;
    color: #64748b;
    font-size: 0.82rem;
}

.invoice-filter-empty {
    grid-column: 1 / -1;
}

.invoice-supplier-cell {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.invoice-supplier-cell strong,
.invoice-supplier-cell small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invoice-supplier-cell small {
    color: #64748b;
    font-size: 0.72rem;
}

.invoice-list-table .director-data-grid-head,
.invoice-list-table .director-list-row {
    display: grid;
    grid-template-columns: minmax(8rem, 1.35fr) minmax(6.25rem, 0.9fr) minmax(5.75rem, 0.72fr) minmax(5.75rem, 0.68fr) minmax(7rem, 0.85fr);
    align-items: center;
}

.invoice-list-table .director-data-grid-head {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 2.15rem;
    padding: 0.34rem 0.65rem;
    color: #475569;
    background: #f8fafc;
    border-bottom: 1px solid #d8e3e8;
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.invoice-list-table .director-list-row {
    min-height: 2.7rem;
    padding: 0.42rem 0.65rem;
    gap: 0.55rem;
    border-radius: 0;
}

.invoice-list-table .director-list-row > span {
    min-width: 0;
}

.invoice-list-table .director-list-row > span:not(.invoice-supplier-cell) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invoice-list-table .director-list-row .status-badge {
    justify-self: start;
    max-width: 100%;
}

.invoice-list-table .director-data-grid-head span:nth-child(4),
.invoice-list-table .director-list-row > span:nth-child(4) {
    text-align: right;
}

.invoice-list-table .director-master-row.is-selected,
.invoice-list-table .director-master-row:focus-visible {
    background: #e9f6f4;
    box-shadow: inset 4px 0 0 var(--primary);
}

.invoice-detail-pane .director-detail-pane-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: start;
    min-height: 5.85rem;
    padding-bottom: 0.5rem;
    margin: -0.68rem -0.68rem 0.62rem;
    padding: 0.48rem 0.68rem 0.5rem;
    border-bottom: 1px solid #d8e3e8;
}

.invoice-detail-pane .director-detail-pane-header .eyebrow {
    color: #0f766e;
    font-size: 0.76rem;
    font-weight: 760;
    letter-spacing: 0.02em;
    text-transform: none;
}

.invoice-detail-pane h2 {
    margin: 0.08rem 0 0;
    font-size: 1rem;
}

.invoice-detail-pane .director-detail-list {
    flex: 0 0 auto;
    gap: 0.12rem;
    margin-bottom: 0.35rem;
}

.invoice-detail-pane .director-detail-list div {
    padding: 0.22rem 0;
}

.invoice-return-notice {
    display: flex;
    flex: 0 0 auto;
    gap: 0.5rem;
    margin: 0 0 0.3rem;
    padding: 0.45rem 0.55rem;
    border-left: 3px solid #d97706;
    color: #713f12;
    background: #fffbeb;
}

.invoice-return-notice svg {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    margin-top: 0.08rem;
    fill: none;
    stroke: #b45309;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.invoice-return-notice h3,
.invoice-return-notice p {
    margin: 0;
}

.invoice-return-notice h3 {
    font-size: 0.72rem;
    font-weight: 850;
}

.invoice-return-notice p {
    margin-top: 0.08rem;
    font-size: 0.76rem;
    line-height: 1.3;
}

.invoice-financial-context {
    display: grid;
    grid-template-columns: 0.72fr 1.45fr 1.05fr 0.82fr;
    flex: 0 0 auto;
    margin: 0.05rem 0 0.1rem;
    border-block: 1px solid #d8e3e8;
    background: #f8fafc;
}

.invoice-financial-context div {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    min-height: 2.2rem;
    padding: 0.28rem 0.42rem;
    border-right: 1px solid #d8e3e8;
}

.invoice-financial-context div:last-child {
    border-right: 0;
}

.invoice-financial-context svg {
    flex: 0 0 auto;
    width: 0.95rem;
    height: 0.95rem;
    fill: none;
    stroke: #0f766e;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.invoice-financial-context div > span {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    min-width: 0;
}

.invoice-financial-context small {
    flex: 0 0 auto;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 750;
}

.invoice-financial-context strong {
    min-width: 0;
    overflow: hidden;
    color: #16324a;
    font-size: 0.76rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.director-pdf-preview {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    margin: 0.1rem 0 0;
}

.director-pdf-preview-actions {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    min-height: 1.55rem;
}

.director-pdf-open-button {
    padding: 0.12rem 0.38rem;
    border: 0;
    color: #0f766e;
    background: transparent;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
}

.director-pdf-open-button:hover {
    text-decoration: underline;
}

.director-pdf-open-button:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.45);
    outline-offset: 1px;
}

.director-pdf-preview-frame {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    min-height: 18rem;
    border: 1px solid #d8e3e8;
    border-radius: 0.85rem;
    background: #f8fafc;
}

.director-preview-placeholder {
    display: grid;
    flex: 1 1 auto;
    min-height: 10rem;
    place-items: center;
    padding: 1rem;
    border: 1px dashed #cbd7e2;
    border-radius: 0.85rem;
    color: #64748b;
    background: #f8fafc;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.15rem;
    max-width: 100%;
    padding: 0.12rem 0.42rem;
    border-radius: 0.42rem;
    color: #425466;
    background: #eef2f7;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.status-ready-for-payment,
.status-paid,
.status-booked,
.status-approved {
    color: #047857;
    background: #dff8e8;
}

.status-rejected,
.status-cancelled {
    color: #991b1b;
    background: #fee2e2;
}

.status-awaiting-approval,
.status-ready-for-approval,
.status-needs-review {
    color: #92400e;
    background: #fef3c7;
}

.status-returned {
    color: #9a3412;
    background: #ffedd5;
}

.status-in-accounting,
.status-in-processing {
    color: #1e3a8a;
    background: #dbeafe;
}

.director-pdf-modal {
    width: min(96vw, 78rem);
    height: min(92vh, 58rem);
}

.director-pdf-modal iframe {
    display: block;
    width: 100%;
    height: calc(100% - 5.1rem);
    border: 0;
    background: #f8fafc;
}

@media (max-width: 1550px) {
    .invoice-financial-context {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .invoice-financial-context div:nth-child(2) {
        border-right: 0;
    }

    .invoice-financial-context div:nth-child(-n + 2) {
        border-bottom: 1px solid #d8e3e8;
    }
}

@media (max-width: 1100px) {
    .director-workspace-toolbar {
        grid-template-columns: 1fr auto;
    }

    .invoice-workspace-frame {
        grid-template-columns: 1fr;
    }

    .invoice-detail-pane {
        border-left: 0;
        border-top: 1px solid #cbd7e2;
    }

    .director-workspace-toolbar .director-module-toolbar {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .director-master-detail {
        grid-template-columns: 1fr;
    }

    .director-master-detail .director-list-card {
        border-right: 0;
        border-bottom: 1px solid #d8e3e8;
    }

    .director-detail-pane {
        position: static;
    }
}

@media (max-width: 820px) {
    .app-header {
        grid-template-columns: 1fr auto;
    }

    .app-header-context {
        display: none;
    }

    .director-workspace-toolbar,
    .director-workspace-toolbar .director-module-toolbar,
    .invoice-list-filter-row {
        grid-template-columns: 1fr;
    }

    .invoice-list-heading-row {
        align-items: flex-start;
    }

    .invoice-list-title-group h1 {
        white-space: normal;
    }

    .invoice-list-filter-row input,
    .invoice-list-filter-row select {
        width: 100%;
    }

    .director-workspace-toolbar > span,
    .director-workspace-toolbar .button {
        justify-self: start;
    }
}
.director-allocation-summary {
    padding: 0.65rem 0;
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
}
.director-allocation-summary h3 { margin: 0; font-size: 0.9rem; }
.director-allocation-summary p { margin: 0.15rem 0; color: var(--text-main); font-size: 0.78rem; line-height: 1.45; }
.director-allocation-summary small { color: var(--text-muted); font-size: 0.7rem; }
.exact-split-summary {
  display: grid;
  gap: 0.25rem;
}

.exact-split-summary p {
  margin: 0;
}

/* KOVA: gedeelde PDF-rotatiebediening in factuurdossiers. */

/* Rustige, documentgerichte werkruimte voor factuurgoedkeuring. */
.approval-workspace-body { margin: 0; min-height: 100vh; background: #eef3f4; color: #17343b; }
.approval-workspace-topbar { height: 4.5rem; padding: 0 1.5rem; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; background: #fff; border-bottom: 1px solid #d9e3e5; }
.approval-workspace-topbar > :last-child { justify-self: end; }
.approval-workspace-progress { font-weight: 800; color: #45616a; }
.approval-workspace { height: calc(100vh - 4.5rem); display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(22rem, 0.75fr); }
.approval-document-panel { min-width: 0; padding: 1.25rem; display: flex; flex-direction: column; background: #dfe7e9; }
.approval-document-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.approval-document-toolbar > div:first-child { min-width: 0; display: grid; gap: .2rem; }
.approval-document-toolbar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.approval-document-toolbar span { color: #5c737a; font-size: .9rem; }
.approval-document-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.approval-rotation-note { margin: .65rem 0; color: #5c737a; font-size: .88rem; }
.approval-pdf-stage { position: relative; flex: 1; min-height: 30rem; overflow: hidden; display: grid; place-items: center; background: #515b5e; border-radius: .75rem; box-shadow: 0 8px 30px rgba(20, 43, 48, .14); }
.approval-pdf-stage iframe { width: 100%; height: 100%; border: 0; background: #fff; transform-origin: center; transition: transform .18s ease; }
.approval-pdf-stage iframe.is-sideways { width: calc(100vh - 9rem); height: calc(100vw - 31rem); max-height: 100%; }
.approval-pdf-state { position: absolute; z-index: 2; display: grid; place-items: center; gap: 1rem; padding: 2rem; text-align: center; color: #fff; background: rgba(35, 48, 52, .92); border-radius: .6rem; }
.approval-decision-panel { overflow-y: auto; padding: clamp(1.5rem, 3vw, 2.75rem); display: flex; flex-direction: column; gap: 1.5rem; background: #fff; border-left: 1px solid #d9e3e5; }
.approval-decision-panel h1 { margin: .4rem 0 .75rem; font-size: clamp(1.7rem, 2.2vw, 2.25rem); line-height: 1.15; }
.approval-task-details { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.approval-task-details div { min-width: 0; padding-bottom: .75rem; border-bottom: 1px solid #e7edef; }
.approval-task-details dt { color: #657b82; font-size: .82rem; }
.approval-task-details dd { margin: .25rem 0 0; font-weight: 750; overflow-wrap: anywhere; }
.approval-comment-field { display: grid; gap: .5rem; font-weight: 750; }
.approval-comment-field textarea { width: 100%; resize: vertical; box-sizing: border-box; }
.approval-primary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.approval-primary-actions .button:first-child { grid-column: 1 / -1; min-height: 3.25rem; font-size: 1rem; }
.approval-task-navigation { margin-top: auto; padding-top: 1rem; display: flex; justify-content: space-between; border-top: 1px solid #e2eaec; }
.approval-complete { max-width: 42rem; margin: 15vh auto; padding: 3rem; text-align: center; background: #fff; border-radius: 1rem; }
.approval-drawer-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(15, 31, 35, .38); }
.approval-task-drawer { position: fixed; z-index: 31; inset: 0 0 0 auto; width: min(30rem, 92vw); padding: 1.25rem; box-sizing: border-box; background: #fff; box-shadow: -12px 0 36px rgba(13, 37, 43, .2); transform: translateX(0); transition: transform .2s ease; }
.approval-task-drawer[aria-hidden="true"] { transform: translateX(105%); visibility: hidden; }
.approval-task-drawer header { display: flex; align-items: center; justify-content: space-between; }
.approval-task-list { display: grid; gap: .5rem; margin-top: 1rem; }
.approval-task-list-item { padding: 1rem; display: grid; gap: .25rem; text-align: left; color: inherit; background: #f6f9f9; border: 1px solid #dce6e8; border-radius: .65rem; cursor: pointer; }
.approval-task-list-item.is-current { border-color: #078477; box-shadow: 0 0 0 2px rgba(7,132,119,.12); }
.approval-task-list-item span, .approval-task-list-item small { color: #60767d; }
@media (max-width: 900px) {
    .approval-workspace-topbar { height: auto; min-height: 4.5rem; padding: .75rem; grid-template-columns: 1fr auto; }
    .approval-workspace-progress { grid-row: 2; grid-column: 1 / -1; text-align: center; }
    .approval-workspace { height: auto; min-height: calc(100vh - 6rem); grid-template-columns: 1fr; }
    .approval-document-panel { min-height: 68vh; }
    .approval-decision-panel { overflow: visible; border-left: 0; border-top: 1px solid #d9e3e5; }
    .approval-pdf-stage iframe.is-sideways { width: 62vh; height: 92vw; }
}
@media (max-width: 520px) {
    .approval-document-toolbar { align-items: flex-start; flex-direction: column; }
    .approval-document-actions { width: 100%; }
    .approval-document-actions .button { flex: 1; }
    .approval-task-details { grid-template-columns: 1fr; }
}
.document-rotation-host:empty {
    display: none;
}

.pdf-rotation-controls {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
    margin-top: 0.65rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--bg-muted);
}

.pdf-rotation-controls[aria-busy="true"] {
    opacity: 0.85;
}

.pdf-rotation-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.35;
}

.pdf-rotation-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.5rem;
    min-width: 0;
}

.pdf-rotation-page-field {
    display: grid;
    gap: 0.2rem;
    color: #405467;
    font-size: 0.74rem;
    font-weight: 800;
}

.pdf-rotation-page-input {
    width: 6rem;
    min-height: 2.1rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: #ffffff;
}

.pdf-rotation-pending {
    margin: 0;
    padding: 0.4rem 0.55rem;
    border-left: 3px solid #d97706;
    color: #92400e;
    background: var(--warning-bg);
    font-size: 0.8rem;
    font-weight: 700;
}

.pdf-rotation-feedback {
    margin: 0;
}

.pdf-rotation-feedback:empty {
    display: none;
}

.pdf-rotation-feedback.success {
    color: var(--success-text);
    font-weight: 600;
}

.pdf-rotation-feedback.error {
    color: var(--danger-text);
    font-weight: 600;
}

/* Shared auto-hiding navigation drawer for the app shell. */
body.app-layout-body .app-layout { grid-template-columns: minmax(0, 1fr); }
body.app-layout-body .app-sidebar {
    position: fixed;
    z-index: 45;
    top: 2.35rem;
    bottom: 0;
    left: 0;
    width: min(15.5rem, 85vw);
    height: auto;
    padding: .65rem 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: #fff;
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform .18s ease, box-shadow .18s ease, visibility 0s linear .18s;
}
body.app-layout-body .app-sidebar.is-expanded {
    transform: translateX(0);
    visibility: visible;
    box-shadow: 8px 0 24px rgba(15, 23, 42, .14);
    transition-delay: 0s;
}
.app-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 1.9rem;
    padding: .25rem .5rem;
    border: 1px solid var(--border-soft);
    border-radius: .4rem;
    color: var(--text-main);
    background: #fff;
    font: inherit;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}
.app-sidebar-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.app-header { grid-template-columns: auto auto minmax(0, 1fr) auto; }
.expense-claim-workspace { max-width: 1500px; }
.expense-claim-workspace-grid {
    display: grid;
    grid-template-columns: minmax(300px, .86fr) minmax(380px, 1.14fr);
    align-items: start;
    gap: 1rem;
}
.expense-claim-evidence-column,
.expense-claim-dossier-column { display: grid; gap: 1rem; min-width: 0; }
.expense-claim-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .15rem 1rem;
    margin: 0;
}
.expense-claim-fact { padding: .65rem 0; border-top: 1px solid var(--border-soft); min-width: 0; }
.expense-claim-fact dt { color: var(--text-muted); font-size: .76rem; font-weight: 700; }
.expense-claim-fact dd { margin: .18rem 0 0; color: var(--text-main); font-size: .92rem; overflow-wrap: anywhere; }
.expense-claim-classification-fields { display: grid; grid-template-columns: minmax(140px, .72fr) minmax(220px, 1.28fr); gap: .8rem; }
.expense-claim-suggestion,
.expense-claim-blocked-note { margin-top: .8rem; padding: .75rem .9rem; border-radius: .55rem; background: #f2f6ff; color: #263c65; font-size: .88rem; }
.expense-claim-blocked-note { background: #fff7e8; color: #704b0c; }
.expense-claim-document-list,
.expense-claim-history-list,
.expense-claim-approval-list { display: grid; gap: .55rem; }
.expense-claim-document-row,
.expense-claim-history-row,
.expense-claim-approval-card { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .75rem 0; border-top: 1px solid var(--border-soft); }
.expense-claim-document-row > div,
.expense-claim-history-row,
.expense-claim-approval-card { min-width: 0; }
.expense-claim-document-row > div,
.expense-claim-history-row { display: grid; gap: .2rem; }
.expense-claim-document-row .button { flex: 0 0 auto; }
.expense-claim-approval-card { display: block; }
.expense-claim-approval-card p { margin: .45rem 0 0; color: var(--text-muted); font-size: .84rem; }
.expense-claim-next-step .section-copy p { max-width: 50rem; }
@media (max-width: 900px) {
    .expense-claim-workspace-grid { grid-template-columns: minmax(0, 1fr); }
    .expense-claim-evidence-column { order: 2; }
    .expense-claim-dossier-column { order: 1; }
}
@media (max-width: 560px) {
    .expense-claim-facts,
    .expense-claim-classification-fields { grid-template-columns: minmax(0, 1fr); }
    .expense-claim-document-row { align-items: flex-start; }
}
@media (max-width: 820px) {
    body.app-layout-body .app-header { grid-template-columns: auto auto minmax(0, 1fr); }
    body.app-layout-body .app-header-context { display: none; }
    body.expense-claim-detail-page.app-layout-body .app-header { grid-template-columns: auto minmax(0, 1fr) auto; }
    body.expense-claim-detail-page.app-layout-body .app-header-context { display: none; }
    body.expense-claim-detail-page.app-layout-body .app-user-session .user-meta { display: none; }
    body.expense-claim-detail-page.app-layout-body .app-brand-text small { display: none; }
}
/* Confirmation is independent of persistent validation and error messages. */
.ocr-position-saved-notice {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    max-width: calc(100vw - 2rem);
    padding: .8rem 1.2rem;
    border-radius: .6rem;
    background: #166b62;
    color: #fff;
    box-shadow: 0 4px 18px #0003;
    pointer-events: none;
    animation: ocr-position-saved-fade 4.5s ease forwards;
}

@keyframes ocr-position-saved-fade {
    0%, 55% { opacity: 1; }
    100% { opacity: 0; }
}

.invoice-approval-procedure { margin-top: 1rem; }
.invoice-status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; min-width: 0; }
.invoice-pending-approval { font-size: .72rem; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; color: #34463c; }
.invoice-approval-procedure h4,
.invoice-approval-procedure summary { font-size: .85rem; margin: .5rem 0; }
.invoice-approval-procedure summary { cursor: pointer; }
.invoice-approval-axis {
    display: flex;
    overflow-x: auto;
    list-style: none;
    padding: 125px 12px 155px;
    margin: 0;
}
.invoice-approval-stage {
    position: relative;
    flex: 0 0 140px;
    text-align: center;
}
.invoice-approval-stage::before {
    content: "";
    position: absolute;
    top: 17px;
    left: 0;
    right: 0;
    height: 3px;
    background: #cbd7d1;
}
.invoice-approval-stage:first-child::before { left: 50%; }
.invoice-approval-stage:last-child::before { right: 50%; }
.invoice-approval-dot {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 2px solid #889b91;
    border-radius: 50%;
    background: #fff;
    color: #34463c;
    font: inherit;
    font-weight: 700;
    cursor: help;
}
.invoice-approval-dot:focus-visible { outline: 3px solid #194e75; outline-offset: 3px; }
.invoice-approval-parallel-previous,
.invoice-approval-parallel-next {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid #889b91;
    border-radius: 5px;
    background: #fff;
    color: #166b62;
    width: 28px;
    height: 24px;
    padding: 0;
    cursor: pointer;
}
.invoice-approval-parallel-previous { top: -32px; }
.invoice-approval-parallel-next { top: 42px; }
.has-parallel-approvers > .invoice-approval-team { margin-top: 35px; }
.invoice-approval-parallel-count { display: block; margin-top: .35rem; font-size: .7rem; }
.is-approved > .invoice-approval-dot { background: #166b62; border-color: #166b62; color: #fff; }
.is-current > .invoice-approval-dot { border-color: #b77d18; background: #fff0cc; }
.is-blocked > .invoice-approval-dot { background: #a43f33; border-color: #a43f33; color: #fff; }
.invoice-approval-actor {
    position: absolute;
    bottom: calc(100% - 2px);
    left: 50%;
    width: 160px;
    text-align: left;
    transform: rotate(-35deg);
    transform-origin: bottom left;
    font-size: .8rem;
    font-weight: 600;
}
.invoice-approval-team,
.invoice-approval-stage-status {
    position: relative;
    display: block;
    margin: .45rem .25rem 0;
    font-size: .7rem;
    overflow-wrap: anywhere;
}
.invoice-approval-stage-status { font-weight: 700; }
.invoice-approval-tooltip {
    display: none;
    position: absolute;
    top: 45px;
    left: 0;
    z-index: 2;
    width: 220px;
    max-height: 170px;
    overflow-y: auto;
    padding: .6rem;
    border-radius: .4rem;
    background: #243d34;
    color: #fff;
    text-align: left;
    font-size: .75rem;
    box-shadow: 0 3px 10px #0003;
}
.invoice-approval-tooltip > * { display: block; margin-bottom: .25rem; white-space: pre-wrap; }
.invoice-approval-stage:last-child .invoice-approval-tooltip { left: auto; right: 0; }
.invoice-approval-dot:hover ~ .invoice-approval-tooltip,
.invoice-approval-stage:focus-within .invoice-approval-tooltip,
.invoice-approval-tooltip:hover { display: block; }

@media (prefers-reduced-motion: reduce) {
    .ocr-position-saved-notice { animation: none; }
}

/* The director workspace also uses the shared allocation editor. */
.director-body .invoice-detail-pane .invoice-allocation-section { display: grid; gap: .55rem; }
.director-body .invoice-detail-pane .invoice-allocation-section h3 { margin: 0; font-size: .9rem; }
.director-body .invoice-detail-pane .invoice-allocation-choices { display: flex; flex-wrap: wrap; gap: .35rem .7rem; margin: 0; padding: 0; border: 0; }
.director-body .invoice-detail-pane .invoice-allocation-choice { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; }
.director-body .invoice-detail-pane .invoice-allocation-rows { display: grid; gap: .5rem; overflow-x: auto; }
.director-body .invoice-detail-pane .invoice-allocation-row { display: grid; grid-template-columns: 5rem minmax(9rem, 1fr) 5rem 6.5rem 4.4rem; align-items: end; gap: .4rem; min-width: 32.5rem; }
.director-body .invoice-detail-pane .invoice-allocation-field { display: grid; min-width: 0; gap: .2rem; color: var(--text-muted); font-size: .68rem; font-weight: 700; }
.director-body .invoice-detail-pane .invoice-allocation-field select,
.director-body .invoice-detail-pane .invoice-allocation-field input { width: 100%; min-width: 0; height: 2rem; padding: .25rem .35rem; border: 1px solid var(--border-strong); border-radius: .4rem; background: var(--bg-surface); font: inherit; color: var(--text-main); }
.director-body .invoice-detail-pane .invoice-allocation-field :focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.director-body .invoice-detail-pane .invoice-allocation-helpers,
.director-body .invoice-detail-pane .invoice-allocation-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.director-body .invoice-detail-pane .invoice-allocation-total { margin-left: auto; font-size: .75rem; }
.director-body .invoice-detail-pane .invoice-allocation-feedback { margin: 0; font-size: .75rem; }
.invoice-allocation-row .invoice-allocation-remove { display: inline-flex; align-items: center; justify-content: center; width: 2rem; min-width: 2rem; height: 2rem; padding: .35rem; color: #b42318; border-color: #edc8c4; }
.invoice-allocation-remove svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.invoice-allocation-row .invoice-allocation-remove:hover { background: #fff0ee; }
.invoice-allocation-row-actions { display: flex; align-items: center; gap: .35rem; }
.invoice-allocation-row .invoice-allocation-confirm { display: inline-flex; align-items: center; justify-content: center; width: 2rem; min-width: 2rem; height: 2rem; padding: .35rem; color: #397165; border-color: #bed5cf; }
.invoice-allocation-confirm svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.invoice-allocation-row .invoice-allocation-confirm[aria-pressed="true"] { background: #0f766e; border-color: #0f766e; color: white; }
.invoice-allocation-rows .invoice-allocation-row:not(:first-child) .invoice-allocation-field > span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.invoice-allocation-helpers .invoice-allocation-feedback.is-complete { color: var(--primary); }
.invoice-allocation-row:has(.invoice-allocation-confirm[aria-pressed="true"]) .invoice-allocation-field { opacity: .5; }
.invoice-allocation-rows { row-gap: .175rem; }
.director-body .invoice-detail-pane .invoice-allocation-rows { gap: .25rem; }
.invoice-upload-allocation-modal .invoice-allocation-rows { gap: .175rem; }

/* Keep the two invoice panes inside the available desktop viewport. */
.invoice-approval-allocation-overview { margin: .45rem 0; overflow-x: auto; }
.invoice-approval-allocation-table { width: 100%; border-collapse: collapse; font-size: .76rem; }
.invoice-approval-allocation-table th,
.invoice-approval-allocation-table td { padding: .35rem .45rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-soft); }
.invoice-approval-allocation-table th { color: var(--text-muted); font-size: .7rem; }
.invoice-approval-allocation-table small { display: block; margin-top: .1rem; font-size: .68rem; }
.invoice-approval-allocation-table td:nth-child(2),
.invoice-approval-allocation-table td:nth-child(3) { white-space: nowrap; }
.invoice-allocation-decision.is-approved { color: var(--success-text); font-weight: 700; }
.invoice-allocation-decision.is-pending { color: var(--warning); }
.invoice-allocation-decision.is-rejected,
.invoice-allocation-decision.is-returned { color: var(--danger); }
.invoice-approval-axis-toggle { cursor: pointer; font-weight: 700; font-size: .8rem; padding: .4rem 0; }
@media (min-width: 1101px) {
    body.director-invoices-body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
    .director-invoices-body > .app-header { flex: 0 0 auto; }
    .director-invoices-body > .app-layout { flex: 1 1 auto; min-height: 0; overflow: hidden; }
    .director-invoices-body .app-main { min-height: 0; overflow: hidden; }
    .director-invoices-body .director-console-module { display: flex; flex-direction: column; height: 100%; min-height: 0; }
    .director-invoices-body .director-action-panel { flex: 0 0 auto; }
    .director-invoices-body .invoice-workspace-frame { flex: 1 1 auto; min-height: 0; grid-template-rows: minmax(0, 1fr); }
    .director-invoices-body .invoice-list-header { flex: 0 0 auto; }
    .director-invoices-body .invoice-list-table,
    .director-invoices-body .invoice-detail-pane { overscroll-behavior-y: contain; }
    .director-invoices-body .invoice-detail-pane { overflow-y: auto; }
    .director-invoices-body .invoice-detail-pane > * { flex-shrink: 0; }
    .director-invoices-body .invoice-detail-pane > .director-pdf-preview { min-height: 28rem; }
}
