@charset "UTF-8";
@import url('https://fonts.googleapis.com/css2?family=M+PLUS+1p:wght@400;500;600;700&display=swap');

/*
  Base Style
*/

body {
  font-family: "M PLUS 1p", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f4f6;
  color: #111827;
  margin: 0;
}

/* =========================
   ログインページ
   ========================= */

body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* 背景のグラデーション＋模様（最近風） */
.login-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 55%),
    radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.18), transparent 55%),
    #0f172a;
  z-index: -1;
}

/* ログインカード */
.login-container {
  width: 340px;
  max-width: calc(100% - 32px);
  background: #f9fafb;
  border-radius: 18px;
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.45),
    0 0 0 1px rgba(148, 163, 184, 0.25);
  padding: 22px 22px 18px;
}

/* ヘッダー部分 */
.login-header {
  margin-bottom: 18px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.logo-mark {
  width: auto;
  height: 26px;
  padding:0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #22c55e);
  color: #f9fafb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.logo-text {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4b5563;
}

.login-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
  color: #111827;
}

.login-subtitle {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
}

/* フォーム */

.login-form {
  margin-top: 8px;
}

.field {
  margin-bottom: 12px;
}

label {
  font-size: 12px;
  display: block;
  margin-bottom: 4px;
  color: #4b5563;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  box-sizing: border-box;
  font-size: 14px;
  background: #f9fafb;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
  background: #ffffff;
}

/* エラー表示 */

.errors {
  background: #fef2f2;
  color: #b91c1c;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  margin-bottom: 10px;
  border: 1px solid #fecaca;
}

.errors ul {
  padding-left: 16px;
  margin: 0;
}

/* ボタン */

.btn-primary {
  width: 100%;
  margin-top: 4px;
  padding: 9px 0;
  font-size: 14px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #f9fafb;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition:
    transform 0.07s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.45);
}

.btn-primary:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 7px 18px rgba(37, 99, 235, 0.45);
}

/* フッターテキスト */

.login-footnote {
  margin-top: 10px;
  font-size: 11px;
  text-align: center;
  color: #9ca3af;
}

/* =========================
   ダッシュボードレイアウト
   ========================= */

body.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 上部ヘッダー */

.app-header {
  background: #0f172a;
  color: #f9fafb;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.4);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
}

.app-user {
  opacity: 0.8;
}

.nav-link {
  color: #e5e7eb;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.nav-link:hover {
  background: rgba(148, 163, 184, 0.3);
  border-color: rgba(148, 163, 184, 0.7);
}

.nav-link--logout {
  background: #ef4444;
  border-color: #ef4444;
  color: #f9fafb;
}

.nav-link--logout:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* シェル */

.app-shell {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* サイドバー */

.sidebar {
  width: 220px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  padding: 16px 12px;
  box-shadow: 4px 0 12px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 6px;
  padding: 0 8px;
}

.sidebar-link {
  display: block;
  padding: 8px 10px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 13px;
  color: #374151;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.07s ease;
}

.sidebar-link:hover {
  background: #e5f0ff;
  color: #1d4ed8;
  transform: translateX(2px);
}

.sidebar-link.is-active {
  background: #2563eb;
  color: #ffffff;
}

/* メイン */

.app-main {
  flex: 1;
  padding: 24px 32px;
  min-width: 0;
}

.card {
  background: #ffffff;
  padding: 18px 20px;
  border-radius: 14px;
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(226, 232, 240, 0.6);
  max-width: 880px;
}

.card-title {
  font-size: 22px;
  margin: 0 0 8px;
  font-weight: 600;
}

/* =========================
   レスポンシブ
   ========================= */

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px 12px;
  }

  .sidebar-title {
    display: none;
  }

  .sidebar-link {
    white-space: nowrap;
    margin-right: 8px;
  }

  .app-main {
    padding: 16px;
  }

  .app-header {
    padding: 8px 12px;
  }

  .app-nav {
    gap: 8px;
    font-size: 11px;
  }

  .app-user {
    display: none; /* モバイルではユーザー名を隠してスッキリさせる */
  }
}

/* =========================
   ユーザー管理ページ
   ========================= */

.user-page-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 24px;
  align-items: flex-start;
}

.user-form-title {
  font-size: 16px;
  margin: 0 0 10px;
  font-weight: 600;
}

.user-form-body {
  margin-top: 4px;
}

.form-row {
  margin-bottom: 10px;
}

.form-row label {
  font-size: 12px;
  color: #4b5563;
  display: block;
  margin-bottom: 4px;
}

.form-row input,
.form-row select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  box-sizing: border-box;
  font-size: 13px;
  background: #f9fafb;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
  background: #ffffff;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* メッセージ */

.message {
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 10px;
}

.message ul {
  margin: 0;
  padding-left: 18px;
}

.message--success {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.message--error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* ボタン（小さめ用） */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  background: #e5e7eb;
  color: #111827;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.05s ease;
}

.btn:hover {
  background: #d1d5db;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #e5e7eb;
  border-color: #e5e7eb;
}

.btn-outline {
  background: transparent;
  border-color: #d1d5db;
}

.btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #f9fafb;
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

.table-actions {
  white-space: nowrap;
}

/* タグ（権限表示） */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.tag-admin {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.tag-user {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

/* テーブル */

.table-wrapper {
  width: 100%;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
}

.table-users {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.table-users th,
.table-users td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.table-users th {
  text-align: left;
  font-weight: 600;
  background: #f9fafb;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-users tbody tr:nth-child(odd) {
  background: #f9fafb;
}

.table-users tbody tr:hover {
  background: #eff6ff;
}

/* テーブルツールバー */

.table-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.table-search input {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  min-width: 210px;
}

.table-search input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
  background: #ffffff;
}

/* ソート可能ヘッダー */

.th-sortable {
  cursor: pointer;
  position: relative;
  padding-right: 16px;
}

.th-sortable::after {
  content: '⇅';
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: #9ca3af;
}

.th-sortable[data-sort-dir="asc"]::after {
  content: '▲';
}

.th-sortable[data-sort-dir="desc"]::after {
  content: '▼';
}

/* レスポンシブ調整 */

@media (max-width: 900px) {
  .user-page-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
}
