:root {
  color-scheme: light;
  --auth-ink: #1f2328;
  --auth-muted: #57606a;
  --auth-line: #d0d7de;
  --auth-blue: #1f6feb;
  --auth-blue-dark: #1859b8;
  --auth-blue-soft: #eef6ff;
  --auth-supply: #087f75;
  --auth-supply-soft: #eaf7f5;
  --auth-admin: #6f42c1;
  --auth-admin-soft: #f5f0ff;
}

* { box-sizing: border-box; }

body.auth-shell {
  min-height: 100vh;
  margin: 0;
  display: flex;
  background:
    radial-gradient(circle at 10% 0, rgba(31,111,235,.09), transparent 28rem),
    #f6f8fa;
  color: var(--auth-ink);
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  font-family: system-ui, "Segoe UI", "Hiragino Sans", Meiryo, sans-serif;
}

.auth-card {
  width: min(540px, 100%);
  margin: auto;
  border: 1px solid var(--auth-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(31,35,40,.09);
  padding: clamp(24px, 5vw, 34px);
}

.auth-heading { margin-bottom: 22px; }
.auth-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--auth-blue);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .16em;
}
.auth-heading h1 { margin: 0 0 7px; font-size: clamp(1.45rem, 4vw, 1.75rem); line-height: 1.25; }
.auth-heading p { margin: 0; color: var(--auth-muted); font-size: .9rem; line-height: 1.55; }

.auth-error {
  margin-bottom: 18px;
  border: 1px solid #ff9b95;
  border-radius: 10px;
  background: #ffebe9;
  color: #a40e26;
  padding: 12px 14px;
  font-size: .9rem;
  font-weight: 650;
  line-height: 1.5;
}

.login-form { display: grid; gap: 20px; }
.role-picker { min-width: 0; margin: 0; border: 0; padding: 0; }
.role-picker > legend,
.password-label {
  display: block;
  margin-bottom: 9px;
  color: var(--auth-muted);
  font-size: .84rem;
  font-weight: 700;
}
.role-groups { display: grid; gap: 12px; }
.role-group {
  border: 1px solid var(--auth-line);
  border-radius: 12px;
  background: #fbfcfd;
  padding: 12px;
}
.role-group-title { display: flex; align-items: center; gap: 8px; margin: 0 0 9px; font-size: .9rem; }
.role-group-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  background: var(--auth-blue-soft);
  color: var(--auth-blue-dark);
  font-weight: 800;
}
.role-group.supplies .role-group-mark { background: var(--auth-supply-soft); color: var(--auth-supply); }
.role-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.role-choice { position: relative; display: block; cursor: pointer; }
.role-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
.role-option {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 2px solid #d8dee4;
  border-radius: 10px;
  background: #fff;
  padding: 9px 12px;
  text-align: center;
  transition: border-color .12s, background-color .12s, box-shadow .12s, transform .12s;
}
.role-option-title { font-size: 1.02rem; font-weight: 800; }
.role-option-desc { color: var(--auth-muted); font-size: .72rem; line-height: 1.35; }
.role-choice:hover .role-option { border-color: #9dbbe8; transform: translateY(-1px); }
.role-radio:checked + .role-option {
  border-color: var(--auth-blue);
  background: var(--auth-blue-soft);
  box-shadow: 0 0 0 2px rgba(31,111,235,.12);
  color: #0e4f9e;
}
.role-group.supplies .role-radio:checked + .role-option {
  border-color: var(--auth-supply);
  background: var(--auth-supply-soft);
  box-shadow: 0 0 0 2px rgba(8,127,117,.11);
  color: #075e57;
}
.role-radio:focus-visible + .role-option { outline: 3px solid rgba(31,111,235,.28); outline-offset: 2px; }

.admin-choice .role-option {
  min-height: 58px;
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  border-color: #d8cbed;
  background: #fcfaff;
  text-align: left;
}
.admin-mark {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--auth-admin-soft);
  color: var(--auth-admin);
  font-weight: 800;
}
.admin-choice .role-radio:checked + .role-option {
  border-color: var(--auth-admin);
  background: var(--auth-admin-soft);
  box-shadow: 0 0 0 2px rgba(111,66,193,.1);
  color: #4f2c91;
}

.password-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.password-wrap input {
  min-width: 0;
  min-height: 50px;
  border: 1px solid var(--auth-line);
  border-radius: 10px 0 0 10px;
  background: #fff;
  color: var(--auth-ink);
  padding: 11px 13px;
  font: inherit;
  font-size: 1rem;
}
.password-wrap input:focus { position: relative; z-index: 1; outline: 3px solid rgba(31,111,235,.2); border-color: var(--auth-blue); }
.password-toggle {
  min-width: 66px;
  min-height: 50px;
  margin: 0 0 0 -1px;
  border: 1px solid var(--auth-line);
  border-radius: 0 10px 10px 0;
  background: #f6f8fa;
  color: #38414b;
  padding: 8px 12px;
  font: inherit;
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
}
.password-toggle:hover { background: #eaeef2; }
.login-submit {
  width: 100%;
  min-height: 52px;
  margin: 0;
  border: 0;
  border-radius: 10px;
  background: var(--auth-blue);
  color: #fff;
  padding: 12px 16px;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}
.login-submit:hover { background: var(--auth-blue-dark); }
.login-submit:focus-visible,
.password-toggle:focus-visible { outline: 3px solid rgba(31,111,235,.28); outline-offset: 2px; }
.login-tools { display: flex; justify-content: center; margin-top: 20px; }
.login-tools .fontscale button { min-width: 50px; min-height: 40px; margin: 0; }

/* 高さの低いタブレット横向きでは、役割を横一列にして画面内へ収める。 */
@media (orientation: landscape) and (min-width: 600px) and (max-height: 720px) {
  body.auth-shell { padding-block: 10px; }
  .auth-card {
    width: min(900px, 100%);
    border-radius: 14px;
    padding: 15px 22px 12px;
  }
  .auth-heading { margin-bottom: 9px; }
  .auth-kicker,
  .auth-heading p { display: none; }
  .auth-heading h1 { margin: 0; font-size: 1.35rem; }
  .auth-error { margin-bottom: 9px; padding: 8px 12px; }
  .login-form { gap: 9px; }
  .role-picker > legend,
  .password-label { margin-bottom: 5px; }
  .role-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(130px, .55fr);
    align-items: stretch;
    gap: 8px;
  }
  .role-group { padding: 8px; }
  .role-group-title { margin-bottom: 6px; }
  .role-options { gap: 6px; }
  .role-option { min-height: 54px; padding: 6px 8px; }
  .admin-choice .role-option {
    height: 100%;
    min-height: 0;
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: center;
    gap: 3px;
    text-align: center;
  }
  .admin-choice .admin-mark { grid-row: auto; }
  .password-wrap input,
  .password-toggle { min-height: 46px; }
  .login-submit { min-height: 46px; padding-block: 9px; }
  .login-tools { margin-top: 7px; }
  .login-tools .fontscale button { min-height: 34px; }
  footer[data-csp-style="s075"] { margin-top: 7px !important; }
}

@media (max-width: 460px) {
  body.auth-shell { padding-inline: 10px; }
  .auth-card { border-radius: 13px; padding: 22px 18px; }
  .role-option { padding-inline: 8px; }
  .role-option-desc { font-size: .68rem; }
}

@media (prefers-reduced-motion: reduce) {
  .role-option { transition: none; }
}
