/* ============================================
   ANALYTIX9 PREMIUM DESIGN SYSTEM
   Inspired by Apple + Linear.app
   ============================================ */

:root {
    /* === NEXUS REBRAND PALETTE === */
    --white: #FFFFFF;
    --off-white: #FBFBFE;
    --black: #000000;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-900: #111827;

    /* Nexus Primary */
    --primary: #135BEC;
    --primary-light: rgba(19, 91, 236, 0.1);

    /* Accent Colors */
    --accent: var(--primary);
    --accent-hover: #0d47a1;
    --accent-light: var(--primary-light);

    /* Google Brand Colors (Secondary) */
    --google-blue: #4285F4;
    --google-red: #EA4335;
    --google-yellow: #FBBC05;
    --google-green: #34A853;

    /* Semantic */
    --success: var(--google-green);
    --danger: var(--google-red);
    --warning: var(--google-yellow);

    /* === TYPOGRAPHY === */
    --font-display: 'Inter',
        -apple-system,
        BlinkMacSystemFont,
        system-ui,
        sans-serif;
    --font-text: 'Inter',
        -apple-system,
        BlinkMacSystemFont,
        system-ui,
        sans-serif;
    --font-mono: 'JetBrains Mono',
        ui-monospace,
        monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;
    --text-5xl: 3.5rem;
    --text-6xl: 4rem;
    --text-8xl: 6rem;

    /* === SPACING === */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-24: 6rem;
    --space-32: 8rem;

    /* === EFFECTS === */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 24px 80px rgba(0, 0, 0, 0.16);
    --shadow-bento: 0 4px 30px rgba(0, 0, 0, 0.03);

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-blur: 20px;

    /* === TRANSITIONS === */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-base: 0.3s;
    --duration-slow: 0.5s;

    /* === LAYOUT === */
    --max-width: 1280px;
    --header-height: 56px;
    --border-radius: 0.25rem;
    --border-radius-lg: 0.5rem;
    --border-radius-xl: 0.75rem;
    --border-radius-2xl: 1.25rem;
    --border-radius-3xl: 1.75rem;
    --border-radius-4xl: 2.5rem;
    --border-radius-full: 9999px;

    /* --- Sidebar Mobile Constants --- */
    --sidebar-mobile-width: 280px;

    /* Shared FE-2 primitives. Keep semantic values small and reusable. */
    --control-height: 44px;
    --touch-target: 44px;
    --control-padding-x: 0.875rem;
    --control-label-gap: var(--space-2);
    --control-field-gap: var(--space-4);
    --control-section-gap: var(--space-6);
    --control-icon-gap: var(--space-2);
    --control-select-inset: 2.75rem;
    --page-gutter: clamp(.75rem, 3vw, 2rem);
    --page-title-size: clamp(1.55rem, 3vw, 2.5rem);
    --section-title-size: 1.25rem;
    --meta-size: .875rem;
    --radius-control: 10px;
    --radius-surface: 14px;
    --surface-subtle: #f8fafc;
    --border-strong: #cbd5e1;
    --ink-strong: #0f172a;
    --ink-muted: #64748b;
    --focus-ring: #1d4ed8;
    --section-gap: 2rem;
}

/* --- Responsive Layout Utilities --- */
.mobile-only {
    display: none !important;
}

@media (max-width: 1024px) {
    .mobile-only {
        display: block !important;
    }

    .desktop-only {
        display: none !important;
    }
}

/* --- View Transitions --- */
/* --- Nexus Utilities --- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
}

.apple-text-gradient {
    background: linear-gradient(180deg, #1d1d1f 00%, #434345 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.bento-card {
    border-radius: var(--border-radius-3xl);
    padding: var(--space-8);
    transition: all 0.5s var(--ease-out);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-bento);
}

.bento-card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.stat-glow {
    text-shadow: 0 0 20px rgba(19, 91, 236, 0.3);
}

.view-section {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.view-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.form-feedback {
    min-height: 1.5rem;
    margin: var(--space-3) 0;
    color: var(--gray-600);
    font-size: var(--text-sm);
}

.form-feedback-success { color: var(--success); }
.form-feedback-error { color: var(--danger); }

/* Empty feedback regions must not reserve space or paint an error surface. */
.form-feedback:empty {
    display: none;
    min-height: 0;
    margin: 0;
}

/* ============================================
   RESET & BASE
   ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-text);
    font-size: var(--text-base);
    font-weight: 400;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--off-white);
}

/* ERP foundation authority (L1). Keep the public-site :root tokens above
   available for compatibility; dashboard-shell is the sole ERP vocabulary. */
body.dashboard-shell {
    --erp-brand-primary: #1d4ed8;
    --erp-brand-strong: #1e40af;
    --erp-brand-light: #dbeafe;

    --erp-surface-page: #f8fafc;
    --erp-surface-panel: #ffffff;
    --erp-surface-subtle: #f1f5f9;
    --erp-surface-elevated: #ffffff;

    --erp-text-primary: #0f172a;
    --erp-text-secondary: #334155;
    --erp-text-muted: #64748b;
    --erp-text-inverse: #ffffff;

    --erp-border-default: #cbd5e1;
    --erp-border-subtle: #e2e8f0;
    --erp-border-strong: #94a3b8;

    --erp-interactive-hover: #eff6ff;
    --erp-interactive-selected: #dbeafe;
    --erp-interactive-focus: #1d4ed8;
    --erp-interactive-disabled: #94a3b8;

    /* Semantic action foundations for L2; existing controls retain their
       current classes and behavior until that wave maps handler intent. */
    --erp-action-primary-bg: #1d4ed8;
    --erp-action-primary-fg: #ffffff;
    --erp-action-success-bg: #166534;
    --erp-action-success-fg: #ffffff;
    --erp-action-danger-bg: #b91c1c;
    --erp-action-danger-fg: #ffffff;
    --erp-action-warning-bg: #92400e;
    --erp-action-warning-fg: #ffffff;
    --erp-action-navigation-bg: #eff6ff;
    --erp-action-navigation-fg: #1d4ed8;
    --erp-action-secondary-bg: #e2e8f0;
    --erp-action-secondary-fg: #334155;
    --erp-action-utility-bg: #ffffff;
    --erp-action-utility-fg: #334155;
    --erp-action-output-bg: #0f766e;
    --erp-action-output-fg: #ffffff;
    --erp-action-security-bg: #6d28d9;
    --erp-action-security-fg: #ffffff;

    --erp-font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --erp-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --erp-type-body: 0.875rem;
    --erp-type-body-mobile: 1rem;
    --erp-type-page-title: clamp(1.5rem, 2.4vw, 1.75rem);
    --erp-type-section-title: 1.25rem;
    --erp-type-card-title: 1rem;
    --erp-type-small: 0.875rem;
    --erp-type-meta: 0.8125rem;
    --erp-type-label: 0.8125rem;
    --erp-type-table-header: 0.75rem;
    --erp-type-kpi: 1.5rem;
    --erp-leading-body: 1.5;
    --erp-leading-tight: 1.25;

    --erp-space-1: 0.25rem;
    --erp-space-2: 0.5rem;
    --erp-space-3: 0.75rem;
    --erp-space-4: 1rem;
    --erp-space-5: 1.25rem;
    --erp-space-6: 1.5rem;
    --erp-space-8: 2rem;
    --erp-space-10: 2.5rem;
    --erp-space-12: 3rem;
    --erp-page-gutter: 1.5rem;

    --erp-radius-sm: 0.25rem;
    --erp-radius-md: 0.5rem;
    --erp-radius-lg: 0.75rem;
    --erp-radius-dialog: 1rem;
    --erp-radius-pill: 9999px;
    --erp-shadow-subtle: 0 1px 2px rgb(15 23 42 / 0.06);
    --erp-shadow-elevated: 0 8px 24px rgb(15 23 42 / 0.12);
    --erp-focus-ring: 3px solid #1d4ed8;
    --erp-focus-offset: 2px;
    --erp-duration-fast: 150ms;
    --erp-duration-base: 200ms;
    --erp-ease-standard: cubic-bezier(0.2, 0, 0, 1);
    /* CSS media queries cannot consume custom properties; these names are
       documented here for component calculations and future extraction. */
    --erp-breakpoint-mobile: 480px;
    --erp-breakpoint-tablet: 768px;
    --erp-breakpoint-desktop: 1024px;
    --erp-control-height: 44px;
    --erp-touch-target: 44px;

    /* Compatibility aliases used by already-active ERP rules. They point to
       the same authority so existing surfaces do not acquire a second palette. */
    --surface: var(--erp-surface-panel);
    --surface-subtle: var(--erp-surface-subtle);
    --border-subtle: var(--erp-border-subtle);
    --space-5: var(--erp-space-5);
    --space-20: 5rem;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --info: #2563eb;
    --success-light: #dcfce7;
    --warm: #92400e;
    --warm-light: #fef3c7;
    --text-hero: 3.5rem;
    --radius-md: var(--erp-radius-md);
    --ease-emphasized: var(--erp-ease-standard);
    --ease-material: var(--erp-ease-standard);
}

body.dashboard-shell,
body.dashboard-shell input,
body.dashboard-shell select,
body.dashboard-shell textarea,
body.dashboard-shell button {
    font-family: var(--erp-font-body);
}

body.dashboard-shell {
    font-size: var(--erp-type-body);
    line-height: var(--erp-leading-body);
    color: var(--erp-text-primary);
    background: var(--erp-surface-page);
}

body.dashboard-shell :where(a, button, input, select, textarea):focus-visible {
    outline: var(--erp-focus-ring);
    outline-offset: var(--erp-focus-offset);
}

body.dashboard-shell :where(button, a, input, select, textarea) {
    transition: background-color var(--erp-duration-base) var(--erp-ease-standard),
        border-color var(--erp-duration-base) var(--erp-ease-standard),
        color var(--erp-duration-base) var(--erp-ease-standard),
        box-shadow var(--erp-duration-base) var(--erp-ease-standard);
}

