        :root {
            color-scheme: light;
            --bg: #f6f8fb;
            --panel: #ffffff;
            --panel-soft: #f9fbfd;
            --text: #17202a;
            --muted: #667789;
            --line: #d9e2ec;
            --line-strong: #c6d2df;
            --primary: #155e9f;
            --primary-dark: #0f4d83;
            --primary-soft: #e9f3fb;
            --success: #16735b;
            --danger-bg: #fff1f0;
            --danger-border: #f2c6c2;
            --danger-text: #922b21;
            --shadow: 0 24px 70px rgba(34, 52, 73, 0.12);
        }

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            min-height: 100vh;
            background:
                linear-gradient(180deg, #ffffff 0%, var(--bg) 46%, #eef4f8 100%);
            color: var(--text);
            font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
            letter-spacing: 0;
        }

        a {
            color: inherit;
        }

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

        .topbar {
            height: 64px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 clamp(16px, 4vw, 40px);
            background: rgba(255, 255, 255, 0.88);
            border-bottom: 1px solid var(--line);
            backdrop-filter: blur(12px);
        }

        .brand {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            font-size: 16px;
            font-weight: 750;
        }

        .brand-logo {
            width: auto;
            height: 34px;
            display: block;
        }

        .topbar-actions {
            display: inline-flex;
            align-items: center;
            gap: 12px;
        }

        .account-chip {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            min-height: 40px;
            padding: 0 12px;
            border: 1px solid var(--line);
            border-radius: 999px;
            background: #fff;
            box-shadow: 0 1px 2px rgba(23, 32, 42, 0.04);
        }

        .account-dot {
            width: 26px;
            height: 26px;
            display: inline-grid;
            place-items: center;
            border-radius: 50%;
            background: var(--primary-soft);
            color: var(--primary);
            font-size: 12px;
            font-weight: 800;
            flex: 0 0 auto;
        }

        .account-name {
            max-width: 190px;
            overflow: hidden;
            color: var(--text);
            font-size: 13px;
            font-weight: 750;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .logout-form {
            margin: 0;
        }

        .logout-button {
            min-height: 40px;
            gap: 9px;
            padding: 0 14px;
            border: 1px solid #f0c7c3;
            background: #fff;
            color: var(--danger-text);
            box-shadow: 0 1px 2px rgba(23, 32, 42, 0.04);
        }

        .logout-button:hover {
            border-color: #e8aaa4;
            background: var(--danger-bg);
            box-shadow: 0 8px 18px rgba(146, 43, 33, 0.11);
            transform: translateY(-1px);
        }

        .logout-icon {
            width: 18px;
            height: 18px;
            flex: 0 0 auto;
        }

        .page {
            width: min(1040px, calc(100% - 32px));
            margin: 32px auto;
        }

        .app-shell {
            width: calc(100% - 32px);
            display: grid;
            grid-template-columns: 248px minmax(0, 1fr);
            gap: 24px;
            margin: 28px auto;
            align-items: start;
        }

        .sidebar {
            position: sticky;
            top: 84px;
            background: var(--panel);
            border: 1px solid var(--line);
            border-radius: 8px;
            padding: 14px;
            box-shadow: 0 10px 28px rgba(34, 52, 73, 0.06);
        }

        .sidebar-title {
            margin: 4px 8px 12px;
            color: var(--muted);
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        .nav-list {
            display: grid;
            gap: 6px;
        }

        .nav-item {
            display: flex;
            align-items: center;
            gap: 10px;
            min-height: 42px;
            padding: 0 10px;
            border-radius: 6px;
            color: var(--muted);
            font-size: 14px;
            font-weight: 700;
            text-decoration: none;
        }

        .nav-item.active,
        .nav-item:hover {
            background: var(--primary-soft);
            color: var(--primary);
        }

        .nav-icon {
            width: 22px;
            height: 22px;
            display: inline-grid;
            place-items: center;
            border-radius: 6px;
            background: #eef3f7;
            color: inherit;
            font-size: 12px;
            flex: 0 0 auto;
        }

        .dashboard-main {
            display: grid;
            gap: 18px;
        }

        .dashboard-header {
            display: flex;
            justify-content: space-between;
            gap: 16px;
            align-items: start;
        }

        .header-actions {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .dashboard-grid {
            display: grid;
            grid-template-columns: minmax(0, 1fr) 320px;
            gap: 18px;
        }

        .section-title {
            margin: 0;
            color: var(--text);
            font-size: 18px;
            line-height: 1.3;
        }

        .section-kicker {
            margin-top: 4px;
            color: var(--muted);
            font-size: 14px;
        }

        .profile-card {
            display: grid;
            gap: 14px;
        }

        .avatar {
            width: 54px;
            height: 54px;
            display: inline-grid;
            place-items: center;
            border-radius: 8px;
            background: var(--primary);
            color: #fff;
            font-size: 20px;
            font-weight: 800;
        }

        .project-list {
            display: grid;
            gap: 10px;
            margin-top: 16px;
        }

        .filter-form {
            display: flex;
            align-items: center;
            gap: 8px;
            max-width: 760px;
            margin-top: 16px;
            padding: 8px;
            border: 1px solid var(--line);
            border-radius: 8px;
            background: var(--panel-soft);
        }

        .filter-actions {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            flex: 0 0 auto;
        }

        .search-field {
            flex: 1 1 auto;
            min-width: 180px;
        }

        .filter-select {
            flex: 0 1 220px;
        }

        .search-field input,
        .filter-select select {
            width: 100%;
            min-height: 38px;
            padding: 0 12px;
            border: 1px solid transparent;
            border-radius: 6px;
            background: #fff;
            color: var(--text);
            font: inherit;
            font-size: 14px;
            box-shadow: 0 1px 2px rgba(23, 32, 42, 0.04);
        }

        .filter-select select {
            padding-right: 34px;
            cursor: pointer;
        }

        .search-field input:focus,
        .filter-select select:focus {
            border-color: var(--primary);
            outline: 3px solid rgba(21, 94, 159, 0.14);
        }

        .search-button {
            min-height: 38px;
            padding: 0 16px;
            border-color: var(--primary);
            background: var(--primary);
            color: #fff;
        }

        .search-button:hover {
            border-color: var(--primary-dark);
            background: var(--primary-dark);
        }

        .clear-button {
            min-height: 38px;
            color: var(--muted);
        }

        .assignment-filter {
            max-width: 520px;
        }

        .project-row {
            display: grid;
            gap: 12px;
            padding: 14px;
            border: 1px solid var(--line);
            border-radius: 8px;
            background: var(--panel-soft);
        }

        .project-row-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        .project-name {
            font-weight: 750;
        }

        .project-meta {
            color: var(--muted);
            font-size: 12px;
            overflow-wrap: anywhere;
        }

        .project-actions {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            flex: 0 0 auto;
            flex-wrap: wrap;
        }

        .mini-button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 32px;
            padding: 0 10px;
            border: 1px solid var(--line-strong);
            border-radius: 6px;
            background: #fff;
            color: var(--primary);
            font-size: 12px;
            font-weight: 800;
            text-decoration: none;
            cursor: pointer;
        }

        .mini-button:hover {
            border-color: #aac1d8;
            background: var(--primary-soft);
        }

        .mini-button.danger {
            border-color: #efc5c1;
            color: var(--danger-text);
        }

        .mini-button.danger:hover {
            border-color: #e7aaa4;
            background: var(--danger-bg);
        }

        .inline-form {
            margin: 0;
        }

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

        .project-edit-form .field.full {
            grid-column: 1 / -1;
        }

        .assignment-table {
            min-width: 920px;
            table-layout: fixed;
        }

        .assignment-table th:nth-child(1),
        .assignment-table td:nth-child(1) {
            width: 32%;
        }

        .assignment-table th:nth-child(2),
        .assignment-table td:nth-child(2) {
            width: 14%;
        }

        .assignment-table th:nth-child(3),
        .assignment-table td:nth-child(3) {
            width: 54%;
        }

        .assignment-user-name {
            color: var(--text);
            font-weight: 750;
            line-height: 1.35;
        }

        .assignment-user-email {
            margin-top: 2px;
            color: var(--muted);
            font-size: 13px;
            overflow-wrap: anywhere;
        }

        .assignment-form {
            display: grid;
            gap: 10px;
        }

        .assignment-projects {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
            gap: 8px;
        }

        .assignment-check {
            display: flex;
            align-items: center;
            gap: 8px;
            min-height: 36px;
            padding: 7px 10px;
            border: 1px solid var(--line);
            border-radius: 6px;
            background: var(--panel-soft);
            color: var(--text);
            font-size: 13px;
            font-weight: 750;
        }

        .assignment-check:has(input:checked) {
            border-color: #aac1d8;
            background: var(--primary-soft);
            color: var(--primary-dark);
        }

        .assignment-check input {
            width: 16px;
            height: 16px;
            margin: 0;
            accent-color: var(--primary);
            flex: 0 0 auto;
        }

        .assignment-check span {
            min-width: 0;
            overflow-wrap: anywhere;
        }

        .assignment-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding-top: 2px;
        }

        .assignment-count {
            color: var(--muted);
            font-size: 12px;
            font-weight: 800;
        }

        .assignment-save {
            min-width: 92px;
        }

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

        .audit-table th:nth-child(1),
        .audit-table td:nth-child(1) {
            width: 18%;
            white-space: nowrap;
        }

        .audit-table th:nth-child(5),
        .audit-table td:nth-child(5) {
            width: 12%;
        }

        .check-field {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            min-height: 42px;
            color: var(--text);
            font-size: 13px;
            font-weight: 800;
        }

        .check-field input {
            width: 16px;
            height: 16px;
            accent-color: var(--primary);
        }

        .project-form {
            display: grid;
            gap: 12px;
            margin-top: 16px;
        }

        .field {
            display: grid;
            gap: 6px;
        }

        .field label {
            color: var(--text);
            font-size: 13px;
            font-weight: 800;
        }

        .field input {
            width: 100%;
            min-height: 42px;
            padding: 0 12px;
            border: 1px solid var(--line-strong);
            border-radius: 6px;
            background: #fff;
            color: var(--text);
            font: inherit;
        }

        .field input:focus {
            border-color: var(--primary);
            outline: 3px solid rgba(21, 94, 159, 0.14);
        }

        .role-form {
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .role-form select {
            min-height: 32px;
            padding: 0 28px 0 10px;
            border: 1px solid var(--line-strong);
            border-radius: 6px;
            background: #fff;
            color: var(--text);
            font: inherit;
            font-size: 13px;
        }

        .field-error {
            color: var(--danger-text);
            font-size: 12px;
            line-height: 1.35;
        }

        .success-alert {
            margin-top: 16px;
            padding: 12px 14px;
            border: 1px solid #b7dfd1;
            border-radius: 6px;
            background: #edf9f4;
            color: var(--success);
            font-size: 14px;
            font-weight: 750;
        }

        .modal {
            width: min(560px, calc(100% - 32px));
            padding: 0;
            border: 1px solid var(--line);
            border-radius: 8px;
            box-shadow: var(--shadow);
        }

        .modal.settings-modal {
            width: min(760px, calc(100% - 32px));
        }

        .modal::backdrop {
            background: rgba(23, 32, 42, 0.42);
        }

        .modal-shell {
            display: grid;
            gap: 18px;
            padding: 24px;
            background: #fff;
        }

        .modal-header {
            display: flex;
            align-items: start;
            justify-content: space-between;
            gap: 16px;
        }

        .modal-close {
            width: 34px;
            height: 34px;
            display: inline-grid;
            place-items: center;
            border: 1px solid var(--line);
            border-radius: 6px;
            background: #fff;
            color: var(--muted);
            cursor: pointer;
            font-size: 18px;
            line-height: 1;
        }

        .modal-close:hover {
            background: var(--panel-soft);
            color: var(--text);
        }

        .settings-stack {
            display: grid;
            gap: 16px;
        }

        .settings-note {
            padding: 12px 14px;
            border: 1px solid var(--line);
            border-radius: 6px;
            background: var(--panel-soft);
            color: var(--muted);
            font-size: 13px;
            line-height: 1.45;
        }

        .settings-note.warning {
            border-color: #f0d39a;
            background: #fff8e8;
            color: #7c5300;
        }

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

        .settings-item {
            display: grid;
            gap: 6px;
            padding: 12px;
            border: 1px solid var(--line);
            border-radius: 6px;
            background: #fff;
        }

        .settings-item span,
        .settings-heading {
            color: var(--muted);
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

        .settings-item code {
            color: var(--text);
            font-size: 13px;
            overflow-wrap: anywhere;
        }

        .settings-heading {
            margin: 0 0 8px;
        }

        .settings-code {
            max-height: 320px;
            margin: 0;
            padding: 14px;
            overflow: auto;
            border: 1px solid var(--line);
            border-radius: 6px;
            background: #101820;
            color: #edf5ff;
            font-size: 12px;
            line-height: 1.55;
            white-space: pre;
        }

        .table-wrap {
            margin-top: 18px;
            overflow-x: auto;
            border: 1px solid var(--line);
            border-radius: 8px;
        }

        .activity-table {
            width: 100%;
            min-width: 1080px;
            border-collapse: collapse;
            background: #fff;
        }

        .activity-table th,
        .activity-table td {
            padding: 13px 14px;
            border-bottom: 1px solid var(--line);
            text-align: left;
            vertical-align: top;
            font-size: 14px;
        }

        .activity-table th {
            background: var(--panel-soft);
            color: var(--muted);
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.05em;
            text-transform: uppercase;
        }

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

        .pagination-nav {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-top: 14px;
            color: var(--muted);
            font-size: 13px;
        }

        .pagination-summary {
            font-weight: 700;
        }

        .pagination-links {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }

        .pagination-button,
        .pagination-ellipsis {
            min-width: 34px;
            min-height: 32px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0 10px;
            border: 1px solid var(--line);
            border-radius: 6px;
            background: #fff;
            color: var(--primary);
            font-size: 12px;
            font-weight: 800;
            text-decoration: none;
        }

        .pagination-button.active {
            border-color: var(--primary);
            background: var(--primary);
            color: #fff;
        }

        .pagination-button.disabled,
        .pagination-ellipsis {
            color: var(--muted);
            cursor: default;
            opacity: 0.62;
        }

        .status-badge {
            display: inline-flex;
            align-items: center;
            min-height: 24px;
            padding: 0 9px;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 800;
            text-transform: capitalize;
        }

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

        .status-failed,
        .status-configuration_error {
            background: var(--danger-bg);
            color: var(--danger-text);
        }

        .status-default {
            background: #eef3f7;
            color: var(--muted);
        }

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

        .auth-shell {
            min-height: calc(100vh - 64px);
            display: grid;
            place-items: center;
            padding: clamp(24px, 6vw, 56px) 16px;
        }

        .auth-card {
            width: min(960px, 100%);
            display: grid;
            grid-template-columns: minmax(0, 1fr) 420px;
            background: var(--panel);
            border: 1px solid var(--line);
            border-radius: 8px;
            box-shadow: var(--shadow);
            overflow: hidden;
        }

        .auth-intro {
            padding: clamp(28px, 5vw, 52px);
            background:
                linear-gradient(135deg, rgba(21, 94, 159, 0.08), rgba(22, 115, 91, 0.08)),
                var(--panel-soft);
            border-right: 1px solid var(--line);
        }

        .eyebrow {
            margin: 0 0 18px;
            color: var(--primary);
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        .auth-intro h1 {
            max-width: 520px;
            font-size: clamp(30px, 5vw, 44px);
            line-height: 1.08;
        }

        .auth-intro p {
            max-width: 520px;
            margin-top: 14px;
            font-size: 16px;
        }

        .trust-list {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 12px;
            margin-top: 34px;
        }

        .trust-item {
            min-height: 88px;
            padding: 14px;
            border: 1px solid var(--line);
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.72);
        }

        .trust-value {
            display: block;
            margin-bottom: 8px;
            color: var(--text);
            font-size: 14px;
            font-weight: 800;
        }

        .trust-label {
            color: var(--muted);
            font-size: 12px;
            line-height: 1.35;
        }

        .auth-panel {
            display: flex;
            flex-direction: column;
            justify-content: center;
            padding: clamp(26px, 4vw, 40px);
        }

        h1 {
            margin: 0 0 8px;
            font-size: 24px;
            line-height: 1.25;
        }

        p {
            margin: 0;
            color: var(--muted);
            line-height: 1.5;
        }

        .actions {
            margin-top: 24px;
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
        }

        .button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 42px;
            padding: 0 16px;
            border: 0;
            border-radius: 6px;
            background: var(--primary);
            color: #fff;
            font-size: 14px;
            font-weight: 700;
            text-decoration: none;
            cursor: pointer;
            transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
        }

        .button:hover {
            background: var(--primary-dark);
        }

        .button:focus-visible {
            outline: 3px solid rgba(21, 94, 159, 0.22);
            outline-offset: 2px;
        }

        .button.microsoft {
            width: 100%;
            min-height: 48px;
            gap: 12px;
            justify-content: center;
            border: 1px solid var(--line-strong);
            background: #fff;
            color: var(--text);
            box-shadow: 0 1px 2px rgba(23, 32, 42, 0.06);
        }

        .button.microsoft:hover {
            background: #f7fafc;
            border-color: #b8c6d4;
            box-shadow: 0 8px 20px rgba(34, 52, 73, 0.1);
            transform: translateY(-1px);
        }

        .microsoft-mark {
            width: 20px;
            height: 20px;
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            grid-template-rows: repeat(2, 1fr);
            gap: 2px;
            flex: 0 0 auto;
        }

        .microsoft-mark span:nth-child(1) { background: #f25022; }
        .microsoft-mark span:nth-child(2) { background: #7fba00; }
        .microsoft-mark span:nth-child(3) { background: #00a4ef; }
        .microsoft-mark span:nth-child(4) { background: #ffb900; }

        .button.secondary {
            background: #eef3f7;
            color: var(--text);
        }

        .alert {
            margin: 18px 0 0;
            padding: 12px 14px;
            border-radius: 6px;
            border: 1px solid var(--danger-border);
            background: var(--danger-bg);
            color: var(--danger-text);
            font-size: 14px;
            line-height: 1.4;
        }

        .security-note {
            margin-top: 18px;
            color: var(--muted);
            font-size: 13px;
            line-height: 1.45;
        }

        .panel {
            background: var(--panel);
            border: 1px solid var(--line);
            border-radius: 8px;
            padding: 24px;
        }

        .meta {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 16px;
            margin-top: 20px;
        }

        .meta-item {
            border: 1px solid var(--line);
            border-radius: 6px;
            padding: 14px;
        }

        .meta-label {
            color: var(--muted);
            font-size: 12px;
            margin-bottom: 6px;
            text-transform: uppercase;
        }

        .meta-value {
            overflow-wrap: anywhere;
            font-weight: 700;
        }

        @media (max-width: 760px) {
            .topbar {
                height: 60px;
            }

            .brand {
                font-size: 15px;
            }

            .brand-logo {
                height: 30px;
            }

            .topbar-actions {
                gap: 8px;
            }

            .account-chip {
                display: none;
            }

            .logout-button {
                width: 40px;
                padding: 0;
            }

            .logout-text {
                position: absolute;
                width: 1px;
                height: 1px;
                overflow: hidden;
                clip: rect(0, 0, 0, 0);
                white-space: nowrap;
            }

            .auth-shell {
                min-height: calc(100vh - 60px);
                align-items: start;
            }

            .auth-card {
                grid-template-columns: 1fr;
            }

            .auth-intro {
                border-right: 0;
                border-bottom: 1px solid var(--line);
            }

            .trust-list {
                grid-template-columns: 1fr;
                margin-top: 24px;
            }

            .trust-item {
                min-height: auto;
            }

            .app-shell {
                grid-template-columns: 1fr;
                margin-top: 18px;
            }

            .sidebar {
                position: static;
            }

            .nav-list {
                grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
            }

            .nav-item {
                justify-content: center;
                padding: 0 8px;
            }

            .nav-item span:last-child {
                display: none;
            }

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

            .dashboard-header {
                display: grid;
            }

            .project-row-header {
                align-items: start;
                flex-direction: column;
            }

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

            .filter-form {
                align-items: stretch;
                flex-direction: column;
            }

            .filter-select,
            .filter-actions,
            .search-button,
            .clear-button {
                width: 100%;
            }

            .pagination-nav {
                align-items: stretch;
                flex-direction: column;
            }

            .pagination-links {
                justify-content: flex-start;
            }

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