:root {
    --ink: #263746;
    --muted: #5f6d76;
    --line: rgba(44, 62, 80, 0.14);
    --surface: #ffffff;
    --surface-soft: #fbf8f0;
    --brand: #2d4354;
    --brand-dark: #243747;
    --accent: #ff9d6b;
    --green: #149566;
    --warning: #b7791f;
    --danger: #bd3a3a;
    --success: #2e7d58;
    --shadow: 0 14px 32px rgba(24, 39, 50, 0.10);
    --cream: #f7f5ef;
    --light-blue: #e9f3f5;
    --border-subtle: rgba(48, 66, 81, 0.22);
    --row-odd: #fbf4ea;
    --row-even: #ffffff;
}

* {
    box-sizing: border-box;
}

/* Remove focus ring when focused via mouse/navigation (Blazor auto-focus after render).
   Keeps outline for keyboard users (:focus-visible). */
*:focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none !important;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--cream);
}

.app-frame {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--cream);
    overflow: hidden;
}

.app-topbar-dark {
    min-height: 58px;
    display: flex;
    align-items: center;
    background: #2d4354 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(24, 39, 50, 0.22);
    z-index: 10;
}

.app-topbar-dark .container-fluid {
    min-height: 58px;
}

.app-topbar-left {
    min-width: 0;
}

.app-nav-collapse {
    width: 31px;
    height: 31px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.86);
    background: transparent;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-nav-collapse:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-toggle {
    display: none;
}

.app-topbar-mark {
    width: 31px;
    height: 31px;
    border-radius: 0.72rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ff9d6b;
    color: #243747;
    font-weight: 800;
    font-size: 0.85rem;
    box-shadow: 0 8px 18px rgba(255, 157, 107, 0.28);
}

.app-topbar-brand {
    color: #ffffff !important;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
}

.app-topbar-brand span {
    color: #ffffff !important;
}

.app-topbar-actions form {
    margin: 0;
}

.app-topbar-user {
    color: rgba(255, 255, 255, 0.92) !important;
    font-weight: 600;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-action,
.topbar-primary {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: 8px;
    padding: 0.4rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.72);
    background: transparent;
    color: #ffffff;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 800;
    white-space: nowrap;
}

.topbar-action:hover,
.topbar-primary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.topbar-primary {
    border-color: transparent;
    background: #ff9d6b;
    color: #243747;
}

.topbar-primary:hover {
    background: #ffb084;
    color: #243747;
}

.topbar-pill {
    min-width: 1.25rem;
    border-radius: 999px;
    padding: 0.12rem 0.38rem;
    background: #6f6de8;
    color: #fff;
    font-size: 0.72rem;
    line-height: 1;
    text-align: center;
}

/* ── Help dropdown ───────────────────────────────────────────────────────── */
.topbar-help-wrap {
    position: relative;
}

.topbar-help-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 230px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    z-index: 9999;
    padding: 0.5rem 0;
}

.topbar-help-heading {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    padding: 0.4rem 1rem 0.3rem;
    margin: 0;
}

.topbar-help-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.12s;
}

.topbar-help-item:hover {
    background: var(--surface-soft);
    color: var(--ink);
}

.topbar-help-item i {
    font-size: 1rem;
    color: var(--muted);
    flex-shrink: 0;
}

.topbar-help-divider {
    height: 1px;
    background: var(--line);
    margin: 0.35rem 0;
}

.topbar-help-note {
    font-size: 0.75rem;
    color: var(--muted);
    padding: 0.3rem 1rem 0.4rem;
    margin: 0;
}

.topbar-help-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: transparent;
    border: none;
    cursor: default;
}

.app-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.app-sidebar-shell {
    width: 270px;
    height: calc(100vh - 58px);
    min-height: 0;
    overflow: hidden;
    transition: width 0.18s ease;
}

.nav-collapsed .app-sidebar-shell {
    width: 64px;
}

.main-pane {
    min-width: 0;
    height: calc(100vh - 58px);
    min-height: 0 !important;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    background:
        radial-gradient(circle at top left, rgba(255, 157, 107, 0.12), transparent 38rem),
        radial-gradient(circle at bottom right, rgba(233, 243, 245, 0.78), transparent 38rem),
        var(--cream);
}

.container-fluid {
    max-width: 100%;
}

.main-pane > main > .container-fluid {
    padding: 1rem 1.5rem 2.5rem !important;
}

.sidebar-overlay {
    display: none;
}

a {
    color: var(--brand);
}

a,
button {
    font: inherit;
}