@media (max-width: 768px) {
    body.dashboard-shell {
        --erp-page-gutter: 0.75rem;
        --erp-type-body: var(--erp-type-body-mobile);
        --erp-type-page-title: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.dashboard-shell,
    body.dashboard-shell * {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Shared ERP shell contract: the mobile header and main content are stacked
   block regions; the fixed sidebar owns the desktop navigation rail. */
body.dashboard-shell {
    display: block;
    min-height: 100vh;
}

body.dashboard-shell .main-content,
body.dashboard-shell .view-section,
body.dashboard-shell .capacity-card,
body.dashboard-shell .workspace-section,
body.dashboard-shell .workspace-toolbar,
body.dashboard-shell .workspace-actions,
body.dashboard-shell .dashboard-header > div {
    min-width: 0;
}

body.dashboard-shell .main-content {
    width: auto;
    max-width: none;
    overflow: visible;
}

/* Phase 1B: People is an operational workspace, not a constrained reading column. */
body.dashboard-shell .people-workspace { width: 100%; max-width: none; }
body.dashboard-shell .overview-major-sections { grid-template-columns: minmax(0, 1fr); gap: var(--section-gap); }
body.dashboard-shell .overview-major-sections > .capacity-card { width: 100%; }

body.dashboard-shell .page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-6);
    margin-bottom: var(--section-gap);
    min-width: 0;
}

body.dashboard-shell .page-header__intro {
    flex: 1 1 20rem;
    min-width: 0;
    max-width: 72ch;
    overflow-wrap: anywhere;
}

body.dashboard-shell .page-header__intro h1 {
    margin: 0 0 var(--space-1);
    font-size: var(--page-title-size);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

body.dashboard-shell .page-header__intro p {
    margin: 0;
    font-size: var(--text-base);
}

body.dashboard-shell .page-header__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 1 auto;
    min-width: 0;
    gap: var(--space-3);
}

body.dashboard-shell .page-header__actions > * {
    min-width: 0;
}

body.dashboard-shell .table-container,
body.dashboard-shell [id$="-grid-container"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

body.dashboard-shell .data-table {
    margin: 0;
}

body.dashboard-shell .dashboard-header {
    min-width: 0;
}

body.dashboard-shell .dashboard-header > div:first-child {
    flex: 1 1 18rem;
    overflow-wrap: anywhere;
}

body.dashboard-shell .user-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}

body.dashboard-shell .user-actions > * {
    min-width: 0;
}

body.dashboard-shell .notification-dropdown {
    max-width: min(320px, calc(100vw - 2rem));
}

body.dashboard-shell .weekly-grid-header,
body.dashboard-shell .weekly-grid-actions,
body.dashboard-shell .weekly-grid-navigation {
    min-width: 0;
    flex-wrap: wrap;
}

body.dashboard-shell .targets-list {
    grid-template-columns: repeat(auto-fill, minmax(min(350px, 100%), 1fr));
    min-width: 0;
}

body.dashboard-shell .weekly-grid-header > h3 {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    body.dashboard-shell .weekly-grid-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    body.dashboard-shell .weekly-grid-actions {
        width: 100%;
        justify-content: flex-start;
        gap: var(--space-2);
    }

    body.dashboard-shell .weekly-grid-actions > .btn {
        flex: 1 1 auto;
    }

    body.dashboard-shell .weekly-grid-navigation {
        width: 100%;
        justify-content: space-between;
    }
}

::selection {
    background: var(--accent);
    color: var(--white);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--duration-base) var(--ease-out);
}

a:hover {
    color: var(--accent-hover);
}

/* Phase 5B: bounded Lead/Project workspace utilities. */
.workspace-toolbar {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.workspace-toolbar > label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 11rem;
    min-width: 11rem;
    width: min(100%, 15rem);
    color: var(--gray-600);
    font-size: var(--text-xs);
    font-weight: 600;
}

.workspace-toolbar > label:first-child {
    flex: 1.5 1 15rem;
    min-width: min(100%, 15rem);
}

.workspace-toolbar input,
.workspace-toolbar select {
    min-height: 44px;
}

.workspace-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.source-choice-card {
    appearance: none;
    border: 1px solid var(--gray-200);
    background: var(--surface, #fff);
    color: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-height: 120px;
    padding: var(--space-5);
    text-align: left;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.source-choice-card:hover,
.source-choice-card:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgb(15 23 42 / 10%);
    transform: translateY(-1px);
}

.workspace-actions .btn,
.workspace-toolbar .btn {
    min-height: 44px;
}

.workspace-results {
    align-items: stretch;
}

.workspace-results > .capacity-card {
    min-width: 0;
}

/* Phase 5E: bounded workflow workspace utilities. */
.workflow-card,
.workflow-table,
.timesheet-card,
.target-card {
    min-width: 0;
}

.workflow-card .workspace-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.workflow-table {
    min-width: 620px;
}

.status-badge {
    white-space: nowrap;
}

.target-card,
.timesheet-card {
    overflow-wrap: anywhere;
}

.recruitment-pipeline {
    display: flex;
    gap: var(--space-4);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    contain: paint;
    padding-bottom: var(--space-4);
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
}

.recruitment-column {
    min-width: 280px;
    align-self: flex-start;
    height: fit-content;
}

.recruitment-card,
.sales-workspace .capacity-card,
.approvals-workspace .capacity-card {
    min-width: 0;
    overflow-wrap: anywhere;
}

.recruitment-card-name {
    color: var(--gray-900);
    font-size: var(--text-sm);
    font-weight: 700;
}

.recruitment-card-role {
    color: var(--gray-500);
    font-size: var(--text-xs);
    margin: 4px 0 8px;
}

.recruitment-card-actions {
    align-items: stretch;
    margin-top: var(--space-3);
}

.form-input-compact {
    min-height: 44px;
    max-width: 100%;
}

.notification-item {
    align-items: flex-start;
    display: flex;
    gap: var(--space-2);
    justify-content: space-between;
}

.notification-content {
    min-width: 0;
}

.notification-read-button {
    flex: 0 0 auto;
    min-height: 36px;
}

.sales-workspace .workflow-table {
    min-width: 680px;
}

.approval-inbox-card { overflow: hidden; }

.approvals-workspace .approval-row {
    gap: var(--space-4);
    flex-wrap: wrap;
    align-items: flex-start;
    border-bottom: 1px solid var(--gray-100);
    padding: var(--space-4) var(--space-6);
}

.approval-inbox-header {
    gap: var(--space-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6);
    border-bottom: 1px solid var(--gray-200);
}

.approval-inbox-heading { min-width: 0; }
.approval-inbox-title-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.approval-inbox-title-row h3 { margin: 0; font-size: var(--text-xl); }
.approval-count-badge { background: var(--primary); color: var(--white); }
.approval-inbox-header > div:first-child {
    min-width: 0;
}

.approval-inbox-header h3 {
    overflow-wrap: anywhere;
}

.approval-filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(160px, 1fr)) auto; gap: var(--space-3); align-items: end; padding: var(--space-4) var(--space-6); background: var(--gray-50); }
.approval-filters label { display: grid; gap: var(--space-1); color: var(--gray-600); font-size: var(--text-xs); font-weight: 600; }
.approval-results-meta { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-6); color: var(--gray-500); font-size: var(--text-sm); }
.approval-list { min-height: 96px; }
.approval-item-main { display: flex; gap: var(--space-3); min-width: 0; flex: 1 1 360px; }
.approval-item-copy { min-width: 0; }
.approval-item-copy h4 { margin: 0; overflow-wrap: anywhere; color: var(--gray-900); }
.approval-item-meta, .approval-item-context { color: var(--gray-500); font-size: var(--text-xs); margin-top: var(--space-1); }
.approval-item-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; justify-content: flex-end; flex: 0 1 auto; }
.approval-type-label { color: var(--primary); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.approval-pagination { justify-content: flex-end; padding: var(--space-4) var(--space-6); }
.approval-action-dialog { max-width: 520px; }
.approval-action-footer { justify-content: flex-end; }

@media (max-width: 768px) {
    .approval-inbox-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .approval-inbox-header > div:first-child,
    .approval-inbox-header > select {
        flex: 1 1 100%;
        width: 100% !important;
    }

    .approval-inbox-header > div:first-child {
        justify-content: space-between;
    }

    .approval-filters { grid-template-columns: 1fr; padding: var(--space-4); }
    .approval-results-meta, .approval-pagination { padding-left: var(--space-4); padding-right: var(--space-4); }
    .approvals-workspace .approval-row { padding: var(--space-4); }
    .approval-item-actions { justify-content: flex-start; width: 100%; }
}

@media (min-width: 1025px) {
    body.dashboard-shell .sidebar {
        left: 0;
        top: 0;
    }
}

.approvals-workspace .approval-row > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.workflow-card button,
.workflow-table button {
    min-height: 44px;
}

@media (max-width: 768px) {
    .workflow-table {
        min-width: 560px;
    }

    .workflow-card .workspace-actions,
    .workflow-card form > div:last-child {
        width: 100%;
    }

    .workflow-card .workspace-actions .btn,
    .workflow-card form > div:last-child .btn {
        flex: 1 1 auto;
    }

    .recruitment-pipeline {
        margin-inline: calc(var(--space-2) * -1);
        padding-inline: var(--space-2);
    }

    .recruitment-column {
        min-width: 0 !important;
        width: 100%;
        min-height: 0 !important;
        flex: none !important;
    }

    .recruitment-pipeline {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-3);
        overflow: visible;
        contain: none;
        margin-inline: 0;
        padding-inline: 0;
    }
}

.finance-workspace .capacity-card,
.finance-workspace .table-container {
    min-width: 0;
}

.finance-workspace .finance-table {
    min-width: 640px;
}

.finance-workspace .status-badge {
    white-space: nowrap;
}

.payroll-workspace,
.payroll-detail,
.payroll-batch-row,
.payroll-quick-list,
.payroll-row {
    min-width: 0;
}

.payroll-workspace .payroll-table {
    min-width: 700px;
}

.payroll-workspace .status-badge,
.payroll-batch-row .status-badge,
.payroll-row .status-badge,
.payroll-quick-row .status-badge {
    white-space: nowrap;
}

.payroll-quick-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--gray-100);
}

.payroll-quick-row > div:first-child {
    min-width: 0;
}

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

