:root {
    color-scheme: light;
    --ink: #1d2722;
    --muted: #657169;
    --line: #d9e0db;
    --surface: #ffffff;
    --canvas: #f4f6f4;
    --green: #276c50;
    --green-soft: #e7f2eb;
    --amber: #9a651c;
    --amber-soft: #fbf1dc;
    --red: #9a3d3d;
    --red-soft: #f8e8e7;
}

html, body { font-family: Inter, "Segoe UI", Arial, sans-serif; background: var(--canvas); color: var(--ink); }
body { margin: 0; }
*, *::before, *::after { box-sizing: border-box; }
a { color: var(--green); }
.icon { width: 18px; height: 18px; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: 1.72rem; line-height: 1.2; font-weight: 750; }
h2 { margin-bottom: 5px; font-size: 1rem; font-weight: 750; }
.eyebrow { margin-bottom: 6px; color: var(--green); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.page-summary, .section-heading p { margin: 0; color: var(--muted); font-size: .87rem; }

.page-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.page-heading { margin-bottom: 25px; }
.section-heading { margin-bottom: 16px; }
.section-heading.compact { align-items: flex-start; margin-bottom: 14px; }

.icon-button {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid #cbd4ce;
    border-radius: 5px;
    background: #fff;
    color: #3c4942;
    cursor: pointer;
}
.icon-button:hover { border-color: #87958c; background: #f7faf8; }
.icon-button:disabled { opacity: .5; cursor: not-allowed; }
.icon-button.danger { color: var(--red); }
.icon-button.positive { color: var(--green); }

.command-button {
    min-height: 38px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid #225d46;
    border-radius: 5px;
    background: var(--green);
    color: #fff;
    font-weight: 700;
    font-size: .83rem;
    text-decoration: none;
    cursor: pointer;
}
.command-button:hover { background: #205d45; color: #fff; }
.command-button:disabled { opacity: .55; cursor: not-allowed; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); }
.metric-block { min-height: 130px; padding: 20px; border-right: 1px solid var(--line); }
.metric-block:last-child { border-right: 0; }
.metric-label { display: block; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.metric-block > strong { display: block; margin: 8px 0 10px; font-size: 1.65rem; line-height: 1; }
.metric-note, .status-line { color: var(--muted); font-size: .78rem; }
.status-line { display: flex; align-items: center; gap: 6px; }
.status-line .icon { width: 15px; height: 15px; }
.status-good { color: var(--green); }
.status-bad { color: var(--red); }

.content-band, .form-band, .data-section { margin-top: 24px; padding: 20px; background: var(--surface); border: 1px solid var(--line); }
.readiness-list { border-top: 1px solid var(--line); }
.readiness-row { min-height: 64px; display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid #e6ebe7; }
.readiness-row:last-child { border-bottom: 0; }
.readiness-number { color: var(--green); font-weight: 800; }
.readiness-row strong, .readiness-row div span { display: block; }
.readiness-row div span { margin-top: 2px; color: var(--muted); font-size: .78rem; }
.text-link { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 700; text-decoration: none; }
.text-link .icon { width: 15px; height: 15px; }
.timestamp { margin: 12px 0 0; color: #7c8780; font-size: .72rem; text-align: right; }

.state-badge, .count-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 4px; background: #edf0ee; color: #59645e; font-size: .68rem; font-weight: 750; white-space: nowrap; }
.state-current, .state-warning { background: var(--amber-soft); color: var(--amber); }
.state-ready { background: var(--green-soft); color: var(--green); }
.state-danger { background: var(--red-soft); color: var(--red); }
.state-neutral { background: #e8eef5; color: #48647c; }

.filter-row { display: flex; gap: 4px; margin-bottom: 18px; }
.filter-button { height: 34px; padding: 0 12px; border: 1px solid var(--line); background: #fff; color: #59645e; font-size: .78rem; cursor: pointer; }
.filter-button:first-child { border-radius: 5px 0 0 5px; }
.filter-button:last-child { border-radius: 0 5px 5px 0; }
.filter-button.active { border-color: #366f58; background: var(--green-soft); color: var(--green); font-weight: 700; }

.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.module-card { min-height: 188px; padding: 17px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.module-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.module-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #d6ded8; border-radius: 5px; color: var(--green); }
.module-card h2 { font-size: .92rem; }
.module-card > code { color: #68746d; font-size: .72rem; }
.module-meta { margin: 18px 0 0; display: flex; gap: 26px; }
.module-meta div { display: flex; flex-direction: column; }
.module-meta dt { color: var(--muted); font-size: .65rem; text-transform: uppercase; }
.module-meta dd { margin: 2px 0 0; font-size: .8rem; font-weight: 700; }

.notice { margin-bottom: 16px; padding: 11px 13px; border-left: 3px solid var(--green); background: var(--green-soft); color: #24533f; font-size: .82rem; }
.notice-error { border-left-color: var(--red); background: var(--red-soft); color: #773333; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid label { color: #4c5851; font-size: .75rem; font-weight: 700; }
.form-control, .form-select { width: 100%; min-height: 40px; margin-top: 5px; border: 1px solid #bdc8c1; border-radius: 4px; background: #fff; color: var(--ink); font-size: .85rem; }
.form-control:focus, .form-select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(39,108,80,.13); }
.form-actions { margin-top: 16px; display: flex; justify-content: flex-end; }
.validation-summary { color: var(--red); font-size: .8rem; }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.data-table th { padding: 10px 12px; border-bottom: 1px solid #bfc9c2; color: #67736c; font-size: .68rem; text-align: left; text-transform: uppercase; }
.data-table td { padding: 13px 12px; border-bottom: 1px solid #e3e8e4; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.secondary-line { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; }
.monospace { font-family: Consolas, monospace; }
.action-cell { display: flex; justify-content: flex-end; gap: 6px; }
.checkbox-cluster { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.check-label { display: inline-flex; gap: 5px; align-items: center; font-size: .74rem; }

.split-workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.role-list, .permission-workspace { padding: 18px; border: 1px solid var(--line); background: #fff; }
.role-row { width: 100%; min-height: 50px; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; border: 0; border-bottom: 1px solid #e6eae7; background: #fff; text-align: left; cursor: pointer; }
.role-row span strong, .role-row span small { display: block; }
.role-row span small { margin-top: 2px; color: var(--muted); }
.role-row.active { background: var(--green-soft); color: var(--green); }
.inline-create { margin-top: 14px; display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.inline-create .form-control { margin: 0; }
.permission-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.permission-group { min-width: 0; padding: 12px; border: 1px solid #dfe5e1; }
.permission-group legend { width: auto; float: none; padding: 0 5px; color: var(--green); font-size: .72rem; font-weight: 800; }
.permission-row { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 7px; align-items: start; padding: 5px 0; }
.permission-row code { white-space: normal; overflow-wrap: anywhere; color: #425049; font-size: .7rem; }
.empty-state { min-height: 220px; display: grid; place-items: center; align-content: center; color: var(--muted); }
.empty-icon { width: 36px; height: 36px; margin-bottom: 9px; }
.audit-table .correlation { font-size: .66rem; }
.loading-row { padding: 18px; display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: .82rem; }

.login-shell { width: min(430px, 100%); margin: 7vh auto 0; }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.login-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--green); border-radius: 4px; color: var(--green); font-weight: 800; }
.login-brand strong, .login-brand span { display: block; }
.login-brand div > span { color: var(--muted); font-size: .72rem; }
.login-panel { padding: 26px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.login-summary { margin-bottom: 22px; }
.login-command { margin-top: 3px; }
.passkey-link { margin-top: 14px; border: 0; background: transparent; color: var(--green); font-size: .8rem; }
.login-footnote { margin-top: 13px; color: var(--muted); font-size: .7rem; text-align: center; }
.account-message { width: min(520px, 100%); margin: 10vh auto; padding: 28px; border: 1px solid var(--line); background: #fff; text-align: center; }
.account-message-icon { width: 38px; height: 38px; margin-bottom: 12px; color: var(--green); }
.account-message p { color: var(--muted); }
.authenticator-qr { width: 210px; max-width: 100%; margin: 10px 0; border: 8px solid #fff; image-rendering: pixelated; }

/* Identity pages retain familiar form structure while using the application palette. */
.btn-primary { background: var(--green); border-color: var(--green); }
.btn-primary:hover { background: #205d45; border-color: #205d45; }
.content { padding-top: 1rem; }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--green); }
.invalid { outline: 1px solid var(--red); }
.validation-message, .text-danger { color: var(--red) !important; }
.darker-border-checkbox.form-check-input { border-color: #86928b; }
h1:focus { outline: none; }

@media (max-width: 1100px) {
    .module-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-block:nth-child(2) { border-right: 0; }
    .metric-block:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 760px) {
    .page-heading { align-items: flex-start; }
    .page-heading h1 { font-size: 1.45rem; }
    .module-grid, .permission-groups, .form-grid, .split-workspace { grid-template-columns: 1fr; }
    .metric-grid { grid-template-columns: 1fr; }
    .metric-block { border-right: 0; border-bottom: 1px solid var(--line); }
    .metric-block:last-child { border-bottom: 0; }
    .readiness-row { grid-template-columns: 40px minmax(0, 1fr); padding: 10px 0; }
    .readiness-row .state-badge { grid-column: 2; justify-self: start; }
    .content-band, .form-band, .data-section { padding: 15px; }
    .section-heading { align-items: flex-start; }
    .text-link { margin-top: 3px; }
}
