* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: #f4f6f8;
  color: #1f2937;
  font-size: 15px;
  line-height: 1.6;
}

.hidden { display: none !important; }
.error { color: #dc2626; margin-top: 8px; min-height: 1.2em; }
.muted { color: #6b7280; font-size: 13px; }

/* ---- ボタン ---- */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #1f2937;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:hover { background: #f3f4f6; }
.btn.primary { background: #1a56db; border-color: #1a56db; color: #fff; }
.btn.primary:hover { background: #1648b8; }
.btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; font-weight: 600; }
.btn.danger:hover { background: #b91c1c; }
.btn.ghost { background: transparent; border-color: #d1d5db; color: #4b5563; }
.btn.small { padding: 3px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }

/* ---- ログイン ---- */
#login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-box {
  background: #fff;
  padding: 40px 36px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .08);
  width: min(380px, 90vw);
  text-align: center;
}
.login-box h1 { font-size: 20px; margin-bottom: 24px; color: #111827; }
.login-box input { margin-bottom: 12px; }
.login-box .btn { width: 100%; }

/* ---- ヘッダー ---- */
header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  flex-wrap: wrap;
}
header h1 { font-size: 16px; color: #111827; padding: 14px 0; }
header nav { display: flex; gap: 4px; flex: 1; }
.tab {
  background: none;
  border: none;
  padding: 16px 14px;
  font-size: 14px;
  color: #4b5563;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.tab:hover { color: #1a56db; }
.tab.active { color: #1a56db; font-weight: 600; border-bottom-color: #1a56db; }
#logout-btn { margin: 8px 0; }

/* ---- メイン ---- */
main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}
.panel p { margin-bottom: 12px; }

/* ---- フォーム ---- */
input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid #93b4f5;
  border-color: #1a56db;
}
label { display: block; margin-bottom: 12px; font-size: 13px; color: #374151; }
label input, label textarea, label select { margin-top: 4px; }
#import-file { margin-bottom: 10px; }
#import-paste { font-size: 13px; }
.toolbar select { width: auto; min-width: 260px; }

/* ---- テーブル ---- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  background: #f9fafb;
  color: #4b5563;
  font-size: 12px;
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}
td { padding: 9px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td .btn { margin-right: 4px; }
tr.invalid { background: #fef2f2; }
td input[type="text"] { min-width: 120px; }

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-badge.unsent { background: #dbeafe; color: #1e40af; }
.status-badge.sent { background: #e5e7eb; color: #4b5563; }
.status-badge.ok { background: #d1fae5; color: #065f46; }
.status-badge.ng { background: #fee2e2; color: #991b1b; }

/* ---- 送信実行 ---- */
#send-preview h2 { font-size: 16px; margin-bottom: 12px; }
#send-preview .count { font-size: 28px; font-weight: 700; color: #1a56db; }
#send-progress .bar-outer {
  background: #e5e7eb;
  border-radius: 999px;
  height: 12px;
  margin: 12px 0;
  overflow: hidden;
}
#send-progress .bar-inner {
  background: #1a56db;
  height: 100%;
  width: 0;
  transition: width .5s;
}

@media (max-width: 640px) {
  header { padding: 0 12px; gap: 8px; }
  header nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .tab { padding: 12px 10px; white-space: nowrap; }
  main { padding: 16px 8px 48px; }
}