.workspace-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.workspace-eyebrow {
    margin-bottom: var(--space-2);
    color: var(--gray-500);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.workspace-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.workspace-detail-grid > div {
    min-width: 0;
    padding: var(--space-4);
    border: 1px solid var(--gray-100);
    border-radius: var(--border-radius-lg);
    background: var(--gray-50);
}

.workspace-detail-grid dt {
    color: var(--gray-500);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
}

.workspace-detail-grid dd {
    margin-top: var(--space-2);
    overflow-wrap: anywhere;
}

/* Project Details workspace productization: retain dl semantics while making
   identity, finance, ownership, and schedule visually scannable. */
body.dashboard-shell .project-summary-grid {
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}
body.dashboard-shell .project-summary-grid > .project-summary-card {
    position: relative;
    min-height: 7.5rem;
    padding: var(--space-4) var(--space-4) var(--space-3);
    border-color: transparent;
}
body.dashboard-shell .project-summary-card--neutral { background: #f1f5f9; border-color: #cbd5e1; }
body.dashboard-shell .project-summary-card--finance { background: #ecfdf5; border-color: #a7f3d0; }
body.dashboard-shell .project-summary-card--people { background: #eff6ff; border-color: #bfdbfe; }
body.dashboard-shell .project-summary-card--schedule { background: #fff7ed; border-color: #fed7aa; }
body.dashboard-shell .project-summary-icon {
    display: inline-grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    margin-bottom: var(--space-3);
    border-radius: 10px;
    background: rgba(255,255,255,.72);
    color: #334155;
    font-size: 1rem;
    font-weight: 800;
}
body.dashboard-shell .project-summary-card dt { color: #475569; }
body.dashboard-shell .project-summary-card dd { color: #0f172a; font-size: 1.05rem; font-weight: 750; }
body.dashboard-shell .workspace-context-link .btn { display: inline-flex; align-items: center; gap: .4rem; }
body.dashboard-shell .project-workspace-tabs {
    display: flex;
    gap: .35rem;
    margin: 0 0 var(--space-5);
    padding: .35rem;
    overflow-x: auto;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: #f8fafc;
}
body.dashboard-shell .project-workspace-tabs a {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .4rem;
    min-height: 2.75rem;
    padding: .6rem .9rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: #475569;
    font-size: .85rem;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
    cursor: pointer;
}
body.dashboard-shell .project-workspace-tabs a:hover { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
body.dashboard-shell .project-workspace-tabs a:focus-visible { outline: 3px solid rgba(29,78,216,.25); outline-offset: 2px; }
body.dashboard-shell .project-workspace-tabs a.is-active,
body.dashboard-shell .project-workspace-tabs a[aria-current="page"] { border-color: #bfdbfe; background: #fff; color: #1d4ed8; box-shadow: 0 3px 10px rgba(15,23,42,.08); }
body.dashboard-shell #project-commercial > h4,
body.dashboard-shell #project-financial > h4 {
    margin: var(--space-5) 0 var(--space-2);
    padding: .7rem .85rem;
    border-left: 3px solid #93c5fd;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
}
body.dashboard-shell #project-commercial > .table-container,
body.dashboard-shell #project-financial > .table-container {
    margin-bottom: var(--space-4);
    padding: .25rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}
body.dashboard-shell #project-commercial > .table-container + h4,
body.dashboard-shell #project-financial > .table-container + h4 { margin-top: var(--space-5); }

body.dashboard-shell .workspace-detail-header .ui-icon,
body.dashboard-shell .workspace-actions .ui-icon,
body.dashboard-shell .project-workspace-tabs .ui-icon,
body.dashboard-shell .project-summary-icon .ui-icon,
body.dashboard-shell .workspace-data-block__icon .ui-icon {
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}
body.dashboard-shell .project-workspace-tabs .project-tab {
    gap: var(--space-1);
    min-height: var(--control-height);
    padding: .5rem .75rem;
    border-width: 1px;
    border-style: solid;
    box-shadow: var(--shadow-sm);
}
body.dashboard-shell .project-workspace-tabs .project-tab .ui-icon,
body.dashboard-shell .workspace-detail-header .btn .ui-icon,
body.dashboard-shell .workspace-actions .btn .ui-icon {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    stroke-width: 1.65;
}
body.dashboard-shell .project-workspace-tabs .project-tab--overview { color: var(--info-ink); background: var(--info-surface); border-color: #bfdbfe; }
body.dashboard-shell .project-workspace-tabs .project-tab--commercial { color: var(--primary); background: var(--primary-light); border-color: #bfdbfe; }
body.dashboard-shell .project-workspace-tabs .project-tab--financial { color: var(--success-ink); background: var(--success-surface); border-color: #a7f3d0; }
body.dashboard-shell .project-workspace-tabs .project-tab--delivery { color: #4338ca; background: #eef2ff; border-color: #c7d2fe; }
body.dashboard-shell .project-workspace-tabs .project-tab--overview.is-active,
body.dashboard-shell .project-workspace-tabs .project-tab--overview[aria-current="page"] { color: var(--info-ink); background: #dbeafe; border-color: #60a5fa; }
body.dashboard-shell .project-workspace-tabs .project-tab--commercial.is-active,
body.dashboard-shell .project-workspace-tabs .project-tab--commercial[aria-current="page"] { color: var(--primary); background: #dbeafe; border-color: #60a5fa; }
body.dashboard-shell .project-workspace-tabs .project-tab--financial.is-active,
body.dashboard-shell .project-workspace-tabs .project-tab--financial[aria-current="page"] { color: var(--success-ink); background: #d1fae5; border-color: #34d399; }
body.dashboard-shell .project-workspace-tabs .project-tab--delivery.is-active,
body.dashboard-shell .project-workspace-tabs .project-tab--delivery[aria-current="page"] { color: #3730a3; background: #e0e7ff; border-color: #818cf8; }
body.dashboard-shell .project-workspace-tabs .project-tab:hover { filter: saturate(1.08); box-shadow: var(--shadow-md); }
body.dashboard-shell .project-workspace-tabs .project-tab:focus-visible { outline: 3px solid rgba(29,78,216,.25); outline-offset: 2px; }
body.dashboard-shell .workspace-detail-header .btn,
body.dashboard-shell .workspace-context-link .btn { display: inline-flex; align-items: center; gap: .45rem; }
body.dashboard-shell .workspace-section-heading { display: flex; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
body.dashboard-shell .workspace-section-heading h3 { margin: 0; }
body.dashboard-shell .workspace-section-heading .workspace-muted { margin-top: .35rem; max-width: 62ch; }
body.dashboard-shell .project-summary-card { display: flex; flex-direction: column; justify-content: flex-start; gap: .2rem; }
body.dashboard-shell .project-summary-card .project-summary-icon { display: inline-grid; place-items: center; }
body.dashboard-shell .project-summary-card dd { margin-top: .35rem; }
body.dashboard-shell .workspace-data-block { display: grid; gap: var(--space-3); margin-top: var(--space-5); padding: var(--space-4); border: 1px solid var(--gray-200); border-radius: var(--border-radius-lg); background: var(--surface-subtle); }
body.dashboard-shell .workspace-data-block__header { display: flex; align-items: flex-start; gap: var(--space-3); min-width: 0; }
body.dashboard-shell .workspace-data-block__header h4 { margin: 0; color: var(--ink-strong); font-size: var(--text-base); }
body.dashboard-shell .workspace-data-block__header .workspace-muted { margin-top: .25rem; }
body.dashboard-shell .workspace-data-block__icon { display: inline-grid; width: 2.25rem; height: 2.25rem; flex: 0 0 2.25rem; place-items: center; border: 1px solid var(--border-strong); border-radius: 10px; background: #fff; color: var(--primary); }
body.dashboard-shell .workspace-data-block__count { margin-left: auto; padding: .2rem .55rem; border: 1px solid var(--border-strong); border-radius: 999px; background: #fff; color: var(--ink-muted); font-size: var(--text-xs); font-weight: 700; }
body.dashboard-shell .workspace-data-block .table-container { margin: 0; background: #fff; }
body.dashboard-shell .workspace-empty-state { display: grid; justify-items: start; gap: .3rem; padding: var(--space-5); border: 1px dashed var(--border-strong); border-radius: var(--border-radius-lg); background: #fff; color: var(--ink-strong); }
body.dashboard-shell .workspace-empty-state__icon { display: inline-grid; width: 2rem; height: 2rem; place-items: center; border-radius: 10px; background: var(--surface-subtle); color: var(--ink-muted); }
body.dashboard-shell .workspace-empty-state__icon .ui-icon { width: 1rem; height: 1rem; }
body.dashboard-shell .delivery-section-grid { display: grid; gap: var(--space-4); }
body.dashboard-shell .delivery-section-card { padding: var(--space-4); border: 1px solid var(--gray-200); border-radius: var(--border-radius-lg); background: var(--surface-subtle); }
body.dashboard-shell #project-delivery > .workspace-related-panel,
body.dashboard-shell #project-delivery > [data-context-task-surface] { margin-top: var(--space-5); }
body.dashboard-shell #project-delivery > [aria-labelledby="project-case-notes-title"],
body.dashboard-shell #project-delivery > #project-activity-panel { padding: var(--space-4); border: 1px solid var(--gray-200); border-radius: var(--border-radius-lg); background: var(--surface-subtle); }
body.dashboard-shell #project-delivery > [aria-labelledby="project-case-notes-title"] .workspace-detail-header { margin-bottom: var(--space-4); }
body.dashboard-shell #project-delivery > [data-context-task-surface] { padding: var(--space-4); }
body.dashboard-shell #project-distributions-surface { margin-top: var(--space-5); padding: 0; border: 0; background: transparent; box-shadow: none; }
body.dashboard-shell #project-distributions-surface > .workspace-detail-header { padding: var(--space-4); border: 1px solid var(--gray-200); border-radius: var(--border-radius-lg); background: var(--surface-subtle); }
body.dashboard-shell #project-distributions-surface > .workspace-metrics { margin-top: var(--space-3); }
body.dashboard-shell #project-distributions-surface > .table-container { margin-top: var(--space-4); }
body.dashboard-shell #project-distributions-surface { padding: var(--space-4); border: 1px solid var(--gray-200); border-radius: var(--border-radius-lg); background: #fff; box-shadow: 0 8px 24px rgba(15,23,42,.05); }
body.dashboard-shell #project-distributions-surface > .workspace-detail-header { padding: 0; border: 0; background: transparent; }
body.dashboard-shell #project-overview .metric-card { position: relative; padding-top: 3.25rem; }
body.dashboard-shell #project-overview .metric-card::before { content: '◎'; position: absolute; top: var(--space-4); left: var(--space-4); display: grid; width: 1.75rem; height: 1.75rem; place-items: center; border-radius: 9px; background: var(--surface-subtle); color: var(--primary); font-weight: 800; }
body.dashboard-shell #project-overview .metric-card__helper,
body.dashboard-shell #project-overview .workspace-muted { color: var(--gray-500); }
body.dashboard-shell #project-overview .metric-card:has(.metric-card__value) { background: #fff; }
body.dashboard-shell #project-overview .metric-card .metric-card__value { font-size: clamp(1.15rem, 2vw, 1.55rem); }
body.dashboard-shell #project-overview .metric-card .workspace-muted { font-size: var(--text-xs); }

.workspace-related-panel {
    min-width: 0;
    overflow-x: auto;
}

.workspace-muted {
    color: var(--gray-500);
    font-size: var(--text-sm);
}

.status-text {
    color: var(--danger);
    font-size: var(--text-xs);
    font-weight: 700;
}

.workspace-detail h2,
.workspace-detail h3,
.workspace-detail h4,
.workspace-detail p,
.workspace-detail a,
.workspace-results h4 {
    overflow-wrap: anywhere;
}

.workspace-detail .workspace-actions,
.workspace-results .workspace-actions {
    align-items: stretch;
}

.workspace-results .workspace-actions > * {
    flex: 0 1 auto;
}

@media (max-width: 768px) {
    .workspace-toolbar {
        align-items: stretch;
    }

    .workspace-toolbar > label,
    .workspace-toolbar > label:first-child {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .workspace-toolbar > .btn {
        flex: 1 1 auto;
    }

    .workspace-actions {
        width: 100%;
    }

    .workspace-actions > .btn,
    .workspace-actions > a {
        flex: 1 1 auto;
        text-align: center;
    }

    .workspace-results .capacity-card {
        padding: var(--space-4);
    }

    .workspace-detail {
        padding: var(--space-4);
    }

    .workspace-detail-header {
        flex-direction: column;
    }

    .payroll-quick-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .payroll-quick-row > a {
        flex: 1 1 100%;
        text-align: center;
    }
}

@media (max-width: 375px) {
    .workspace-toolbar > .btn,
    .workspace-actions > .btn,
    .workspace-actions > a {
        width: 100%;
        flex-basis: 100%;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

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

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--black);
}

h1 {
    font-size: var(--text-hero);
}

h2 {
    font-size: var(--text-4xl);
}

h3 {
    font-size: var(--text-xl);
}

p {
    color: var(--gray-500);
    max-width: 640px;
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

@media (min-width: 768px) {
    .container {
        padding: 0 var(--space-12);
    }
}

.section {
    padding: var(--space-16) 0;
}

@media (min-width: 768px) {
    .section {
        padding: var(--space-24) 0;
    }
}

.section-header {
    margin-bottom: var(--space-10);
}

.section-header--center {
    text-align: center;
}

.section-header--center p {
    margin: var(--space-3) auto 0;
    max-width: 520px;
}

.section-header p {
    margin-top: var(--space-3);
}

/* ============================================
   HEADER
   ============================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--header-height);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--gray-200);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--text-lg);
    color: var(--black);
}

/* One source asset, separate presentation contexts. The intrinsic aspect
   ratio is preserved so the supplied brand mark reads as a logo, not a tiny
   favicon or a stretched square. */
.brand-logo {
    display: block;
    width: auto;
    height: auto;
    object-fit: contain;
}

.brand-logo--header {
    max-width: min(100%, 11rem);
    max-height: 3rem;
}

body.dashboard-shell .mobile-header .brand-logo--header {
    max-height: 2.25rem;
}

.logo-mark {
    width: 28px;
    height: 28px;
    background: var(--black);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: var(--text-sm);
    font-weight: 700;
}

/* ============================================
   HAMBURGER MENU
   ============================================ */

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    z-index: 110;
    position: relative;
}

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--gray-900);
    border-radius: 2px;
    transition: all var(--duration-base) var(--ease-material);
    transform-origin: center;
}

.hamburger.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (min-width: 768px) {
    .hamburger {
        display: none;
    }
}

/* ============================================
   NAVIGATION — Desktop + Mobile Drawer
   ============================================ */

.nav {
    display: none;
}

@media (max-width: 767px) {
    #platform-settings-panel .settings-input,
    #platform-settings-panel select,
    #platform-settings-panel textarea {
        box-sizing: border-box;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }
    #platform-settings-panel > div[style*="grid-template-columns"],
    #platform-settings-panel div[style*="grid-template-columns: 1fr 1fr"],
    #platform-settings-panel div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    .fx-rate-entry-grid {
        grid-template-columns: 1fr 1fr !important;
        min-width: 0;
    }
    .fx-rate-entry-grid > * { min-width: 0; }
    .fx-rate-entry-grid > div:nth-child(5),
    .fx-rate-entry-grid > button {
        grid-column: 1 / -1;
    }
    .nav {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--white);
        padding: calc(var(--header-height) + var(--space-8)) var(--space-6) var(--space-6);
        box-shadow: var(--shadow-xl);
        transition: right var(--duration-base) var(--ease-material);
        z-index: 105;
        overflow-y: auto;
    }

    .nav.open {
        right: 0;
    }

    .nav .nav-link {
        font-size: var(--text-base);
        padding: var(--space-2) 0;
        width: 100%;
    }

    .nav .btn {
        width: 100%;
        text-align: center;
        margin-top: var(--space-4);
    }
}

@media (min-width: 768px) {
    .nav {
        display: flex;
        align-items: center;
        gap: var(--space-8);
    }
}

.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 104;
    opacity: 0;
    transition: opacity var(--duration-base) var(--ease-material);
}

.nav-overlay.visible {
    display: block;
    opacity: 1;
}

.nav-link {
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--gray-500);
    transition: color var(--duration-base) var(--ease-out);
}

.nav-link:hover {
    color: var(--black);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-text);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1;
    border: none;
    border-radius: var(--border-radius-full);
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-material);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--accent);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.25);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 102, 204, 0.35);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 6px rgba(0, 102, 204, 0.2);
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
}

/* Phase 9A shared ERP foundation. Keep this layer framework-free and reusable. */
:root {
    --success-surface: #ecfdf3;
    --success-ink: #166534;
    --warning-surface: #fffbeb;
    --warning-ink: #92400e;
    --danger-surface: #fef2f2;
    --danger-ink: #b91c1c;
    --info-surface: #eff6ff;
    --info-ink: #1e40af;
}

body.dashboard-shell {
    background: var(--erp-surface-page);
    color: var(--erp-text-primary);
}

/* Shared title authority wins over the legacy template baseline while
   preserving the existing mobile media-query adjustments. */
body.dashboard-shell .dashboard-header h1 {
    font-size: var(--erp-type-page-title);
    line-height: var(--erp-leading-tight);
}

body.dashboard-shell p,
body.dashboard-shell .workspace-muted,
body.dashboard-shell .helper-text {
    color: var(--ink-muted);
    line-height: 1.55;
}

body.dashboard-shell .btn {
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 650;
    letter-spacing: 0;
    padding: .65rem 1rem;
    line-height: 1.25;
    text-decoration: none;
    transform: none;
    white-space: nowrap;
}

body.dashboard-shell .btn > svg,
body.dashboard-shell .btn > [aria-hidden="true"] {
    display: inline-flex;
    width: 1.05em;
    height: 1.05em;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}
body.dashboard-shell .workspace-actions { gap: var(--space-3); }
body.dashboard-shell .workspace-actions > .btn,
body.dashboard-shell .workspace-actions > a.btn { flex: 0 1 auto; }

/* Compact native selects also carry the legacy .btn class. The .btn rule
   intentionally starts borderless for buttons, so this shared control-family
   rule restores the field border without touching individual filters. */
body.dashboard-shell select.btn {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-control);
    background: #fff;
    color: var(--ink-strong);
}

body.dashboard-shell select.btn:focus {
    border-color: var(--focus-ring);
}

body.dashboard-shell select.btn:disabled {
    border-color: var(--border-subtle);
    background: var(--surface-subtle);
    color: var(--ink-muted);
}

body.dashboard-shell .btn-sm,
body.dashboard-shell .btn-xs {
    min-height: 44px;
    padding: .6rem .85rem;
    line-height: 1.2;
}

body.dashboard-shell .btn-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-target);
    padding: .5rem .75rem;
    line-height: 1.25;
}

body.dashboard-shell .btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

body.dashboard-shell .btn:disabled,
body.dashboard-shell .btn.is-loading {
    cursor: wait;
    opacity: .68;
}

body.dashboard-shell :where(a, button, input, select, textarea):focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

body.dashboard-shell .btn-primary {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

body.dashboard-shell .btn-primary:hover:not(:disabled) { background: #1e40af; }

body.dashboard-shell .btn-outline {
    background: #fff;
    border-color: var(--border-strong);
    color: var(--ink-strong);
}

body.dashboard-shell .btn-outline:hover:not(:disabled) {
    background: var(--surface-subtle);
    border-color: #64748b;
    color: #0f172a;
}

body.dashboard-shell .btn-danger {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

body.dashboard-shell .btn-secondary {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #0f172a;
}

body.dashboard-shell input:not([type="hidden"]),
body.dashboard-shell select,
body.dashboard-shell textarea,
body.dashboard-shell .form-input,
body.dashboard-shell .input {
    min-height: 44px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: #fff;
    color: var(--ink-strong);
    font: inherit;
}

body.dashboard-shell input:not([type="hidden"]):focus,
body.dashboard-shell select:focus,
body.dashboard-shell textarea:focus,
body.dashboard-shell .form-input:focus,
body.dashboard-shell .input:focus {
    border-color: var(--focus-ring);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .16);
    outline: none;
}

body.dashboard-shell .label,
body.dashboard-shell .workspace-toolbar > label {
    color: #334155;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.3;
    text-transform: none;
}

body.dashboard-shell .capacity-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
    padding: clamp(1rem, 2vw, 1.5rem);
}

body.dashboard-shell .capacity-card:hover { transform: none; }

body.dashboard-shell .capacity-card > :where(h2, h3, h4) {
    margin-top: 0;
    margin-bottom: 0;
}

body.dashboard-shell .capacity-card > :where(h2, h3, h4) + :not(.sr-only) {
    margin-top: var(--space-3);
}

body.dashboard-shell .capacity-card > :where(h2, h3, h4) + .chart-content,
body.dashboard-shell .capacity-card > :where(h2, h3, h4) + .metric-chart {
    margin-top: var(--space-5);
}

body.dashboard-shell .project-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
}

body.dashboard-shell .project-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: var(--space-5);
}

body.dashboard-shell .project-card__header {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

body.dashboard-shell .project-card__identity { min-width: 0; }
body.dashboard-shell .project-card__identity h4 { overflow-wrap: anywhere; }
body.dashboard-shell .project-card__meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; margin-top: var(--space-2); }
body.dashboard-shell .project-card__actions { margin-top: auto; justify-content: flex-end; align-items: center; }
body.dashboard-shell .project-detail-table-wrap { overflow-x: auto; }
body.dashboard-shell .project-detail-table { min-width: 760px; }
body.dashboard-shell .project-detail-empty { padding: var(--space-5); border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--ink-muted); text-align: center; }

body.dashboard-shell .metric-chart { display: flex; min-height: 13rem; flex-direction: column; justify-content: flex-end; gap: var(--space-2); }
body.dashboard-shell .metric-chart__bars { display: flex; min-height: 10rem; align-items: flex-end; gap: var(--space-2); border-bottom: 1px solid var(--border-strong); padding: var(--space-3) var(--space-2) 0; }
body.dashboard-shell .metric-chart__bar { flex: 1 1 0; min-height: 2px; border-radius: 4px 4px 0 0; opacity: .9; }
body.dashboard-shell .metric-chart__labels { display: flex; gap: var(--space-2); padding: 0 var(--space-2); color: var(--ink-muted); font-size: var(--text-xs); }
body.dashboard-shell .metric-chart__labels span { flex: 1 1 0; text-align: center; }
body.dashboard-shell .metric-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin-top: var(--space-4); }
body.dashboard-shell .metric-summary > div { display: flex; min-width: 0; flex-direction: column; gap: var(--space-1); padding: var(--space-3); border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--surface-subtle); }
body.dashboard-shell .metric-summary strong { overflow-wrap: anywhere; }

@media (max-width: 600px) {
    body.dashboard-shell .metric-summary { grid-template-columns: 1fr; }
}

@media (max-width: 1280px) {
    body.dashboard-shell .project-results { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
    body.dashboard-shell .project-card__header { flex-direction: column; }
    body.dashboard-shell .project-card__actions { justify-content: flex-start; }
    body.dashboard-shell .project-detail-table { min-width: 0; }
}

body.dashboard-shell .workspace-section + .workspace-section,
body.dashboard-shell .view-section > .capacity-grid + .capacity-grid {
    margin-top: var(--section-gap);
}

/* Shared vertical rhythm for stacked cards and form sections. Keep spacing
   on the container contract instead of adding page-specific margins. */
body.dashboard-shell .workspace-panel > .workspace-detail-header + *,
body.dashboard-shell .workspace-panel > .workspace-toolbar + *,
body.dashboard-shell .workspace-panel > form > * + *,
body.dashboard-shell .workspace-related-panel > form > * + * {
    margin-top: var(--space-4);
}
body.dashboard-shell .my-day-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-top: 1px solid var(--gray-100);
}
body.dashboard-shell #my-day-body { align-items: start; }
body.dashboard-shell .my-day-section { align-self: start; overflow: hidden; border-top: 3px solid var(--gray-200); }
body.dashboard-shell .my-day-section--attention { border-top-color: var(--danger); }
body.dashboard-shell .my-day-section--info { border-top-color: var(--accent); }
body.dashboard-shell .my-day-section--finance { border-top-color: var(--warning); }
body.dashboard-shell .my-day-section__header { display:flex; align-items:center; justify-content:space-between; gap:var(--space-4); margin-bottom:var(--space-2); }
body.dashboard-shell .my-day-section__header h3 { margin:0; }
body.dashboard-shell .my-day-section__body { min-height: 0; }
body.dashboard-shell .my-day-section__body > .ui-state-empty { margin:0; padding:var(--space-4) 0; border:0; background:transparent; min-height:0; }
body.dashboard-shell .my-day-section--attention .my-day-item strong { color:var(--danger); }
body.dashboard-shell .my-day-item > div,
body.dashboard-shell .my-day-item > strong { min-width: 0; }
body.dashboard-shell .my-day-item .workspace-muted { display: block; overflow-wrap: anywhere; }
body.dashboard-shell .my-day-task-row { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:var(--space-4); padding:var(--space-3) 0; border-top:1px solid var(--gray-100); }
body.dashboard-shell .my-day-task-row__content { min-width:0; display:grid; gap:var(--space-1); }
body.dashboard-shell .my-day-task-row__title { min-width:0; overflow-wrap:anywhere; line-height:1.35; }
body.dashboard-shell .my-day-task-row__meta { color:var(--gray-500); font-size:var(--text-xs); }
body.dashboard-shell .my-day-task-row__action { min-width:6.5rem; white-space:nowrap; }
@media (max-width: 600px) { body.dashboard-shell .my-day-task-row { align-items:start; } body.dashboard-shell .my-day-task-row__action { min-width:0; } }

body.dashboard-shell .data-table {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: none;
}

body.dashboard-shell .data-table th {
    background: #f8fafc;
    color: #475569;
    font-size: .72rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

body.dashboard-shell .data-table td,
body.dashboard-shell .data-table th { padding: .8rem 1rem; vertical-align: middle; }

body.dashboard-shell .status-badge,
body.dashboard-shell .badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: .25rem .65rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.2;
    text-transform: none;
}

body.dashboard-shell .status-badge[data-status-tone="success"] { background: var(--success-surface); color: var(--success-ink); }
body.dashboard-shell .status-badge[data-status-tone="warning"] { background: var(--warning-surface); color: var(--warning-ink); }
body.dashboard-shell .status-badge[data-status-tone="danger"] { background: var(--danger-surface); color: var(--danger-ink); }
body.dashboard-shell .status-badge[data-status-tone="info"] { background: var(--info-surface); color: var(--info-ink); }

body.dashboard-shell .form-feedback,
body.dashboard-shell [role="alert"] {
    border-radius: 10px;
    line-height: 1.45;
}

body.dashboard-shell .form-feedback-success { background: var(--success-surface); color: var(--success-ink); padding: .7rem .85rem; }
body.dashboard-shell .form-feedback-error { background: var(--danger-surface); color: var(--danger-ink); padding: .7rem .85rem; }

body.dashboard-shell .erp-toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: var(--z-toast);
    max-width: min(28rem, calc(100vw - 2rem));
    padding: .75rem 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .18);
    font-weight: 650;
    line-height: 1.4;
}

