: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-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);
}

.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;
}

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

.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: 0;
    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: 0;
    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: max(100%, 1320px);
    min-width: 1320px;
    table-layout: fixed;
}

.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: 22%;
}

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

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

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

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

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

.admin-analytic-codes-table th:nth-child(8),
.admin-analytic-codes-table td:nth-child(8) {
    width: 15%;
    min-width: 13rem;
}

.admin-analytic-codes-table .admin-actions-cell {
    min-width: 13rem;
    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;
}

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

.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;
}

#admin-active-view-note,
[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-overview-grid,
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-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;
}

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

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

.admin-overview-card {
    display: grid;
    gap: 0.35rem;
    align-content: start;
}

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

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

.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;
    }
}

/* 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 { padding: 1rem 1.15rem; background: white; border: 1px solid #d8e3e8; border-radius: 16px; }

.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 {
    overflow: hidden;
    border: 1px solid #d8e3e8;
    border-radius: 16px;
    background: #ffffff;
}

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

.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.active {
    background: #e9f6f4;
    border-left-color: var(--primary);
    color: #0f2f3f;
    box-shadow: none;
}

.app-sidebar-nav a.active small {
    color: #51706d;
}

.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 {
    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: minmax(0, 2fr) minmax(320px, 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;
    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: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    min-width: 0;
}

.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,
.invoice-list-filter-row #director-upload-open {
    min-height: 1.75rem;
    padding: 0.24rem 0.58rem;
    border-radius: 0.5rem;
    font-size: 0.86rem;
}

.invoice-list-filter-row #director-upload-open {
    margin-left: auto;
    width: auto;
    min-width: 8.25rem;
    font-weight: 850;
}

.invoice-list-filter-row input {
    width: clamp(20rem, 24vw, 22.5rem);
}

.invoice-list-filter-row select {
    width: clamp(10.625rem, 14vw, 12.5rem);
}

.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-table .director-data-grid-head,
.invoice-list-table .director-list-row {
    display: grid;
    grid-template-columns: minmax(12rem, 1.45fr) minmax(8rem, 0.85fr) minmax(7rem, 0.7fr) minmax(7rem, 0.6fr) minmax(8rem, 0.72fr);
    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-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;
}

.director-pdf-preview {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    margin: 0.35rem 0 0;
}

.director-pdf-preview-button {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    text-align: left;
    cursor: zoom-in;
}

.director-document-label {
    flex: 0 0 auto;
    color: #405467;
    font-size: 0.78rem;
    font-weight: 900;
}

.director-pdf-preview-button iframe {
    flex: 1 1 auto;
    width: 100%;
    min-height: 18rem;
    border: 1px solid #d8e3e8;
    border-radius: 0.85rem;
    background: #f8fafc;
    pointer-events: none;
}

.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-in-accounting,
.status-in-processing {
    color: #1e3a8a;
    background: #dbeafe;
}

.director-pdf-preview-button:hover iframe,
.director-pdf-preview-button:focus-visible iframe {
    border-color: var(--primary);
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.12);
}

.director-pdf-preview-button:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.45);
    outline-offset: 4px;
    border-radius: 0.85rem;
}

.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: 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-heading-row,
    .invoice-list-filter-row {
        grid-template-columns: 1fr;
    }

    .invoice-list-heading-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .invoice-list-filter-row input,
    .invoice-list-filter-row select {
        width: 100%;
    }

    .invoice-list-filter-row #director-upload-open {
        margin-left: 0;
    }

    .director-workspace-toolbar > span,
    .director-workspace-toolbar .button {
        justify-self: start;
    }
}
