:root {
  color-scheme: light dark;
  --page: light-dark(#f5f5f7, #101012);
  --surface: light-dark(#ffffff, #1b1b1e);
  --text: light-dark(#1d1d1f, #f5f5f7);
  --muted: light-dark(#626269, #b1b1ba);
  --line: light-dark(#dedee3, #3b3b43);
  --soft: light-dark(#ededf1, #29292f);
  --link: light-dark(#0066cc, #91c3ff);
  --action: #006bd6;
  --on-action: #ffffff;
  --danger: light-dark(#b42332, #ffabb3);
  --danger-fill: light-dark(#b42332, #a02130);
  --success: light-dark(#227544, #8edaa8);
  --shadow: light-dark(#0000000d, #00000030);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  background: var(--page);
  color: var(--text);
}
:root[data-appearance="light"] { color-scheme: light; }
:root[data-appearance="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: not-allowed; opacity: .52; }
button, input, a { scroll-margin-block: 24px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }
button, a { transition: background-color .15s ease, box-shadow .15s ease; }
a { color: var(--link); }
h1, h2, h3, p { margin: 0; }
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 20px max(28px, calc((100% - 1160px) / 2)); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; flex-direction: column; gap: 3px; color: var(--text); text-decoration: none; min-width: 0; }
.brand > span { font-size: 17px; font-weight: 600; letter-spacing: .4px; }
.brand small { font-size: 12px; color: var(--muted); letter-spacing: .25px; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.text-button { background: transparent; border: 0; border-radius: 10px; padding: 10px 12px; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; text-decoration: none; color: var(--text); }
.text-button:hover, .text-button[aria-current="page"] { background: var(--soft); }
.text-button[aria-current="page"], .link-button { color: var(--link); }
.avatar { width: 29px; height: 29px; flex-shrink: 0; display: inline-grid; place-items: center; border-radius: 50%; background: var(--soft); font-size: 12px; }
.session-name { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#main-content { flex: 1; width: 100%; outline: none; }
#main-content:has(.login-layout) { display: grid; align-items: center; }
#main-content:focus-visible { outline: 3px solid var(--link); outline-offset: -3px; }
.login-layout { display: grid; place-items: center; padding: 62px 24px; min-height: 560px; }
.login-box { width: 100%; max-width: 440px; min-width: 0; padding: 36px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 30px var(--shadow); }
.login-box h1 { font-size: 23px; font-weight: 600; letter-spacing: -.5px; text-align: center; line-height: 1.5; margin-bottom: 30px; }
.login-box h1 span { display: inline-block; }
.field { display: block; margin-top: 20px; font-size: 13px; font-weight: 500; }
.field input { display: block; width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; background: var(--surface); color: var(--text); margin-top: 8px; min-height: 48px; font-size: 16px; font-weight: 400; }
.field input[readonly] { background: var(--page); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.primary-button, .secondary-button { border-radius: 999px; min-height: 44px; padding: 10px 21px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-size: 14px; font-weight: 500; }
.primary-button { background: var(--action); border: 1px solid var(--action); color: var(--on-action); }
.primary-button:hover:not(:disabled) { filter: brightness(1.08); }
.primary-button.danger-fill { background: var(--danger-fill); border-color: var(--danger-fill); }
.secondary-button { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.secondary-button:hover:not(:disabled) { background: var(--soft); }
.full-width { width: 100%; margin-top: 28px; }
.login-help { display: flex; justify-content: center; margin: 14px auto 0; font-size: 12px; }
.subtext, .helper { color: var(--muted); font-size: 13px; }
.helper { margin-top: 14px; line-height: 1.7; }
.page-content { max-width: 1100px; margin: auto; padding: 52px 36px 68px; }
.welcome { text-align: center; padding: 4px 0 40px; }
.eyebrow { font-size: 12px; color: var(--muted); letter-spacing: 1px; margin-bottom: 12px; }
.welcome h1 { font-size: clamp(30px, 4.5vw, 46px); font-weight: 600; line-height: 1.2; letter-spacing: -1.3px; }
.welcome p { color: var(--muted); font-size: 14px; margin-top: 16px; }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.module-card { display: flex; flex-direction: column; align-items: flex-start; text-align: left; width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--text); padding: 28px 26px 25px; box-shadow: 0 4px 16px var(--shadow); text-decoration: none; transition: transform .18s ease, box-shadow .18s ease; }
.module-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px var(--shadow); }
.module-mark { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 14px; background: var(--page); margin-bottom: 30px; font-size: 14px; font-weight: 500; }
.module-summary { flex: 1; min-width: 0; }
.module-card h2 { font-size: 31px; font-weight: 600; letter-spacing: -1px; line-height: 1.2; }
.module-subtitle { color: var(--muted); font-size: 14px; margin-top: 9px; overflow-wrap: anywhere; }
.module-enter { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; margin-top: 30px; color: var(--link); font-size: 14px; }
.module-enter > span:last-child { font-size: 20px; }
.manager-link { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.manager-link strong { font-weight: 500; font-size: 14px; }
.manager-link p { color: var(--muted); font-size: 13px; margin-top: 5px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-heading h1 { font-size: 32px; letter-spacing: -.7px; font-weight: 600; line-height: 1.3; }
.page-heading p { color: var(--muted); font-size: 14px; margin-top: 10px; }
.account-list { border-top: 1px solid var(--line); }
.account-row { display: grid; grid-template-columns: minmax(190px, 1.4fr) minmax(155px, 1fr) 80px 66px; gap: 18px; align-items: center; padding: 20px 10px; border-bottom: 1px solid var(--line); }
.account-row-heading { padding-block: 12px; color: var(--muted); font-size: 12px; }
.account-person { display: flex; gap: 12px; align-items: center; min-width: 0; }
.account-person .avatar { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); }
.account-person strong { display: block; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.account-person small { display: block; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; margin-top: 2px; }
.pill-set { display: flex; gap: 7px; flex-wrap: wrap; }
.pill { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: var(--surface); color: var(--muted); }
.account-status { font-size: 13px; color: var(--success); display: flex; gap: 6px; align-items: center; }
.account-status::before { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.account-status.inactive { color: var(--muted); }
.edit-panel { margin-top: 30px; padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 7px 23px var(--shadow); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.panel-heading h2 { font-size: 23px; font-weight: 600; overflow-wrap: anywhere; }
.panel-heading p { color: var(--muted); margin-top: 7px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
fieldset { padding: 0; border: 0; margin: 25px 0 0; min-width: 0; }
legend { font-size: 13px; font-weight: 500; margin-bottom: 12px; }
.module-options { display: flex; flex-wrap: wrap; gap: 12px; }
.module-option { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; flex: 1; min-width: 90px; background: var(--page); font-size: 14px; cursor: pointer; }
.module-option:has(input:checked) { border-color: var(--link); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--action); margin: 0; }
.panel-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.action-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.danger-text { color: var(--danger); }
.error-message { color: var(--danger); font-size: 13px; margin-top: 16px; overflow-wrap: anywhere; }
.internal-status { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 22px; font-size: 13px; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.notice { max-width: 1028px; width: calc(100% - 48px); margin: 20px auto 0; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; color: var(--text); background: var(--surface); overflow-wrap: anywhere; }
.notice.error-notice { color: var(--danger); }
.empty-state { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 48px 28px; text-align: center; }
.empty-state h2 { font-size: 23px; font-weight: 500; line-height: 1.5; margin-bottom: 12px; }
.empty-state p { color: var(--muted); font-size: 14px; }
.empty-state .secondary-button { margin-top: 22px; }
.loading-state { min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: var(--muted); font-size: 14px; padding: 36px; text-align: center; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--link); border-radius: 50%; animation: spin .9s linear infinite; }
.app-footer { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 18px 30px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.skip-link { position: absolute; top: 12px; left: 12px; padding: 12px; background: var(--surface); z-index: 5; transform: translateY(-160%); border: 1px solid var(--line); }
.skip-link:focus { transform: translateY(0); }
dialog { max-width: 480px; width: calc(100% - 40px); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: 0 20px 70px #00000030; }
dialog::backdrop { background: #00000066; }
.dialog-content { padding: 30px; }
.dialog-content h2 { font-size: 23px; font-weight: 600; overflow-wrap: anywhere; }
.dialog-content p { font-size: 14px; color: var(--muted); margin-top: 16px; line-height: 1.8; white-space: pre-line; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.noscript-message { max-width: 600px; margin: 30px auto; padding: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 760px) {
  .app-header { padding: 18px 20px; gap: 14px; }
  .brand > span { font-size: 15px; }
  .brand small { font-size: 11px; }
  nav { width: 100%; gap: 4px; }
  nav .session-control { margin-left: auto; }
  .text-button { padding: 9px; font-size: 12px; }
  .session-name { max-width: 115px; }
  .login-layout { padding: 38px 20px; min-height: 480px; }
  .login-box { padding: 28px 24px; }
  .login-box h1 { font-size: 20px; }
  .page-content { padding: 36px 22px 46px; }
  .welcome { padding-bottom: 30px; }
  .welcome h1 { font-size: clamp(26px, 6.4vw, 36px); letter-spacing: -.9px; }
  .module-grid { grid-template-columns: 1fr; gap: 14px; }
  .module-card { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 9px 18px; padding: 23px; }
  .module-mark { margin: 0; grid-row: 1 / 3; }
  .module-card h2 { font-size: 26px; }
  .module-enter { grid-column: 2; margin-top: 4px; }
  .module-subtitle { margin-top: 4px; font-size: 13px; }
  .account-row { grid-template-columns: minmax(0, 1fr) 56px; gap: 10px 14px; padding: 18px 0; }
  .account-row-heading { display: none; }
  .account-person { grid-column: 1; }
  .account-row > .text-button { grid-column: 2; grid-row: 1 / 4; }
  .pill-set, .account-status { grid-column: 1; padding-left: 50px; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .edit-panel { padding: 22px 18px; }
  .module-options { gap: 8px; }
  .module-option { padding: 13px 10px; min-width: 72px; }
  .page-heading h1 { font-size: 28px; }
  .app-footer { padding: 18px 22px; }
  .dialog-content { padding: 24px; }
}
@media (pointer: coarse) { .text-button { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .module-card:hover { transform: none; } }