body.dashboard-shell .erp-toast-success { background: var(--success-surface); color: var(--success-ink); border-color: #86efac; }
body.dashboard-shell .erp-toast-error { background: var(--danger-surface); color: var(--danger-ink); border-color: #fca5a5; }

body.dashboard-shell .modal-backdrop {
    z-index: var(--z-modal-backdrop);
    background: rgba(15, 23, 42, .62);
    padding: 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}
body.dashboard-shell .modal-backdrop[hidden] { display: none !important; }
body.dashboard-shell .modal-content {
    position: relative;
    z-index: var(--z-modal);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: clamp(1.25rem, 4vw, 2rem);
}
body.dashboard-shell .modal-content h2 { color: var(--ink-strong); font-size: clamp(1.2rem, 2vw, 1.5rem); line-height: 1.25; }

body.dashboard-shell .empty-state,
body.dashboard-shell .loading,
body.dashboard-shell .workspace-empty,
body.dashboard-shell .workspace-error {
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #fff;
    color: var(--ink-muted);
    padding: 1.25rem;
    text-align: center;
}

@media (max-width: 768px) {
    body.dashboard-shell .dashboard-header { gap: 1rem; }
    body.dashboard-shell .workspace-toolbar,
    body.dashboard-shell .workspace-actions { gap: .65rem; }
    body.dashboard-shell .data-table { min-width: 640px; }
    body.dashboard-shell .modal-content { max-height: calc(100vh - 2rem); }
    body.dashboard-shell .erp-toast { right: .75rem; bottom: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
    body.dashboard-shell *,
    body.dashboard-shell *::before,
    body.dashboard-shell *::after {
        animation-duration: 0.01ms !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* Phase 9I-J mobile/tablet productization primitives. These extend the
   existing ERP tokens and are consumed by dashboard toolbars, tables,
   forms, cards, dialogs, dropdowns, and navigation. */
body.dashboard-shell {
    --drawer-width: min(320px, 86vw);
    --z-drawer-backdrop: 40;
    --z-drawer: 50;
    --z-modal-backdrop: 100;
    --z-modal: 110;
    --z-toast: 120;
}

body.dashboard-shell.sidebar-open,
body.dashboard-shell.modal-open {
    overflow: hidden;
    scrollbar-gutter: stable;
}

body.dashboard-shell .mobile-header {
    min-height: 60px;
    padding: var(--space-2) var(--page-gutter);
}

body.dashboard-shell .mobile-header .hamburger {
    order: -1;
    flex: 0 0 var(--touch-target);
    display: inline-grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
}

body.dashboard-shell .ui-state {
    display: flex;
    min-width: 0;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    padding: var(--space-4);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-control);
    background: #fff;
    color: var(--ink-muted);
    text-align: center;
}

body.dashboard-shell .ui-state[hidden] {
    display: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

body.dashboard-shell .ui-state__title,
body.dashboard-shell .ui-state__message {
    margin: 0;
    line-height: 1.45;
}

body.dashboard-shell .ui-state__title {
    color: var(--ink-strong);
    flex-basis: 100%;
}

body.dashboard-shell .ui-state-loading {
    border-style: solid;
}

body.dashboard-shell .ui-state-error {
    border-color: #fca5a5;
    background: var(--danger-surface);
    color: var(--danger-ink);
}
body.dashboard-shell #calendar-event-form-error[hidden] { display:none !important; width:0 !important; height:0 !important; min-height:0 !important; padding:0 !important; margin:0 !important; border:0 !important; background:transparent !important; }

body.dashboard-shell .ui-state-empty {
    background: var(--surface-subtle);
}

/* Shared semantic major-panel contract. Generic capacity-grid remains
   auto-fill for KPI/list surfaces; paired major panels use explicit tracks. */
body.dashboard-shell .major-panel-grid {
    display: grid;
    gap: var(--space-6);
    min-width: 0;
}
body.dashboard-shell .major-panel-grid--two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
body.dashboard-shell .major-panel-grid--culture { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) {
    body.dashboard-shell .major-panel-grid--two,
    body.dashboard-shell .major-panel-grid--culture { grid-template-columns: minmax(0, 1fr); }
}

/* Phase 2 shared workspace contract: major operational surfaces own the
   available row, while pagination is a centered sibling row after the list. */
body.dashboard-shell .project-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.dashboard-shell .project-results > .project-results__pagination,
body.dashboard-shell .project-results > .list-pagination { grid-column: 1 / -1; justify-content: center; width: 100%; margin-inline: auto; }
body.dashboard-shell .commercial-open-invoices-panel,
body.dashboard-shell .commercial-documents-panel,
body.dashboard-shell .leave-request-panel,
body.dashboard-shell .leave-history-panel,
body.dashboard-shell .admin-full-width-panel { grid-column: 1 / -1; }
body.dashboard-shell .culture-kudos-panel { min-width: 0; }
body.dashboard-shell .culture-recognition-stack { min-width: 0; display: flex; flex-direction: column; gap: var(--space-8); }
body.dashboard-shell .commercial-documents-toolbar { justify-content: flex-start; align-items: center; }
body.dashboard-shell .commercial-documents-toolbar .workspace-actions { margin-left: 0; }
body.dashboard-shell .commercial-project-filter { min-width: 180px; }
body.dashboard-shell .commercial-project-filter > label { display: flex; flex-direction: column; gap: 4px; }
body.dashboard-shell .finance-operation-panel { margin-top: var(--section-gap); }
body.dashboard-shell .sales-performance-grid > .capacity-card { min-width: 0; min-height: 100%; }
body.dashboard-shell .sales-performance-grid > .capacity-card > div[id] { min-width: 0; width: 100%; }
body.dashboard-shell .finance-workspace .commissions-panel { grid-column: auto; min-width: 0; }
body.dashboard-shell .finance-workspace .commissions-panel .finance-table { min-width: 0; width: 100%; }
body.dashboard-shell .finance-workspace .commissions-panel { grid-column: 1 / -1; width: 100%; }
body.dashboard-shell .my-commissions-panel { grid-column: 1 / -1; min-width: 0; }
body.dashboard-shell .my-commissions-panel .table-container { width: 100%; overflow-x: auto; }
body.dashboard-shell .my-commissions-panel .finance-table { min-width: 640px; width: 100%; table-layout: auto; }
body.dashboard-shell .my-commissions-panel .finance-table td,
body.dashboard-shell .my-commissions-panel .finance-table th { vertical-align: middle; white-space: normal; }
body.dashboard-shell .weekly-timesheet-workspace { padding-top: var(--section-gap); }
body.dashboard-shell #treasury-movements-detail { margin-top: var(--section-gap); min-width: 0; }
body.dashboard-shell #treasury-movements-detail .table-container { margin-top: var(--space-4); }
body.dashboard-shell #treasury-movements-detail .finance-table { min-width: 760px; }
body.dashboard-shell #admin-section > .capacity-grid > .capacity-card { grid-column: 1 / -1; }
@media (max-width: 900px) {
    body.dashboard-shell .culture-recognition-stack { gap: var(--space-6); }
}
body.dashboard-shell .expenses-operational-panel,
body.dashboard-shell .partner-economics-surface { width: 100%; }
body.dashboard-shell .metric-card,
body.dashboard-shell .stat-label,
body.dashboard-shell .stat-value { min-width: 0; }
body.dashboard-shell .stat-label { display: block; color: var(--gray-500); font-size: var(--text-sm); line-height: 1.35; }
body.dashboard-shell .stat-value { display: block; margin-top: var(--space-2); color: var(--gray-900); font-size: var(--text-2xl); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
body.dashboard-shell .stat-label + .stat-value { white-space: normal; }
body.dashboard-shell .my-day-item + .my-day-item { border-top: 1px solid var(--gray-100); }
body.dashboard-shell #my-day-body > .ui-state-loading,
body.dashboard-shell #reminders-list > .ui-state-loading { border: 0; padding: var(--space-4) 0; background: transparent; min-height: 0; }

body.dashboard-shell .ui-state-success {
    border-color: #86efac;
    background: var(--success-surface);
    color: var(--success-ink);
}

body.dashboard-shell .ui-table-state td {
    min-height: var(--control-height);
    padding: var(--space-6);
    color: var(--ink-muted);
    text-align: center;
}

body.dashboard-shell .ui-table-state-error td {
    background: var(--danger-surface);
    color: var(--danger-ink);
}

body.dashboard-shell .skills-list:not(.ui-state) {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

body.dashboard-shell .mobile-header .hamburger:hover {
    background: var(--surface-subtle);
    border-color: var(--border-strong);
}

body.dashboard-shell .sidebar-overlay {
    z-index: var(--z-drawer-backdrop);
    pointer-events: none;
    opacity: 0;
    transition: opacity 180ms ease;
}

body.dashboard-shell .sidebar {
    width: var(--drawer-width);
    max-width: var(--drawer-width);
    z-index: var(--z-drawer);
    padding: var(--space-4);
}

body.dashboard-shell .sidebar-overlay.active {
    pointer-events: auto;
    opacity: 1;
}

body.dashboard-shell .sidebar-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

body.dashboard-shell .sidebar-topbar .sidebar-logo {
    min-width: 0;
    margin-bottom: 0;
}

body.dashboard-shell .sidebar-close {
    display: none;
    min-width: var(--touch-target);
    min-height: var(--touch-target);
}

body.dashboard-shell .workspace-toolbar,
body.dashboard-shell .workspace-actions,
body.dashboard-shell .workspace-detail-header {
    row-gap: var(--space-3);
}

body.dashboard-shell .workspace-toolbar > label,
body.dashboard-shell .workspace-toolbar > label:first-child {
    min-width: min(100%, 14rem);
}

/* FE-21 shared control contract. Toolbars wrap before controls become
   unreadable; searchable fields get the wide lane while enum fields remain
   compact without relying on field IDs or route-specific widths. */
body.dashboard-shell .workspace-toolbar {
    align-items: flex-end;
    column-gap: var(--space-3);
    row-gap: var(--space-3);
}

body.dashboard-shell .workspace-toolbar > label {
    flex: 1 1 11rem;
    min-width: 11rem;
    width: auto;
}

body.dashboard-shell .workspace-toolbar > label:first-child,
body.dashboard-shell .workspace-toolbar > label:has(input[type="search"]),
body.dashboard-shell .workspace-toolbar > label:has(.entity-selector) {
    flex: 1.5 1 15rem;
    min-width: min(100%, 15rem);
}

body.dashboard-shell .workspace-toolbar > select,
body.dashboard-shell .workspace-toolbar > input,
body.dashboard-shell .workspace-toolbar > .form-input {
    flex: 0 1 11rem;
    min-width: 8.5rem;
}

body.dashboard-shell .entity-selector {
    min-width: 0;
    width: 100%;
}

body.dashboard-shell :where(input[type="date"], input[type="month"], input[type="datetime-local"]) {
    appearance: auto;
    -webkit-appearance: auto;
    min-width: 11rem;
    min-height: var(--control-height);
    padding: 0 .75rem;
    font-size: 1rem;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

body.dashboard-shell :where(input[type="date"], input[type="month"], input[type="datetime-local"])::-webkit-calendar-picker-indicator {
    width: 1.25rem;
    height: 1.25rem;
    padding: .15rem;
    cursor: pointer;
}

/* Invoice/quotation lines use two intentional tiers on desktop and stack as
   cards on narrow viewports. This keeps text fields readable and numeric
   fields from shrinking into slivers. */
.invoice-line-editor,
.quotation-line-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
    align-items: end;
    margin-top: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-control);
    background: var(--surface-subtle);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.invoice-line-editor > :nth-child(1),
.invoice-line-editor > :nth-child(2),
.quotation-line-editor > :nth-child(1),
.quotation-line-editor > :nth-child(2) {
    min-width: 0;
}

.invoice-line-editor textarea,
.quotation-line-editor textarea {
    min-height: 5.5rem;
    resize: vertical;
}

.invoice-line-editor__financials,
.quotation-line-editor__financials {
    display: grid;
    grid-template-columns: minmax(6.5rem, .8fr) minmax(7rem, 1fr) minmax(7rem, 1fr) auto;
    gap: var(--space-2);
    grid-column: 1 / -1;
    align-items: end;
    min-width: 0;
    width: 100%;
}

.invoice-line-editor__financials > input,
.quotation-line-editor__financials > input {
    min-width: 0;
    width: 100%;
}

.line-item-field {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    min-width: 0;
    color: var(--gray-700);
    font-size: .8125rem;
    font-weight: 700;
    line-height: 1.2;
}

.line-item-field .form-input {
    width: 100%;
    min-width: 0;
}

.line-amount {
    min-height: var(--control-height);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 7rem;
    color: var(--gray-700);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Explicitly preserve the native hidden contract when the branch itself is
   a flex container. Without this semantic selector, the browser's default
   [hidden] rule loses to .org-children { display:flex }. */
.org-children[hidden] {
    display: none;
}

/* Date filters may carry the legacy .btn class; keep them on the shared date
   typography/height contract instead of inheriting compact button text. */
body.dashboard-shell input[type="date"],
body.dashboard-shell input[type="month"],
body.dashboard-shell input[type="datetime-local"] {
    height: var(--control-height);
    min-height: var(--control-height);
    padding: 0 .75rem 0  .875rem;
    font-size: 1rem;
    line-height: 1.4;
}

@media (max-width: 700px) {
    .invoice-line-editor,
    .quotation-line-editor {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
        padding: var(--space-3);
    }

    .invoice-line-editor__financials,
    .quotation-line-editor__financials {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: var(--space-3);
        width: 100%;
    }

    .invoice-line-editor__financials .line-amount,
    .quotation-line-editor__financials .line-amount,
    .invoice-line-editor__financials .btn,
    .quotation-line-editor__financials .btn {
        justify-content: flex-start;
        width: 100%;
    }
}

body.dashboard-shell .workspace-toolbar input,
body.dashboard-shell .workspace-toolbar select,
body.dashboard-shell input[type="search"] {
    box-sizing: border-box;
    width: 100%;
}

body.dashboard-shell input[type="search"] {
    padding-left: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364758b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: .8rem center;
}

body.dashboard-shell .btn,
body.dashboard-shell input:not([type="hidden"]),
body.dashboard-shell select,
body.dashboard-shell textarea {
    box-sizing: border-box;
}

body.dashboard-shell .btn-sm,
body.dashboard-shell .btn-xs {
    min-height: var(--touch-target);
}

/* FE-11: keep every form control on the same 44px interaction grid. */
body.dashboard-shell :where(input:not([type="hidden"]), select, textarea, .form-input, .input, .settings-input) {
    box-sizing: border-box;
    min-height: var(--touch-target);
    line-height: 1.4;
}

body.dashboard-shell :where(input:not([type="hidden"]), select, .form-input, .input, .settings-input) {
    padding-inline: var(--control-padding-x);
}

body.dashboard-shell select {
    padding-inline-end: var(--control-select-inset);
}

body.dashboard-shell :where(.form-group, .form-field, .field-group) {
    display: flex;
    flex-direction: column;
    gap: var(--control-label-gap);
}

body.dashboard-shell :where(.form-group, .form-field, .field-group) > label {
    margin: 0;
}

body.dashboard-shell textarea {
    min-height: 6rem;
    padding: .75rem var(--control-padding-x);
    resize: vertical;
    line-height: 1.5;
}

body.dashboard-shell :where(input[type="date"], input[type="month"], input[type="number"]) {
    padding-inline: var(--control-padding-x) var(--control-select-inset);
}

body.dashboard-shell input[type="search"] {
    padding-inline: var(--control-select-inset) var(--control-padding-x);
}

body.dashboard-shell .workspace-actions > .btn,
body.dashboard-shell .workspace-actions > a,
body.dashboard-shell .workspace-toolbar > .btn {
    white-space: normal;
    line-height: 1.25;
}

body.dashboard-shell .workspace-section-actions {
    justify-content: flex-end;
    margin: var(--space-3) 0 var(--space-5);
}

body.dashboard-shell .capacity-card > h3,
body.dashboard-shell .capacity-card > h2,
body.dashboard-shell .workspace-panel > h3 {
    overflow-wrap: anywhere;
}

body.dashboard-shell .data-table[data-responsive-cards] {
    border: 0;
    min-width: 0;
}

body.dashboard-shell .data-table[data-responsive-cards] td[data-label] {
    min-width: 0;
}

body.dashboard-shell .responsive-filter-trigger {
    display: none;
}

body.dashboard-shell .responsive-filter-count {
    display: inline-flex;
    min-width: 1.35rem;
    min-height: 1.35rem;
    align-items: center;
    justify-content: center;
    margin-left: var(--space-2);
    padding: 0 .35rem;
    border-radius: 999px;
    background: var(--info-surface);
    color: var(--info-ink);
    font-size: var(--text-xs);
}

body.dashboard-shell .responsive-filter-summary {
    display: none;
    margin: var(--space-3) 0 0;
    color: var(--ink-muted);
    font-size: var(--text-sm);
}

body.dashboard-shell .field-group,
body.dashboard-shell .form-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

body.dashboard-shell .field-group + .field-group,
body.dashboard-shell .form-field + .form-field {
    margin-top: var(--space-4);
}

body.dashboard-shell .modal-content form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

body.dashboard-shell .modal-content form > :where(.form-group, .form-field, .field-group) + :where(.form-group, .form-field, .field-group) {
    margin-top: 0;
}

body.dashboard-shell .modal-content form label {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

body.dashboard-shell .modal-content .workspace-actions,
body.dashboard-shell .modal-content form > div:last-child {
    margin-top: var(--space-2);
    gap: var(--space-3);
}

body.dashboard-shell .workspace-actions,
body.dashboard-shell .list-pagination,
body.dashboard-shell .notification-list-controls,
body.dashboard-shell .weekly-grid-navigation {
    align-items: center;
    line-height: 1.25;
}

body.dashboard-shell .workspace-actions > *,
body.dashboard-shell .list-pagination > *,
body.dashboard-shell .notification-list-controls > * {
    flex: 0 1 auto;
}

body.dashboard-shell .list-pagination,
body.dashboard-shell #notification-page-label,
body.dashboard-shell .weekly-grid-navigation > span {
    white-space: nowrap;
}

body.dashboard-shell .list-pagination {
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

body.dashboard-shell .notification-list-controls {
    flex-wrap: wrap;
    gap: var(--space-2) !important;
}

body.dashboard-shell .weekly-grid-header {
    margin-bottom: var(--section-gap);
}

body.dashboard-shell .workspace-detail > .workspace-actions + * {
    margin-top: var(--section-gap);
}

@media (max-width: 1024px) {
    body.dashboard-shell .sidebar-close { display: inline-grid; place-items: center; }
    body.dashboard-shell .main-content { padding-inline: var(--page-gutter); }
    body.dashboard-shell .dashboard-header > div:first-child,
    body.dashboard-shell .page-header__intro { flex: 0 1 auto; }
}

@media (max-width: 768px) {
    body.dashboard-shell .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-4);
    }

    body.dashboard-shell .page-header__actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 430px) {
    body.dashboard-shell .main-content {
        padding-inline: var(--space-3);
    }

    body.dashboard-shell .page-header__intro {
        width: 100%;
        max-width: 100%;
        padding-inline: 0;
    }

    body.dashboard-shell .page-header__intro h1 {
        font-size: clamp(1.5rem, 7vw, 2rem);
    }

    body.dashboard-shell .page-header__actions > .btn {
        flex: 1 1 12rem;
    }

    body.dashboard-shell .workspace-section-actions > .btn,
    body.dashboard-shell .workspace-section-actions > a {
        flex: 1 1 100%;
    }
}

@media (min-width: 1025px) {
    body.dashboard-shell .sidebar {
        width: var(--sidebar-width);
        max-width: none;
    }
}

@media (max-width: 600px) {
    body.dashboard-shell .main-content { padding-inline: var(--space-3); }
    body.dashboard-shell .dashboard-header { margin-bottom: var(--space-6); }
    body.dashboard-shell .dashboard-header > div:first-child { flex-basis: 100%; }
    body.dashboard-shell .dashboard-header h1 { font-size: clamp(1.55rem, 7vw, 2rem); line-height: 1.15; }
    body.dashboard-shell .user-actions { gap: var(--space-2); }
    body.dashboard-shell .user-actions > .btn { flex: 1 1 auto; }

    body.dashboard-shell .responsive-filter-trigger {
        display: inline-flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        margin-bottom: var(--space-2);
    }

    body.dashboard-shell .workspace-toolbar.has-responsive-filter:not(.is-filter-open) > :not(.responsive-filter-trigger) {
        display: none;
    }

    body.dashboard-shell .workspace-toolbar.has-responsive-filter.is-filter-open {
        padding: var(--space-3);
        border: 1px solid var(--border-strong);
        border-radius: 12px;
        background: var(--surface-subtle);
    }

    body.dashboard-shell .workspace-toolbar.has-responsive-filter.is-filter-open > label,
    body.dashboard-shell .workspace-toolbar.has-responsive-filter.is-filter-open > .btn {
        flex: 1 1 100%;
        min-width: 100%;
    }

    body.dashboard-shell .workspace-toolbar.has-responsive-filter.is-filter-open > .responsive-filter-trigger {
        margin-bottom: var(--space-2);
    }

    body.dashboard-shell .responsive-filter-summary.has-active-filters { display: block; }

    /* Progressive table-to-card view. The Weekly Grid and other explicitly
       dense grids remain contained tables; record lists become readable cards. */
    body.dashboard-shell .table-container:has(.data-table[data-responsive-cards]) {
        overflow: visible;
    }

    body.dashboard-shell .data-table[data-responsive-cards],
    body.dashboard-shell .data-table[data-responsive-cards] tbody {
        display: block;
        width: 100%;
    }

    body.dashboard-shell .data-table[data-responsive-cards] thead {
        display: none;
    }

    body.dashboard-shell .data-table[data-responsive-cards] tbody {
        display: grid;
        gap: var(--space-3);
    }

    body.dashboard-shell .data-table[data-responsive-cards] tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-2);
        padding: var(--space-4);
        border: 1px solid var(--gray-200);
        border-radius: 12px;
        background: var(--white);
        box-shadow: var(--shadow-sm);
    }

    body.dashboard-shell .data-table[data-responsive-cards] td {
        display: grid;
        grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr);
        gap: var(--space-3);
        width: auto;
        min-width: 0;
        padding: var(--space-2) 0;
        border: 0;
        overflow-wrap: anywhere;
    }

    body.dashboard-shell .data-table[data-responsive-cards] td::before {
        content: attr(data-label);
        color: var(--ink-muted);
        font-size: var(--text-xs);
        font-weight: 700;
        letter-spacing: .03em;
        text-transform: uppercase;
    }

    body.dashboard-shell .data-table[data-responsive-cards] td:last-child {
        padding-top: var(--space-3);
        border-top: 1px solid var(--gray-100);
    }

    body.dashboard-shell .data-table[data-responsive-cards] td:last-child::before {
        align-self: center;
    }

    body.dashboard-shell .data-table[data-responsive-cards] td .workspace-actions {
        justify-content: flex-end;
        min-width: 0;
    }

    body.dashboard-shell .data-table[data-responsive-cards] td .workspace-actions .btn,
    body.dashboard-shell .data-table[data-responsive-cards] td .workspace-actions a {
        flex: 0 1 auto;
        min-height: 44px;
    }

    body.dashboard-shell .workspace-toolbar > .btn,
    body.dashboard-shell .workspace-actions > .btn,
    body.dashboard-shell .workspace-actions > a {
        min-height: 44px;
    }

    body.dashboard-shell .workspace-detail-grid,
    body.dashboard-shell .workspace-metrics { grid-template-columns: 1fr; }
}

@media (min-width: 601px) and (max-width: 1024px) {
    body.dashboard-shell .capacity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.dashboard-shell .workspace-toolbar > label { flex: 1 1 13rem; }
    body.dashboard-shell .workspace-toolbar > label:first-child { flex: 2 1 18rem; }
    body.dashboard-shell .workspace-actions { width: auto; }
    body.dashboard-shell .workspace-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .recruitment-pipeline {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
        contain: none;
    }

    .recruitment-column {
        min-width: 0 !important;
        width: auto;
        min-height: 0 !important;
        flex: none !important;
    }
}

/* Phase 9C Payroll administration consumers. */
.workspace-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    margin: var(--space-4) 0;
}
.workspace-metrics .capacity-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-height: 0;
}
.payroll-admin-workspace .payroll-table th:last-child,
.payroll-admin-workspace .payroll-table td:last-child {
    min-width: 260px;
}
@media (max-width: 768px) {
    .workspace-metrics { grid-template-columns: 1fr; }
    .payroll-admin-workspace .payroll-table { min-width: 860px; }
}

/* ============================================
   HERO
   ============================================ */

.hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: var(--space-24) var(--space-6) var(--space-16);
    padding-top: calc(var(--header-height) + var(--space-16));
    background: var(--white);
}

.hero .hero-metric {
    margin-bottom: var(--space-6);
}

.hero .metric-value.hero-metric {
    font-size: var(--text-hero);
    color: var(--accent);
}

.hero .metric-label {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-top: var(--space-1);
}

.hero h1 {
    font-size: clamp(var(--text-3xl), 6vw, var(--text-hero));
    margin-bottom: var(--space-4);
    max-width: 800px;
}

.hero p {
    font-size: var(--text-lg);
    color: var(--gray-500);
    max-width: 520px;
    margin: 0 auto var(--space-8);
    line-height: 1.6;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--gray-100);
    border-radius: var(--border-radius-full);
    font-size: var(--text-sm);
    color: var(--gray-600);
}

.hero-badge-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
}