.pro-sidebar {
    width: 270px;
    height: 100%;
    min-height: 0;
    max-height: calc(100vh - 58px);
    background: linear-gradient(180deg, #fbf8f0 0%, #f4efe5 100%);
    color: #263746;
    font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    border-right: 1px solid rgba(44, 62, 80, 0.13);
    padding: 0.65rem 0 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.pro-sidebar.is-collapsed {
    width: 64px;
}

.pro-sidebar::-webkit-scrollbar {
    width: 8px;
}

.pro-sidebar::-webkit-scrollbar-thumb {
    background: rgba(44, 62, 80, 0.14);
    border-radius: 8px;
}

.psb-top-links {
    margin-top: 0.15rem !important;
    border-left: 0 !important;
}

.psb-section-label {
    font-size: 0.72rem;
    letter-spacing: 0.2rem;
    color: #5f6d76;
    font-weight: 800;
    opacity: 0.85;
    padding: 0.9rem 1rem 0.3rem;
    text-transform: uppercase;
}

.psb-group {
    padding: 0.2rem 0.5rem;
}

.psb-toggle {
    width: 100%;
    background: transparent;
    border: 0;
    color: #263746;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.6rem;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.psb-toggle .left,
.psb-toggle .right {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.psb-toggle .left span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.psb-toggle i {
    opacity: 0.9;
    font-size: 1.05rem;
}

.psb-toggle:hover {
    background: rgba(20, 149, 102, 0.08);
}

.psb-links {
    display: flex;
    flex-direction: column;
    margin: 0.15rem 0.35rem 0.3rem;
    border-left: 2px solid rgba(44, 62, 80, 0.13);
}

.psb-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #405463 !important;
    text-decoration: none;
    padding: 0.55rem 0.8rem 0.55rem 0.75rem;
    margin: 0.12rem 0 0.12rem 0.3rem;
    border-radius: 0.55rem;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.psb-link i {
    width: 1.15rem;
    min-width: 1.15rem;
    font-size: 1.02rem;
    opacity: 0.95;
    text-align: center;
}

.psb-link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.psb-link:hover {
    background: rgba(20, 149, 102, 0.08);
    color: #263746 !important;
}

.psb-link.active {
    color: #263746 !important;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 157, 107, 0.42), 0 8px 20px rgba(15, 23, 42, 0.04);
    font-weight: 800;
}

.psb-link.active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 10px;
    bottom: 10px;
    width: 3px;
    background: #149566;
    border-radius: 2px;
    box-shadow: 0 0 0 3px rgba(20, 149, 102, 0.12);
}

.pill {
    background: #6f6de8;
    color: #fff;
    font-size: 0.7rem;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    line-height: 1;
    box-shadow: 0 6px 14px rgba(111, 109, 232, 0.25);
}

.pro-sidebar.is-collapsed .psb-section-label,
.pro-sidebar.is-collapsed .psb-toggle span,
.pro-sidebar.is-collapsed .psb-link span,
.pro-sidebar.is-collapsed .psb-toggle .right,
.pro-sidebar.is-collapsed .pill {
    display: none;
}

.pro-sidebar.is-collapsed .psb-toggle,
.pro-sidebar.is-collapsed .psb-link {
    justify-content: center;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

.pro-sidebar.is-collapsed .psb-links {
    border-left: 0;
    margin-left: 0.25rem;
    margin-right: 0.25rem;
}

.pro-sidebar.is-collapsed .psb-link.active::before {
    left: -4px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 860px;
    font-size: clamp(1.45rem, 2.1vw, 1.9rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 0;
}

.primary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 999px;
    padding: 0.48rem 0.95rem;
    border: 1px solid transparent;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.primary-button {
    background: rgba(255, 157, 107, 0.14);
    color: var(--brand);
    border-color: rgba(255, 157, 107, 0.38);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.primary-button.danger {
    background: var(--danger);
    box-shadow: 0 10px 24px rgba(189, 58, 58, 0.22);
}

.primary-button.compact,
.ghost-button.compact {
    min-height: 34px;
    padding: 0.45rem 0.7rem;
    font-size: 0.86rem;
}

.ghost-button {
    background: #fff;
    color: var(--ink);
    border-color: var(--border-subtle);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.ghost-button:hover,
.primary-button:hover {
    transform: translateY(-1px);
}

.icon-button {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--brand);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.action-menu {
    position: relative;
    display: inline-flex;
    justify-content: flex-end;
}

td:has(.action-menu[open]),
tr:has(.action-menu[open]) {
    position: relative;
    z-index: 130;
}

.action-menu-button {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    list-style: none;
    border: 0;
    border-radius: 999px;
    background: #f6f8f9;
    color: var(--brand);
    cursor: pointer;
}

.action-menu-button::-webkit-details-marker {
    display: none;
}

.action-menu > summary.ghost-button,
.action-menu > summary.ghost-button.compact {
    list-style: none;
    gap: 0.4rem;
}

.action-menu > summary.ghost-button::-webkit-details-marker {
    display: none;
}

.action-menu[open] .action-menu-button,
.action-menu-button:hover {
    background: #e7f2f5;
}

.action-menu-panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 200;
    min-width: 12rem;
    padding: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(24, 39, 50, 0.16);
}

.action-menu-panel a,
.action-menu-panel button {
    width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    border: 0;
    border-radius: 8px;
    padding: 0.45rem 0.65rem;
    background: transparent;
    color: var(--ink);
    text-align: left;
    text-decoration: none;
    font-weight: 700;
}

.action-menu-panel a:hover,
.action-menu-panel button:hover {
    background: rgba(20, 149, 102, 0.08);
}

.action-menu-panel button:disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

.toggle-switch {
    position: relative;
    width: 76px;
    min-width: 76px;
    max-width: 76px;
    height: 34px;
    min-height: 34px;
    flex: 0 0 76px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.18), 0 5px 12px rgba(15, 23, 42, 0.08);
    transition: background-color 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.toggle-switch.is-on {
    border-color: rgba(20, 149, 102, 0.4);
    background: linear-gradient(180deg, #52c878, #1e9f5f);
}

.toggle-switch.is-off {
    border-color: rgba(189, 58, 58, 0.38);
    background: linear-gradient(180deg, #ef7474, #c94343);
}

.toggle-switch-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(15, 23, 42, 0.28);
    transition: transform 160ms ease;
}

.toggle-switch.is-on .toggle-switch-knob {
    transform: translateX(42px);
}

.toggle-switch-label {
    position: absolute;
    top: 50%;
    z-index: 1;
    width: 36px;
    padding: 0;
    transform: translateY(-50%);
    pointer-events: none;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.toggle-switch.is-on .toggle-switch-label {
    left: 10px;
}

.toggle-switch.is-off .toggle-switch-label {
    right: 8px;
}

.toggle-switch:hover {
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.18), 0 7px 16px rgba(15, 23, 42, 0.14);
}

.toggle-switch:disabled,
.toggle-switch.is-busy {
    opacity: 0.72;
    cursor: wait;
}

.feedback-slot {
    min-height: 50px;
    display: flex;
    align-items: stretch;
    margin: 1rem 0;
}

.feedback-slot:empty {
    visibility: hidden;
}

.feedback-slot .form-alert {
    width: 100%;
    margin: 0;
}

.section-kicker {
    margin-bottom: 0.45rem;
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 290px;
    gap: 0.85rem 1rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1.05rem 1.2rem;
    border: 1px solid var(--border-subtle);
    border-radius: 16px 16px 0 0;
    background:
        radial-gradient(circle at 6% 0%, rgba(255, 157, 107, 0.18), transparent 18rem),
        linear-gradient(135deg, #fffaf3, rgba(233, 243, 245, 0.88));
    color: var(--ink);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.dashboard-hero::before {
    content: "D";
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    align-self: start;
    margin-top: 0.1rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), #ffd9a6);
    color: var(--brand-dark);
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(255, 157, 107, 0.26);
}

.dashboard-hero p {
    max-width: 760px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.45;
}

.dashboard-hero h1 {
    margin: 0 0 0.25rem;
    font-size: 1.55rem;
    font-weight: 750;
    color: var(--brand);
}

.dashboard-hero .section-kicker {
    margin-bottom: 0.25rem;
    color: var(--brand);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    grid-column: 2 / 3;
    margin-top: 0.75rem;
}

.hero-actions-inline {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.65rem;
}

.dashboard-hero .ghost-button {
    background: #fff;
    color: var(--brand);
    border-color: var(--border-subtle);
}

.dashboard-hero .primary-button {
    background: rgba(255, 157, 107, 0.16);
    color: var(--brand);
    border-color: rgba(255, 157, 107, 0.42);
}

.dashboard-command {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid rgba(48, 66, 81, 0.12);
    background:
        radial-gradient(circle at 4% 10%, rgba(255, 157, 107, 0.18), transparent 18rem),
        linear-gradient(135deg, #fffaf3, rgba(233, 243, 245, 0.88));
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.dashboard-command h1 {
    margin: 0 0 0.25rem;
    font-size: 1.8rem;
    color: var(--brand);
}

.dashboard-command p:not(.section-kicker) {
    margin: 0;
    color: var(--muted);
}

.dashboard-segment {
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.dashboard-segment a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    color: var(--brand);
    text-decoration: none;
    font-weight: 800;
}

.dashboard-segment a.active {
    background: #ff9d6b;
    color: var(--brand-dark);
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.dashboard-kpi {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
    padding: 1rem;
    border: 1px solid rgba(48, 66, 81, 0.16);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.archive-kpi-button,
.document-kpi-button,
.case-kpi-button {
    width: 100%;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.archive-guidance-card div,
.document-guidance-card div,
.case-guidance-card div {
    align-items: start;
}

.archive-guidance-card .primary-button,
.document-guidance-card .primary-button,
.case-guidance-card .primary-button {
    margin-top: .45rem;
    width: fit-content;
}

.scanner-bulk-reject-panel {
    margin: .85rem 0 1rem;
}

.dashboard-kpi:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.dashboard-kpi small,
.dashboard-kpi p {
    display: block;
    margin: 0;
    color: var(--muted);
}

.dashboard-kpi strong {
    display: block;
    margin: 0.1rem 0;
    font-size: 1.45rem;
    line-height: 1;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 12px;
    background: #e7f2f5;
    color: var(--brand);
    font-size: 1.18rem;
}

.dashboard-kpi.danger .kpi-icon {
    background: #ffe9e6;
    color: var(--danger);
}

.dashboard-kpi.warning .kpi-icon {
    background: #fff1df;
    color: var(--warning);
}

.dashboard-kpi.success .kpi-icon {
    background: #e5f6ee;
    color: var(--success);
}

.dashboard-analytics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.85fr);
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: stretch;
}

.dashboard-card {
    min-width: 0;
    padding: 1rem;
    border: 1px solid rgba(48, 66, 81, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.055);
}

.dashboard-card.wide {
    min-width: 0;
}

.compact-heading {
    margin-bottom: 0.8rem;
}

.compact-heading h2 {
    font-size: 1rem;
}

.pipeline-bars,
.mix-list,
.compact-list {
    display: grid;
    gap: 0.7rem;
}

.pipeline-row,
.mix-row {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr) 2.5rem;
    gap: 0.8rem;
    align-items: center;
    color: var(--ink);
    text-decoration: none;
}

.pipeline-row span,
.mix-row span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pipeline-track {
    height: 11px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6ecef;
}

.pipeline-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--green);
}

.pipeline-track .danger {
    background: var(--danger);
}

.pipeline-track .warning {
    background: #e0a10a;
}

.pipeline-track .info {
    background: var(--brand);
}

.pipeline-track .success {
    background: var(--green);
}

.pipeline-track .accent {
    background: var(--accent);
}

.dashboard-gauge {
    --gauge-value: 0;
    width: 170px;
    height: 170px;
    display: grid;
    place-items: center;
    margin: 0.35rem auto 0.9rem;
    border-radius: 999px;
    background:
        radial-gradient(circle, #fff 0 58%, transparent 59%),
        conic-gradient(var(--green) calc(var(--gauge-value) * 1%), #e6ecef 0);
    box-shadow: inset 0 0 0 1px rgba(48, 66, 81, 0.1), 0 10px 24px rgba(15, 23, 42, 0.08);
}

.dashboard-gauge div {
    text-align: center;
}

.dashboard-gauge strong {
    display: block;
    font-size: 1.75rem;
    line-height: 1;
}

.dashboard-gauge span {
    color: var(--muted);
    font-weight: 800;
}

.stats-line.compact {
    justify-content: center;
    margin: 0;
}

.health-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.health-item {
    min-height: 94px;
    padding: 0.75rem;
    border: 1px solid rgba(48, 66, 81, 0.12);
    border-radius: 10px;
    background: #fbf8f0;
}

.health-item small,
.health-item span {
    display: block;
    color: var(--muted);
}

.health-item strong {
    display: block;
    margin: 0.2rem 0;
    font-size: 1.25rem;
}

.health-item.danger strong {
    color: var(--danger);
}

.health-item.warning strong {
    color: var(--warning);
}

.health-item.info strong {
    color: var(--brand);
}

.compact-list-row,
.case-strip-item {
    display: grid;
    gap: 0.2rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(48, 66, 81, 0.12);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
}

.compact-list-row span,
.compact-list-row small,
.case-strip-item span,
.case-strip-item small {
    color: var(--muted);
}

.case-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.case-strip-item div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.45rem;
}

.hero-panel {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.62);
}

.panel-label {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.hero-panel strong {
    display: block;
    margin: 0.6rem 0 0.1rem;
    font-size: 2rem;
    line-height: 1;
}

.progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(48, 66, 81, 0.14);
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #ff9d6b;
}

.metric-grid,
.module-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
    margin-top: 1rem;
}

.metric-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin: 0 0 1rem;
}

.metric-card,
.module-card,
.panel,
.feature-card {
    border: 1px solid rgba(48, 66, 81, 0.16);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.055);
}

.metric-card {
    padding: 1rem 1.15rem;
}

.metric-card span,
.metric-card small {
    display: block;
    color: var(--muted);
}

.metric-card strong {
    display: block;
    margin: 0.4rem 0 0.1rem;
    font-size: 1.55rem;
}

.metric-card .compact {
    margin-top: 0.7rem;
}

.metric-card.warning strong {
    color: var(--warning);
}

.metric-card.info strong {
    color: var(--brand);
}

.metric-card.success strong {
    color: var(--success);
}

.metric-card.danger strong {
    color: var(--danger);
}

.metric-link {
    color: inherit;
    text-decoration: none;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.metric-link:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 157, 107, 0.45);
    box-shadow: var(--shadow);
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    gap: 1rem;
    margin-top: 1rem;
}

.panel {
    padding: 1rem 1.2rem;
}

.panel[id] {
    scroll-margin-top: 1rem;
}

.sub-panel {
    margin-bottom: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.sub-panel .panel-heading {
    margin-bottom: 0.8rem;
}

.sub-panel h3 {
    margin-bottom: 0;
    font-size: 1rem;
}

.document-text-panel {
    margin-top: 1rem;
}

.duplicate-group-panel {
    margin-top: 0.75rem;
    padding: 0.7rem 0.9rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(251, 248, 240, 0.78);
}

.duplicate-group-summary {
    padding: 0 0 0.55rem;
    border-bottom: 1px solid var(--line);
}

.duplicate-group-summary .section-kicker {
    margin-bottom: 0.25rem;
}

.duplicate-review-grid {
    display: grid;
    grid-template-columns: minmax(10rem, 0.7fr) minmax(18rem, 1.4fr) auto;
    gap: 0.65rem;
    align-items: end;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.duplicate-review-grid label {
    display: grid;
    gap: 0.35rem;
}

.duplicate-review-grid label > span {
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 800;
}

.duplicate-review-grid .form-actions {
    margin-top: 0;
}

.extracted-text-preview {
    max-height: 260px;
    margin: 0 0 0.75rem;
    padding: 0.9rem;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    line-height: 1.6;
}

/* ── Portal cetateni ─────────────────────────────── */

.portal-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
}

.portal-header {
    background: #1e293b;
    padding: 0.75rem 1.25rem;
}

.portal-header-inner {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.portal-brand strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
}

.portal-brand span {
    display: block;
    font-size: 0.73rem;
    color: #94a3b8;
}

.portal-main {
    flex: 1;
    padding: 2rem 0 3rem;
}

.portal-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 2rem 2.25rem;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.portal-form-section {
    margin-bottom: 1.75rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--line);
}

.portal-form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.portal-section-label {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 1rem;
}

.portal-success {
    text-align: center;
    padding: 1.5rem 1rem;
}

.portal-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    font-size: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.portal-tracking {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    text-align: left;
    margin: 0 auto 1.5rem;
    max-width: 440px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.1rem 1.5rem;
    align-items: baseline;
}

.portal-tracking dt {
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #15803d;
    white-space: nowrap;
}

.portal-tracking dd {
    font-size: 1.35rem;
    font-weight: 800;
    color: #14532d;
    margin: 0 0 0.6rem;
    font-family: monospace;
    letter-spacing: 0.02em;
}

.portal-status-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem 2.25rem;
    margin-top: 1.25rem;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.portal-status-result {
    margin-top: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.portal-footer {
    background: #1e293b;
    padding: 1rem 1.25rem;
    text-align: center;
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.6;
}

.portal-footer p {
    margin: 0.15rem 0;
}

/* ── End portal ────────────────────────────────────── */

.search-snippet {
    display: block;
    max-width: 680px;
    margin-top: 0.35rem;
    color: var(--muted);
    line-height: 1.5;
    font-size: 0.82rem;
}

.search-snippet mark {
    background: #fef3c7;
    color: #92400e;
    border-radius: 2px;
    padding: 0 2px;
    font-weight: 600;
}

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

.panel-heading a {
    font-weight: 800;
    text-decoration: none;
}

.case-list {
    display: grid;
    gap: 0.65rem;
}

.case-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem;
    border: 1px solid rgba(48, 66, 81, 0.12);
    border-radius: 10px;
    background: #fff;
}

.case-row strong,
.case-row span {
    display: block;
}

.case-row div span {
    color: var(--muted);
    font-size: 0.92rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
    border: 1px solid rgba(44, 62, 80, 0.08);
    background: #eef3f5;
    color: var(--ink);
}

.status-pill.info {
    background: #e7f2f5;
    color: var(--brand);
}

.status-pill.warning {
    background: #fff1df;
    color: var(--warning);
}

.status-pill.success {
    background: #e5f6ee;
    color: var(--success);
}

.status-pill.danger {
    background: #ffe9e6;
    color: var(--danger);
}

.timeline {
    display: grid;
    gap: 0.75rem;
}

.timeline > div {
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 0.75rem;
}

.timeline span {
    width: 12px;
    height: 12px;
    margin-top: 0.35rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(255, 157, 107, 0.18);
}

.timeline p {
    margin-bottom: 0;
    color: var(--muted);
}

.activity-timeline {
    display: grid;
    gap: 0.85rem;
}

.activity-item {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.activity-item > span {
    width: 12px;
    height: 12px;
    margin-top: 0.35rem;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 4px rgba(30, 86, 160, 0.12);
}

.activity-item.success > span {
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(35, 134, 91, 0.14);
}

.activity-item.warning > span {
    background: var(--warning);
    box-shadow: 0 0 0 4px rgba(180, 111, 0, 0.14);
}

.activity-item.danger > span {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.13);
}

.activity-item em,
.activity-item small {
    display: block;
    color: var(--muted);
    font-style: normal;
}

.activity-item strong {
    display: block;
    margin: 0.12rem 0;
}

.activity-item p {
    margin: 0;
    color: var(--ink);
    line-height: 1.5;
}

.task-focus-list {
    display: grid;
    gap: 0.7rem;
}

.task-focus-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.8rem;
    align-items: center;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-left: 4px solid var(--green);
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff, #fbf8f0);
    box-shadow: 0 8px 18px rgba(24, 39, 50, 0.045);
    color: inherit;
    text-decoration: none;
}

.task-focus-item:hover {
    border-color: rgba(25, 105, 122, .28);
    transform: translateY(-1px);
}

.my-work-lane {
    max-width: 1180px;
    margin: 1rem auto;
}

.task-focus-item.warning {
    border-left-color: var(--warning);
}

.task-focus-item.danger {
    border-left-color: var(--danger);
}

.task-focus-item strong,
.task-focus-item small {
    display: block;
}

.task-focus-item small {
    color: var(--muted);
}

.task-focus-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
}

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

.workflow-map-card {
    min-height: 188px;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 24px rgba(24, 39, 50, 0.055);
}

.workflow-map-card > span {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    margin-bottom: 0.85rem;
    border-radius: 8px;
    background: #e7f2f5;
    color: var(--brand);
    font-weight: 900;
}

.workflow-map-card strong,
.workflow-map-card small {
    display: block;
}

.workflow-map-card p {
    color: var(--muted);
    line-height: 1.55;
}

.workflow-map-card small {
    color: var(--brand);
    font-weight: 800;
}

.workflow-roadmap {
    display: grid;
    gap: 0.75rem;
}

.workflow-roadmap article {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 0.8rem;
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.workflow-roadmap span {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-weight: 900;
}

.workflow-roadmap strong {
    display: block;
}

.workflow-roadmap p {
    margin: 0.2rem 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.module-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-card {
    display: block;
    padding: 1.2rem;
    color: inherit;
    text-decoration: none;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.module-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 157, 107, 0.45);
    box-shadow: var(--shadow);
}

.module-card span {
    display: inline-flex;
    margin-bottom: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    background: #e7f2f5;
    color: var(--brand);
    font-size: 0.72rem;
    font-weight: 900;
}

.module-card strong,
.feature-card strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 1.05rem;
}

.module-card p,
.feature-card p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.55;
}

.data-panel {
    --table-summary-sticky-height: 3.25rem;
    position: relative;
    margin-top: 1rem;
    overflow: visible;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.data-panel:has(.action-menu[open]) {
    z-index: 120;
}

.workspace-grid > .data-panel,
.admin-list-panel {
    align-self: start;
    margin-top: 0;
    min-width: 0;
}

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

.filter-panel {
    margin: 1rem 0;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 0.8rem 1rem 0.9rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(233, 243, 245, 0.86));
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.filter-panel form,
.filter-panel form > div:not(.validation-message):not(.validation-summary-errors) {
    min-width: 0;
}

.filter-grid {
    display: grid;
    grid-template-columns: minmax(15rem, 1.7fr) repeat(6, minmax(7.5rem, 0.9fr)) auto;
    gap: 0.7rem 0.65rem;
    align-items: end;
}

.filter-grid label {
    display: grid;
    gap: 0.4rem;
}

.filter-grid label > span {
    font-size: 0.73rem;
    font-weight: 750;
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.filter-grid .span-2 {
    grid-column: span 1;
}

.filter-panel .form-actions {
    margin-top: 0;
}

.filter-actions {
    grid-column: auto;
    align-self: end;
    justify-content: flex-end;
    margin-top: 0;
    padding-bottom: 0.05rem;
    white-space: nowrap;
}

.filter-actions .ghost-button,
.filter-actions .primary-button {
    min-height: 46px;
    padding-inline: 0.9rem;
}

.audit-filter-grid {
    grid-template-columns: minmax(18rem, 1.75fr) repeat(2, minmax(8.5rem, 0.78fr)) repeat(2, minmax(8.5rem, 0.82fr)) minmax(6.2rem, 0.55fr) auto;
    gap: 0.6rem;
}

.audit-filter-grid .form-control {
    min-height: 40px;
    padding: 0.5rem 0.65rem;
}

.audit-filter-grid .filter-actions {
    gap: 0.55rem;
}

.audit-filter-grid .filter-actions .ghost-button,
.audit-filter-grid .filter-actions .primary-button {
    min-height: 40px;
    padding-inline: 0.8rem;
}

.reports-filter-grid {
    grid-template-columns: minmax(10rem, 0.72fr) minmax(10rem, 0.72fr) minmax(13rem, 1fr) auto;
    gap: 0.6rem;
    align-items: end;
}

.reports-filter-grid label,
.reports-filter-grid .filter-actions {
    min-width: 0;
}

.reports-filter-grid .form-control {
    min-height: 40px;
    padding: 0.5rem 0.65rem;
}

.reports-filter-grid .filter-actions {
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-top: 0;
}

.reports-filter-grid .filter-actions .ghost-button,
.reports-filter-grid .filter-actions .primary-button {
    min-height: 40px;
    padding-inline: 0.8rem;
}

.stats-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1.15rem;
    margin-top: 0.65rem;
    padding: 0 0.1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.stats-line span,
.stats-line a {
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
}

.stats-line strong {
    color: var(--brand);
    font-weight: 900;
}

.stats-line a:hover {
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 0.18rem;
}

.dashboard-stats-panel {
    margin-top: 1rem;
}

.registry-detail-summary {
    margin-top: 1rem;
}

.registry-detail-summary .stats-line {
    margin-top: 0;
}

.signature-summary-line {
    margin: 0 0 0.9rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--line);
}

.workflow-mini-list {
    display: grid;
    gap: 0.65rem;
}

.workflow-mini-list p {
    margin: 0;
    padding: 0.72rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff, #fbf8f0);
    color: var(--muted);
    line-height: 1.45;
}

.workflow-mini-list strong {
    color: var(--brand);
}

.text-success {
    color: var(--success) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.scanner-runtime-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf3;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.scanner-runtime-strip small {
    flex-basis: 100%;
    color: var(--muted);
    font-weight: 700;
}

.scanner-filter-row {
    display: grid;
    grid-template-columns: minmax(18rem, 1fr) auto auto;
    align-items: end;
    gap: 0.7rem 0.75rem;
}

.scanner-filter-row label {
    display: grid;
    gap: 0.4rem;
}

.scanner-filter-row label > span {
    font-size: 0.73rem;
    font-weight: 750;
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.scanner-filter-row .filter-actions {
    grid-column: auto;
}

.scanner-filter-row .scanner-status-tabs {
    margin-top: 0;
}

.compact-ops-panel {
    padding: 0.75rem 0.95rem;
}

.ops-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ops-row .section-kicker {
    margin-bottom: 0.2rem;
}

.ops-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.55rem;
}

.ops-actions .primary-button,
.ops-actions .ghost-button {
    min-height: 36px;
    padding: 0.42rem 0.75rem;
    font-size: 0.88rem;
}

.ops-help {
    margin: 0.55rem 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.settings-two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.8fr);
    gap: 1rem;
    align-items: stretch;
}

.settings-panel {
    display: flex;
    flex-direction: column;
    margin-top: 0;
    min-width: 0;
}

.settings-panel > form,
.settings-panel > .definition-list {
    padding: 0.95rem 1rem 1rem;
}

.settings-panel-alert {
    margin: 0.85rem 1rem 0;
}

.settings-panel .form-grid {
    gap: 0.75rem 0.75rem;
}

.settings-panel .form-actions {
    margin-top: auto;
    padding-top: 0.8rem;
}

.compact-settings-panel > form {
    padding-top: 0.65rem;
}

.compact-settings-panel .form-grid {
    gap: 0.5rem 0.75rem;
}

.compact-settings-panel .form-grid label {
    gap: 0.28rem;
}

.compact-settings-panel .form-control {
    min-height: 38px;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.compact-settings-panel .checkbox-line {
    min-height: 36px;
    align-items: center;
}

.compact-settings-panel .path-picker-row {
    gap: 0.4rem;
}

.compact-settings-panel .form-actions {
    padding-top: 0.65rem;
}

.settings-status-panel .definition-list {
    flex: 1 1 auto;
}

.settings-side-actions {
    display: flex;
    justify-content: flex-start;
    gap: 0.65rem;
    margin-top: auto;
    padding: 0 1rem 1rem;
}

.settings-side-actions .primary-button,
.settings-side-actions .ghost-button {
    min-height: 36px;
    padding: 0.42rem 0.85rem;
}

.forms-filter-row {
    grid-template-columns: minmax(18rem, 1fr) auto;
}

.forms-filter-row .forms-status-tabs {
    margin-top: 1.45rem;
}

.text-danger {
    color: var(--danger) !important;
}

.segmented-control {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
}

.segmented-control button {
    min-height: 40px;
    border: 0;
    border-right: 1px solid var(--line);
    padding: 0.55rem 0.9rem;
    background: transparent;
    color: var(--muted);
    font-weight: 800;
}

.segmented-control button:last-child {
    border-right: 0;
}

.segmented-control button.active {
    background: var(--brand);
    color: #fff;
}

.scanner-status-tabs {
    margin-top: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-summary {
    position: sticky;
    top: 0;
    z-index: 70;
    min-height: var(--table-summary-sticky-height);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.72rem 1rem;
    border-bottom: 1px solid rgba(48, 66, 81, 0.14);
    background: linear-gradient(135deg, #eef6f8, #ffffff);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.standalone-summary {
    position: sticky;
    top: 0;
    z-index: 70;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.table-summary span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.data-table th,
.data-table td {
    position: relative;
    padding: 0.78rem 1rem;
    border-bottom: 1px solid rgba(229, 231, 235, 0.9);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    position: sticky;
    top: calc(var(--table-summary-sticky-height) - 1px);
    z-index: 65;
    background: #eef6f8;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    box-shadow: inset 0 -1px 0 rgba(48, 66, 81, 0.14);
}

.data-table td {
    z-index: 1;
}

.data-panel > .data-table:first-child th,
.record-card .data-table th,
.panel .data-table th {
    top: 0;
}

.data-panel:not(:has(> .table-summary)) > .data-table th {
    top: 0;
}

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

.data-table tbody tr:nth-child(odd):not(.table-section-row) td {
    background-color: var(--row-odd);
}

.data-table tbody tr:nth-child(even):not(.table-section-row) td {
    background-color: var(--row-even);
}

.data-table tbody tr:hover td {
    background: #fef3e5;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03), inset 0 -1px 0 rgba(15, 23, 42, 0.03);
}

.data-table tr.row-highlight td {
    background: #f0faf7;
}

.data-table tr.row-danger td {
    background: #fff1ee;
}

.data-table tr.row-muted td {
    background: var(--surface-soft);
    opacity: 0.65;
}

.data-table .table-section-row td {
    border-bottom: 1px solid var(--line);
    background: #fffaf3;
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.data-table .nested-table-row td {
    padding: 0;
    background: #f7fbfc !important;
}

.nested-table-wrap {
    padding: 0.7rem 0.9rem 0.9rem;
    border-top: 1px solid rgba(48, 66, 81, 0.08);
}

.nested-summary {
    position: static;
    min-height: auto;
    padding: 0.45rem 0.65rem;
    border: 1px solid rgba(48, 66, 81, 0.12);
    border-radius: 10px 10px 0 0;
    box-shadow: none;
}

.compact-nested-table {
    border: 1px solid rgba(48, 66, 81, 0.12);
    border-top: 0;
    background: #fff;
}

.compact-nested-table th {
    position: static;
    top: auto;
}

.compact-nested-table th,
.compact-nested-table td {
    padding: 0.55rem 0.7rem;
}

.data-table td strong {
    display: block;
}

.data-table .table-key-link {
    display: inline;
    font-size: inherit;
    font-weight: 700;
    line-height: inherit;
    white-space: nowrap;
}

.data-table td small {
    color: var(--muted);
}

/* ── Inline badges (override Bootstrap .badge white text) ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.73rem;
    font-weight: 700;
    white-space: nowrap;
    background: #e2e8f0;
    color: #475569;
    border: none;
    line-height: 1.4;
}

.badge-green {
    background: #dcfce7;
    color: #166534;
}

.badge-yellow {
    background: #fef9c3;
    color: #854d0e;
}

.badge-red {
    background: #fee2e2;
    color: #991b1b;
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

.badge-orange {
    background: #ffedd5;
    color: #9a3412;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: .35rem;
    padding: 1.4rem;
    color: var(--muted);
    text-align: center;
    border: 1px dashed rgba(48, 66, 81, .18);
    border-radius: 12px;
    background: rgba(248, 250, 252, .72);
}

.empty-state i {
    color: var(--accent);
    font-size: 1.4rem;
}

.empty-state p {
    margin: 0;
}

.loading-placeholder {
    min-height: 1rem;
    border-radius: 999px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f8fafc 38%, #e2e8f0 63%);
    background-size: 400% 100%;
    animation: loading-shimmer 1.4s ease infinite;
}

@keyframes loading-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

.code-text {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: #f1f5f9;
    color: #334155;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.78rem;
    border: 1px solid #e2e8f0;
}

.compact-detail-table th {
    width: 11rem;
}

.compact-detail-table th,
.compact-detail-table td {
    position: static;
    padding: 0.68rem 0.8rem;
}

.compact-detail-table th {
    background: rgba(233, 243, 245, 0.48);
    box-shadow: none;
}

.list-pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid rgba(199, 208, 214, 0.75);
    border-radius: 0 0 16px 16px;
    background: rgba(250, 250, 250, 0.92);
    color: var(--muted);
    font-size: 0.85rem;
}

.record-grid + .list-pager {
    margin-top: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.list-pager-summary {
    font-weight: 700;
    color: var(--brand);
}

.list-pager-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
}

.list-pager .ghost-button {
    min-height: 34px;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
}

.list-pager .form-control {
    width: auto;
    min-width: 8.75rem;
    min-height: 34px;
    padding-block: 0.35rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.permission-group-list {
    display: grid;
    gap: 0.85rem;
    margin-top: 1rem;
}

.permission-group-card {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem;
    align-items: start;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.permission-group-card > div:first-child {
    display: grid;
    gap: 0.5rem;
}

.permission-group-card strong {
    font-size: 1.25rem;
}

.permission-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.row-link {
    display: inline-block;
    color: var(--brand);
    font-weight: 900;
    text-decoration: none;
}

.row-link:hover {
    text-decoration: underline;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.detail-card {
    min-height: 132px;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 24px rgba(24, 39, 50, 0.055);
}

.detail-card.highlight {
    background:
        radial-gradient(circle at 90% 10%, rgba(255, 157, 107, 0.22), transparent 11rem),
        linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
}

.detail-card span:not(.status-pill),
.detail-card small {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.detail-card.highlight small,
.detail-card.highlight p {
    color: rgba(255, 255, 255, 0.76);
}

.detail-card strong {
    display: block;
    margin: 0.35rem 0 0.15rem;
    font-size: 1.35rem;
}

.detail-card h2 {
    margin: 0.8rem 0 0.3rem;
    font-size: 1.55rem;
}

.lifecycle-panel {
    margin: 1rem 0;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 24px rgba(24, 39, 50, 0.055);
}

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

.lifecycle-step {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 0.65rem;
    align-items: start;
    min-height: 104px;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff, #fbf8f0);
}

.lifecycle-step > span {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #eef3f5;
    color: var(--muted);
    font-weight: 900;
}

.lifecycle-step strong,
.lifecycle-step small {
    display: block;
}

.lifecycle-step small {
    margin-top: 0.25rem;
    color: var(--muted);
    line-height: 1.45;
}

.lifecycle-step.done {
    border-color: rgba(46, 125, 88, 0.28);
    background: #f0fbf5;
}

.lifecycle-step.done > span {
    background: var(--success);
    color: #fff;
}

.lifecycle-step.active {
    border-color: rgba(255, 157, 107, 0.7);
    background: #fff4ea;
    box-shadow: 0 10px 24px rgba(255, 157, 107, 0.14);
}

.lifecycle-step.active > span {
    background: var(--accent);
    color: var(--brand-dark);
}

.lifecycle-note {
    margin-top: 0.9rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    background: var(--surface-soft);
    border-left: 4px solid var(--brand);
}

.lifecycle-note p {
    margin: 0.25rem 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.lifecycle-note.warning {
    border-left-color: var(--warning);
    background: #fff1df;
}

.lifecycle-note.success {
    border-left-color: var(--success);
    background: #f0fbf5;
}

.lifecycle-note.danger {
    border-left-color: var(--danger);
    background: #fff1ee;
}

.checklist-panel {
    margin: 1rem 0;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 24px rgba(24, 39, 50, 0.055);
}

.checklist-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.checklist-item {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 0.75rem;
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-left: 4px solid var(--muted);
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff, #fbf8f0);
}

.checklist-item > span {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #eef3f5;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 900;
}

.checklist-item.done {
    border-left-color: var(--success);
    background: #f0fbf5;
}

.checklist-item.done > span {
    background: var(--success);
    color: #fff;
}

.checklist-item.blocked {
    border-left-color: var(--danger);
    background: #fff1ee;
}

.checklist-item.blocked > span {
    background: var(--danger);
    color: #fff;
}

.checklist-item p {
    margin: 0.25rem 0;
    color: var(--muted);
    line-height: 1.5;
}

.checklist-item small {
    color: var(--muted);
    font-weight: 800;
}

.definition-list {
    display: grid;
    gap: 0.85rem;
    margin: 0;
}

.definition-list dt {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.definition-list dd {
    margin: 0.2rem 0 0;
    font-weight: 700;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bulk-action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    margin: 0.75rem 0;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(255, 157, 107, 0.34);
    border-radius: 8px;
    background: rgba(255, 157, 107, 0.08);
}

.bulk-action-bar strong {
    margin-right: auto;
}

.compact-control {
    min-width: 9rem;
    max-width: 13rem;
    min-height: 36px;
    padding: 0.45rem 0.55rem;
    font-size: 0.86rem;
}

.task-reassign {
    align-items: center;
    margin-top: 0.55rem;
}

.task-reassign .compact-control {
    min-width: 8.5rem;
}

.task-discussion {
    display: grid;
    gap: 0.75rem;
    min-width: 24rem;
    margin-top: 0.75rem;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff, #fbf8f0);
}

.comment-list {
    display: grid;
    gap: 0.65rem;
}

.comment-item {
    padding: 0.75rem;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--line);
}

.comment-item > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.comment-item p {
    margin-bottom: 0;
    color: var(--ink);
    line-height: 1.5;
    white-space: pre-wrap;
}

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

.comment-form .textarea-control {
    min-height: 86px;
}

.hash-text {
    max-width: 100%;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.82rem;
}

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

.record-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.content-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.record-card {
    overflow-x: auto;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 24px rgba(24, 39, 50, 0.055);
}

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

.record-card h2 {
    font-size: 1rem;
}

.record-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 1rem;
    margin: 0;
}

.record-card dt {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.record-card dd {
    margin: 0.15rem 0 0;
    font-weight: 700;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.form-shell {
    max-width: 980px;
    padding: 1.25rem;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

/* Override Bootstrap's opaque .modal-backdrop — make it a centering overlay */
.modal-backdrop {
    position: fixed !important;
    inset: 58px 0 0 !important;
    z-index: 1000 !important;
    display: grid !important;
    place-items: center !important;
    padding: 1.5rem !important;
    overflow: auto !important;
    background: rgba(20, 24, 28, 0.48) !important;
    width: auto !important;
    height: auto !important;
    opacity: 1 !important;
}

.modal-panel {
    width: min(100%, 560px);
    background: #fbf8f0;
    border-radius: 8px;
    border: 1px solid rgba(48, 66, 81, 0.18);
    box-shadow: 0 24px 54px rgba(15, 23, 42, 0.28);
    overflow: hidden;
    z-index: 1001;
    position: relative;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 0.85rem;
    border-bottom: 1px solid rgba(48, 66, 81, 0.12);
    background: #fbf8f0;
    gap: 1rem;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 750;
}

.modal-footer {
    display: flex;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(48, 66, 81, 0.12);
    background: #f7f3ea;
}

.modal-body {
    padding: 1rem;
    overflow-y: auto;
}

.modal-backdrop-panel {
    position: fixed;
    inset: 58px 0 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    overflow: auto;
    background: rgba(20, 24, 28, 0.48);
}

.modal-card {
    width: min(100%, 560px);
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(48, 66, 81, 0.18);
    border-radius: 8px;
    background: #fbf8f0;
    box-shadow: 0 24px 54px rgba(15, 23, 42, 0.28);
}

.modal-card > .panel-heading {
    align-items: center;
    margin-bottom: 0;
    padding: 1rem 1rem 0.85rem;
    border-bottom: 1px solid rgba(48, 66, 81, 0.12);
    background: #fbf8f0;
}

.modal-card > .panel-heading .section-kicker {
    margin-bottom: 0.25rem;
    color: #d96c42;
    letter-spacing: 0.04em;
}

.modal-card > .panel-heading h2 {
    font-size: 1.1rem;
    font-weight: 750;
}

.modal-card > .panel-heading p:not(.section-kicker) {
    margin-top: 0.2rem;
    font-size: 0.88rem;
}

.modal-card > form,
.modal-card > .form-grid,
.modal-card > .access-profile-strip,
.modal-card > .permission-group-list {
    padding: 1rem;
}

.modal-card form > .form-grid {
    gap: 0.8rem;
}

.modal-card .form-control {
    min-height: 38px;
    border-radius: 8px;
    padding: 0.48rem 0.65rem;
}

.modal-card .form-grid label > span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.modal-card form > .form-actions {
    margin: 1rem -1rem -1rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(48, 66, 81, 0.12);
    background: #f7f3ea;
}

.modal-card .ghost-button,
.modal-card .primary-button {
    min-height: 36px;
    border-radius: 999px;
    padding: 0.42rem 0.85rem;
    box-shadow: none;
}

.modal-card .primary-button {
    background: rgba(255, 157, 107, 0.12);
    border-color: rgba(255, 157, 107, 0.5);
}

.modal-card .icon-button {
    width: 32px;
    height: 32px;
    border-color: rgba(48, 66, 81, 0.16);
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.modal-card.narrow-modal {
    width: min(100%, 520px);
}

.modal-card.wide-modal {
    width: min(100%, 760px);
}

.workflow-steps-modal {
    width: min(100%, 1040px);
}

.workflow-modal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(48, 66, 81, 0.12);
    background: #fffaf3;
}

.workflow-modal-toolbar .stats-line {
    margin-top: 0;
    padding: 0;
}

.workflow-steps-table {
    max-height: min(58vh, 520px);
    overflow: auto;
    padding: 1rem;
}

.workflow-steps-table .compact-nested-table {
    border-top: 1px solid rgba(48, 66, 81, 0.12);
}

.access-profile-modal {
    width: min(100%, 860px);
}

.access-profile-modal .panel-heading {
    align-items: center;
    margin-bottom: 0.7rem;
}

.access-profile-modal h2 {
    font-size: 1.15rem;
}

.access-profile-modal .panel-heading p:not(.section-kicker) {
    margin-top: 0.15rem;
    font-size: 0.9rem;
}

.access-profile-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: linear-gradient(135deg, #eef6f8, #ffffff);
    color: var(--muted);
    font-size: 0.88rem;
}

.access-profile-strip strong {
    color: var(--ink);
}

.access-profile-modal .permission-group-list {
    gap: 0.45rem;
    margin-top: 0;
    max-height: min(58vh, 560px);
    overflow: auto;
    padding: 0 1rem 1rem;
}

.access-profile-modal .permission-group-card {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.6rem 0.7rem;
    border-radius: 10px;
}

.access-profile-modal .permission-group-card > div:first-child {
    gap: 0.3rem;
}

.access-profile-modal .permission-group-card strong {
    font-size: 1rem;
}

.access-profile-modal .status-pill {
    min-height: 24px;
    padding: 0.18rem 0.5rem;
    font-size: 0.72rem;
}

.access-profile-modal .permission-chip-list {
    gap: 0.3rem;
}

.document-create-shell {
    max-width: 1180px;
    margin: 1rem auto 0;
    padding: 1.1rem;
}

.create-workflow-shell {
    max-width: 1180px;
    margin: 1rem auto 0;
    padding: 1.1rem;
}

.document-create-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1rem;
    align-items: stretch;
}

.create-workflow-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1rem;
    align-items: stretch;
}

.document-create-main {
    min-width: 0;
}

.create-workflow-main {
    min-width: 0;
}

.document-create-aside {
    padding: 1rem;
    border: 1px solid rgba(48, 66, 81, 0.14);
    border-radius: 14px;
    background: linear-gradient(135deg, #fffaf3, rgba(233, 243, 245, 0.86));
}

.create-workflow-aside {
    padding: 1rem;
    border: 1px solid rgba(48, 66, 81, 0.14);
    border-radius: 14px;
    background: linear-gradient(135deg, #fffaf3, rgba(233, 243, 245, 0.86));
}

.document-create-aside ul {
    display: grid;
    gap: 0.65rem;
    margin: 0;
    padding-left: 1.1rem;
    color: var(--muted);
    line-height: 1.45;
}

.create-workflow-aside ul {
    display: grid;
    gap: 0.65rem;
    margin: 0;
    padding-left: 1.1rem;
    color: var(--muted);
    line-height: 1.45;
}

.intake-progress-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .6rem;
    margin: 0 0 1rem;
}

.intake-progress-step {
    min-width: 0;
    padding: .7rem .75rem;
    border: 1px solid rgba(48, 66, 81, .13);
    border-radius: 10px;
    background: rgba(48, 66, 81, .025);
}

.intake-progress-step i,
.intake-progress-step span,
.intake-progress-step small {
    display: block;
}

.intake-progress-step i {
    color: var(--muted);
    font-size: 1rem;
}

.intake-progress-step span {
    margin-top: .25rem;
    overflow: hidden;
    color: var(--ink);
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.intake-progress-step small {
    margin-top: .1rem;
    overflow: hidden;
    color: var(--muted);
    font-size: .76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.intake-progress-step.current {
    border-color: rgba(25, 105, 122, .28);
    background: rgba(25, 105, 122, .07);
}

.intake-progress-step.current i { color: var(--accent); }
.intake-progress-step.done i { color: #23845b; }
.intake-progress-step.upcoming { opacity: .72; }

.intake-choice-card {
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    font-weight: 600;
}

.segmented-choice {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
    padding: .25rem;
    border: 1px solid rgba(48, 66, 81, .14);
    border-radius: 10px;
    background: #fff;
}

.segmented-choice button {
    min-height: 2.4rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 800;
}

.segmented-choice button.active {
    background: var(--accent);
    color: #fff;
}

.intake-readiness-card {
    display: grid;
    gap: .25rem;
    margin-bottom: .75rem;
    padding: .75rem;
    border: 1px solid rgba(25, 105, 122, .22);
    border-radius: 10px;
    background: rgba(25, 105, 122, .07);
}

.intake-readiness-card strong { color: var(--ink); }
.intake-readiness-card span { color: var(--muted); font-size: .82rem; line-height: 1.4; }
.intake-readiness-card.done { border-color: rgba(35, 132, 91, .24); background: rgba(35, 132, 91, .08); }
.intake-readiness-card.warning { border-color: rgba(190, 120, 20, .24); background: rgba(246, 181, 69, .12); }

.post-save-action-card {
    display: flex;
    gap: .65rem;
    margin-bottom: .85rem;
    padding: .75rem;
    border: 1px solid rgba(48, 66, 81, .13);
    border-radius: 10px;
    background: rgba(255, 255, 255, .68);
}

.post-save-action-card i {
    color: var(--accent);
    font-size: 1.1rem;
}

.post-save-action-card div {
    display: grid;
    gap: .15rem;
}

.post-save-action-card strong {
    color: var(--ink);
}

.post-save-action-card span {
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.4;
}

.post-save-action-card.upload-next-action {
    margin-bottom: 1rem;
}

.create-workflow-aside .intake-checklist {
    padding-left: 0;
    list-style: none;
}

.intake-checklist li {
    display: flex;
    align-items: flex-start;
    gap: .45rem;
}

.intake-checklist i {
    margin-top: .15rem;
    color: var(--accent);
    font-size: .72rem;
}

.duplicate-suggestion-list {
    display: grid;
    gap: .45rem;
}

.duplicate-suggestion-list a {
    display: grid;
    gap: .1rem;
    padding: .6rem;
    border: 1px solid rgba(48, 66, 81, .12);
    border-radius: 9px;
    background: rgba(255, 255, 255, .72);
    color: inherit;
    text-decoration: none;
}

.duplicate-suggestion-list span,
.duplicate-suggestion-list small {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.intake-recommendation-list {
    display: grid;
    gap: .45rem;
}

.intake-recommendation-list > div {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    padding: .6rem;
    border: 1px solid rgba(48, 66, 81, .12);
    border-radius: 9px;
    background: rgba(255, 255, 255, .7);
}

.intake-recommendation-list i {
    margin-top: .1rem;
    color: var(--accent);
}

.intake-recommendation-list span {
    display: grid;
    gap: .08rem;
    min-width: 0;
}

.intake-recommendation-list small {
    color: var(--muted);
    font-size: .75rem;
    line-height: 1.35;
}

.intake-suggestion-button {
    margin-top: .55rem;
}

.upload-dropzone {
    padding: 0.85rem;
    border: 1px dashed rgba(255, 157, 107, 0.75);
    border-radius: 14px;
    background: #fffaf3;
}

.auth-page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-page-header {
    background: var(--brand);
    padding: 0.85rem 1.5rem;
}

.auth-page-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.auth-page-brand-text {
    font-weight: 800;
    font-size: 0.95rem;
    color: #ffffff;
}

.auth-page-brand-text span {
    color: var(--accent);
}

.auth-page-main {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 2rem;
    background:
        radial-gradient(circle at top left, rgba(255, 157, 107, 0.12), transparent 38rem),
        radial-gradient(circle at bottom right, rgba(233, 243, 245, 0.78), transparent 38rem),
        var(--cream);
}

.auth-shell {
    width: 100%;
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(100%, 460px);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.5rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    font-size: 2rem;
}

h1:focus, h2:focus, h3:focus, h4:focus, h5:focus, h6:focus {
    outline: none;
}

.auth-card p {
    color: var(--muted);
    line-height: 1.6;
}

.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-form label {
    display: grid;
    gap: 0.4rem;
}

.auth-form label > span {
    font-size: 0.84rem;
    font-weight: 800;
}

.auth-demo {
    display: grid;
    gap: 0.35rem;
    margin-top: 1.25rem;
    border-radius: 8px;
    padding: 0.9rem;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 0.86rem;
}

.auth-demo strong {
    color: var(--ink);
}

.ms-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.6rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #1f2937;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.ms-login-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
}

/* ── Document preview modal ─────────────────────────────────────────────── */
.preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.preview-panel {
    background: #fff;
    border-radius: 8px;
    width: min(95vw, 1080px);
    height: min(92vh, 920px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
    flex-shrink: 0;
}

.preview-filename {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.preview-body {
    flex: 1;
    overflow: hidden;
    background: #525659;
}

.preview-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.preview-body img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #525659;
}

/* ── Calendar ───────────────────────────────────────────────────────────── */
.cal-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.cal-nav h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
    flex: 1;
    text-align: center;
    text-transform: capitalize;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-left: 1px solid var(--line);
    border-top: 1px solid var(--line);
}

.cal-header-cell {
    padding: 0.45rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    text-align: center;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cal-cell {
    min-height: 100px;
    padding: 0.35rem 0.4rem;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    transition: background 0.1s;
}

.cal-cell:not(.cal-cell-empty):hover {
    background: var(--surface-soft);
}

.cal-cell-empty {
    background: var(--surface-soft);
    opacity: 0.5;
    cursor: default;
}

.cal-selected {
    background: #f0f9ff !important;
}

.cal-today {
    background: #fffbf5;
}

.cal-day-num {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 0.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
}

.cal-today .cal-day-num {
    background: var(--accent);
    color: #fff;
}

/* Task detail modal — redesigned layout */
.task-props-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    padding: 0.6rem 1rem;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--line);
}

.task-meta-chip {
    font-size: 0.82rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.task-completion-note {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    padding: 0.5rem 1rem;
    background: #fffbf3;
    border-bottom: 1px solid var(--line);
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.task-completion-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.task-action-bar {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

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

.task-note-input {
    flex: 1;
    min-width: 140px;
}

.task-reject-btn {
    color: var(--danger);
    border-color: rgba(189, 58, 58, .3);
    margin-left: auto;
}

.task-reject-btn:hover {
    background: rgba(189, 58, 58, .06);
    border-color: rgba(189, 58, 58, .55);
}

.task-reject-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--danger);
    margin: 0 0 0.4rem;
}

.task-btn-danger {
    background: rgba(189, 58, 58, .08);
    border-color: rgba(189, 58, 58, .4);
    color: var(--danger);
}

.task-btn-danger:hover {
    background: rgba(189, 58, 58, .15);
}

.task-accordion {
    border-bottom: 1px solid var(--line);
}

.task-accordion-summary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

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

.task-accordion-chevron {
    margin-left: auto;
    transition: transform 0.18s ease;
    font-size: 0.7rem;
}

details[open] .task-accordion-chevron {
    transform: rotate(180deg);
}

.task-accordion-body {
    padding: 0.75rem 1rem 1rem;
}

.task-section-kicker {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem;
}

.cal-chip {
    display: block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.71rem;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.cal-chip-task { background: #dbeafe; color: #1e40af; }
.cal-chip-registry { background: #dcfce7; color: #15803d; }
.cal-chip-overdue { background: #fee2e2; color: #991b1b; }

.cal-chip-more {
    font-size: 0.68rem;
    color: var(--accent);
    padding-left: 5px;
    font-weight: 600;
}

.cal-legend {
    display: flex;
    gap: 1.25rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.cal-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

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

.form-grid label {
    display: grid;
    gap: 0.4rem;
    margin: 0;
}

.form-grid label > span {
    color: var(--ink);
    font-size: 0.84rem;
    font-weight: 800;
}

.form-grid .span-2 {
    grid-column: 1 / -1;
}

.checkbox-line {
    display: flex !important;
    align-items: center;
    gap: 0.6rem !important;
    min-height: 44px;
}

.checkbox-line input {
    width: 18px;
    height: 18px;
}

.toggle-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 44px;
    padding: 0.35rem 0;
}

.toggle-field > span {
    color: var(--ink);
    font-size: 0.84rem;
    font-weight: 800;
}

.form-control {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.65rem 0.8rem;
    color: var(--ink);
    background: #fff;
    font: inherit;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.form-control:focus {
    outline: none;
    border-color: rgba(255, 157, 107, 0.8);
    box-shadow: 0 0 0 4px rgba(255, 157, 107, 0.16);
}

.mt-2 {
    margin-top: 0.5rem;
}

.path-picker-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.5rem;
    align-items: center;
}

.path-picker-panel {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.6rem;
    padding: 0.65rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf3;
}

.path-picker-option {
    display: grid;
    gap: 0.2rem;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    color: var(--ink);
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.path-picker-option:hover {
    border-color: rgba(255, 157, 107, 0.7);
    background: rgba(255, 157, 107, 0.08);
}

.path-picker-option small {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.textarea-control {
    min-height: 116px;
    resize: vertical;
}

.manual-textarea {
    min-height: 260px;
    resize: vertical;
    line-height: 1.55;
}

.form-actions.align-end {
    align-self: end;
    margin-top: 0;
}

.file-input {
    width: 100%;
    min-height: 48px;
    border: 1px solid rgba(48, 66, 81, 0.14);
    border-radius: 10px;
    padding: 0.7rem;
    background: #fff;
}

.file-note {
    color: var(--muted);
    font-weight: 700;
}

.validation-message,
.validation-errors {
    color: var(--danger);
    font-size: 0.84rem;
}

.validation-errors {
    margin-bottom: 1rem;
}

.form-alert {
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-weight: 700;
}

.form-alert.danger {
    color: var(--danger);
    background: #ffe9e6;
}

.form-alert.success {
    color: var(--success);
    background: #e5f6ee;
}

.form-alert.info {
    color: var(--brand);
    background: #e7f2f5;
}

.form-alert.warning {
    color: var(--warning);
    background: #fff4d6;
}

.duplicate-decision-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .85rem;
    margin-bottom: 1rem;
    padding: .75rem .85rem;
    border: 1px solid rgba(190, 120, 20, .24);
    border-radius: 10px;
    background: #fff4d6;
    color: #8a5a0a;
}

.duplicate-decision-alert > div:first-child {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    min-width: 0;
}

.duplicate-decision-alert i {
    margin-top: .1rem;
}

.duplicate-decision-alert span {
    display: grid;
    gap: .08rem;
}

.duplicate-decision-alert strong {
    color: #7c4c06;
}

.duplicate-decision-alert small {
    color: #8a5a0a;
    line-height: 1.35;
}

.registry-next-action {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .38rem .55rem;
    border: 1px solid rgba(48, 66, 81, .13);
    border-radius: 8px;
    background: rgba(48, 66, 81, .035);
    color: var(--ink);
    font-size: .78rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.registry-next-action.current {
    border-color: rgba(25, 105, 122, .28);
    background: rgba(25, 105, 122, .08);
    color: var(--accent);
}

.registry-next-action.attention {
    border-color: rgba(190, 120, 20, .26);
    background: rgba(246, 181, 69, .13);
    color: #8a5a0a;
}

.registry-next-action.done {
    border-color: rgba(35, 132, 91, .24);
    background: rgba(35, 132, 91, .08);
    color: #23845b;
}

.registry-next-action-note {
    display: block;
    margin-top: .25rem;
    color: var(--muted);
    font-size: .73rem;
    white-space: nowrap;
}

.workflow-context-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .9rem;
    max-width: 1180px;
    margin: .75rem auto 0;
    padding: .85rem 1rem;
    border: 1px solid rgba(25, 105, 122, .16);
    border-radius: 12px;
    background: rgba(25, 105, 122, .055);
}

.workflow-context-strip > div {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    min-width: 0;
}

.workflow-context-icon {
    display: inline-grid;
    flex: 0 0 auto;
    width: 2.1rem;
    height: 2.1rem;
    place-items: center;
    border-radius: 10px;
    background: #fff;
    color: var(--accent);
}

.workflow-context-strip strong {
    display: block;
    color: var(--ink);
    font-size: .9rem;
}

.workflow-context-strip p {
    margin: .15rem 0 0;
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.4;
}

.workflow-repair-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .85rem;
    margin: .75rem 0 1rem;
    padding: .78rem .85rem;
    border: 1px solid rgba(48, 66, 81, .13);
    border-radius: 10px;
    background: rgba(48, 66, 81, .035);
}

.workflow-repair-card.danger {
    border-color: rgba(189, 58, 58, .24);
    background: rgba(255, 233, 230, .72);
}

.workflow-repair-card.warning {
    border-color: rgba(190, 120, 20, .24);
    background: rgba(255, 244, 214, .78);
}

.workflow-repair-card > div {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    min-width: 0;
}

.workflow-repair-card i {
    margin-top: .1rem;
    color: var(--accent);
}

.workflow-repair-card.danger i { color: var(--danger); }
.workflow-repair-card.warning i { color: var(--warning); }

.workflow-repair-card span {
    display: grid;
    gap: .1rem;
}

.workflow-repair-card strong {
    color: var(--ink);
}

.workflow-repair-card small {
    color: var(--muted);
    line-height: 1.35;
}

.search-test-grid {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.audit-filter-grid {
    grid-template-columns: minmax(14rem, 1.35fr) repeat(2, minmax(7rem, 0.72fr)) repeat(2, minmax(7.6rem, 0.78fr)) minmax(5.2rem, 0.45fr) auto;
    align-items: end;
}

.audit-filter-grid label,
.audit-filter-grid .filter-actions {
    min-width: 0;
}

.audit-filter-grid .filter-actions {
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-top: 0;
}

.reports-filter-grid {
    grid-template-columns: minmax(10rem, 0.72fr) minmax(10rem, 0.72fr) minmax(13rem, 1fr) auto;
    align-items: end;
}

.reports-filter-grid label,
.reports-filter-grid .filter-actions {
    min-width: 0;
}

.reports-filter-grid .filter-actions {
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-top: 0;
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    margin-bottom: 1rem;
    padding: 1.05rem 1.2rem;
    border: 1px solid var(--border-subtle);
    border-radius: 16px 16px 0 0;
    background:
        radial-gradient(circle at 6% 0%, rgba(255, 157, 107, 0.18), transparent 18rem),
        linear-gradient(135deg, #fffaf3, rgba(233, 243, 245, 0.88));
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.page-header::before {
    content: "D";
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    align-self: flex-start;
    margin-top: 0.1rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), #ffd9a6);
    color: var(--brand-dark);
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(255, 157, 107, 0.26);
}

.page-header > div {
    min-width: 0;
    flex: 1 1 auto;
}

.page-header > a,
.page-header > button,
.page-header > .top-actions,
.page-header > .inline-actions,
.page-header > .form-actions {
    margin-left: auto;
    flex: 0 0 auto;
}

.page-header h1 {
    margin: 0 0 0.25rem;
    font-size: 1.55rem;
    font-weight: 750;
    color: var(--brand);
}

.page-header p {
    max-width: 780px;
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.45;
}

.page-header .source-note {
    margin-top: 0.6rem;
    color: var(--green);
    font-weight: 800;
}

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

.feature-card {
    padding: 1.2rem;
}

.feature-card span {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 0.9rem;
    border-radius: 8px;
    background: #e7f2f5;
    color: var(--brand);
    font-weight: 900;
}

.blazor-error-boundary {
    background: #bd3a3a;
    color: #fff;
    padding: 1rem;
}

@media (max-width: 1120px) {
    .metric-grid,
    .feature-grid,
    .workflow-map {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workspace-grid,
    .dashboard-hero,
    .detail-grid,
    .lifecycle-steps,
    .checklist-grid {
        grid-template-columns: 1fr;
    }

    .document-create-layout,
    .create-workflow-layout {
        grid-template-columns: 1fr;
    }

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

    .workflow-context-strip {
        align-items: stretch;
        flex-direction: column;
    }

    .workflow-context-strip .ghost-button {
        justify-content: center;
    }

    .duplicate-decision-alert {
        align-items: stretch;
        flex-direction: column;
    }

    .workflow-repair-card {
        align-items: stretch;
        flex-direction: column;
    }

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

    .scanner-filter-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .scanner-filter-row .filter-actions {
        justify-content: flex-start;
    }

    .forms-filter-row .forms-status-tabs {
        margin-top: 0;
    }

    .dashboard-kpi-grid,
    .case-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-analytics-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        grid-column: 1 / -1;
    }

    .data-panel {
        overflow-x: auto;
        scrollbar-width: thin;
    }

    .data-panel::-webkit-scrollbar {
        height: 8px;
    }

    .data-panel::-webkit-scrollbar-thumb {
        border-radius: 999px;
        background: rgba(48, 66, 81, 0.24);
    }

    .data-table {
        min-width: 920px;
    }
}

@media (max-width: 920px) {
    .app-topbar-actions {
        gap: 0.45rem !important;
    }

    .topbar-action span,
    .topbar-primary span {
        display: none;
    }
}

@media (max-width: 760px) {
    .desktop-toggle {
        display: none;
    }

    .mobile-toggle {
        display: inline-flex;
    }

    .app-sidebar-shell,
    .nav-collapsed .app-sidebar-shell {
        position: fixed;
        inset: 58px auto 0 0;
        width: min(86vw, 318px);
        height: calc(100vh - 58px);
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        z-index: 8;
    }

    .mobile-nav-open .app-sidebar-shell {
        transform: translateX(0);
    }

    .pro-sidebar,
    .pro-sidebar.is-collapsed {
        width: 100%;
        max-height: calc(100vh - 58px);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 58px 0 0;
        z-index: 7;
        border: 0;
        background: rgba(8, 24, 43, 0.52);
    }

    .main-pane {
        height: calc(100vh - 58px);
    }

    h1 {
        font-size: 2rem;
    }

    .dashboard-hero {
        padding: 1.2rem;
    }

    .metric-grid,
    .module-grid,
    .feature-grid,
    .workflow-map,
    .record-grid,
    .content-split,
    .dashboard-kpi-grid,
    .case-strip {
        grid-template-columns: 1fr;
    }

    .dashboard-command {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-segment {
        width: 100%;
    }

    .dashboard-segment a {
        flex: 1 1 0;
        justify-content: center;
    }

    .pipeline-row,
    .mix-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .case-row,
    .task-focus-item,
    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .task-focus-item {
        display: flex;
    }

    .task-focus-meta {
        justify-content: flex-start;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .filter-grid .span-2 {
        grid-column: auto;
    }

    .filter-actions {
        grid-column: auto;
        justify-content: stretch;
    }

    .filter-actions .ghost-button,
    .filter-actions .primary-button {
        width: 100%;
    }

    .scanner-filter-row .filter-actions,
    .scanner-filter-row .scanner-status-tabs,
    .forms-filter-row .forms-status-tabs {
        width: 100%;
    }

    .scanner-filter-row .scanner-status-tabs,
    .forms-filter-row .forms-status-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        border-radius: 12px;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .data-table {
        min-width: 760px;
    }

    .list-pager {
        align-items: stretch;
        flex-direction: column;
    }

    .list-pager-controls {
        justify-content: space-between;
    }

    .list-pager .form-control {
        flex: 1 1 100%;
        width: 100%;
    }

    .task-discussion {
        min-width: 18rem;
    }
}

/* ── Dashboard charts ──────────────────────────────────────────────── */

.status-donut {
    width: 148px;
    height: 148px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(48, 66, 81, 0.1), 0 10px 24px rgba(15, 23, 42, 0.08);
    margin: 0.6rem auto 0.85rem;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 0.9rem;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.chart-legend-item strong {
    color: var(--ink);
    font-weight: 800;
}

.chart-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 auto;
}

/* Unified process workspace: one primary action, visible readiness, compact lifecycle. */
.process-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(17rem, 0.75fr);
    gap: 1.1rem;
    margin: 1rem 0 1.25rem;
    padding: 1.15rem;
    border: 1px solid rgba(48, 66, 81, 0.12);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(244,248,250,.96));
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
}

.process-workspace-main { min-width: 0; }

.process-workspace-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.process-workspace-heading h2 { margin: 0.15rem 0 0.3rem; }
.process-workspace-heading p:last-child { margin: 0; color: var(--muted); max-width: 52rem; }

.process-workspace-progress {
    display: grid;
    gap: 0.3rem;
    min-width: 6rem;
    text-align: right;
    color: var(--ink);
}

.process-workspace-progress span {
    display: block;
    width: 6rem;
    height: 6px;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(48, 66, 81, 0.12);
}

.process-workspace-progress i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.process-primary-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid rgba(25, 105, 122, 0.22);
    border-radius: 14px;
    background: rgba(25, 105, 122, 0.07);
}

.process-primary-action.warning { border-color: rgba(190, 120, 20, .28); background: rgba(246, 181, 69, .10); }
.process-primary-action p { margin: 0.25rem 0 0; color: var(--muted); }
.process-primary-action .primary-button { flex: 0 0 auto; }

.process-waiting-state {
    display: flex;
    gap: .65rem;
    align-items: center;
    margin-top: 1rem;
    padding: .9rem 1rem;
    border-radius: 14px;
    background: rgba(24, 135, 84, .08);
    color: #176b49;
    font-weight: 700;
}

.process-blockers {
    display: grid;
    gap: .5rem;
    margin-top: .8rem;
    padding: .8rem 1rem;
    border-left: 4px solid #d39224;
    border-radius: 10px;
    background: rgba(246, 181, 69, .09);
}

.process-blocker { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); }
.process-blocker b { color: var(--ink); }
.process-blocker a, .process-secondary-actions a, .process-stepper a { color: var(--accent); font-weight: 800; }

.process-secondary-actions { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin-top: .8rem; font-size: .88rem; }
.process-secondary-actions span { color: var(--muted); }

.process-stepper {
    display: grid;
    align-content: start;
    gap: 0;
    margin: 0;
    padding: .25rem 0;
    list-style: none;
}

.process-stepper li { position: relative; display: grid; grid-template-columns: 1.35rem 1fr; gap: .7rem; min-height: 3.4rem; color: var(--muted); }
.process-stepper li:not(:last-child)::after { content: ""; position: absolute; left: .61rem; top: 1.35rem; bottom: 0; width: 2px; background: rgba(48, 66, 81, .14); }
.process-step-marker { z-index: 1; display: grid; place-items: center; width: 1.35rem; height: 1.35rem; border: 2px solid rgba(48, 66, 81, .22); border-radius: 50%; background: #fff; font-size: .65rem; }
.process-stepper strong, .process-stepper small { display: block; }
.process-stepper small { margin-top: .12rem; }
.process-stepper li.done .process-step-marker { border-color: #23845b; background: #23845b; color: #fff; }
.process-stepper li.done:not(:last-child)::after { background: #7ab99c; }
.process-stepper li.current { color: var(--ink); }
.process-stepper li.current .process-step-marker { border: 4px solid var(--accent); }
.process-stepper li.blocked { color: #8f5a0c; }
.process-stepper li.blocked .process-step-marker { border-color: #d39224; background: #fff5dc; }

@media (max-width: 900px) {
    .process-workspace { grid-template-columns: 1fr; }
    .process-stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
    .process-stepper li { min-height: auto; }
    .process-stepper li::after { display: none; }
}

@media (max-width: 620px) {
    .process-workspace-heading, .process-primary-action, .process-blocker { align-items: stretch; flex-direction: column; }
    .process-workspace-progress { text-align: left; }
    .process-primary-action .primary-button { width: 100%; }
    .process-stepper { grid-template-columns: 1fr; }
}

/* Case-local task execution keeps normal work inside the case context. */
.task-inline-workspace > div { min-width: 0; width: 100%; }

.inline-task-actions {
    margin-top: .7rem;
    border: 1px solid rgba(25, 105, 122, .18);
    border-radius: 12px;
    background: rgba(25, 105, 122, .045);
}

.inline-task-actions > summary {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .72rem .85rem;
    cursor: pointer;
    color: var(--accent);
    font-size: .88rem;
    font-weight: 800;
    list-style: none;
}

.inline-task-actions > summary::-webkit-details-marker { display: none; }
.inline-task-action-body { display: grid; gap: .7rem; padding: 0 .85rem .85rem; }
.inline-task-action-body label { display: grid; gap: .3rem; font-size: .82rem; font-weight: 700; }
.inline-task-action-body textarea { min-height: 4.5rem; resize: vertical; }
.inline-task-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }

.inline-task-exception {
    padding-top: .55rem;
    border-top: 1px solid rgba(48, 66, 81, .12);
}

.inline-task-exception > summary {
    cursor: pointer;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}

.inline-task-exception[open] > summary { margin-bottom: .65rem; }
.inline-task-exception .task-reject-btn { margin-top: .55rem; }

.task-admin-actions {
    border-top-style: dashed;
}

.task-admin-actions > summary {
    color: var(--ink);
}

.task-admin-actions .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
}

.checklist-action-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: .55rem;
    color: var(--accent);
    font-size: .82rem;
    font-weight: 800;
    text-decoration: none;
}

.checklist-action-link:hover { text-decoration: underline; }

.guided-closure-panel { margin-top: 1rem; }

.workspace-section-nav {
    position: sticky;
    top: .5rem;
    z-index: 18;
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: .65rem 0 1rem;
    padding: .55rem .65rem;
    border: 1px solid rgba(48, 66, 81, .12);
    border-radius: 14px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .07);
    backdrop-filter: blur(12px);
}

.workspace-section-nav-label { padding-left: .25rem; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.workspace-section-nav > div { display: flex; flex: 1; gap: .35rem; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.workspace-section-nav a { display: grid; grid-template-columns: auto auto; align-items: center; gap: .05rem .4rem; min-width: max-content; padding: .45rem .6rem; border-radius: 9px; color: var(--muted); text-decoration: none; }
.workspace-section-nav a i { grid-row: 1 / span 2; }
.workspace-section-nav a span { color: var(--ink); font-size: .8rem; font-weight: 800; }
.workspace-section-nav a small { font-size: .68rem; }
.workspace-section-nav a:hover { background: rgba(25, 105, 122, .07); }
.workspace-section-nav a.current { background: var(--accent); color: #fff; }
.workspace-section-nav a.current span, .workspace-section-nav a.current small { color: #fff; }
.workspace-section-nav a.attention { background: rgba(246, 181, 69, .1); }
.workspace-section-nav a.attention i { color: #ad6c0e; }
.workspace-section-nav a.done i { color: #23845b; }

#checklist-dosar,
#documente-dosar,
#sarcini-dosar,
#legaturi-dosar,
#registratura-iesire,
#inchidere-dosar,
#arhivare-dosar,
#evidenta-registratura,
#audit-registratura,
#creare-sarcina,
#creare-dosar,
#semnare-iesire,
#expediere-iesire,
.task-inline-workspace { scroll-margin-top: 5.5rem; }

.progressive-disclosure {
    margin-top: .8rem;
    border: 1px solid rgba(48, 66, 81, .14);
    border-radius: 12px;
    background: rgba(48, 66, 81, .025);
}

.progressive-disclosure > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem .85rem;
    cursor: pointer;
    list-style: none;
}

.progressive-disclosure > summary::-webkit-details-marker { display: none; }
.progressive-disclosure > summary > span { display: inline-flex; align-items: center; gap: .45rem; color: var(--ink); font-weight: 800; }
.progressive-disclosure > summary > small { color: var(--muted); }
.progressive-disclosure[open] > summary { border-bottom: 1px solid rgba(48, 66, 81, .11); background: rgba(25, 105, 122, .045); }
.progressive-disclosure-body { padding: .85rem; }
.progressive-disclosure-body > .sub-panel:first-child { margin-top: 0; }
.progressive-disclosure.compact { margin-top: .7rem; }

.existing-outgoing-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: .75rem;
    padding: .8rem;
    border-radius: 11px;
    background: rgba(35, 132, 91, .065);
}

.existing-outgoing-summary div { min-width: 0; }
.existing-outgoing-summary strong, .existing-outgoing-summary div span { display: block; }
.existing-outgoing-summary div span { overflow: hidden; margin-top: .15rem; color: var(--muted); font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }

.evidence-disclosure { border-top: 1px solid rgba(48, 66, 81, .11); }
.evidence-disclosure > summary { display: flex; justify-content: space-between; gap: .75rem; padding: .7rem 0; color: var(--accent); cursor: pointer; font-size: .82rem; font-weight: 800; }
.evidence-disclosure > summary span { color: var(--muted); font-weight: 600; }
.evidence-disclosure-body { padding-top: .55rem; }

@media (max-width: 700px) {
    .workspace-section-nav { align-items: stretch; flex-direction: column; gap: .3rem; }
    .workspace-section-nav-label { padding-left: .55rem; }
    .existing-outgoing-summary { grid-template-columns: 1fr auto; }
    .existing-outgoing-summary .ghost-button { grid-column: 1 / -1; }
    .progressive-disclosure > summary { align-items: flex-start; flex-direction: column; gap: .2rem; }
    #checklist-dosar,
    #documente-dosar,
    #sarcini-dosar,
    #legaturi-dosar,
    #registratura-iesire,
    #inchidere-dosar,
    #arhivare-dosar,
    #evidenta-registratura,
    #audit-registratura,
    #creare-sarcina,
    #creare-dosar,
    #semnare-iesire,
    #expediere-iesire,
    .task-inline-workspace { scroll-margin-top: 8rem; }
}

.readiness-review {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: .65rem;
    margin: .85rem 0 1rem;
}

.readiness-check {
    display: grid;
    grid-template-columns: 1.65rem 1fr;
    gap: .65rem;
    padding: .8rem;
    border: 1px solid rgba(48, 66, 81, .13);
    border-radius: 12px;
    background: rgba(48, 66, 81, .035);
}

.readiness-check.ready { border-color: rgba(35, 132, 91, .22); background: rgba(35, 132, 91, .06); }
.readiness-check.exception { border-color: rgba(211, 146, 36, .3); background: rgba(246, 181, 69, .09); }
.readiness-check.blocked { border-color: rgba(190, 58, 58, .24); background: rgba(190, 58, 58, .055); }

.readiness-check-icon {
    display: grid;
    place-items: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    background: rgba(48, 66, 81, .1);
    font-size: .76rem;
}

.readiness-check.ready .readiness-check-icon { background: #23845b; color: #fff; }
.readiness-check.exception .readiness-check-icon { background: #d39224; color: #fff; }
.readiness-check.blocked .readiness-check-icon { background: #bd4444; color: #fff; }
.readiness-check p { margin: .2rem 0 0; color: var(--muted); font-size: .82rem; }
.readiness-check a { display: inline-flex; gap: .3rem; align-items: center; margin-top: .45rem; color: var(--accent); font-size: .8rem; font-weight: 800; }

.closure-complete-message,
.closure-blocked-message {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    margin-top: .8rem;
    padding: .85rem 1rem;
    border-radius: 12px;
}

.closure-complete-message { background: rgba(35, 132, 91, .08); color: #176b49; }
.closure-complete-message i { margin-top: .12rem; }
.closure-blocked-message { display: block; border-left: 4px solid #bd4444; background: rgba(190, 58, 58, .055); }
.closure-blocked-message p { margin: .25rem 0 0; color: var(--muted); }

.closure-resolution-form { display: grid; gap: .85rem; margin-top: 1rem; }
.closure-resolution-form > label,
.closure-exception-panel label { display: grid; gap: .35rem; font-weight: 700; }
.closure-resolution-form small { color: var(--muted); font-weight: 400; }
.closure-resolution-form textarea { min-height: 6rem; }

.closure-exception-panel {
    display: grid;
    grid-template-columns: minmax(12rem, .7fr) minmax(18rem, 1.3fr);
    gap: 1rem;
    padding: .9rem;
    border: 1px solid rgba(211, 146, 36, .3);
    border-radius: 12px;
    background: rgba(246, 181, 69, .09);
}

.closure-exception-panel p { margin: .25rem 0 0; color: var(--muted); }
.closure-exception-panel textarea { min-height: 5rem; }

@media (max-width: 700px) {
    .closure-exception-panel { grid-template-columns: 1fr; }
}

.task-collaboration-toggle {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-top: .65rem;
    padding: .35rem 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-size: .84rem;
    font-weight: 800;
}

.task-collaboration-toggle span {
    display: grid;
    place-items: center;
    min-width: 1.3rem;
    height: 1.3rem;
    padding: 0 .3rem;
    border-radius: 99px;
    background: rgba(25, 105, 122, .12);
    font-size: .72rem;
}

.task-collaboration-panel {
    margin-top: .35rem;
    padding: .85rem;
    border: 1px solid rgba(48, 66, 81, .13);
    border-radius: 12px;
    background: rgba(255, 255, 255, .78);
}

.task-collaboration-columns { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(15rem, .85fr); gap: 1rem; }
.task-collaboration-columns > div + div { padding-left: 1rem; border-left: 1px solid rgba(48, 66, 81, .12); }
.task-collaboration-columns h4 { margin: 0 0 .65rem; font-size: .9rem; }
.task-collaboration-columns form { display: grid; gap: .55rem; margin-top: .7rem; }
.task-collaboration-columns form textarea { min-height: 4.5rem; }
.task-collaboration-columns form .primary-button { justify-self: start; }

.inline-comment-list { display: grid; gap: .5rem; max-height: 18rem; overflow-y: auto; }
.inline-comment-list article { padding: .65rem .7rem; border-radius: 9px; background: rgba(48, 66, 81, .055); }
.inline-comment-list article > div { display: flex; justify-content: space-between; gap: .75rem; }
.inline-comment-list time { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.inline-comment-list p { margin: .3rem 0 0; white-space: pre-wrap; }

.inline-transition-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.inline-transition-list li { position: relative; display: grid; grid-template-columns: .8rem 1fr; gap: .55rem; padding-bottom: .75rem; }
.inline-transition-list li > span { z-index: 1; width: .65rem; height: .65rem; margin-top: .25rem; border: 2px solid var(--accent); border-radius: 50%; background: #fff; }
.inline-transition-list li:not(:last-child)::after { content: ""; position: absolute; left: .28rem; top: .85rem; bottom: 0; width: 1px; background: rgba(48, 66, 81, .2); }
.inline-transition-list strong, .inline-transition-list small { display: block; }
.inline-transition-list small { margin-top: .12rem; color: var(--muted); }
.inline-transition-list p { margin: .3rem 0 0; padding: .4rem .5rem; border-radius: 7px; background: rgba(246, 181, 69, .09); }

@media (max-width: 760px) {
    .task-collaboration-columns { grid-template-columns: 1fr; }
    .task-collaboration-columns > div + div { padding: .85rem 0 0; border-top: 1px solid rgba(48, 66, 81, .12); border-left: 0; }
    .inline-comment-list article > div { align-items: flex-start; flex-direction: column; gap: .15rem; }
}
