:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #62706a;
  --paper: #f4f1e8;
  --panel: #fffdf7;
  --line: #ddd9cc;
  --forest: #153f32;
  --forest-light: #245c49;
  --lime: #ccff78;
  --warm: #f0bb63;
  --danger: #a43d32;
  --shadow: 0 20px 60px rgba(25, 40, 33, 0.12);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 15%, rgba(204, 255, 120, 0.14), transparent 30rem),
    var(--paper);
}

a {
  color: inherit;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.7rem;
  color: var(--forest-light);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 8.75rem;
  height: auto;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 4.7rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem max(1.25rem, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(21, 63, 50, 0.12);
  background: rgba(244, 241, 232, 0.92);
  backdrop-filter: blur(18px);
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.topbar nav a,
.link-button {
  border: 0;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
}

.topbar nav a:hover,
.link-button:hover {
  color: var(--forest);
}

.topbar nav form {
  margin: 0;
}

.user-name {
  font-weight: 700;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(204, 255, 120, 0.11), transparent 30rem),
    var(--forest);
}

.status-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 5px rgba(204, 255, 120, 0.1);
}

.login-card {
  width: min(100%, 440px);
  padding: clamp(1.6rem, 5vw, 2.8rem);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  background: var(--panel);
}

.login-card h1,
.panel h1 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: 2.15rem;
  font-weight: 500;
  line-height: 1.3;
}