/* ============================================
   SOCIAL PROOF BAR
   ============================================ */

.proof-bar {
    background: var(--gray-100);
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-4) 0;
}

.proof-bar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    flex-wrap: wrap;
    font-size: var(--text-sm);
    color: var(--gray-500);
    font-weight: 500;
}

.proof-bar-dot {
    width: 4px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 50%;
    flex-shrink: 0;
}

/* ============================================
   PROBLEM STATEMENT
   ============================================ */

.problem-grid {
    display: grid;
    gap: var(--space-10);
}

@media (min-width: 768px) {
    .problem-grid {
        grid-template-columns: 1fr 1fr;
        align-items: center;
    }
}

.problem-text h2 {
    margin-bottom: var(--space-6);
}

.problem-text p {
    margin-bottom: var(--space-4);
    font-size: var(--text-lg);
    line-height: 1.6;
}

.problem-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.problem-card {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: var(--space-5);
    text-align: center;
}

.problem-card-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin-bottom: var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.problem-card-value {
    display: block;
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--gray-900);
}

.problem-card--highlight {
    background: var(--warm-light);
    border-color: var(--warm);
    grid-column: 1 / -1;
}

.problem-card--highlight .problem-card-value {
    color: var(--warm);
    font-size: var(--text-3xl);
}

