/* 共通ログイン基盤（最小実装）— ログイン / 403 / ログアウト */

:root {
    --auth-bg: #f4f7f5;
    --auth-card: #ffffff;
    --auth-text: #1a2b1f;
    --auth-muted: #4a5d51;
    --auth-accent: #0d6f4c;
    --auth-accent-hover: #0a5a3e;
    --auth-error: #9b1c1c;
    --auth-banner: #6a4c0c;
    --auth-border: #d5e0d8;
    --auth-radius: 10px;
    --auth-shadow: 0 8px 24px rgba(13, 111, 76, 0.08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.auth-body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    color: var(--auth-text);
    background: radial-gradient(circle at 20% 20%, #e8f5ef 0, var(--auth-bg) 45%, #e4ece7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-card {
    width: min(440px, 100%);
    background: var(--auth-card);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    padding: 28px 26px 22px;
}

.auth-title {
    margin: 0 0 10px;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.auth-lead {
    margin: 0 0 18px;
    color: var(--auth-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}

.auth-banner {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff7e6;
    border: 1px solid #f0d9a8;
    color: var(--auth-banner);
    font-size: 0.9rem;
}

.auth-error {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fdecec;
    border: 1px solid #f5c2c2;
    color: var(--auth-error);
    font-size: 0.9rem;
}

.auth-diag {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f0f4f2;
    border: 1px solid var(--auth-border);
    font-size: 0.82rem;
    color: var(--auth-muted);
}

.auth-diag__title {
    margin: 0 0 8px;
    font-weight: 700;
    color: var(--auth-text);
}

.auth-diag__list {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
}

.auth-diag__list dt {
    margin: 0;
    font-weight: 600;
}

.auth-diag__list dd {
    margin: 0;
    word-break: break-all;
}

.auth-diag__list code {
    font-size: 0.78rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--auth-muted);
    margin-top: 6px;
}

.auth-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--auth-border);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input:focus {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px rgba(13, 111, 76, 0.15);
}

.auth-password-wrap {
    position: relative;
    width: 100%;
}

.auth-input--password {
    padding-right: 44px;
}

.auth-password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.auth-password-toggle:hover {
    color: var(--auth-accent);
    background: rgba(13, 111, 76, 0.08);
}

.auth-password-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(13, 111, 76, 0.35);
}

.auth-password-toggle:focus:not(:focus-visible) {
    box-shadow: none;
}

.auth-password-toggle:focus-visible {
    box-shadow: 0 0 0 2px rgba(13, 111, 76, 0.35);
}

.auth-password-toggle__icon {
    display: block;
    line-height: 0;
}

.auth-password-toggle__show,
.auth-password-toggle__hide {
    display: block;
}

.auth-password-toggle__hide {
    display: none;
}

.auth-password-toggle[aria-pressed="true"] .auth-password-toggle__show {
    display: none;
}

.auth-password-toggle[aria-pressed="true"] .auth-password-toggle__hide {
    display: block;
}

.auth-remember {
    margin-top: 10px;
}

.auth-remember__label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--auth-text);
    cursor: pointer;
    line-height: 1.45;
}

.auth-remember__checkbox {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0.15rem 0 0;
    flex-shrink: 0;
    accent-color: var(--auth-accent);
    cursor: pointer;
}

.auth-remember__hint {
    margin: 0.35rem 0 0 1.55rem;
    font-size: 0.78rem;
    color: var(--auth-muted);
    line-height: 1.45;
}

.auth-button {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 14px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--auth-accent), #0a8f5f);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.05s ease, filter 0.15s ease;
}

.auth-button:hover {
    filter: brightness(1.05);
}

.auth-button:active {
    transform: translateY(1px);
}

.auth-button--link {
    text-align: center;
}

