* {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Yu Gothic UI", "Yu Gothic", "Meiryo", sans-serif;
  box-sizing: border-box;
}

body {
  background: #f0f4f8;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ========== ヘッダー（メイン画面に合わせる） ========== */
.header {
  height: 40px;
  background: #0BABE5;
  color: #fff;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
}

.header-title {
  font-size: 16px;
  font-weight: bold;
  margin-right: auto;
}

.header-links {
  display: flex;
  gap: 8px;
}

.header a {
  color: #0BABE5;
  font-size: 12px;
  text-decoration: none;
  background: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #0BABE5;
}

.header a:hover {
  background: #e6f6fc;
}

/* ========== ログイン画面 ========== */
.login-container {
  max-width: 480px;
  margin: 60px auto;
  padding: 0;
  box-sizing: border-box;
}

.login-card {
  background: #fff;
  border-radius: 10px;
  padding: 40px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.login-title {
  font-size: 20px;
  color: #333;
  margin: 0 0 32px;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  padding: 12px;
  font-size: 15px;
}

.login-card .button-primary--block {
  padding: 14px;
  font-size: 15px;
}

@media (max-width: 768px) {
  .login-container {
    margin: 20px;
    padding: 0;
  }

  .login-card {
    padding: 24px 20px;
  }

  .login-title {
    font-size: 18px;
    margin: 0 0 24px;
  }
}

/* ========== コンテナ ========== */
.page-container {
  max-width: 480px;
  margin: 40px auto;
  padding: 0 16px;
}

.page-container--wide {
  max-width: 100%;
  margin: 32px 40px;
  padding: 0;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  max-width: 100%;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

h1 {
  font-size: 18px;
  color: #333;
  margin: 0 0 20px;
}

/* ========== フォーム ========== */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 6px;
  font-weight: bold;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

input:focus {
  outline: none;
  border-color: #0BABE5;
}

/* ========== ボタン（メイン画面の .header-button に合わせる） ========== */
.button-primary {
  display: inline-block;
  padding: 7px 16px;
  background: #0BABE5;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}

.button-primary:hover {
  background: #099fd4;
}

.button-primary--block {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  text-align: center;
}

.dialog-cancel-btn {
  padding: 7px 16px;
  background: #f5f5f5;
  color: #555;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.dialog-cancel-btn:hover {
  background: #ebebeb;
}

/* ========== アラート ========== */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: #fff0f0;
  color: #cc0000;
  border: 1px solid #ffcccc;
}

.alert-success {
  background: #f0fff4;
  color: #007700;
  border: 1px solid #ccffcc;
}

.links {
  margin-top: 16px;
  text-align: center;
}

.links a {
  color: #0BABE5;
  font-size: 13px;
  text-decoration: none;
}

/* ========== テーブル ========== */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 8px 12px;
  text-align: left;
  font-size: 12px;
  color: #999;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-bottom: 1.5px solid #e8e8e8;
}

td {
  padding: 12px 12px;
  font-size: 14px;
  color: #333;
  border-bottom: 1px solid #f2f2f2;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: #fafafa;
}

/* ========== アバター ========== */
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e6f6fc;
  color: #0BABE5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-id-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== バッジ ========== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-admin {
  background: #e6f6fc;
  color: #0BABE5;
}

.badge-user {
  color: #888;
}

/* ========== 権限変更 ========== */
.authority-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.authority-select {
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  color: #333;
  background: #fafafa;
  cursor: pointer;
}

.authority-change-btn {
  padding: 5px 12px;
  background: #0BABE5;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.authority-change-btn:hover {
  background: #099fd4;
}

.authority-message {
  font-size: 12px;
}

.authority-message--success { color: #007700; }
.authority-message--error   { color: #cc0000; }

/* ========== 停止中ユーザー ========== */
.user-suspended td {
  background: #fff5f5;
}

.badge-suspended {
  color: #cc0000;
  font-size: 12px;
  font-weight: 600;
}

.badge-active {
  color: #0BABE5;
  font-size: 12px;
  font-weight: 600;
}

.user-restore-btn {
  padding: 5px 12px;
  background: #cc0000;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.user-restore-btn:hover {
  background: #a00000;
}

.user-reset-btn {
  padding: 5px 12px;
  background: #fff;
  color: #888;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.user-reset-btn:hover {
  background: #f5f5f5;
}

.user-force-logout-btn {
  padding: 5px 12px;
  background: #fff;
  color: #cc6600;
  border: 1px solid #ffddaa;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.user-force-logout-btn:hover {
  background: #fff8f0;
}

/* ========== ユーザー削除 ========== */
.user-delete-btn {
  padding: 5px 12px;
  background: #fff;
  color: #cc0000;
  border: 1px solid #ffcccc;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.user-delete-btn:hover {
  background: #fff0f0;
}

.user-delete-confirm-btn {
  padding: 8px 16px;
  background: #cc0000;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.user-delete-confirm-btn:hover {
  background: #a00000;
}

/* ========== トースト ========== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.toast-error { background: #cc0000; }

/* ========== ダイアログ（メイン画面に合わせる） ========== */
dialog {
  border: none;
  border-radius: 10px;
  padding: 0;
  width: 300px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  position: fixed !important;
  top: 60px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  margin: 0 !important;
}

dialog::backdrop {
  background: rgba(0,0,0,0.4);
}

#invite-dialog { width: min(90vw, 400px); }
#confirm-dialog { width: min(90vw, 360px); }
#delete-dialog { width: min(90vw, 360px); }
#invite-confirm-dialog { width: min(90vw, 360px); }

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
}

.dialog-header span {
  font-size: 14px;
  font-weight: 600;
  color: #222;
}

.dialog-header button {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #666;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
}

.dialog-header button:hover {
  color: #333;
}

.dialog-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialog-content input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.dialog-content input[type="email"]:focus {
  outline: none;
  border-color: #0BABE5;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #eee;
}

/* ========== 登録完了ダイアログ ========== */
.completion-dialog {
  background: #fff;
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  max-width: 320px;
  width: 100%;
}

.sub-label {
  font-size: 13px;
  color: #888;
  margin: 0 0 24px;
}

/* ========== レスポンシブ ========== */
@media (max-width: 768px) {
  .page-container--wide {
    margin: 16px auto;
    padding: 0 8px;
  }

  .card {
    padding: 16px 12px;
    border-radius: 8px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  th, td {
    padding: 10px 8px;
    font-size: 13px;
    white-space: nowrap;
  }

  .authority-select {
    max-width: 80px;
  }
}