/* ============================================
   SERVICES GRID
   ============================================ */

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: var(--space-6);
    transition: all var(--duration-base) var(--ease-material);
}

.card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card-icon {
    width: 44px;
    height: 44px;
    background: var(--accent-light);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: var(--space-4);
}

.card h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
}

.card p {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

/* ============================================
   9-POINT AUDIT GRID (Compact)
   ============================================ */

.audit-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}

.audit-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-900);
    transition: all var(--duration-base) var(--ease-material);
}

.audit-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.audit-number {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
}

/* ============================================
   CASE STUDIES
   ============================================ */

.case-studies-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.case-study {
    display: grid;
    gap: var(--space-8);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: var(--space-8);
}

@media (min-width: 768px) {
    .case-study {
        grid-template-columns: 1fr 1fr;
        align-items: center;
    }
}

.case-study-tag {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-3);
}

.case-study-metric {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-weight: 700;
    color: var(--warm);
    line-height: 1;
    margin-bottom: var(--space-1);
}

.case-study-detail {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-bottom: var(--space-4);
}

.case-study-info p {
    font-size: var(--text-sm);
    color: var(--gray-500);
    line-height: 1.6;
}

/* Compare Bars */
.compare-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.compare-bar-label {
    font-size: var(--text-xs);
    color: var(--gray-500);
    width: 72px;
    flex-shrink: 0;
}

