/* 認証まわりの追加スタイル（login.html と index.html から読み込む）。色・角丸・字体は styles.css に合わせる。 */

/* ---- ログイン画面 ---- */
body.auth-page { min-height: 100vh; }
.auth-shell { margin: 0; max-width: none; min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 56px 16px 40px; }
.auth-card { width: 100%; max-width: 420px; background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 32px 30px 28px; box-shadow: 0 18px 60px #10233014; }
.auth-brand { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; font-size: 13px; font-weight: 700; color: var(--ink); }
.auth-brand img { max-width: 140px; max-height: 58px; object-fit: contain; object-position: left; }
.auth-card h1 { font-size: 22px; margin: 0 0 8px; }
.auth-lead { margin: 0 0 18px; font-size: 13px; }
.auth-form { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.auth-form label { margin: 8px 0 0; }
.auth-wide { width: 100%; margin-top: 14px; padding: 12px 17px; }
.auth-code { font-size: 22px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.auth-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.auth-codes { width: 100%; min-height: 230px; font-size: 15px; line-height: 1.75; text-align: center; resize: none; background: #fafbfb; margin: 6px 0 4px; }
.auth-error { border: 1px solid #ecc7bd; background: #fdf3f0; color: #a3482f; border-radius: 6px; padding: 9px 12px; font-size: 12px; margin: 10px 0 0; white-space: pre-line; }
.auth-status { font-size: 12px; color: var(--muted); margin: 8px 0; }
.auth-warning { border: 1px solid #f0d7be; background: #fff9f1; border-radius: 6px; padding: 10px 14px; font-size: 12px; color: #9b6836; }
.auth-details { margin: 18px 0 4px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.auth-details > summary { font-weight: 600; color: var(--ink); list-style: none; display: flex; gap: 6px; }
.auth-details > summary::-webkit-details-marker { display: none; }
.auth-details > summary::before { content: '▸'; flex: none; }
.auth-details[open] > summary::before { content: '▾'; }
.auth-details label { margin-top: 12px; }
.auth-center { text-align: center; margin: 18px 0 0; }
.auth-link { border: 0; background: none; padding: 4px; color: #64737c; text-decoration: underline; text-underline-offset: 4px; font-weight: 500; font-size: 12px; }
.auth-link:hover { background: none; color: var(--ink); }
.auth-button-link { display: block; text-align: center; margin-top: 16px; background: var(--ink); color: #fff; border-radius: 7px; padding: 12px 17px; font-weight: 600; text-decoration: none; }
.auth-qr { display: flex; justify-content: center; margin: 4px 0 6px; }
.auth-qr img { width: 240px; height: 240px; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 8px; }
.auth-copy-row { display: flex; gap: 8px; align-items: center; }
.auth-copy-row input { flex: 1; min-width: 0; }
.auth-copy-row .auth-status { margin: 0; }
.auth-page [hidden], .auth-user[hidden], .auth-open-notice[hidden], .auth-error[hidden] { display: none !important; }

/* ---- アプリ側: サイドバーの利用者表示・open モードの帯 ---- */
.auth-user { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); max-width: 170px; }
.auth-user-name { font-size: 12px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.auth-role { font-size: 10px; background: #f0f3f3; color: #5f707a; border-radius: 20px; padding: 2px 8px; }
.auth-logout { width: 100%; margin-top: 4px; }
.auth-open-notice { margin-bottom: 18px; }

/* ---- 利用者管理・セキュリティのダイアログ ---- */
.users-dialog { width: min(980px, 94vw); }
.users-table-wrap { overflow-x: auto; }
.users-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.users-table th { text-align: left; font-size: 10px; letter-spacing: 1px; color: #89949b; font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.users-table td { padding: 10px 8px; border-bottom: 1px solid #edf0f1; vertical-align: top; }
.users-table td small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.users-table select { font-size: 12px; padding: 6px 8px; min-width: 88px; }
.users-stopped td { color: #9aa4ab; }
.users-self { font-size: 10px; background: #edf5ef; color: #4a7b5a; border-radius: 20px; padding: 1px 7px; margin-left: 6px; }
.users-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.users-actions .delete { border: 1px solid #ecd6d0; }
.users-add { margin: 0 0 18px; }
.users-add summary { font-weight: 600; color: var(--ink); font-size: 13px; }
.users-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; margin-top: 12px; }
.users-panel { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 0 0 18px; background: #fbfcfc; }
.users-panel h3 { margin-bottom: 4px; }
.users-panel .actions { margin-top: 10px; }
.users-revealed code { font-size: 14px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.tfa-scope { border: 0; padding: 0; margin: 8px 0 4px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.tfa-scope legend { font-size: 11px; font-weight: 600; color: #7b8790; padding: 0; margin-bottom: 6px; }
.tfa-scope-option { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; }
.tfa-scope-option input { width: 16px; height: 16px; accent-color: var(--ink); }
.tfa-note { font-size: 11px; margin: 10px 0 0; }
.security-section { padding: 4px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.security-section:last-child { border-bottom: 0; margin-bottom: 0; }
.security-section .actions { margin-top: 6px; }

/* ---- 閲覧（reports.write なし）: 書き込みの操作を出さない。サーバーが正本で、ここは見える範囲を減らすだけ ---- */
body.auth-read-only :is(#newReport, #emptyNew, #createCompletion, #blankItem, #dropzone, #detectSurfaces,
  [data-remove], [data-add-photo], [data-ai], [data-ai-mode], .ai-edit-menu, [data-register], [data-undo], [data-phrase], [data-use],
  [data-remove-photo], [data-rec-remove], [data-material-add], [data-material-show-all], [data-apply-proposal], [data-show-ai-proposal],
  [data-discard-proposal], [data-lock-category], [data-refresh-job], [data-copy-request], [data-auto-resume], [data-auto-stop],
  [data-auto-resolve], [data-auto-file], [data-completion-pick], [data-completion-drop], [data-completion-remove], [data-completion-copy],
  [data-diagram-copy], [data-diagram-remove], [data-diagram-replace]) { display: none !important; }

/* ---- カタログ編集（catalog.write なし）: 材料・工法／文例の登録・編集を出さない ---- */
body.auth-no-catalog :is(#materialNew, #materialOrder, [data-edit-material], #newPhrase, [data-edit-phrase], [data-register]) { display: none !important; }

/* ---- スマホ（styles.css は 780px 以下でサイドバー下部を隠すので、利用者表示だけ出す） ---- */
@media (max-width: 780px) {
  aside { height: auto; min-height: 76px; flex-wrap: wrap; row-gap: 6px; }
  .side-bottom { display: block; position: static; font-size: 0; margin-left: auto; }
  .side-bottom > :not(.auth-user) { display: none; }
  .auth-user { font-size: 11px; max-width: none; margin: 0; padding: 0; border: 0; flex-wrap: nowrap; }
  .auth-logout { width: auto; margin: 0; padding: 6px 10px; font-size: 11px; }
  .auth-open-notice { margin-bottom: 14px; }
}
@media (max-width: 420px) {
  .auth-shell { padding: 24px 16px; }
  .auth-card { padding: 24px 18px 20px; }
  .auth-code { font-size: 20px; letter-spacing: .25em; }
  .auth-user-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .users-form { grid-template-columns: 1fr; }
}
