:root {
  color-scheme: light;
  --canvas: #f2f6f4;
  --surface: #fff;
  --ink: #1b2d2a;
  --muted: #4b645e;
  --line: #d4e1db;
  --brand: #5dbcb4;
  --action: #145b53;
  --action-hover: #0e4942;
  --tint: #e8f4ee;
  --radius: 14px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC", system-ui, sans-serif;
  line-height: 1.55;
  font-weight: 400;
  color: var(--ink);
  background: var(--canvas);
}

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

body {
  min-width: 0;
  margin: 0;
}

::selection { color: #092e28; background: #c4e9dc; }

a { color: var(--action); text-underline-offset: 0.25em; }

h1, h2, p { margin: 0; }

h1 {
  font-size: 2.375rem;
  font-weight: 680;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

button, input { font: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--action);
  outline-offset: 3px;
}

.visually-hidden, .skip-link:not(:focus) {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  position: absolute;
  z-index: 1;
  inset: 0.5rem auto auto 0.5rem;
  padding: 0.65rem 1rem;
  background: var(--surface);
}

.layout {
  width: min(calc(100% - 4rem), 66rem);
  margin-inline: auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.site-header::before {
  display: block;
  height: 3px;
  background: var(--brand);
  content: "";
}

.header-inner, .site-brand, .account-nav {
  display: flex;
  align-items: center;
}

.header-inner {
  justify-content: space-between;
  min-height: 5.25rem;
  gap: 1.25rem;
}

.site-brand {
  justify-self: start;
  gap: 1rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 680;
}

.site-brand img {
  width: 5rem;
  height: auto;
  display: block;
}

.site-brand span {
  border-left: 1px solid var(--line);
  padding-left: 1rem;
  line-height: 1.8;
}

.account-nav {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.button, .manage-link, .app-action, a.app-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.35;
  font-weight: 650;
  color: var(--action);
  text-align: center;
  text-decoration: none;
  background: transparent;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.button-plain { color: var(--ink); }

.button-subtle, .manage-link {
  border-color: var(--line);
  background: var(--surface);
}

.button-subtle:hover, .manage-link:hover,
.button-plain:hover, a.app-secondary:hover {
  background: var(--tint);
}

.button-primary, .app-action {
  color: #fff;
  background: var(--action);
}

.button-primary:hover, .app-action:hover { background: var(--action-hover); }

.button-primary:active, .app-action:active { background: #082f29; }

.button-primary svg, .app-action svg, .app-secondary svg {
  width: 1.05rem;
  height: 1.05rem;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.page-main { padding-block: 3.5rem 4.5rem; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.page-intro {
  margin-top: 0.65rem;
  color: var(--muted);
}

.view-state {
  flex: 0 0 auto;
  border: 1px solid #bfd8ce;
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 650;
  color: var(--action);
  background: var(--tint);
}

.app-directory, .manage-directory {
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.app-directory:empty {
  display: none;
}

.empty-state {
  padding: 1.4rem;
  color: var(--muted);
}

.app-card {
  display: grid;
  grid-template-columns: 3.3rem minmax(8rem, 0.82fr) minmax(10rem, 1.18fr) 4.85rem 12.75rem;
  grid-template-areas: "icon name description status action";
  align-items: center;
  gap: 0.9rem 1.1rem;
  min-height: 6.25rem;
  padding: 1.25rem 1.45rem;
}

.app-card + .app-card, .manage-row + .manage-row {
  border-top: 1px solid var(--line);
}

.app-card-top { display: contents; }

.app-card-top > svg, .app-card-top > :has(> svg) {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 3.1rem;
  height: 3.1rem;
  padding: 0.71rem;
  border-radius: 10px;
  color: var(--action);
  background: var(--tint);
}

.app-card-top > :has(> svg) > svg { width: 100%; height: 100%; }

.app-card h2 {
  grid-area: name;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.app-card p {
  grid-area: description;
  font-size: 0.9rem;
  color: var(--muted);
}

.app-status {
  grid-area: status;
  color: var(--action);
  font-size: 0.8125rem;
  font-weight: 650;
  white-space: nowrap;
}

.app-status::before {
  display: inline-block;
  width: 0.42rem;
  height: 0.42rem;
  margin: 0 0.36rem 0.08rem 0;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.app-status:empty { display: none; }

.app-status.status-planned { color: #63533e; }

.app-dms .app-card-top > svg, .app-dms .app-card-top > :has(> svg) {
  color: #63533e;
  background: #f4efe6;
}

.app-card-footer {
  grid-area: action;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.app-card-footer:empty { display: none; }

.app-action { min-width: 5.75rem; }

.app-card-footer .app-secondary:not(a) {
  padding-inline: 0.4rem;
  font-size: 0.875rem;
}

.manage-form, .manage-notice { max-width: 48rem; }

.manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.75rem;
  padding: 0.8rem 1.25rem;
  cursor: pointer;
}

.manage-row:hover { background: var(--tint); }

.manage-row small {
  display: block;
  color: var(--muted);
}

.manage-row input {
  appearance: auto;
  margin: 0.5rem;
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--action);
}

.manage-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.login-page {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-shell {
  width: min(100%, 56rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.login-brand {
  display: grid;
  place-items: center;
  padding: 2rem;
  background: #dfefe8;
  border-inline-end: 1px solid var(--line);
}

.login-brand img {
  display: block;
  width: min(90%, 18rem);
  height: auto;
  mix-blend-mode: multiply;
}

.login-content {
  padding: 3.5rem 2.75rem;
}

.login-content h1 { font-size: 2rem; }

.login-intro {
  margin-top: 0.55rem;
  color: var(--muted);
}

.form-notice {
  margin: 1rem 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid #b6d5c8;
  border-radius: 8px;
  color: #224c40;
  background: var(--tint);
}

.form-notice:empty { display: none; }

.login-notice {
  border-color: #e6c5bb;
  color: #842f22;
  background: #fff3ef;
}

.login-form {
  display: grid;
  gap: 0.45rem;
  margin-top: 1.65rem;
}

.login-notice:not(:empty) + .login-form { margin-top: 1rem; }

.login-form label {
  font-size: 0.875rem;
  font-weight: 650;
}

.login-form input:not([type=hidden]) {
  width: 100%;
  height: 3rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #92aaa0;
  border-radius: 8px;
  color: var(--ink);
  caret-color: var(--action);
  background: var(--surface);
}

.login-form input:hover { border-color: var(--action); }

.login-form label[for=password] { margin-top: 0.55rem; }

.login-form .button-primary {
  min-height: 3rem;
  margin-top: 0.95rem;
  font-size: 0.9375rem;
}

@media (max-width: 52rem) {
  .app-card {
    grid-template-columns: 3.3rem minmax(0, 1fr) 4.8rem 6.95rem;
    grid-template-areas: "icon name status action" "icon description status action";
    gap: 0.2rem 1rem;
  }
}

@media (max-width: 40rem) {
  h1 { font-size: 1.9rem; }

  .layout { width: calc(100% - 2rem); }

  .header-inner { min-height: 4.3rem; }

  .site-brand { gap: 0.45rem; }

  .site-brand img { width: 3.5rem; }

  .site-brand span {
    padding-left: 0.55rem;
    font-size: 0.9rem;
  }

  .header-inner:has(.account-nav) {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding-block: 0.5rem;
  }

  .account-nav { justify-content: flex-start; }

  .account-nav .button, .manage-link { font-size: 0.8125rem; }

  .page-main { padding-block: 2rem 2.5rem; }

  .page-heading {
    align-items: flex-start;
    margin-bottom: 1.2rem;
  }

  .page-intro { font-size: 0.875rem; }

  .view-state { margin-top: 0.15rem; }

  .app-card {
    grid-template-columns: 2.65rem minmax(0, 1fr) max-content;
    grid-template-areas: "icon name status" "icon description description" ". action action";
    column-gap: 0.65rem;
    row-gap: 0.2rem;
    padding: 0.95rem;
  }

  .app-card-top > svg, .app-card-top > :has(> svg) {
    align-self: start;
    width: 2.6rem;
    height: 2.6rem;
    padding: 0.55rem;
  }

  .app-card h2 { font-size: 1rem; }
  .app-card p { font-size: 0.84rem; }

  .app-card-footer {
    justify-content: flex-start;
    margin-top: 0.3rem;
  }

  .app-card-footer .app-secondary:not(a) { padding-inline: 0; }

  .manage-row { padding-inline: 0.9rem; }

  .manage-actions .button { width: 100%; }

  .login-page {
    align-items: start;
    padding: 1.25rem 1rem;
  }

  .login-shell {
    width: min(100%, 28rem);
    grid-template-columns: minmax(0, 1fr);
    margin-top: max(1rem, calc((100svh - 38rem) / 3));
  }

  .login-brand {
    padding: 1.25rem;
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }

  .login-brand img { width: 8rem; }

  .login-content { padding: 1.65rem 1.35rem 1.8rem; }
  .login-content h1 { font-size: 1.625rem; }
}

@media (max-width: 22rem) {
  .page-heading { flex-wrap: wrap; }
  .app-card { padding-inline: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

.identity-page > section { margin-block: 2rem; }
.identity-page h2 { margin-block: 0 0.6rem; font-size: 1.2rem; }
.identity-record {
  padding: 0.9rem 1rem;
  margin-block: 0.55rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  overflow-wrap: anywhere;
}
.identity-record > form { margin-top: 0.8rem; }
.identity-record > small { margin-left: 0.5rem; }
.identity-record summary { cursor: pointer; font-weight: 650; }
.identity-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: 0.75rem;
  margin: 0.6rem 0 0.85rem;
  min-width: 0;
}
.identity-fields legend { font-weight: 650; }
.identity-fields label { display: block; font-size: 0.9rem; }
.identity-fields label > :is(input:not([type="checkbox"]), select) {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: #fff;
  padding: 0.5rem;
  margin-top: 0.25rem;
  font: inherit;
}
.identity-state-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-top: 0.9rem;
}
.identity-state-actions form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; }
.identity-audit {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: white;
}
.identity-audit table { width: 100%; border-collapse: collapse; font-size: 0.9rem; text-align: left; }
.identity-audit :is(th, td) { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.identity-audit :is(th, td):first-child { white-space: nowrap; }