.compare-bar-track {
    flex: 1;
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--border-radius-full);
    overflow: hidden;
}

.compare-bar-fill {
    height: 100%;
    border-radius: var(--border-radius-full);
    transition: width 1s var(--ease-out);
}

.compare-bar-fill--before {
    background: var(--gray-400);
}

.compare-bar-fill--after {
    background: var(--success);
}

.compare-bar-value {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-900);
    width: 48px;
    text-align: right;
    flex-shrink: 0;
}

/* ============================================
   METRICS
   ============================================ */

.metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
    margin-top: var(--space-10);
    padding-top: var(--space-10);
    border-top: 1px solid var(--gray-200);
}

.metric {
    text-align: center;
}

.metric-value {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-weight: 600;
    color: var(--success);
    line-height: 1;
    letter-spacing: -0.03em;
}

.metric-label {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-top: var(--space-1);
}

/* ============================================
   TESTIMONIALS
   ============================================ */

.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-6);
}

.testimonial-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: var(--space-6);
    position: relative;
    transition: all var(--duration-base) var(--ease-material);
}

.testimonial-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.testimonial-quote-mark {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 3rem;
    line-height: 1;
    color: var(--warm);
    margin-bottom: var(--space-2);
}

.testimonial-text {
    font-size: var(--text-sm);
    font-style: italic;
    color: var(--gray-600);
    line-height: 1.7;
    margin-bottom: var(--space-6);
    max-width: none;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.testimonial-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 600;
    flex-shrink: 0;
}

