/* ===== 共通トークン（kpipoint等の既存システムと統一） ===== */
:root {
  --brand-red: #e60012;
  --bg-main: #0d0d1a;
  --bg-dark: #1a1a2e;
  --bg-card: #1a1a2e;
  --bg-input: #0f1f3d;
  --border: #0f3460;
  --green: #00b894;
  --yellow: #fdcb6e;
  --orange: #fd7f6f;
  --text-main: #eaeaea;
  --text-sub: #a0a0b0;
  --shadow: 0 4px 16px rgba(0,0,0,0.4);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  font-size: 15px;
  min-height: 100vh;
}
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
}

/* ===== ヘッダー ===== */
.brand-header {
  text-align: center;
  margin-bottom: 28px;
}
.brand-header .brand-name {
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-sub);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.brand-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-red);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--brand-red);
}
.app-header h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-red);
}
.app-header .user-chip {
  font-size: 12px;
  color: var(--text-sub);
  text-align: right;
  line-height: 1.5;
}
.app-header .user-chip strong {
  color: var(--text-main);
  font-size: 13px;
}

/* ===== カード ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-red);
  margin-bottom: 14px;
}
.card-sub {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 14px;
  line-height: 1.6;
}

/* ===== フォーム ===== */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
}
.field input[type=text],
.field input[type=password],
.field input[type=tel],
.field input[type=number] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 16px;
  padding: 11px 12px;
}
.field input:focus { outline: none; border-color: var(--brand-red); }
.field-hint { font-size: 11px; color: var(--text-sub); margin-top: 5px; }

.staff-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.staff-code-prefix {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--yellow);
  white-space: nowrap;
}
.staff-code-row input { flex: 1; letter-spacing: 2px; }

.row2 { display: flex; gap: 10px; }
.row2 .field { flex: 1; }

/* ===== ボタン ===== */
.btn {
  display: inline-block;
  background: var(--brand-red);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.btn:active { opacity: 0.7; }
.btn-full { width: 100%; }
.btn-green { background: var(--green); }
.btn-gray { background: #3a3a4a; }
.btn-outline {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-main);
}
.btn-small { padding: 7px 12px; font-size: 12px; }
.btn-danger { background: var(--orange); color: #2a1a1a; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.link-row { text-align: center; margin-top: 16px; font-size: 13px; }
.link-row a { color: var(--text-sub); text-decoration: underline; }

/* ===== メッセージ ===== */
.msg {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
  line-height: 1.6;
}
.msg.error { background: rgba(253,127,111,0.15); border: 1px solid var(--orange); color: var(--orange); display: block; }
.msg.success { background: rgba(0,184,148,0.12); border: 1px solid var(--green); color: var(--green); display: block; }

/* ===== システム一覧（マイページ） ===== */
.system-list { display: flex; flex-direction: column; gap: 10px; }
.system-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-decoration: none;
  color: var(--text-main);
}
.system-item .name { font-size: 14px; font-weight: 700; }
.system-item .desc { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.system-item .arrow { color: var(--text-sub); font-size: 16px; }
.system-item.disabled { opacity: 0.4; }

/* ===== ユーザー一覧（管理画面） ===== */
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-row {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.user-row .main-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.user-row .code { font-size: 13px; font-weight: 700; color: var(--yellow); }
.user-row .name { font-size: 14px; font-weight: 700; margin-left: 6px; }
.user-row .meta { font-size: 11px; color: var(--text-sub); }
.user-row .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.status-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}
.status-tag.pending { background: rgba(253,203,110,0.18); color: var(--yellow); }
.status-tag.approved { background: rgba(0,184,148,0.18); color: var(--green); }
.status-tag.locked { background: rgba(253,127,111,0.18); color: var(--orange); }
.status-tag.admin { background: rgba(230,0,18,0.18); color: var(--brand-red); }

.section-title {
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 700;
  margin: 18px 0 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ===== ログ ===== */
.log-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; }
.log-row {
  font-size: 11px;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  line-height: 1.6;
}
.log-row .log-time { color: var(--text-sub); }
.log-row .log-action { color: var(--text-main); font-weight: 700; }

/* ===== トースト ===== */
#toast {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #2a2a3a;
  color: #fff;
  padding: 11px 20px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 999;
  max-width: 90%;
  text-align: center;
}

/* ===== モーダル風の一時表示（仮パスワード表示など） ===== */
.reveal-box {
  background: var(--bg-input);
  border: 1px dashed var(--green);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
  font-size: 13px;
  text-align: center;
}
.reveal-box .value {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--green);
  margin: 6px 0;
}

.text-center { text-align: center; }
.empty-state { text-align: center; color: var(--text-sub); font-size: 13px; padding: 20px 0; }

/* ===== ライトモード ===== */
html[data-theme="light"] {
  --brand-red: #cc0010;
  --bg-main: #f0f2f5;
  --bg-dark: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #e8eaed;
  --border: #d0d5dd;
  --green: #00916e;
  --yellow: #b07800;
  --orange: #c0392b;
  --text-main: #1a1a2e;
  --text-sub: #555566;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
}
html[data-theme="light"] body { background: var(--bg-main); }
html[data-theme="light"] .card,
html[data-theme="light"] .app-header { background: var(--bg-card); }
html[data-theme="light"] input[type=text],
html[data-theme="light"] input[type=password],
html[data-theme="light"] input[type=tel],
html[data-theme="light"] input[type=number] {
  background: var(--bg-input);
  color: var(--text-main);
  -webkit-text-fill-color: var(--text-main);
}
html[data-theme="light"] .system-item { background: var(--bg-input); color: var(--text-main); }
html[data-theme="light"] .btn.btn-gray { background: #ccc; color: #333; }
html[data-theme="light"] .btn.btn-outline { border-color: var(--border); color: var(--text-main); }