:root {
  font-family: "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  color: #172421;
  background: #f3f5f2;
  font-synthesis: none;
  --ink: #172421;
  --forest: #123e37;
  --forest-light: #1d5d52;
  --gold: #b68a3a;
  --line: #d8dfda;
  --muted: #66736f;
  --danger: #a13d37;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 0 0, #e4ece7 0, transparent 35%), #f5f6f3; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(29,93,82,.3); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .55; }
.brandbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 4vw, 64px); background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--forest); text-decoration: none; font-weight: 800; letter-spacing: .03em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; color: #fff; background: var(--forest); border-radius: 10px 10px 14px 10px; font-family: serif; }
.environment { color: var(--muted); font-size: 13px; }
main { min-height: calc(100vh - 68px); }
.loading, .center-layout { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 24px; }
.split-layout { min-height: calc(100vh - 68px); display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px); gap: clamp(36px, 7vw, 110px); align-items: center; max-width: 1240px; margin: auto; padding: 60px 32px; }
.intro-panel h1 { max-width: 720px; margin: 8px 0 18px; font-family: "Yu Mincho", serif; font-size: clamp(36px, 5vw, 62px); line-height: 1.2; color: var(--forest); }
.lead { max-width: 620px; color: #4e5c58; font-size: 18px; line-height: 1.9; }
.eyebrow { margin: 0 0 6px; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.steps { display: grid; gap: 18px; list-style: none; margin: 36px 0 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 14px; }
.steps li > span { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border: 1px solid #9eb2aa; border-radius: 50%; color: var(--forest); font-weight: 800; }
.steps strong, .steps small { display: block; }
.steps small { color: var(--muted); margin-top: 3px; }
.card { background: rgba(255,255,255,.96); border: 1px solid #dde4df; border-radius: 20px; box-shadow: 0 20px 60px rgba(18, 62, 55, .08); }
.form-card, .login-card { display: grid; gap: 18px; padding: clamp(24px, 4vw, 42px); }
.login-card { width: min(100%, 440px); text-align: center; }
.auth-card { display: grid; gap: 18px; width: min(100%, 560px); padding: clamp(24px, 5vw, 42px); }
.wide-auth-card { width: min(100%, 720px); }
.compact-auth-card { margin-top: 18px; }
.operations-card { width: min(100%, 620px); }
.stack-form { display: grid; gap: 17px; }
.card-heading h2, .dialog-heading h2 { margin: 4px 0 0; color: var(--forest); }
label { display: grid; gap: 7px; text-align: left; color: #35423e; font-size: 14px; font-weight: 700; }
input, select { width: 100%; min-height: 48px; padding: 10px 13px; color: var(--ink); background: #fff; border: 1px solid #bcc8c2; border-radius: 10px; outline: none; }
input:focus, select:focus { border-color: var(--forest-light); box-shadow: 0 0 0 3px rgba(29,93,82,.13); }
small { color: var(--muted); font-weight: 400; }
.subdomain-field { display: flex; align-items: center; background: #fff; border: 1px solid #bcc8c2; border-radius: 10px; overflow: hidden; }
.subdomain-field:focus-within { border-color: var(--forest-light); box-shadow: 0 0 0 3px rgba(29,93,82,.13); }
.subdomain-field input { min-width: 90px; border: 0; box-shadow: none; }
.subdomain-field span { flex: 0 0 auto; padding-right: 12px; color: var(--muted); font-size: 13px; }
.consent { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; }
.consent input { width: 18px; min-height: 18px; margin-top: 2px; }
.primary, .secondary, .link-button, .icon-button { border: 0; border-radius: 10px; }
.primary { min-height: 50px; padding: 0 20px; color: #fff; background: var(--forest); font-weight: 800; }
.primary:hover { background: var(--forest-light); }
.primary:disabled { cursor: not-allowed; opacity: .5; }
.primary.compact { min-height: 44px; }
.secondary { min-height: 46px; padding: 0 18px; color: var(--forest); background: #e9efec; font-weight: 700; }
.link-button { color: var(--forest-light); background: transparent; text-decoration: underline; }
.action-link { display: inline-flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; }
.full-width { width: 100%; }
.field-status, .form-message { min-height: 20px; margin: -8px 0 0; font-size: 13px; }
.is-ok { color: #16724e; }
.is-error { color: var(--danger); }
.tenant-avatar { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 4px; color: #fff; background: var(--forest); border-radius: 18px; font-family: serif; font-size: 26px; }
.muted { color: var(--muted); }
.success-lead { margin: 0; color: #16724e; font-size: 18px; font-weight: 800; text-align: center; }
.success-panel { display: grid; gap: 14px; padding: 18px; background: #f2f8f4; border: 1px solid #cfe2d5; border-radius: 12px; }
.success-panel h2, .success-panel p { margin: 0; }
.recovery-actions { display: grid; gap: 10px; }
.account-details { display: grid; gap: 0; margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.account-details > div { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 14px; padding: 12px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.account-details > div:last-child { border-bottom: 0; }
.account-details dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.account-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-weight: 700; }
.compact-details > div { grid-template-columns: minmax(100px, 28%) 1fr; }
.method-switch { display: flex; gap: 8px; }
.method-switch button { flex: 1; min-height: 42px; padding: 8px 12px; color: var(--forest); background: #eef2ef; border: 1px solid transparent; border-radius: 9px; font-weight: 700; }
.method-switch button[aria-pressed="true"] { background: #fff; border-color: var(--forest-light); box-shadow: 0 0 0 2px rgba(29,93,82,.1); }
.backup-code-panel { padding: 16px; background: #fff9ed; border: 1px solid #ead8b4; border-radius: 12px; }
.backup-code-panel h2, .backup-code-panel p { margin-top: 0; }
.backup-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.backup-codes li { padding: 8px 10px; background: #fff; border: 1px solid #e5d2ac; border-radius: 7px; font-family: ui-monospace, "Cascadia Mono", monospace; text-align: center; }
.secret-value { display: block; padding: 7px 9px; overflow-wrap: anywhere; color: var(--ink); background: #f0f3f1; border-radius: 6px; font-size: 13px; user-select: all; }
.workspace { max-width: 1240px; margin: auto; padding: 52px 28px 80px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 4px 0 6px; color: var(--forest); font-family: "Yu Mincho", serif; font-size: 38px; }
.page-heading p { margin-bottom: 0; }
.role-summary { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.summary-card { padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.summary-card strong { display: block; color: var(--forest); font-size: 26px; }
.summary-card span { color: var(--muted); font-size: 13px; }
.table-card { overflow: hidden; }
.table-toolbar { display: flex; gap: 12px; padding: 18px; border-bottom: 1px solid var(--line); }
.table-toolbar input { max-width: 360px; }
.table-toolbar select { max-width: 200px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 18px; text-align: left; white-space: nowrap; border-bottom: 1px solid #edf0ee; font-size: 14px; }
th { color: var(--muted); background: #fafbf9; font-size: 12px; letter-spacing: .05em; }
.person strong, .person small { display: block; }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; background: #e7efeb; color: var(--forest); font-size: 12px; font-weight: 800; }
.badge.inactive { background: #eee; color: #69706d; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.row-actions button { padding: 7px 10px; color: var(--forest); background: #eef2ef; border: 0; border-radius: 8px; }
.member-message { margin: 0 0 14px; }
.empty-state { padding: 34px 18px; color: var(--muted); text-align: center; }
dialog { width: min(92vw, 520px); max-height: min(90vh, 820px); padding: 0; overflow-y: auto; border: 0; border-radius: 18px; box-shadow: 0 30px 100px rgba(0,0,0,.22); }
dialog::backdrop { background: rgba(9, 24, 21, .52); backdrop-filter: blur(3px); }
.dialog-card { display: grid; gap: 17px; padding: 28px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; }
.icon-button { width: 36px; height: 36px; color: var(--muted); background: #f0f2f0; font-size: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.security-note { padding: 13px; margin: 0; color: #4c5a56; background: #f2f6f3; border-left: 3px solid var(--gold); border-radius: 5px; font-size: 13px; line-height: 1.7; }
.security-note p { margin: 5px 0 10px; }
.property-fieldset { min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.property-fieldset legend { padding: 0 5px; color: #35423e; font-size: 14px; font-weight: 800; }
.property-options { display: grid; gap: 8px; margin-top: 12px; max-height: 210px; overflow-y: auto; }
.property-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px; background: #f8faf8; border: 1px solid #e4e9e6; border-radius: 8px; cursor: pointer; }
.property-option input { flex: 0 0 18px; width: 18px; min-height: 18px; margin-top: 2px; }
.property-option strong, .property-option small { display: block; }
.property-option span { min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 800px) {
  .environment { display: none; }
  .split-layout { grid-template-columns: 1fr; padding: 36px 18px; }
  .intro-panel h1 { font-size: 38px; }
  .steps { margin-bottom: 12px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .role-summary { grid-template-columns: 1fr; }
  .table-toolbar { flex-direction: column; }
  .table-toolbar input, .table-toolbar select { max-width: none; }
  .account-details > div { grid-template-columns: 1fr; gap: 4px; }
  .backup-codes { grid-template-columns: 1fr; }
  .dialog-card { padding: 22px 18px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
}