.testimonial-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-900);
}

.testimonial-role {
    font-size: var(--text-xs);
    color: var(--gray-500);
}

/* ============================================
   CTA SECTION
   ============================================ */

.section-cta {
    background: var(--gray-900);
    padding: var(--space-20) var(--space-6);
}

.section-cta h2 {
    color: var(--white);
    font-size: var(--text-4xl);
}

.section-cta p {
    color: var(--gray-400);
    font-size: var(--text-lg);
}

.section-cta .btn-primary {
    background: var(--white);
    color: var(--gray-900);
}

.section-cta .btn-primary:hover {
    background: var(--gray-200);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    background: var(--gray-100);
    padding: var(--space-12) 0;
    border-top: 1px solid var(--gray-200);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

@media (min-width: 768px) {
    .footer-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.footer-brand {
    color: var(--gray-500);
    font-size: var(--text-sm);
}

.footer-links {
    display: flex;
    gap: var(--space-6);
    flex-wrap: wrap;
}

.footer-link {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.footer-link:hover {
    color: var(--black);
}

/* ============================================
   WHATSAPP FLOATING BUTTON
   ============================================ */

.whatsapp-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 90;
    width: 56px;
    height: 56px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    transition: transform var(--duration-base) var(--ease-material), box-shadow var(--duration-base) var(--ease-material);
}

.whatsapp-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
}

.whatsapp-btn:active {
    transform: scale(0.95);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.animate-in {
    animation: fadeInUp var(--duration-slow) var(--ease-out) forwards;
}

.animate-delay-1 {
    animation-delay: 0.1s;
}

.animate-delay-2 {
    animation-delay: 0.2s;
}

.animate-delay-3 {
    animation-delay: 0.3s;
}

.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--duration-slow) var(--ease-material), transform var(--duration-slow) var(--ease-emphasized);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 767px) {
    h1 {
        font-size: var(--text-3xl);
    }

    h2 {
        font-size: var(--text-2xl);
    }

    .hero {
        padding-top: calc(var(--header-height) + var(--space-10));
    }

    .hero .metric-value.hero-metric {
        font-size: var(--text-4xl);
    }

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

    .metrics {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .problem-cards {
        grid-template-columns: 1fr 1fr;
    }

    .section-cta {
        padding: var(--space-16) var(--space-6);
    }

    .section-cta h2 {
        font-size: var(--text-2xl);
    }

    .whatsapp-btn {
        width: 48px;
        height: 48px;
        bottom: 16px;
        right: 16px;
    }

    .whatsapp-btn svg {
        width: 24px;
        height: 24px;
    }

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

    .sticky-cta {
        padding: var(--space-3) var(--space-4);
    }

    .sticky-cta-text {
        display: none;
    }

    .scroll-modal {
        width: calc(100% - 32px);
        right: 16px;
        bottom: 72px;
    }
}

/* ============================================
   STICKY CTA BAR
   ============================================ */

.sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 80;
    background: var(--gray-900);
    padding: var(--space-3) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    transform: translateY(100%);
    transition: transform var(--duration-base) var(--ease-material);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.sticky-cta.visible {
    transform: translateY(0);
}

.sticky-cta.dismissed {
    transform: translateY(100%);
}

.sticky-cta-text {
    font-size: var(--text-sm);
    color: var(--gray-300);
    font-weight: 500;
}

.sticky-cta .btn {
    flex-shrink: 0;
}

.sticky-cta-dismiss {
    position: absolute;
    top: 50%;
    right: var(--space-4);
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    font-size: var(--text-lg);
    line-height: 1;
    padding: var(--space-2);
}

.sticky-cta-dismiss:hover {
    color: var(--white);
}

/* ============================================
   SCROLL MODAL (Bottom-Right Popup)
   ============================================ */

.scroll-modal {
    position: fixed;
    bottom: 88px;
    right: 24px;
    z-index: 79;
    width: 340px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-6);
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-base) var(--ease-material);
}

.scroll-modal.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.scroll-modal-dismiss {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: var(--text-lg);
    line-height: 1;
    padding: var(--space-1);
}

.scroll-modal-dismiss:hover {
    color: var(--gray-900);
}

.scroll-modal h4 {
    font-size: var(--text-base);
    margin-bottom: var(--space-2);
    padding-right: var(--space-6);
}

.scroll-modal p {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-bottom: var(--space-4);
    max-width: none;
    line-height: 1.6;
}

/* ============================================
   FOOTER LINK GROUP (for upgraded footer)
   ============================================ */

.footer-link-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.footer-link-group-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-900);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

/* --- Lead Status Badges --- */
.badge-new {
    background: var(--gray-200) !important;
    color: var(--gray-900) !important;
}

.badge-contacted {
    background: var(--accent-light) !important;
    color: var(--accent) !important;
}

.badge-qualified {
    background: rgba(245, 166, 35, 0.15) !important;
    color: var(--warm) !important;
}

.badge-proposal_sent {
    background: rgba(175, 82, 222, 0.15) !important;
    color: #AF52DE !important;
}

/* Purple */
.badge-won {
    background: var(--success-light) !important;
    color: var(--success) !important;
}

.badge-lost {
    background: rgba(255, 59, 48, 0.1) !important;
    color: var(--danger) !important;
}

.badge-pending_approval {
    background: rgba(255, 149, 0, 0.15) !important;
    color: #FF9500 !important;
}

/* Orange */

/* Phase 1C shared active-source repairs. */
body.dashboard-shell .calendar-event-content {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    gap: var(--space-2);
}

body.dashboard-shell .calendar-event-meta {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin-top: 0;
    line-height: 1.4;
}

body.dashboard-shell .calendar-event-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

body.dashboard-shell .calendar-event-location { overflow-wrap: anywhere; }

body.dashboard-shell .case-note-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

body.dashboard-shell .case-note-form .workspace-toolbar { margin-top: 0; }
body.dashboard-shell .case-note-form label { display: flex; min-width: 0; flex-direction: column; gap: var(--space-2); }
body.dashboard-shell .case-note-form .case-note-body-field textarea {
    width: 100%;
    min-height: 12rem;
    line-height: 1.55;
    resize: vertical;
}
body.dashboard-shell .case-note-form .case-note-attachment-field { gap: var(--space-2); }
body.dashboard-shell .case-note-form [data-attachment-list] { display: block; min-height: 1.25rem; }
body.dashboard-shell .case-note-form > .workspace-actions {
    justify-content: flex-end;
    margin-top: var(--space-2);
    padding-top: var(--space-4);
    border-top: 1px solid var(--gray-200);
}

body.dashboard-shell .settings-workspace-card { grid-column: 1 / -1; }

@media (max-width: 700px) {
    body.dashboard-shell .calendar-event-card { align-items: stretch; }
    body.dashboard-shell .calendar-event-time { min-width: 0; }
    body.dashboard-shell .settings-workspace-card { grid-column: auto; }
}

/* Phase 1C user-confirmed failure-only spacing contract. These rules apply
   only between intended top-level/group siblings; nested cards remain dense. */
body.dashboard-shell .vertical-stack > * + *,
body.dashboard-shell .workspace-related-panel + .workspace-related-panel {
    margin-top: var(--section-gap);
}

body.dashboard-shell .management-kpi-groups {
    display: grid;
    gap: var(--section-gap);
    padding-top: var(--section-gap);
}

body.dashboard-shell .management-report-group {
    display: grid;
    gap: var(--space-4);
}

body.dashboard-shell .management-report-group > .capacity-grid {
    margin-top: 0;
}

body.dashboard-shell .metric-card { display: flex; min-width: 0; flex-direction: column; gap: var(--space-2); }
body.dashboard-shell .metric-card__label { color: var(--gray-500); font-size: var(--text-sm); line-height: 1.35; }
body.dashboard-shell .metric-card__value { color: var(--gray-900); font-size: var(--text-2xl); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
body.dashboard-shell .metric-card__helper { color: var(--gray-500); font-size: var(--text-xs); line-height: 1.45; }

body.dashboard-shell .activity-record-stack,
body.dashboard-shell .context-task-list,
body.dashboard-shell .task-list {
    display: grid;
    gap: var(--space-4);
}

body.dashboard-shell .activity-records {
    margin-block: var(--section-gap);
}

body.dashboard-shell .activity-records > .activity-record-stack {
    margin-block: 0;
}

body.dashboard-shell .workspace-pagination,
body.dashboard-shell [aria-label="Activity pagination"],
body.dashboard-shell [aria-label="Notification pagination"] {
    display: flex;
    flex-wrap: wrap;
    margin-block: var(--section-gap);
    gap: var(--space-3);
}

body.dashboard-shell .workspace-pagination > * {
    flex: 0 0 auto;
}

body.dashboard-shell .reminder-actions,
body.dashboard-shell .reminder-snooze-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: var(--space-3);
}

body.dashboard-shell .reminder-snooze-form label {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    color: var(--gray-600);
    font-size: var(--text-xs);
    font-weight: 600;
}

body.dashboard-shell .reminder-snooze-form input {
    width: 7rem;
}
.entity-native-select { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.cap1c-entity-search { width:100%; }
.cap1c-pagination { display:flex; align-items:center; justify-content:center; gap:var(--space-3); padding:var(--space-4) 0; }
.cap1c-event-list { display:grid; gap:var(--space-2); }
.cap1c-event { display:grid; grid-template-columns:minmax(96px, .35fr) minmax(130px, .55fr) 1fr auto; gap:var(--space-3); align-items:center; padding:var(--space-3); border:1px solid var(--gray-200); border-radius:var(--radius-md); background:var(--white); }
@media (max-width: 720px) { .cap1c-event { grid-template-columns:1fr 1fr; } .cap1c-event > :last-child { grid-column:1/-1; } }
