:root {
  color-scheme: light;
  --background: #f8f9f7;
  --surface: #fff;
  --ink: #1c2720;
  --muted: #59665e;
  --quiet: #6a756d;
  --line: #e4e9e3;
  --green: #23543e;
  --dark-green: #194431;
  --sidebar: 234px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  background: var(--background);
  color: var(--ink);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:not(:disabled), a { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #598769; outline-offset: 3px; }
a { color: inherit; }
h1, h2, p, dl, dd { margin: 0; }
svg { flex-shrink: 0; display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); font-size: .85rem; line-height: 1.5; }

.brand { display: flex; align-items: center; gap: 10px; width: max-content; font-size: 1.08rem; font-weight: 750; }
.brand img { display: block; }
.brand-latin { margin-left: 2px; color: var(--muted); font-size: .82em; font-weight: 650; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 41px; padding: 0 14px; border: 1px solid #dfe6dd; border-radius: 8px; background: white; color: var(--ink); font-size: .875rem; font-weight: 650; white-space: nowrap; }
.button:not(:disabled):hover { background: #f2f5f1; }
.button-small { min-height: 34px; padding-inline: 11px; }
.button-primary { background: var(--green); border-color: var(--green); color: #fff; }
.button-primary:not(:disabled):hover { background: var(--dark-green); border-color: var(--dark-green); }
.text-button { padding: 4px 2px; border: 0; background: transparent; color: #2f6146; font-size: .875rem; font-weight: 660; white-space: nowrap; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.icon-button { display: grid; flex-shrink: 0; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); padding: 0; }
.icon-button:hover { background: #f1f4ef; }

.login-page { min-height: 100dvh; background: radial-gradient(ellipse at 50% 33%, #edf4e8, #f8f9f7 67%); }
.login-page > p[role="status"] { padding: 26px; color: var(--muted); }
.login-header { height: 78px; padding: 0 clamp(18px, 4vw, 55px); display: flex; justify-content: space-between; align-items: center; }
.login-api { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); text-decoration: none; font-size: .875rem; font-weight: 610; }
.login-api:hover { color: var(--green); }
.login-content { display: grid; justify-items: center; padding: clamp(28px, 10vh, 92px) 16px 42px; }
.login-card { width: min(100%, 405px); padding: 29px; background: #fff; border: 1px solid #dce6da; border-radius: 17px; box-shadow: 0 14px 38px #294a360a; }
.login-icon { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 11px; background: #e7f0e4; color: var(--green); margin-bottom: 13px; }
.login-card h1 { margin-bottom: 22px; font-size: 1.62rem; letter-spacing: -.035em; }
.login-card .dialog-form { gap: 15px; }
.demo-credentials { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 7px; border-radius: 8px; background: #f3f6f1; padding: 9px 10px; }
.demo-credentials > div { display: grid; gap: 2px; }
.demo-credentials strong { font-size: .78rem; color: var(--muted); }
.demo-credentials span { font-size: .85rem; color: #344f3e; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 26px 16px 15px; overflow-y: auto; z-index: 3; }
.sidebar .brand { margin-left: 6px; }
.nav { display: grid; gap: 5px; margin-top: 44px; }
.nav-link { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 43px; padding: 0 12px; color: var(--muted); text-align: left; text-decoration: none; border: 0; border-radius: 8px; background: transparent; font-size: .9rem; font-weight: 560; }
.nav-link:hover { background: #f1f4ef; }
.nav-link.selected { background: #eaf2e7; color: #224f3a; font-weight: 700; }
.nav-link.selected svg { stroke-width: 1.9; }
.sidebar-footer { margin-top: auto; padding-top: 18px; }
.sidebar-footer a svg:last-child { margin-left: auto; color: var(--quiet); }
.sidebar-account { display: flex; align-items: center; gap: 10px; margin-top: 11px; padding: 14px 4px 0; border-top: 1px solid var(--line); }
.avatar { width: 35px; height: 35px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: #e9f0e5; color: #2c5940; font-size: .9rem; font-weight: 720; }
.identity { display: grid; flex: 1; gap: 3px; min-width: 0; }
.identity strong, .identity span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity strong { font-size: .875rem; }
.identity span { font-size: .76rem; color: var(--quiet); }

.workspace { margin-left: var(--sidebar); min-width: 0; }
.topbar { height: 66px; background: var(--background); border-bottom: 1px solid var(--line); padding: 0 clamp(24px, 3vw, 48px); display: flex; align-items: center; justify-content: space-between; }
.desktop-heading, .top-actions { color: var(--muted); font-size: .875rem; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; min-width: 0; gap: 12px; }
.demo-label { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; white-space: nowrap; padding: 5px 8px; border-radius: 6px; background: #eaf2e7; color: #41604c; font-weight: 640; font-size: .8rem; }
.demo-label i, .member-status i { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.mobile-brand, .mobile-nav, .mobile-account-actions { display: none; }
.main { max-width: 1350px; margin: 0 auto; padding: 36px clamp(26px, 4vw, 59px) 48px; }
.main h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.2; font-weight: 760; letter-spacing: -.04em; }
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 16px; }
.metric { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 104px; padding: 15px 18px; }
.metric > div { min-width: 0; }
.metric p { color: var(--muted); font-size: .875rem; font-weight: 600; }
.metric strong { display: block; margin-top: 6px; font-size: 1.8rem; font-weight: 760; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-icon { display: grid; place-items: center; width: 39px; height: 39px; flex-shrink: 0; border-radius: 9px; background: #eaf3e7; color: #316148; }

.users-card { overflow: hidden; }
.list-heading { min-height: 67px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; justify-content: space-between; padding: 10px 16px; }
h2 { font-size: 1.06rem; font-weight: 730; letter-spacing: -.02em; }
.search-form { display: flex; gap: 7px; min-width: 0; }
.search-field { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }
.search-field:focus-within { outline: 2px solid #598769; outline-offset: 2px; }
.search-field input { width: min(171px, 100%); min-width: 0; border: 0; outline: none; background: transparent; font-size: .875rem; }
.search-field input:focus-visible { outline: none; }
.table-wrap { container: records / inline-size; }
.data-table { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: left; font-size: .875rem; }
th, td { padding: 12px 11px; border-top: 1px solid #edf0ec; overflow-wrap: anywhere; }
th { color: var(--muted); background: #f8faf7; font-size: .82rem; font-weight: 630; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; text-align: right; }
.user-table th:first-child { width: 28%; }
.user-table th:last-child { width: 86px; }
.app-table th:first-child { width: 29%; }
.app-table th:nth-child(2) { width: 20%; }
.app-table th:last-child { width: 238px; }
.detail-cell { color: var(--muted); }
.cell-caption { display: none; }
.table-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.table-user > div { display: grid; gap: 3px; min-width: 0; }
.table-user strong { display: block; min-width: 0; overflow-wrap: anywhere; }
.table-user > div > span { font-size: .8125rem; color: var(--quiet); overflow-wrap: anywhere; }
.table-user .avatar { width: 32px; height: 32px; }
.admin-tag { display: inline-block; margin-left: 6px; border-radius: 5px; padding: 2px 4px; background: #eef1ed; color: var(--muted); font-size: .69rem; font-weight: 630; }
.member-status { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 2px 7px; border-radius: 20px; background: #eef1ed; color: #536157; font-size: .78rem; font-weight: 650; white-space: nowrap; }
.member-status.active { background: #e1efd9; color: #315d40; }
.member-status.expired { background: #f6eddd; color: #795224; }
.empty-state { display: grid; justify-items: center; align-content: center; min-height: 155px; gap: 8px; color: var(--muted); font-size: .9rem; text-align: center; border-top: 1px solid var(--line); padding: 13px; }
.empty-state svg { color: #799180; }
.pagination { display: flex; align-items: center; justify-content: end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .81rem; }

.account-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 15px; align-items: start; }
.profile-card { padding: 16px; }
.card-heading { display: flex; align-items: center; gap: 9px; }
.profile-card dl { margin-top: 14px; }
.profile-card dl > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.profile-card dt { flex-shrink: 0; color: var(--muted); }
.profile-card dd { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.security-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; min-height: 49px; margin-top: 14px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; }
.security-row > span:first-child { color: var(--muted); letter-spacing: 2px; }

dialog { width: min(435px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 0; overflow: auto; overscroll-behavior: contain; border: 1px solid #dbe4db; border-radius: 15px; color: var(--ink); box-shadow: 0 20px 70px #172f2440; }
dialog::backdrop { background: #15251a58; }
html:has(dialog[open]) { overflow: hidden; }
.dialog-inner { padding: 22px; }
.dialog-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.dialog-title h2 { font-size: 1.28rem; }
.dialog-form { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; font-size: .875rem; font-weight: 630; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.field textarea { resize: vertical; }
.field-control { position: relative; display: flex; min-width: 0; }
.field input, .field textarea { width: 100%; min-width: 0; min-height: 41px; padding: 8px 10px; border: 1px solid #dfe7dc; border-radius: 8px; background: #fff; color: var(--ink); font-size: 1rem; font-weight: 450; }
.field input[name*="assword"], .field input[name="confirmation"], .field input[name="setupToken"] { padding-right: 44px; }
.password-toggle { position: absolute; top: 4px; right: 3px; }
.form-submit { width: 100%; margin-top: 3px; }
.form-footer { display: flex; justify-content: center; }
.form-error { color: #a5322f; font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
.registration-settings { border-top: 1px solid var(--line); padding-top: 10px; }
.registration-settings > summary { cursor: pointer; font-size: .875rem; font-weight: 650; }
.registration-fields { display: grid; gap: 10px; padding-top: 10px; }
.registration-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.registration-row .checkbox { min-height: 42px; }
.registration-extras { display: grid; gap: 10px; }
.registration-extras:empty { display: none; }
.custom-registration-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
.custom-registration-row .button { min-height: 42px; }
.registration-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-card dd { min-width: 0; overflow-wrap: anywhere; }

.dialog-meta { display: grid; gap: 4px; margin-bottom: 16px; overflow-wrap: anywhere; }
.dialog-meta span { color: var(--muted); font-size: .875rem; }
.reset-section { display: grid; justify-items: start; gap: 9px; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); }
.reset-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; width: 100%; gap: 7px; }
.reset-link .field { min-width: 0; }
.toast { position: fixed; bottom: 20px; right: 22px; z-index: 5; max-width: calc(100% - 44px); border-radius: 9px; padding: 11px 14px; color: #fff; background: #214c36; font-size: .875rem; box-shadow: 0 5px 20px #172f2430; }

.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.app-switcher { display: flex; align-items: center; min-width: 0; gap: 8px; }
.app-switcher label { color: var(--muted); font-size: .875rem; font-weight: 650; white-space: nowrap; }
.app-select { position: relative; display: flex; align-items: center; width: clamp(8rem, 18vw, 15rem); min-width: 0; color: var(--green); }
.app-select > svg { position: absolute; left: 9px; pointer-events: none; }
.app-select::after { content: ""; position: absolute; right: 12px; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-2px) rotate(45deg); pointer-events: none; }
.app-select select { width: 100%; min-width: 0; min-height: 36px; appearance: none; padding: 4px 24px 4px 32px; border: 1px solid var(--line); border-radius: 7px; background: #f8faf7; color: var(--ink); font: inherit; font-size: .86rem; text-overflow: ellipsis; }
.app-select select:focus-visible { outline: 2px solid #598769; outline-offset: 2px; }
.applications-card { overflow: hidden; }
.applications-card th { border-top: 0; }
.applications-card th, .applications-card td { padding-block: 13px; }
.applications-card code { color: #344f3e; }
.app-table .member-status { white-space: normal; }
.app-table .row-actions .button-small { padding-inline: 8px; }
.app-icon { display: grid; flex-shrink: 0; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--green); background: #eaf2e7; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: .875rem; font-weight: 630; }
.checkbox input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.debug-options { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f7faf6; }

@media (max-width: 1040px) {
  :root { --sidebar: 195px; }
  .main { padding-inline: 24px; }
  .metric { padding-inline: 14px; }
}

@container records (max-width: 680px) {
  .data-table, .data-table tbody { display: block; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .data-table tbody { display: grid; gap: 10px; padding: 0 12px 12px; }
  .data-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px 14px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; }
  .data-table td { display: block; min-width: 0; padding: 0; border: 0; text-align: left; }
  .data-table .identity-cell { grid-column: 1 / -1; padding-bottom: 12px; border-bottom: 1px solid #edf0ec; }
  .data-table .actions-cell { grid-column: 1 / -1; padding-top: 11px; border-top: 1px solid #edf0ec; text-align: right; }
  .app-table .detail-cell:nth-child(2) { grid-column: 1 / -1; }
  .cell-caption { display: block; margin-bottom: 4px; color: var(--quiet); font-size: .8125rem; }
  .applications-card .table-wrap { padding-top: 12px; }
}

@media (max-width: 820px), (max-width: 980px) and (max-height: 520px) and (pointer: coarse) {
  .sidebar, .desktop-heading { display: none; }
  .workspace { margin-left: 0; }
  .workspace-header { position: sticky; top: 0; z-index: 2; background: var(--background); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
  .topbar { height: 56px; padding-inline: 16px; border-bottom: 0; }
  .mobile-brand { display: block; }
  .mobile-brand .brand { gap: 8px; font-size: 1rem; }
  .mobile-brand img { width: 32px; height: 32px; }
  .top-actions { gap: 8px; }
  .mobile-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 0 12px 7px; }
  .mobile-nav .nav-link { justify-content: center; gap: 6px; padding-inline: 4px; white-space: nowrap; font-size: .875rem; }
  .mobile-nav .nav-link svg { width: 17px; height: 17px; }
  .main { padding: 22px 16px max(35px, env(safe-area-inset-bottom, 0px)); scroll-margin-top: 112px; }
  .main h1 { font-size: 1.65rem; }
  .page-header { margin-bottom: 16px; }
  .app-switcher label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .app-select { width: clamp(6rem, 31vw, 10rem); }
  .app-select select { min-height: 44px; font-size: 1rem; }
  .button, .icon-button, .nav-link, .text-button, .login-api { min-height: 44px; }
  .icon-button { width: 44px; }
  .field input { min-height: 44px; }
  .field input[name*="assword"], .field input[name="confirmation"], .field input[name="setupToken"] { padding-right: 48px; }
  .password-toggle { top: 0; right: 1px; }
  .checkbox { min-height: 44px; }
  .search-field input { font-size: 1rem; }
  .list-heading { padding: 12px 14px; }
  .mobile-account-actions { display: grid; padding: 6px; grid-column: 1 / -1; }
  .mobile-account-actions a svg:last-child { margin-left: auto; }
  .login-page { padding-top: env(safe-area-inset-top, 0px); }
  .login-header { height: 62px; padding-inline: 16px; }
  .login-content { padding: clamp(19px, 6svh, 48px) 16px max(25px, env(safe-area-inset-bottom, 0px)); }
  .login-card { padding: 23px; }
  .toast { right: 14px; bottom: max(14px, env(safe-area-inset-bottom, 0px)); max-width: calc(100% - 28px); }
  .topbar, .mobile-nav, .main, .login-header, .login-content {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
}

@media (max-width: 520px) {
  .metrics { gap: 7px; margin-bottom: 12px; }
  .metric { align-items: flex-start; min-height: 78px; padding: 10px; gap: 5px; }
  .metric p { font-size: .8125rem; }
  .metric strong { font-size: 1.35rem; }
  .metric .metric-icon { width: 23px; height: 23px; }
  .metric .metric-icon svg { width: 15px; height: 15px; }
  .list-heading { align-items: stretch; flex-direction: column; }
  .search-field { flex: 1; }
  .search-field input { width: 100%; min-height: 42px; }
  .account-grid { grid-template-columns: 1fr; }
  .mobile-account-actions { grid-column: auto; }
  dialog {
    width: 100%; max-width: none; max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 12px);
    margin: auto 0 0; border-inline: 0; border-bottom: 0; border-radius: 16px 16px 0 0;
  }
  .dialog-inner { padding: 18px max(16px, env(safe-area-inset-right, 0px)) max(18px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
}

@media (max-width: 395px) {
  .top-actions .demo-label i { display: none; }
  .metric .metric-icon { display: none; }
}

@media (max-height: 520px) {
  .workspace-header { position: static; }
  .login-content { padding-top: 14px; }
}

.task-card > p { margin: 0; padding: 16px; color: var(--muted); }
.task-list { list-style: none; display: grid; gap: 10px; margin: 0; padding: 0 14px 14px; }
.task-item { padding: 14px; border: 1px solid var(--line); border-radius: 9px; }
.task-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; overflow-wrap: anywhere; }
.task-fields { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px 14px; margin: 12px 0; }
.task-fields > div { min-width: 0; overflow-wrap: anywhere; }
.task-fields dt { color: var(--muted); font-size: .875rem; }
.task-fields dd { margin-top: 4px; }
@media (max-width: 520px) {
  .task-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-fields > div:first-child { grid-column: 1 / -1; }
  .mobile-nav .nav-link svg { display: none; }
}

.attendance-results { display: grid; gap: 5px; margin: 0 0 12px; padding: 0; list-style: none; color: var(--muted); overflow-wrap: anywhere; }

.user-detail { display: grid; gap: 14px; }
.user-detail .card-heading { flex-wrap: wrap; }
.user-detail .card-heading h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.text-button { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: start; text-decoration: underline; text-underline-offset: .2em; overflow-wrap: anywhere; cursor: pointer; }

.template-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.template-meta, .template-definition, .workflow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; overflow-wrap: anywhere; }
.template-meta, .template-definition, .task-filter { color: var(--muted); font-size: .875rem; }
.template-definition { padding: 0 16px 16px; }
.workflow { flex-basis: 100%; }
.workflow code { padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; }
.template-source { font: .875rem/1.5 ui-monospace, monospace; }
.task-config { margin: 10px 0; }
.task-config summary { cursor: pointer; font-size: .9rem; }
.task-config ul { margin-top: 8px; }

.template-page-header { flex-wrap: wrap; }

.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.admin-credential-value { max-height: 16rem; overflow: auto; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