.login-heading {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.login-heading p {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.stack-form {
  display: grid;
  gap: 1.15rem;
}

.stack-form label {
  display: grid;
  gap: 0.55rem;
  color: #34433d;
  font-size: 0.86rem;
  font-weight: 750;
}

.stack-form label small {
  color: var(--muted);
  font-weight: 450;
}

.field-note,
.readonly-field {
  margin: 0;
  padding: 0.8rem 0.9rem;
  border-radius: 0.55rem;
  color: var(--muted);
  background: #f2f0e8;
  font-size: 0.78rem;
  line-height: 1.55;
}

.readonly-field {
  display: grid;
  gap: 0.28rem;
}

.readonly-field span {
  color: #34433d;
  font-size: 0.86rem;
  font-weight: 750;
}

.readonly-field strong {
  color: var(--forest);
}

.readonly-field small {
  overflow-wrap: anywhere;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cfcbbf;
  border-radius: 0.55rem;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: border-color 150ms, box-shadow 150ms;
}

input,
select {
  height: 3.2rem;
  padding: 0 0.9rem;
}

textarea {
  min-height: 7rem;
  padding: 0.85rem 0.9rem;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--forest-light);
  box-shadow: 0 0 0 3px rgba(36, 92, 73, 0.12);
}

.button {
  display: inline-flex;
  min-height: 2.8rem;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  color: white;
  background: var(--forest);
}

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

.button.light {
  color: var(--forest);
  background: var(--lime);
}

.button.secondary {
  color: var(--forest);
  border-color: var(--line);
  background: transparent;
}

.button.danger {
  color: var(--danger);
  border-color: rgba(164, 61, 50, 0.25);
  background: #fff8f6;
}

.button.full {
  width: 100%;
  margin-top: 0.4rem;
}

.notice {
  margin: 1.25rem 0;
  padding: 0.85rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.notice.error {
  color: #7c2f29;
  border: 1px solid #ecc4bd;
  background: #fff2ef;
}

.notice.warning {
  color: #6a4a15;
  border: 1px solid #ead09c;
  background: #fff8e9;
}

.notice.success {
  color: var(--forest);
  border: 1px solid #b7d6c8;
  background: #eef8f3;
}

.dashboard-shell {
  width: min(calc(100% - 2.5rem), 1180px);
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

.hero {
  display: flex;
  min-height: 280px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(2rem, 5vw, 4rem);
  border-radius: 1.2rem;
  color: white;
  background:
    linear-gradient(120deg, rgba(204, 255, 120, 0.13), transparent 50%),
    var(--forest);
}

.hero .eyebrow {
  color: var(--lime);
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(2.15rem, 4vw, 3.4rem);
  font-weight: 500;
  line-height: 1.05;
}

.hero .button {
  white-space: nowrap;
}

.hero p:last-child {
  max-width: 620px;
  margin: 1.1rem 0 0;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.7;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 3.5rem 0 1.5rem;
}

.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: 2rem;
  font-weight: 500;
}

.section-kicker {
  display: block;
  margin-bottom: 0.5rem;
}

.secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.76rem;
}

.secure-badge .status-dot {
  width: 0.4rem;
  height: 0.4rem;
  background: #3c9b67;
  box-shadow: none;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.service-card {
  display: flex;
  min-height: 320px;
  flex-direction: column;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(255, 253, 247, 0.78);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.service-card:hover {
  border-color: #b9b6ab;
  box-shadow: 0 15px 35px rgba(25, 40, 33, 0.08);
  transform: translateY(-3px);
}

.service-topline,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.service-topline {
  flex-wrap: wrap;
}

.category,
.service-status,
.access-scope {
  color: var(--forest-light);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.access-scope {
  margin-left: auto;
  padding: 0.3rem 0.45rem;
  border-radius: 999px;
  color: #24513f;
  background: #e3f0df;
}

.access-scope.external {
  color: #765010;
  background: #fff0d1;
}

.service-status {
  color: #8b651b;
}

.service-status.quiet {
  color: #5f7f70;
}

.service-glyph {
  display: grid;
  width: 3.1rem;
  height: 3.1rem;
  margin-top: 2rem;
  place-items: center;
  border-radius: 0.7rem;
  color: var(--forest);
  background: #e2efc9;
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 800;
}

.service-card h3 {
  margin: 1.1rem 0 0.5rem;
  font-size: 1.25rem;
}

.service-card > p {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.card-actions {
  margin-top: 1.3rem;
}

.button.disabled {
  color: var(--muted);
  border-color: var(--line);
  background: #efede5;
  cursor: not-allowed;
}

.text-link,
.back-link {
  color: var(--forest-light);
  font-size: 0.84rem;
  font-weight: 750;
  text-decoration: none;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 5rem 2rem;
  border: 1px dashed #c6c2b5;
  border-radius: 0.9rem;
  text-align: center;
  background: rgba(255, 253, 247, 0.48);
}

.empty-symbol {
  display: grid;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.2rem;
  place-items: center;
  border-radius: 50%;
  color: var(--forest);
  background: #e2efc9;
  font-size: 2rem;
}

.empty-state h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-weight: 500;
}

.empty-state p {
  margin: 0.8rem 0 0;
  color: var(--muted);
}

.directory-section {
  margin-top: 1rem;
}

.approval-section {
  margin-top: 1rem;
}

.directory-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.table-shell {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(255, 253, 247, 0.78);
  overflow-x: auto;
}

.service-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.service-table th,
.service-table td {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.service-table th {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.service-table td {
  font-size: 0.84rem;
}

.service-table td:first-child {
  min-width: 240px;
}

.service-table td small {
  display: block;
  max-width: 380px;
  margin-top: 0.28rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.service-table code {
  color: #34433d;
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.service-table form {
  margin: 0;
}

.inline-role-form {
  display: flex;
  min-width: 250px;
  align-items: center;
  gap: 0.55rem;
}

.inline-name-form {
  display: flex;
  min-width: 330px;
  align-items: center;
  gap: 0.55rem;
}

.inline-name-form input {
  min-width: 180px;
  height: 2.5rem;
}

.inline-name-form .table-action {
  min-width: auto;
  white-space: nowrap;
}

.inline-role-form select {
  min-width: 120px;
}

.inline-role-form .table-action {
  min-width: auto;
}

.password-reset-control {
  min-width: 190px;
}

.password-reset-control > summary {
  display: inline-block;
  min-width: auto;
  list-style: none;
  text-align: center;
  user-select: none;
}

.password-reset-control > summary::-webkit-details-marker {
  display: none;
}

.password-reset-control[open] > summary {
  border-color: var(--line);
  color: var(--muted);
  background: #f2f0e8;
}

.password-reset-control p {
  max-width: 220px;
  margin: 0.65rem 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.password-reset-control .table-action.reset {
  min-width: auto;
  border-color: rgba(164, 61, 50, 0.3);
  color: var(--danger);
  white-space: nowrap;
}

.role-badge {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  color: white;
  background: var(--forest);
  font-size: 0.76rem;
}

.admin-shell > .section-heading {
  margin-bottom: 1.5rem;
}

.account-create-section {
  margin-bottom: 2.5rem;
}

.create-user-form {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(255, 253, 247, 0.78);
}

.create-user-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 0.8fr;
  gap: 1rem;
}

.create-user-fields label {
  display: grid;
  align-content: start;
  gap: 0.5rem;
  color: #34433d;
  font-size: 0.84rem;
  font-weight: 750;
}

.create-user-fields small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 450;
  line-height: 1.5;
}

.create-user-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.create-user-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.create-user-footer .button {
  flex: 0 0 auto;
}

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

.review-actions {
  display: flex;
  gap: 0.5rem;
}

.table-action {
  min-width: 8.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--forest-light);
  border-radius: 999px;
  color: var(--forest);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 750;
  cursor: pointer;
}

.table-action.approve {
  color: white;
  background: var(--forest);
}

.table-action.reject {
  min-width: auto;
  color: var(--danger);
  border-color: rgba(164, 61, 50, 0.3);
}

.table-action.selected {
  border-color: var(--line);
  color: var(--muted);
  background: #f2f0e8;
}

.table-empty {
  padding: 3rem !important;
  color: var(--muted);
  text-align: center;
}

.modal {
  width: min(calc(100% - 2rem), 570px);
  max-height: calc(100vh - 2rem);
  padding: 1.8rem;
  border: 0;
  border-radius: 1rem;
  box-shadow: var(--shadow);
  background: var(--panel);
  overflow: auto;
}

.modal::backdrop {
  background: rgba(14, 31, 24, 0.58);
  backdrop-filter: blur(4px);
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-heading h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 2rem;
  font-weight: 500;
}

.icon-button {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.narrow-shell {
  width: min(calc(100% - 2rem), 720px);
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
}

.guide-shell {
  width: min(calc(100% - 2.5rem), 1000px);
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
}

.guide-document {
  padding: clamp(1.5rem, 5vw, 4rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: 0 10px 35px rgba(25, 40, 33, 0.06);
  background: var(--panel);
}

.guide-document h1,
.guide-document h2,
.guide-document h3 {
  color: var(--forest);
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-weight: 600;
  line-height: 1.3;
}

.guide-document h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.guide-document h2 {
  margin: 2.8rem 0 1rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--line);
  font-size: 1.65rem;
}

.guide-document h3 {
  margin: 2rem 0 0.7rem;
  font-size: 1.18rem;
}

.guide-document p,
.guide-document li {
  line-height: 1.85;
}

.guide-document p {
  margin: 0.75rem 0;
}

.guide-document ul,
.guide-document ol {
  margin: 0.8rem 0 1.2rem;
  padding-left: 1.5rem;
}

.guide-document li + li {
  margin-top: 0.45rem;
}

.guide-meta {
  margin: 0.2rem 0 !important;
  color: var(--muted);
  font-size: 0.86rem;
}

.guide-callout {
  margin: 1.8rem 0 2rem;
  padding: 1.2rem 1.3rem;
  border-left: 4px solid var(--forest-light);
  border-radius: 0 0.7rem 0.7rem 0;
  color: #29483d;
  background: #edf4ef;
  line-height: 1.8;
}

.guide-document code {
  padding: 0.12rem 0.32rem;
  border-radius: 0.25rem;
  color: #244b3e;
  background: #edf1ea;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.guide-document pre {
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: #f1efe8;
  line-height: 1.65;
}

.guide-document pre code {
  padding: 0;
  color: var(--ink);
  background: transparent;
  white-space: pre;
  overflow-wrap: normal;
}

.guide-table-shell {
  overflow-x: auto;
  margin: 1rem 0 1.7rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
}

.guide-document table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: white;
}

.guide-document th,
.guide-document td {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.6;
}

.guide-document th {
  color: var(--forest);
  background: #edf1ea;
  font-size: 0.82rem;
}

.guide-document tbody tr:last-child td {
  border-bottom: 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.2rem;
}

.panel {
  padding: clamp(1.5rem, 5vw, 3.4rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: 0 10px 35px rgba(25, 40, 33, 0.06);
  background: var(--panel);
}

.panel > .muted {
  margin: 0.7rem 0 2rem;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.danger-zone strong,
.danger-zone p {
  display: block;
  margin: 0;
}

.danger-zone p {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.account-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.8rem 0;
  padding: 1.1rem;
  border-radius: 0.7rem;
  background: #f2f0e8;
}

.avatar {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--forest);
  font-weight: 800;
}

.account-summary strong,
.account-summary span {
  display: block;
}

.account-summary span,
.account-summary small {
  color: var(--muted);
  font-size: 0.78rem;
}

.account-summary small {
  margin-left: auto;
}

.account-panel h2 {
  margin: 2rem 0 0;
  font-size: 1.2rem;
}

.password-result-panel h1 {
  margin-bottom: 1rem;
}

.temporary-password-field {
  display: block;
  margin: 1.5rem 0 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.temporary-password-field input {
  width: 100%;
  margin-top: 0.45rem;
  color: var(--ink);
  background: #f2f0e8;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.password-result-actions {
  display: flex;
  margin-top: 1.5rem;
}

.profile-form {
  margin-top: 1rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}

input:disabled,
button:disabled {
  color: var(--muted);
  background: #efede5;
  cursor: not-allowed;
}

.error-panel {
  text-align: center;
}

.error-panel h1 {
  font-size: 5rem;
}

.error-panel .button {
  margin-top: 1rem;
}

.center-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
}

@media (max-width: 900px) {
  .service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    position: static;
    padding: 0.65rem 0.75rem;
  }

  .user-name {
    display: none;
  }

  .brand-logo {
    width: 4.6rem;
  }

  .topbar nav {
    gap: 0.45rem;
    font-size: 0.68rem;
  }

  .topbar nav a,
  .topbar nav button {
    white-space: nowrap;
  }

  .login-card h1 {
    font-size: 1.8rem;
  }

  .hero {
    min-height: 310px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 1.5rem;
  }

  .hero .button {
    width: 100%;
  }

  .hero h1 {
    font-size: 1.9rem;
  }

  .section-heading {
    align-items: flex-start;
  }

  .secure-badge {
    display: none;
  }

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

  .service-card {
    min-height: 290px;
  }

  .directory-help {
    display: none;
  }

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

  .create-user-fields {
    grid-template-columns: 1fr;
  }

  .create-user-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .account-summary {
    align-items: flex-start;
  }

  .account-summary small {
    display: none;
  }

  .danger-zone {
    align-items: flex-start;
    flex-direction: column;
  }

  .guide-shell {
    width: min(calc(100% - 1.2rem), 1000px);
    padding-top: 1.4rem;
  }

  .guide-document {
    padding: 1.25rem;
  }
}

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