.auth-button--secondary {
    background: #fff;
    color: var(--auth-accent);
    border: 2px solid var(--auth-accent);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.auth-button--secondary:hover {
    filter: none;
    background: rgba(13, 111, 76, 0.07);
}

/* 関連ページナビ（テキストリンクではなくボタン横並び） */
.auth-nav-actions {
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    justify-content: center;
    align-items: stretch;
}

.auth-nav-actions--after-title {
    margin-top: 4px;
    margin-bottom: 14px;
    justify-content: flex-start;
}

.auth-nav-actions--tight-top {
    margin-top: 0.5rem;
}

.auth-body--admin-wide .auth-card--wide .auth-nav-actions:not(.auth-nav-actions--after-title) {
    justify-content: flex-start;
}

.auth-nav-actions .auth-button {
    margin-top: 0;
    width: auto;
    min-width: 10.5rem;
    flex: 1 1 calc(50% - 6px);
    max-width: 100%;
}

@media (min-width: 520px) {
    .auth-nav-actions .auth-button {
        flex: 0 1 auto;
    }
}

.auth-actions {
    margin: 10px 0 0;
}

.auth-foot {
    margin: 18px 0 0;
    font-size: 0.9rem;
    text-align: center;
}

.auth-foot a {
    color: var(--auth-accent);
    font-weight: 600;
    text-decoration: none;
}

.auth-foot a:hover {
    text-decoration: underline;
    color: var(--auth-accent-hover);
}

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

/* 登録済み写真ファイル名（クリックで調整画面） */
.auth-avatar-existing {
    margin: 0.4rem 0 0;
    font-size: 0.92rem;
    line-height: 1.5;
}

.auth-avatar-existing__link {
    display: inline;
    padding: 0;
    margin: 0 0 0 0.35rem;
    border: none;
    background: none;
    color: var(--auth-accent);
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}

.auth-avatar-existing__link:hover {
    color: var(--auth-accent-hover);
}

.auth-avatar-existing__link:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* 顔写真：円トリミング調整 */
.auth-avatar-editor {
    margin-top: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    background: #fafcfb;
}

.auth-avatar-editor__stage {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0;
}

#auth_avatar_editor_canvas {
    display: block;
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    cursor: grab;
    touch-action: none;
    max-width: 100%;
    height: auto;
}

#auth_avatar_editor_canvas:active {
    cursor: grabbing;
}

.auth-avatar-editor__controls {
    margin-top: 0.75rem;
}

.auth-avatar-editor__zoom {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--auth-text);
}

.auth-avatar-editor__zoom input[type="range"] {
    width: 100%;
    max-width: 20rem;
}

.auth-avatar-editor__pan {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.35rem;
    margin-top: 0.75rem;
    max-width: 12rem;
    margin-left: auto;
    margin-right: auto;
}

.auth-avatar-editor__panbtn {
    padding: 0.4rem 0.35rem;
    border: 1px solid var(--auth-border);
    border-radius: 6px;
    background: #fff;
    font-size: 1rem;
    cursor: pointer;
    color: var(--auth-text);
}

.auth-avatar-editor__panbtn:hover {
    background: rgba(13, 111, 76, 0.08);
}

/* 管理者：一覧・編集（モバイル縦以外は幅広） */
@media (min-width: 600px) {
    .auth-body.auth-body--admin-wide {
        align-items: flex-start;
        padding: 32px 20px 40px;
    }

    .auth-card.auth-card--wide {
        width: min(1100px, 96vw);
        max-width: 1100px;
        margin: 0 auto;
    }
}

.auth-fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 1.15rem;
}

.auth-hint {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--auth-muted);
    line-height: 1.5;
}

.auth-hint a {
    color: var(--auth-accent);
    font-weight: 600;
}

.auth-radio {
    display: block;
    margin: 0.35rem 0;
    font-size: 0.95rem;
}

.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    margin: 0.25rem 0;
    font-size: 0.88rem;
    line-height: 1.35;
}

.auth-committee-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.15rem 0.75rem;
    margin-top: 0.35rem;
}

@media (min-width: 600px) {
    .auth-committee-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .auth-committee-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.auth-table-wrap {
    overflow-x: auto;
    margin-top: 1rem;
}

.auth-table--wide {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.auth-table--wide th,
.auth-table--wide td {
    padding: 0.45rem 0.4rem;
    border-bottom: 1px solid var(--auth-border);
    text-align: left;
    vertical-align: top;
}

.auth-table--wide th {
    font-weight: 700;
    white-space: nowrap;
}

.auth-table__multiline {
    max-width: 14rem;
    white-space: normal;
    word-break: break-word;
}

/* メンバー一覧（写真列） */
.auth-table--members .auth-table__th-photo,
.auth-table--members .auth-table__td-photo {
    width: 4.5rem;
    vertical-align: middle;
    text-align: center;
}

.auth-member-photo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: #e8f0eb;
    color: var(--auth-muted);
}

.auth-member-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.auth-member-photo--empty svg {
    display: block;
    opacity: 0.55;
}
