:root {
  color-scheme: light;
  --navy: #182851;
  --navy-dark: #000029;
  --navy-light: #45507e;
  --ink: #424344;
  --grey: #6d6e6f;
  --hair: #8b9c9d;
  --line: #d9dfe5;
  --paper: #fff;
  --wash: #f4f6f9;
  --muted-blue: #9aa6c9;
  --good: #22664e;
  --good-bg: #eaf4ef;
  --warn: #805b1c;
  --warn-bg: #fbf3df;
  --bad: #8c3030;
  --bad-bg: #fbefee;
  --display: "Zilla Slab", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --shadow: 0 16px 42px rgba(24, 40, 81, 0.08);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
a { color: var(--navy); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #7087c4; outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--navy); font-family: var(--display); letter-spacing: -0.015em; }
h1 { font-size: clamp(2.5rem, 5vw, 4.2rem); line-height: 1.05; font-weight: 600; }
h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.12; font-weight: 600; }
h3 { font-size: 1.4rem; line-height: 1.2; font-weight: 600; }

.skip-link { position: absolute; z-index: 20; top: 8px; left: 8px; transform: translateY(-160%); border-radius: 3px; background: var(--navy); color: white; padding: 10px 14px; }
.skip-link:focus { transform: translateY(0); }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.topbar { position: relative; z-index: 2; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px max(28px, calc((100vw - 1320px) / 2)); border-bottom: 1px solid #e3e7ed; background: rgba(255,255,255,.97); }
.brand { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 11px; color: var(--navy); text-decoration: none; font-family: var(--display); font-size: 1.48rem; letter-spacing: -.02em; white-space: nowrap; }
.brand img { display: block; width: 38px; height: 39px; object-fit: contain; }
.brand strong { font-weight: 700; }
.topbar-tools, .main-nav { display: flex; align-items: center; gap: 24px; }
.main-nav a { padding: 8px 0; color: var(--grey); text-decoration: none; font-size: .88rem; font-weight: 500; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--navy); }
.main-nav a[aria-current="page"] { box-shadow: 0 2px var(--navy); }
.identity { display: grid; gap: 0; max-width: 240px; text-align: right; }
.identity-label { color: var(--grey); font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; }
.identity-email { overflow: hidden; color: var(--navy); font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.topbar form { margin: 0; }

.main-shell { width: min(1320px, 100%); max-width: 100%; min-width: 0; flex: 1 1 auto; margin: 0 auto; padding: 62px 32px 76px; }
.footer { display: flex; justify-content: space-between; gap: 18px; padding: 22px max(32px, calc((100vw - 1256px) / 2)); border-top: 1px solid #e5e9ee; color: var(--grey); font-size: .76rem; letter-spacing: .02em; }
.eyebrow { margin: 0 0 12px; color: var(--grey); font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.lede { max-width: 650px; margin-bottom: 0; color: var(--grey); font-size: clamp(1rem, 1.5vw, 1.18rem); line-height: 1.65; }
.page-heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 56px; padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.page-heading-row h1 { margin-bottom: 12px; }
.heading-index { display: grid; justify-items: end; gap: 4px; padding-bottom: 5px; color: var(--muted-blue); font-family: var(--display); }
.heading-index span:first-child { color: var(--navy); font-size: 2rem; }
.heading-index span:last-child { font-family: var(--sans); font-size: .65rem; letter-spacing: .12em; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-heading .eyebrow { margin-bottom: 6px; }
.section-heading h2 { margin-bottom: 0; }
.section-count { flex: 0 0 auto; padding: 6px 10px; border: 1px solid var(--line); border-radius: 2px; color: var(--grey); font-size: .74rem; font-weight: 500; white-space: nowrap; }
.notice { margin: 0 0 24px; padding: 13px 16px; border-left: 3px solid; border-radius: 2px; font-size: .91rem; }
.notice-error { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.notice-info { border-color: var(--navy-light); background: #f0f3fa; color: var(--navy); }

/* Sign in */
.login-layout { min-height: min(650px, calc(100vh - 190px)); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); align-items: center; gap: clamp(48px, 9vw, 140px); padding: 18px 6% 48px; }
.login-intro { max-width: 660px; }
.login-intro h1 { max-width: 620px; margin-bottom: 22px; }
.login-intro .lede { max-width: 530px; }
.trust-note { display: flex; align-items: center; gap: 10px; margin-top: 40px; color: var(--grey); font-size: .84rem; }
.trust-mark { color: var(--muted-blue); font-size: .9rem; }
.login-card { width: 100%; max-width: 460px; justify-self: end; padding: clamp(26px, 4vw, 42px); border: 1px solid #e2e7ec; border-radius: 4px; background: var(--paper); box-shadow: var(--shadow); }
.login-card-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-card-heading img { width: 42px; height: 43px; object-fit: contain; }
.login-card-heading .eyebrow { margin-bottom: 1px; }
.login-card-heading h2 { margin-bottom: 0; font-size: 1.8rem; }
.provider-actions { display: grid; gap: 12px; }
.provider-actions form { margin: 0; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 11px; border: 1px solid transparent; border-radius: 2px; padding: 11px 16px; cursor: pointer; font-size: .86rem; font-weight: 600; line-height: 1.25; text-align: center; text-decoration: none; transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { background: var(--navy); color: #fff; }
.button-primary:hover { background: var(--navy-dark); color: #fff; }
.button-outline { border-color: #b8c1cf; background: #fff; color: var(--navy); }
.button-outline:hover { border-color: var(--navy); background: #f4f6f9; }
.button-quiet { background: transparent; color: var(--navy); }
.button-quiet:hover { background: var(--wash); }
.button-small { min-height: 36px; padding: 8px 12px; font-size: .77rem; }
.button-provider { width: 100%; min-height: 52px; justify-content: flex-start; border-color: #cbd2dc; background: #fff; color: var(--navy); padding: 12px 14px; }
.button-provider:hover { border-color: var(--navy-light); background: #f8f9fb; }
.button-arrow { margin-left: auto; color: var(--navy-light); font-size: 1rem; }
.provider-icon { width: 21px; height: 21px; flex: 0 0 21px; display: inline-flex; align-items: center; justify-content: center; }
.provider-icon-google { color: #4285f4; font-size: 1.1rem; font-weight: 700; }
.provider-icon-microsoft { display: grid; grid-template-columns: repeat(2, 8px); grid-template-rows: repeat(2, 8px); gap: 2px; }
.provider-icon-microsoft i:nth-child(1) { background: #f35325; }.provider-icon-microsoft i:nth-child(2) { background: #81bc06; }.provider-icon-microsoft i:nth-child(3) { background: #05a6f0; }.provider-icon-microsoft i:nth-child(4) { background: #ffba08; }
.login-footnote { margin: 23px 0 0; color: var(--grey); font-size: .78rem; line-height: 1.6; }

/* Home and app directory */
.apps-section { margin-bottom: 64px; }
.apps-section .section-heading { margin-bottom: 27px; }
.app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.app-card { min-height: 228px; display: flex; flex-direction: column; padding: 23px; border: 1px solid #dfe4ea; border-radius: 3px; background: #fff; box-shadow: 0 5px 20px rgba(24,40,81,.035); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.app-card:hover { transform: translateY(-2px); border-color: #aeb9ca; box-shadow: 0 12px 28px rgba(24,40,81,.08); }
.app-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 19px; }
.app-glyph { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border: 1px solid #d9dfeb; border-radius: 2px; background: #f3f5f9; color: var(--navy); font-family: var(--display); font-size: 1.45rem; }
.health { display: inline-flex; align-items: center; gap: 7px; max-width: 68%; border-radius: 20px; padding: 5px 9px; font-size: .68rem; font-weight: 500; line-height: 1.25; text-align: right; }
.health-available { background: var(--good-bg); color: var(--good); }
.health-unavailable { background: var(--warn-bg); color: var(--warn); }
.health-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: currentColor; }
.app-purpose { margin: 0 0 4px; color: var(--grey); font-size: .71rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.app-card h3 { margin-bottom: 22px; font-size: 1.5rem; }
.app-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 14px; border-top: 1px solid #edf0f3; }
.app-status { color: var(--grey); font-size: .72rem; }
.empty-state { display: grid; justify-items: center; padding: 48px 24px; border: 1px dashed #bdc7d3; background: #fbfcfd; text-align: center; }
.empty-state h3 { margin: 5px 0 8px; }
.empty-state p { max-width: 440px; margin: 0; color: var(--grey); font-size: .88rem; }
.empty-mark { color: var(--muted-blue); font-family: var(--display); font-size: 2.4rem; }
.empty-state-compact { display: block; padding: 26px; }
.empty-state-compact p { margin: 0; }
.install-panel { display: grid; grid-template-columns: minmax(210px, .68fr) minmax(0, 1.32fr); gap: 48px; padding: 33px; border: 1px solid #dce2e9; border-top: 3px solid var(--navy); background: #f7f8fa; }
.install-intro h2 { margin-bottom: 10px; font-size: 1.75rem; }
.install-intro p:last-child { margin-bottom: 0; color: var(--grey); font-size: .87rem; }
.install-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; }
.install-step { display: flex; gap: 14px; }
.step-number { color: var(--muted-blue); font-family: var(--display); font-size: 1.3rem; }
.install-step h3 { margin-bottom: 6px; font-family: var(--sans); font-size: .9rem; font-weight: 600; }
.install-step p { margin-bottom: 0; color: var(--grey); font-size: .78rem; line-height: 1.6; }

/* Administration */
.admin-heading { align-items: center; }
.admin-heading h1 { font-size: clamp(2.4rem, 4.5vw, 3.7rem); }
.admin-badge { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #d9e4dd; background: #f4f8f5; color: var(--good); padding: 8px 12px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.admin-section { min-width: 0; margin: 0 0 58px; }
.section-note { margin: -13px 0 17px; color: var(--grey); font-size: .8rem; }
.workspace-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; max-width: 680px; padding: 18px; border: 1px solid #dfe4ea; background: #f8f9fb; }
.workspace-form label { width: 100%; color: #59616d; font-size: .72rem; font-weight: 600; }
.workspace-form .form-input { flex: 1 1 280px; }
.table-wrap { position: relative; width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid #dfe4ea; background: #fff; }
.admin-section > .table-wrap table { min-width: 1160px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 12px 13px; background: #f2f4f7; color: #59616d; font-size: .67rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
td { padding: 12px 13px; border-top: 1px solid #e8ecf0; color: var(--ink); font-size: .79rem; vertical-align: middle; }
tbody tr:hover { background: #fbfcfd; }
.table-input, .form-input { width: 100%; min-width: 100px; min-height: 38px; border: 1px solid #cbd3dd; border-radius: 2px; background: #fff; color: var(--ink); padding: 8px 9px; font-size: .78rem; }
.table-input:focus, .form-input:focus { border-color: var(--navy-light); }
.email-input { min-width: 205px; }
.check-label { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: .76rem; white-space: nowrap; }
.check-label input { width: 16px; height: 16px; margin: 0; accent-color: var(--navy); }
.muted { color: #828990; font-size: .75rem; }
.provider-list { display: flex; flex-wrap: wrap; gap: 5px; }
.provider-chip { display: inline-flex; padding: 3px 7px; border: 1px solid #dce1e7; border-radius: 2px; color: #59616d; font-size: .68rem; }
.access-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.access-list li { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.access-list small { border-radius: 2px; background: #eef1f6; color: #59616d; padding: 2px 5px; font-size: .63rem; }
.access-explainer { display: inline-block; max-width: 175px; margin-bottom: 7px; font-size: .68rem; line-height: 1.4; }
.configured-grants-cell, .effective-access-cell { min-width: 180px; }
.add-row { background: #fafbfd; }
.add-employee-form { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.add-employee-form .form-input { width: auto; min-width: 220px; }
.grant-layout { display: grid; grid-template-columns: minmax(220px, .65fr) minmax(0, 1.35fr); align-items: start; gap: 18px; min-width: 0; }
.grant-create-card { padding: 22px; border: 1px solid #dfe4ea; background: #f8f9fb; }
.grant-create-card h3 { margin-bottom: 19px; font-size: 1.35rem; }
.stack-form { display: grid; gap: 8px; }
.stack-form label { margin-top: 4px; color: #555e69; font-size: .72rem; font-weight: 600; }
.stack-form button { margin-top: 9px; }
.grants-table table { min-width: 510px; }
.role-input { min-width: 108px; }
.table-empty { padding: 28px; color: var(--grey); text-align: center; }
.registry-list { display: grid; gap: 15px; min-width: 0; }
.registry-card { padding: 20px; border: 1px solid #dfe4ea; background: #fff; }
.registry-card-top, .registry-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.registry-card-top { margin-bottom: 17px; }
.registry-card-bottom { justify-content: flex-end; margin-top: 17px; }
.registry-new { border-style: dashed; background: #fafbfd; }
.registry-new h3 { margin-bottom: 3px; font-size: 1.3rem; }
.registry-new > p { margin-bottom: 18px; color: var(--grey); font-size: .8rem; }
.app-slug { margin-right: 9px; color: var(--navy); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; font-weight: 600; }
.registry-state { display: inline-block; border-radius: 2px; padding: 4px 7px; font-size: .64rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.registry-state-enabled { background: var(--good-bg); color: var(--good); }
.registry-state-disabled { background: #edf0f3; color: #636c76; }
.registry-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 0 0 19px; padding: 15px; background: #f6f7f9; }
.registry-meta > div { min-width: 0; }
.registry-meta dt { margin-bottom: 4px; color: #737c87; font-size: .64rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.registry-meta dd { margin: 0; color: var(--ink); font-size: .76rem; overflow-wrap: anywhere; }
.registry-meta code { font-size: .71rem; }
.dependency-list { margin: 0; padding-left: 16px; color: var(--grey); }
.dependency-list li + li { margin-top: 2px; }
.registry-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.registry-fields label:not(.check-label) { display: grid; gap: 6px; color: #59616d; font-size: .7rem; font-weight: 600; }
.registry-fields .form-input { font-weight: 400; }
.registry-enable { align-self: end; min-height: 38px; }
.audit-section { margin-bottom: 0; }
.audit-section table { min-width: 850px; }
.audit-time { min-width: 170px; color: var(--grey); white-space: nowrap; }
.event-name { color: var(--navy); font-weight: 600; }
.audit-details summary { color: var(--navy-light); cursor: pointer; font-size: .75rem; font-weight: 600; }
.audit-details pre { max-width: 440px; max-height: 250px; overflow: auto; margin: 8px 0 0; padding: 10px; background: #f5f7f9; color: #3f4854; font: .7rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Access-denied and error views */
.message-panel { width: min(640px, 100%); margin: 8vh auto; padding: clamp(28px, 5vw, 54px); border: 1px solid #dfe4ea; border-top: 4px solid var(--navy); background: #fff; box-shadow: var(--shadow); }
.message-panel h1 { margin-bottom: 15px; font-size: clamp(2.3rem, 5vw, 3.5rem); }
.message-panel > p:not(.eyebrow) { margin-bottom: 26px; color: var(--grey); }
.message-icon { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 27px; border: 1px solid #d7deea; color: var(--navy-light); font-family: var(--display); font-size: 1.5rem; }
.message-panel-error { border-top-color: var(--bad); }
.message-panel-error .message-icon { border-color: #ebd4d2; background: var(--bad-bg); color: var(--bad); }

@media (max-width: 1000px) {
  .login-layout { gap: 44px; padding-right: 2%; padding-left: 2%; }
  .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grant-layout { grid-template-columns: minmax(210px, .8fr) minmax(0, 1.2fr); }
}
@media (max-width: 760px) {
  .topbar { min-height: 68px; flex-wrap: wrap; gap: 9px 18px; padding: 10px 20px; }
  .brand { font-size: 1.28rem; }
  .brand img { width: 32px; height: 33px; }
  .topbar-tools { flex: 1 1 100%; justify-content: space-between; gap: 12px; }
  .main-nav { gap: 17px; }
  .identity { margin-left: auto; }
  .identity-label { display: none; }
  .main-shell { padding: 42px 20px 54px; }
  .footer { padding: 18px 20px; font-size: .7rem; }
  .login-layout { min-height: 0; grid-template-columns: 1fr; gap: 34px; padding: 20px 0 38px; }
  .login-intro h1 { max-width: 520px; font-size: clamp(2.55rem, 10vw, 3.7rem); }
  .trust-note { margin-top: 22px; }
  .login-card { max-width: none; justify-self: stretch; }
  .page-heading-row { align-items: flex-start; margin-bottom: 38px; padding-bottom: 25px; }
  .heading-index { display: none; }
  .apps-section { margin-bottom: 42px; }
  .install-panel { grid-template-columns: 1fr; gap: 26px; padding: 24px; }
  .grant-layout { grid-template-columns: 1fr; }
  .registry-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .registry-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  h1 { font-size: 2.45rem; }
  .topbar-tools { flex-wrap: wrap; }
  .main-nav { flex: 1 1 100%; order: 2; }
  .identity { max-width: min(46vw, 210px); margin-left: 0; text-align: left; }
  .topbar-tools > form { margin-left: auto; }
  .main-shell { padding: 34px 16px 44px; }
  .footer { flex-direction: column; gap: 3px; padding: 16px; }
  .page-heading-row { margin-bottom: 30px; }
  .section-heading { align-items: flex-start; }
  .section-count { padding: 5px 7px; font-size: .67rem; }
  .app-grid { grid-template-columns: 1fr; }
  .app-card { min-height: 205px; padding: 19px; }
  .install-steps { grid-template-columns: 1fr; gap: 19px; }
  .install-panel { padding: 21px 18px; }
  .registry-fields { grid-template-columns: 1fr; }
  .registry-meta { grid-template-columns: 1fr 1fr; }
  .registry-card { padding: 16px; }
  .admin-badge { font-size: .66rem; }
  .admin-heading { flex-direction: column; }
  .add-employee-form { align-items: stretch; }
  .add-employee-form .form-input { width: 100%; }
  .add-employee-form .check-label { margin: 5px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
