        :root {
            color-scheme: light;
            --bg: #f8fafc;
            --bg-accent: #eef4ff;
            --panel: rgba(255, 255, 255, 0.9);
            --panel-solid: #ffffff;
            --border: #e2e8f0;
            --border-strong: #cbd5e1;
            --ink: #0f172a;
            --muted: #64748b;
            --brand: #2563eb;
            --brand-strong: #1d4ed8;
            --brand-soft: #dbeafe;
            --success: #15803d;
            --success-soft: #dcfce7;
            --danger: #b91c1c;
            --danger-soft: #fee2e2;
            --warning: #b45309;
            --warning-soft: #fef3c7;
            --chip: #f8fafc;
            --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
            --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
            --radius-sm: 10px;
            --radius-md: 16px;
            --radius-lg: 22px;
            --container: 1280px;
        }

        * {
            box-sizing: border-box;
        }

        html {
            font-size: 16px;
        }

        body {
            margin: 0;
            min-height: 100vh;
            font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            color: var(--ink);
            background:
                radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28%),
                radial-gradient(circle at top right, rgba(14, 165, 233, 0.08), transparent 24%),
                linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
            line-height: 1.5;
        }

        body.mim-brand-theme {
            --bg: #f4f6f6;
            --bg-accent: #e6e7e8;
            --panel: rgba(255, 255, 255, 0.94);
            --panel-solid: #ffffff;
            --border: #d9dede;
            --border-strong: #b8c5c5;
            --ink: #173f41;
            --muted: #587477;
            --brand: #225e61;
            --brand-strong: #17484a;
            --brand-soft: #e4efef;
            --chip: #f5f7f7;
            --shadow-sm: 0 1px 2px rgba(34, 94, 97, 0.08);
            --shadow-md: 0 14px 34px rgba(34, 94, 97, 0.11);
            font-family: "Proxima Nova", "Avenir Next", Avenir, "Segoe UI", Arial, sans-serif;
            background: #f4f6f6;
        }

        body.mim-brand-theme header {
            background: rgba(255, 255, 255, 0.94);
            border-bottom: 3px solid #f99d25;
            box-shadow: 0 8px 24px rgba(34, 94, 97, 0.08);
        }

        body.mim-brand-theme nav a:hover,
        body.mim-brand-theme nav button:hover,
        body.mim-brand-theme nav summary:hover,
        body.mim-brand-theme .nav-dropdown[open] summary,
        body.mim-brand-theme .brand-tools .inline-form button:hover {
            background: #fff0dc;
            color: var(--brand-strong);
            border-color: rgba(249, 157, 37, 0.55);
        }

        body.mim-brand-theme nav a:focus-visible,
        body.mim-brand-theme nav button:focus-visible,
        body.mim-brand-theme nav summary:focus-visible,
        body.mim-brand-theme .button:focus-visible,
        body.mim-brand-theme .field input:focus-visible,
        body.mim-brand-theme .field select:focus-visible,
        body.mim-brand-theme .field textarea:focus-visible {
            box-shadow: 0 0 0 4px rgba(249, 157, 37, 0.28);
        }

        body.mim-brand-theme .button {
            border-color: var(--brand);
            background: var(--brand);
            box-shadow: 0 8px 18px rgba(34, 94, 97, 0.2);
        }

        body.mim-brand-theme .button:hover {
            box-shadow: 0 12px 24px rgba(34, 94, 97, 0.25);
        }

        body.mim-brand-theme .button.secondary {
            background: #ffffff;
            color: var(--brand-strong);
            border-color: #f99d25;
        }

        body.mim-brand-theme .nav-meta {
            background: var(--brand-soft);
            color: var(--brand-strong);
            border-color: #c4d7d8;
        }

        body.mim-brand-theme .setup-assistant-link {
            border-color: #f99d25;
            color: var(--brand-strong);
        }

        a {
            color: inherit;
        }

        button,
        input,
        select,
        textarea {
            font: inherit;
        }

        .app-shell {
            min-height: 100vh;
        }

        header {
            position: sticky;
            top: 0;
            z-index: 40;
            backdrop-filter: blur(14px);
            background: rgba(255, 255, 255, 0.82);
            border-bottom: 1px solid rgba(226, 232, 240, 0.9);
            box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
        }

        .topbar {
            width: 100%;
            padding: 1rem 1.5rem 1.1rem;
        }

        .brand-row {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 1rem;
            flex-wrap: wrap;
            position: relative;
        }

        .brand {
            display: flex;
            align-items: center;
            justify-content: center;
            min-width: 0;
            width: 100%;
        }

        .brand-mark {
            display: block;
            width: clamp(250px, 34vw, 440px);
            max-width: 100%;
            max-height: 112px;
            height: auto;
            object-fit: contain;
            flex: 0 1 auto;
        }

        .brand-home {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            text-decoration: none;
        }

        .brand-name {
            color: var(--ink);
            font-size: clamp(1.55rem, 3vw, 2.35rem);
            font-weight: 800;
            letter-spacing: -0.035em;
            line-height: 1.1;
            text-align: center;
        }

        .brand-tools {
            display: inline-flex;
            align-items: center;
            gap: 0.75rem;
            flex-wrap: wrap;
            justify-content: flex-end;
            position: absolute;
            right: 0;
            top: 50%;
            transform: translateY(-50%);
        }

        nav {
            margin-top: 1rem;
            display: flex;
            gap: 0.65rem;
            flex-wrap: wrap;
            align-items: center;
            justify-content: center;
        }

        nav a,
        nav button,
        nav summary {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 2.5rem;
            padding: 0.65rem 0.95rem;
            border-radius: 999px;
            border: 1px solid transparent;
            background: transparent;
            color: var(--muted);
            text-decoration: none;
            font-weight: 600;
            cursor: pointer;
            transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
        }

        nav a:hover,
        nav button:hover,
        nav summary:hover {
            background: rgba(37, 99, 235, 0.08);
            color: var(--brand-strong);
            border-color: rgba(37, 99, 235, 0.12);
        }

        nav a:focus-visible,
        nav button:focus-visible,
        nav summary:focus-visible,
        .button:focus-visible,
        .field input:focus-visible,
        .field select:focus-visible,
        .field textarea:focus-visible {
            outline: none;
            box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
        }

        nav summary {
            list-style: none;
        }

        nav summary::-webkit-details-marker {
            display: none;
        }

        .nav-dropdown {
            position: relative;
        }

        .nav-dropdown[open] summary {
            background: rgba(37, 99, 235, 0.08);
            color: var(--brand-strong);
            border-color: rgba(37, 99, 235, 0.12);
        }

        .nav-dropdown-menu {
            position: absolute;
            top: calc(100% + 0.5rem);
            right: 0;
            min-width: 220px;
            max-height: min(72vh, 34rem);
            overflow-y: auto;
            overscroll-behavior: contain;
            padding: 0.45rem;
            border: 1px solid var(--border);
            border-radius: 16px;
            background: rgba(255, 255, 255, 0.98);
            box-shadow: var(--shadow-md);
            display: grid;
            gap: 0.25rem;
            z-index: 50;
            scrollbar-width: thin;
            scrollbar-color: var(--border-strong) transparent;
        }

        .nav-dropdown-menu::-webkit-scrollbar {
            width: 0.55rem;
        }

        .nav-dropdown-menu::-webkit-scrollbar-thumb {
            background: var(--border-strong);
            border-radius: 999px;
        }

        .nav-dropdown-menu a {
            justify-content: flex-start;
            width: 100%;
            border: 1px solid transparent;
            border-radius: 12px;
        }

        .nav-spacer {
            flex: 1 1 auto;
        }

        .nav-meta {
            display: inline-flex;
            align-items: center;
            min-height: 2.5rem;
            padding: 0.45rem 0.9rem;
            border-radius: 999px;
            background: var(--bg-accent);
            color: var(--brand-strong);
            font-size: 0.92rem;
            font-weight: 700;
            border: 1px solid #dbeafe;
        }

        .brand-tools .inline-form {
            gap: 0;
        }

        .brand-tools .inline-form button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 2.5rem;
            padding: 0.65rem 0.95rem;
            border-radius: 999px;
            border: 1px solid transparent;
            background: transparent;
            color: var(--muted);
            font-weight: 600;
            cursor: pointer;
            transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
        }

        .brand-tools .inline-form button:hover {
            background: rgba(37, 99, 235, 0.08);
            color: var(--brand-strong);
            border-color: rgba(37, 99, 235, 0.12);
        }

        main {
            max-width: var(--container);
            margin: 0 auto;
            padding: 2rem 1.5rem 3rem;
        }

        .panel,
        .detail-card,
        .file-card {
            background: var(--panel);
            border: 1px solid rgba(226, 232, 240, 0.95);
            border-radius: var(--radius-md);
            padding: 1.4rem;
            box-shadow: var(--shadow-md);
            backdrop-filter: blur(10px);
        }

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

        .page-head h2,
        .page-head h1 {
            margin: 0;
            font-size: clamp(1.5rem, 2.5vw, 2rem);
            line-height: 1.1;
            letter-spacing: -0.03em;
        }

        .page-head p {
            margin: 0.45rem 0 0;
            color: var(--muted);
        }

        .button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.45rem;
            min-height: 2.8rem;
            padding: 0.72rem 1.05rem;
            border: 1px solid var(--brand);
            border-radius: 12px;
            background: linear-gradient(180deg, #3b82f6 0%, var(--brand) 100%);
            color: #fff;
            text-decoration: none;
            font-weight: 700;
            cursor: pointer;
            box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
            transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
        }

        .button:hover {
            transform: translateY(-1px);
            box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
            filter: brightness(1.02);
        }

        .button.secondary {
            background: #fff;
            color: var(--ink);
            border-color: var(--border-strong);
            box-shadow: var(--shadow-sm);
        }

        .button.secondary:hover {
            border-color: var(--brand);
            color: var(--brand-strong);
            box-shadow: var(--shadow-md);
        }

        table {
            width: 100%;
            border-collapse: collapse;
            background: transparent;
        }

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

        tr:hover td {
            background: rgba(248, 250, 252, 0.9);
        }

        th {
            color: var(--muted);
            font-size: 0.79rem;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            font-weight: 800;
        }

        form {
            display: grid;
            gap: 1rem;
        }

        .inline-form {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            flex-wrap: wrap;
            margin: 0;
        }

        .grid,
        .detail-grid,
        .ticket-spec-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
            gap: 1rem;
        }

        .field label {
            display: block;
            font-weight: 700;
            font-size: 0.94rem;
            margin-bottom: 0.45rem;
            color: var(--ink);
        }

        .field input,
        .field select,
        .field textarea {
            width: 100%;
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 0.82rem 0.95rem;
            background: #fff;
            color: var(--ink);
            box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
            transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
        }

        .field input:hover,
        .field select:hover,
        .field textarea:hover {
            border-color: var(--border-strong);
        }

        .field input:focus,
        .field select:focus,
        .field textarea:focus {
            border-color: var(--brand);
            background: #fff;
            outline: none;
        }

        .helptext {
            color: var(--muted);
            font-size: 0.88rem;
            margin-top: 0.4rem;
        }

        .errors,
        .messages {
            margin-bottom: 1rem;
            padding: 0.95rem 1rem;
            border-radius: 14px;
            border: 1px solid;
            box-shadow: var(--shadow-sm);
        }

        .errors {
            background: var(--danger-soft);
            color: var(--danger);
            border-color: #fecaca;
        }

        .messages {
            background: var(--success-soft);
            color: var(--success);
            border-color: #bbf7d0;
        }

        .detail-card h3 {
            margin: 0 0 0.75rem;
            font-size: 1rem;
            letter-spacing: -0.01em;
        }

        .collapsible-card {
            overflow: hidden;
        }

        .collapsible-card.is-collapsed .collapsible-body {
            display: none;
        }

        .collapsible-trigger {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
            padding: 0;
            border: 0;
            background: transparent;
            color: inherit;
            text-align: left;
            cursor: pointer;
            font: inherit;
        }

        .collapsible-trigger:hover .collapsible-title,
        .collapsible-trigger:focus-visible .collapsible-title {
            color: var(--brand);
        }

        .collapsible-trigger:focus-visible {
            outline: 2px solid rgba(37, 99, 235, 0.28);
            outline-offset: 6px;
            border-radius: 12px;
        }

        .collapsible-title {
            display: block;
            min-width: 0;
            font-weight: 700;
        }

        .collapsible-toggle-icon {
            flex: 0 0 auto;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 2rem;
            height: 2rem;
            border-radius: 999px;
            border: 1px solid var(--border);
            background: var(--chip);
            color: var(--ink);
            transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, background-color 160ms ease;
        }

        .collapsible-card.is-collapsed .collapsible-toggle-icon {
            transform: rotate(-90deg);
        }

        .collapsible-card .collapsible-trigger:hover .collapsible-toggle-icon,
        .collapsible-card .collapsible-trigger:focus-visible .collapsible-toggle-icon {
            border-color: var(--brand);
            color: var(--brand);
            background: var(--brand-soft);
        }

        .collapsible-body {
            margin-top: 0.9rem;
        }

        .collapsible-card .collapsible-header > :first-child {
            margin-top: 0;
        }

        .nav-dropdown[open] .nav-dropdown-menu {
            animation: dropdownFade 160ms ease;
        }

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

        .detail-label {
            display: block;
            color: var(--muted);
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            font-weight: 800;
            margin-bottom: 0.25rem;
        }

        .status-row {
            display: flex;
            gap: 0.6rem;
            flex-wrap: wrap;
            margin-bottom: 1rem;
        }

        .status-chip,
        .readiness-pill {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 2rem;
            padding: 0.45rem 0.8rem;
            border-radius: 999px;
            text-decoration: none;
            font-size: 0.9rem;
            font-weight: 700;
            border: 1px solid var(--border);
            background: var(--chip);
            color: var(--ink);
        }

        .status-chip.active {
            background: var(--brand);
            border-color: var(--brand);
            color: #fff;
            box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
        }

        .readiness-pill.success {
            background: var(--success-soft);
            color: var(--success);
            border-color: #bbf7d0;
        }

        .readiness-pill.danger {
            background: var(--danger-soft);
            color: var(--danger);
            border-color: #fecaca;
        }

        .ticket-banner {
            border-width: 1px;
        }

        .ticket-banner.success {
            border-color: #bbf7d0;
            background: linear-gradient(180deg, #f7fff9 0%, #effcf3 100%);
        }

        .ticket-banner.danger {
            border-color: #fecaca;
            background: linear-gradient(180deg, #fff8f8 0%, #fff1f2 100%);
        }

        .ticket-banner-row,
        .file-card-head {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
            align-items: center;
            flex-wrap: wrap;
        }

        .ticket-banner-meta {
            display: grid;
            gap: 0.35rem;
            min-width: 220px;
        }

        .file-card-current {
            border-left: 5px solid var(--success);
        }

        .file-card-missing {
            border-left: 5px solid var(--danger);
        }

        .ticket-panel {
            max-width: 1120px;
            margin: 0 auto;
        }

        .ticket-grid {
            grid-template-columns: 1.5fr 1fr;
        }

        .ticket-table th,
        .ticket-table td {
            font-size: 0.95rem;
        }

        .login-shell {
            min-height: calc(100vh - 160px);
            display: grid;
            place-items: center;
        }

        .login-panel {
            width: 100%;
            max-width: 460px;
        }

        ul.clean {
            list-style: none;
            padding: 0;
            margin: 0;
        }

        ul.clean li + li {
            margin-top: 0.75rem;
        }

        .section-stack > * + * {
            margin-top: 1rem;
        }

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

        .section-gap {
            margin-top: 1.25rem;
        }

        .section-gap-sm {
            margin-top: 1rem;
        }

        .crm-shell {
            display: grid;
            gap: 1.25rem;
        }

        .crm-hero {
            border: 1px solid rgba(15, 23, 42, 0.08);
            border-radius: 24px;
            padding: 1.6rem;
            background:
                linear-gradient(135deg, rgba(15, 23, 42, 0.96) 0%, rgba(30, 41, 59, 0.95) 55%, rgba(37, 99, 235, 0.9) 100%);
            color: #eff6ff;
            box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
        }

        .crm-hero h2,
        .crm-hero h1,
        .crm-hero h3,
        .crm-hero p,
        .crm-hero a,
        .crm-hero .detail-label {
            color: inherit;
        }

        .crm-hero-copy {
            max-width: 760px;
            display: grid;
            gap: 0.55rem;
        }

        .crm-eyebrow {
            display: inline-flex;
            align-items: center;
            width: fit-content;
            padding: 0.28rem 0.7rem;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.12);
            border: 1px solid rgba(255, 255, 255, 0.14);
            font-size: 0.76rem;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            font-weight: 800;
        }

        .crm-headline {
            margin: 0;
            font-size: clamp(2rem, 3vw, 3rem);
            line-height: 0.98;
            letter-spacing: -0.05em;
        }

        .crm-subhead {
            margin: 0;
            max-width: 62ch;
            font-size: 1rem;
            color: rgba(239, 246, 255, 0.82);
        }

        .crm-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 0.7rem;
            margin-top: 0.35rem;
        }

        .crm-actions .button.secondary {
            background: rgba(255, 255, 255, 0.12);
            color: #fff;
            border-color: rgba(255, 255, 255, 0.18);
        }

        .crm-actions .button.secondary:hover {
            border-color: rgba(255, 255, 255, 0.38);
            color: #fff;
            background: rgba(255, 255, 255, 0.16);
        }

        .crm-kpi-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
            gap: 0.8rem;
        }

        .crm-kpi {
            border-radius: 18px;
            padding: 1rem 1.05rem;
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 247, 251, 0.98) 100%);
            border: 1px solid rgba(226, 232, 240, 0.95);
        }

        .crm-kpi-toned {
            background: linear-gradient(180deg, rgba(219, 234, 254, 0.85) 0%, rgba(239, 246, 255, 0.96) 100%);
            border-color: rgba(147, 197, 253, 0.55);
        }

        .crm-kpi-value {
            margin: 0.15rem 0 0;
            font-size: 1.6rem;
            font-weight: 800;
            letter-spacing: -0.04em;
        }

        .crm-kpi-note {
            margin-top: 0.3rem;
            color: var(--muted);
            font-size: 0.88rem;
        }

        .crm-layout {
            display: grid;
            grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.9fr);
            gap: 1rem;
        }

        .crm-stack {
            display: grid;
            gap: 1rem;
            min-width: 0;
        }

        .crm-panel {
            background: rgba(255, 255, 255, 0.94);
            border: 1px solid rgba(226, 232, 240, 0.95);
            border-radius: 20px;
            padding: 1.2rem;
            box-shadow: var(--shadow-md);
            min-width: 0;
        }

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

        .crm-panel-head h3 {
            margin: 0;
            font-size: 1.05rem;
            letter-spacing: -0.02em;
        }

        .crm-panel-head p {
            margin: 0.25rem 0 0;
            color: var(--muted);
            font-size: 0.92rem;
        }

        .crm-board {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 0.9rem;
        }

        .crm-lane {
            min-width: 0;
            display: grid;
            gap: 0.7rem;
            padding: 0.95rem;
            border-radius: 18px;
            background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.96) 100%);
            border: 1px solid rgba(226, 232, 240, 0.95);
        }

        .crm-lane-head {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            gap: 0.6rem;
        }

        .crm-lane-head strong {
            font-size: 0.96rem;
        }

        .crm-lane-meta {
            color: var(--muted);
            font-size: 0.82rem;
            font-weight: 700;
        }

        .crm-lane-items {
            display: grid;
            gap: 0.65rem;
        }

        .crm-entity {
            display: grid;
            gap: 0.3rem;
            padding: 0.8rem 0.85rem;
            border-radius: 14px;
            background: rgba(255, 255, 255, 0.96);
            border: 1px solid rgba(226, 232, 240, 0.9);
        }

        .crm-entity a {
            text-decoration: none;
        }

        .crm-entity-title {
            margin: 0;
            font-size: 0.96rem;
            font-weight: 700;
            line-height: 1.25;
        }

        .crm-entity-subtitle,
        .crm-entity-meta {
            color: var(--muted);
            font-size: 0.84rem;
        }

        .crm-entity-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 0.35rem;
        }

        .crm-chip {
            display: inline-flex;
            align-items: center;
            padding: 0.22rem 0.55rem;
            border-radius: 999px;
            background: #eef2ff;
            color: #1e3a8a;
            font-size: 0.78rem;
            font-weight: 700;
        }

        .crm-chip.soft {
            background: #f1f5f9;
            color: #334155;
        }

        .crm-chip.alert {
            background: #fee2e2;
            color: #b91c1c;
        }

        .crm-chip.good {
            background: #dcfce7;
            color: #166534;
        }

        .crm-split {
            display: grid;
            grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
            gap: 1rem;
        }

        .crm-split > * {
            min-width: 0;
        }

        .crm-matrix {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
            gap: 1rem;
        }

        .crm-stat-list {
            display: grid;
            gap: 0.8rem;
        }

        .crm-stat-row {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
            align-items: baseline;
            padding-bottom: 0.65rem;
            border-bottom: 1px solid rgba(226, 232, 240, 0.9);
        }

        .crm-stat-row:last-child {
            padding-bottom: 0;
            border-bottom: 0;
        }

        .crm-table-wrap {
            overflow-x: auto;
        }

        .crm-table-wrap table {
            min-width: 760px;
        }

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

        .crm-list-item {
            display: grid;
            gap: 0.25rem;
            padding: 0.75rem 0.85rem;
            border-radius: 14px;
            background: rgba(248, 250, 252, 0.95);
            border: 1px solid rgba(226, 232, 240, 0.95);
        }

        .crm-divider {
            height: 1px;
            background: rgba(226, 232, 240, 0.95);
            margin: 0.25rem 0;
        }

        .crm-form-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
            gap: 0.85rem;
        }

        .crm-form-grid.crm-form-grid-single {
            grid-template-columns: minmax(0, 1fr);
        }

        .crm-form-grid.crm-form-grid-single .field,
        .crm-form-grid.crm-form-grid-single .field input,
        .crm-form-grid.crm-form-grid-single .field select,
        .crm-form-grid.crm-form-grid-single .field textarea {
            min-width: 0;
        }

        .page-subtitle {
            margin: 0.35rem 0 0;
            color: var(--muted);
        }

        .flush-title {
            margin: 0;
        }

        .flush-top {
            margin-top: 0;
        }

        .rule-top {
            margin-top: 1rem;
            padding-top: 1rem;
            border-top: 1px solid var(--border);
        }

        .rule-bottom {
            margin-bottom: 1rem;
            padding-bottom: 1rem;
            border-bottom: 1px solid var(--border);
        }

        @media (max-width: 900px) {
            .ticket-grid {
                grid-template-columns: 1fr;
            }

            .crm-layout,
            .crm-split {
                grid-template-columns: 1fr;
            }

            main {
                padding-top: 1.35rem;
            }
        }

        @media (max-width: 720px) {
            .topbar,
            main {
                padding-left: 1rem;
                padding-right: 1rem;
            }

            .brand {
                width: 100%;
            }

            .brand-mark {
                width: min(100%, 320px);
            }

            .brand-tools {
                position: static;
                transform: none;
                width: 100%;
                justify-content: flex-start;
            }

            nav {
                gap: 0.45rem;
            }

            nav a,
            nav button,
            nav summary {
                width: 100%;
                justify-content: flex-start;
                border: 1px solid var(--border);
                background: rgba(255, 255, 255, 0.7);
            }

            .nav-dropdown {
                width: 100%;
            }

            .nav-dropdown-menu {
                position: static;
                min-width: 0;
                margin-top: 0.45rem;
            }

            .nav-spacer {
                display: none;
            }

            .nav-meta,
            .inline-form {
                width: 100%;
            }

            .inline-form button {
                width: 100%;
            }

            .brand-tools .inline-form,
            .brand-tools .inline-form button {
                width: auto;
            }

            th,
            td {
                padding-left: 0.55rem;
                padding-right: 0.55rem;
            }
        }

        @media print {
            body {
                background: #fff;
            }

            header,
            .messages,
            .button {
                display: none !important;
            }

            main {
                max-width: none;
                margin: 0;
                padding: 0;
            }

            .panel,
            .detail-card,
            .file-card {
                box-shadow: none;
                border-color: #cbd5e1;
                background: #fff;
            }

            .ticket-panel {
                max-width: none;
            }
        }

        .setup-assistant-link {
            display: inline-flex;
            align-items: center;
            min-height: 2.5rem;
            padding: 0.6rem 0.9rem;
            border: 1px solid rgba(37, 99, 235, 0.45);
            border-radius: 999px;
            background: #fff;
            color: var(--brand-strong);
            text-decoration: none;
            font-size: 0.9rem;
            font-weight: 750;
            white-space: nowrap;
        }

        .tenant-setup-overlay {
            position: fixed;
            inset: 0;
            z-index: 200;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1.5rem;
            background: rgba(241, 245, 249, 0.82);
            backdrop-filter: blur(2px);
        }

        .tenant-setup-overlay[hidden] {
            display: none;
        }

        .tenant-setup-dialog {
            width: min(1000px, calc(100vw - 3rem));
            max-width: none;
            max-height: calc(100vh - 3rem);
            padding: 0;
            border: 1px solid var(--border);
            border-radius: 20px;
            background: var(--panel-solid);
            color: var(--ink);
            box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22);
            overflow: hidden;
        }

        .tenant-setup-dialog:focus {
            outline: none;
        }

        .tenant-setup-header,
        .tenant-setup-content-head,
        .tenant-setup-footer {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 1rem;
        }

        .tenant-setup-header {
            padding: 1.7rem 2rem 1.25rem;
        }

        .tenant-setup-header h2,
        .tenant-setup-content-head h3 {
            margin: 0;
            letter-spacing: -0.025em;
        }

        .tenant-setup-header h2 {
            font-size: 1.65rem;
        }

        .tenant-setup-header p,
        .tenant-setup-content-head p,
        .tenant-setup-guidance p {
            margin: 0.4rem 0 0;
            color: var(--muted);
        }

        .tenant-setup-close {
            border: 0;
            background: transparent;
            color: var(--muted);
            padding: 0.45rem;
            font-weight: 700;
            text-decoration: none;
            cursor: pointer;
        }

        .tenant-setup-close:hover,
        .tenant-setup-close:focus-visible {
            color: var(--brand-strong);
        }

        .tenant-setup-progress {
            display: grid;
            grid-template-columns: 1fr auto;
            align-items: center;
            gap: 1.25rem;
            padding: 0 2rem 1.25rem;
            border-bottom: 1px solid var(--border);
            color: var(--muted);
            font-size: 0.87rem;
        }

        .tenant-setup-progress-track {
            height: 5px;
            overflow: hidden;
            border-radius: 999px;
            background: #e8eef7;
        }

        .tenant-setup-progress-track span {
            display: block;
            height: 100%;
            border-radius: inherit;
            background: var(--brand);
        }

        .tenant-setup-layout {
            display: grid;
            grid-template-columns: 260px minmax(0, 1fr);
            min-height: 525px;
        }

        .tenant-setup-steps {
            display: block;
            margin: 0;
            padding: 0.75rem;
            border-right: 1px solid var(--border);
            background: #fbfdff;
        }

        .tenant-setup-step {
            display: grid;
            grid-template-columns: 1.8rem minmax(0, 1fr);
            align-items: start;
            gap: 0.7rem;
            width: 100%;
            min-height: 0;
            padding: 0.78rem 0.75rem;
            border: 0;
            border-bottom: 1px solid #edf2f7;
            border-radius: 0;
            color: var(--ink);
            text-align: left;
            text-decoration: none;
        }

        .tenant-setup-step:hover,
        .tenant-setup-step:focus-visible,
        .tenant-setup-step.current {
            border-color: transparent;
            border-radius: 10px;
            background: var(--brand-soft);
            color: var(--brand-strong);
        }

        .tenant-setup-step-number {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 1.55rem;
            height: 1.55rem;
            border: 1px solid var(--border-strong);
            border-radius: 999px;
            color: var(--muted);
            font-size: 0.78rem;
            font-weight: 800;
        }

        .tenant-setup-step.current .tenant-setup-step-number {
            border-color: var(--brand);
            background: var(--brand);
            color: #fff;
        }

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

        .tenant-setup-step strong {
            font-size: 0.91rem;
        }

        .tenant-setup-step small {
            margin-top: 0.14rem;
            color: var(--muted);
            font-size: 0.79rem;
        }

        .tenant-setup-step .state-complete {
            color: var(--success);
        }

        .tenant-setup-step .state-missing {
            color: var(--warning);
        }

        .tenant-setup-content {
            display: flex;
            flex-direction: column;
            min-width: 0;
            padding: 1.65rem 1.8rem 1.2rem;
        }

        .tenant-setup-content-head {
            padding-bottom: 1.15rem;
        }

        .tenant-setup-content-head h3 {
            font-size: 1.45rem;
        }

        .tenant-setup-saved {
            color: var(--success);
            font-size: 0.82rem;
            font-weight: 700;
            white-space: nowrap;
        }

        .tenant-setup-form {
            flex: 1 1 auto;
        }

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

        .tenant-setup-field-grid .field:first-child,
        .tenant-setup-field-grid.location-grid .field-corporate_address_line1,
        .tenant-setup-field-grid.location-grid .field-corporate_address_line2 {
            grid-column: 1 / -1;
        }

        .tenant-setup-note {
            margin: 0;
            padding: 0.8rem 0.9rem;
            border: 1px solid #bfdbfe;
            border-radius: 10px;
            background: #eff6ff;
            color: var(--brand-strong);
            font-size: 0.86rem;
        }

        .tenant-setup-guidance {
            padding: 1.25rem 0;
            border-top: 1px solid var(--border);
            border-bottom: 1px solid var(--border);
        }

        .tenant-setup-guidance h4 {
            margin: 0;
            font-size: 1.05rem;
        }

        .tenant-setup-guide-links {
            display: flex;
            gap: 0.75rem;
            flex-wrap: wrap;
            margin-top: 1.2rem;
        }

        .tenant-setup-footer {
            align-items: center;
            margin-top: auto;
            padding-top: 1.15rem;
            border-top: 1px solid var(--border);
        }

        .tenant-setup-footer p {
            max-width: 220px;
            margin: 0;
            color: var(--muted);
            font-size: 0.8rem;
        }

        .tenant-setup-actions {
            display: flex;
            justify-content: flex-end;
            gap: 0.7rem;
            flex-wrap: nowrap;
        }

        .tenant-setup-actions .button {
            min-height: 2.55rem;
            padding: 0.62rem 0.78rem;
            font-size: 0.86rem;
        }

        @media (max-width: 820px) {
            .tenant-setup-dialog {
                width: calc(100vw - 1rem);
                max-height: calc(100vh - 1rem);
            }

            .tenant-setup-header,
            .tenant-setup-progress {
                padding-left: 1rem;
                padding-right: 1rem;
            }

            .tenant-setup-layout {
                display: block;
            }

            .tenant-setup-steps {
                display: flex;
                overflow-x: auto;
                border-right: 0;
                border-bottom: 1px solid var(--border);
            }

            .tenant-setup-step {
                flex: 0 0 180px;
            }

            .tenant-setup-content {
                padding: 1.2rem 1rem;
            }

            .tenant-setup-field-grid {
                grid-template-columns: 1fr;
            }

            .tenant-setup-field-grid .field {
                grid-column: auto;
            }

            .tenant-setup-footer {
                display: block;
            }

            .tenant-setup-actions {
                justify-content: stretch;
                margin-top: 0.8rem;
            }

            .tenant-setup-actions .button {
                flex: 1 1 100%;
            }
        }

