/* ===== リセット・基本 ===== */
* {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "メイリオ", Meiryo, "MS ゴシック", sans-serif;
  font-size: 13px;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}

/* ===== ログイン画面 ===== */
.login-wrapper {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a3a5c 0%, #2d6a9f 100%);
}

.login-card {
  background: #fff;
  border-radius: 8px;
  padding: 40px 48px;
  width: 380px;
  -webkit-box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

.login-title {
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  color: #1a3a5c;
  margin-bottom: 8px;
}

.login-sub {
  text-align: center;
  font-size: 12px;
  color: #888;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: #555;
  margin-bottom: 6px;
  font-weight: bold;
}

.form-group input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  -webkit-transition: border-color 0.2s;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #2d6a9f;
}

.btn-login {
  width: 100%;
  padding: 10px;
  background: #2d6a9f;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 8px;
  font-family: inherit;
  -webkit-transition: background 0.2s;
  transition: background 0.2s;
}

.btn-login:hover {
  background: #1a3a5c;
}

.login-error {
  color: #d32f2f;
  font-size: 12px;
  text-align: center;
  margin-top: 10px;
  display: none;
}

/* ===== メイン画面ヘッダー ===== */
.app-header {
  background: #1a3a5c;
  color: #fff;
  padding: 0 20px;
  height: 52px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -webkit-box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
}

.app-title {
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 0.03em;
}

.header-right {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 10px;
  position: relative;
}

.last-updated {
  font-size: 11px;
  color: #aac8e8;
}

.btn-refresh {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.5);
  color: #fff;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  -webkit-transition: background 0.2s;
  transition: background 0.2s;
}

.btn-refresh:hover { background: rgba(255,255,255,0.25); }
.btn-refresh:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== ハンバーガーボタン ===== */
.btn-menu {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.5);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  -webkit-transition: background 0.2s;
  transition: background 0.2s;
}

.btn-menu:hover { background: rgba(255,255,255,0.15); }

/* ===== ドロップダウンメニュー ===== */
.menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border-radius: 8px;
  -webkit-box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  min-width: 280px;
  padding: 16px;
  z-index: 300;
  color: #333;
}

.menu-dropdown.open { display: block; }

.menu-upload-label {
  font-size: 12px;
  font-weight: bold;
  color: #555;
  margin-bottom: 10px;
  display: block;
}

.menu-file-input {
  font-size: 12px;
  font-family: inherit;
  display: block;
  width: 100%;
  margin-bottom: 8px;
}

.btn-upload {
  padding: 6px 16px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  -webkit-transition: background 0.2s;
  transition: background 0.2s;
}

.btn-upload:hover  { background: #047857; }
.btn-upload:disabled { background: #9ca3af; cursor: not-allowed; }

.upload-msg { font-size: 12px; display: block; margin-top: 6px; }
.upload-msg.success { color: #059669; }
.upload-msg.error   { color: #d32f2f; }

.menu-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 12px 0;
}

.menu-logout {
  width: 100%;
  padding: 8px 12px;
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  -webkit-transition: background 0.2s;
  transition: background 0.2s;
}

.menu-logout:hover { background: #fecaca; }

/* ===== メインコンテンツ ===== */
.main-content {
  margin-top: 52px;
  padding: 16px 20px;
  padding-bottom: 30px; /* 固定スクロールバー分の余白 */
}

/* ===== フィルター・検索バー ===== */
.filter-bar {
  background: #fff;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 12px;
  -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 10px;
}

.status-tabs {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  border: 1px solid #ddd;
  border-radius: 5px;
  overflow: hidden;
}

.status-tab {
  padding: 6px 12px;
  font-size: 12px;
  background: #fff;
  border: none;
  border-right: 1px solid #ddd;
  cursor: pointer;
  color: #555;
  font-family: inherit;
  -webkit-transition: background 0.15s;
  transition: background 0.15s;
}

.status-tab:last-child { border-right: none; }
.status-tab.active { background: #2563eb; color: #fff; }
.status-tab:hover:not(.active) { background: #f5f5f5; }

.search-input {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  width: 240px;
  font-family: inherit;
  outline: none;
}

.search-input:focus { border-color: #2563eb; }

.date-label {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
}

.date-input {
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
}

.date-input:focus { border-color: #2563eb; }

.btn-clear {
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
}

.btn-clear:hover { color: #d32f2f; }

.count-label {
  font-size: 12px;
  color: #888;
  margin-left: auto;
}

/* ===== テーブル ===== */
.table-wrapper {
  background: #fff;
  border-radius: 6px;
  -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* テーブル自身のスクロールバーは非表示、固定バーで代替 */
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.table-scroll::-webkit-scrollbar { display: none; }

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1400px;
  font-size: 12px;
}

thead th {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
  color: #374151;
  font-weight: bold;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

thead th:hover { background: #eff6ff; }

thead th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  color: #9ca3af;
  font-style: normal;
}

thead th.sort-asc  .sort-icon::after { content: '▲'; color: #2563eb; }
thead th.sort-desc .sort-icon::after { content: '▼'; color: #2563eb; }
thead th:not(.sort-asc):not(.sort-desc) .sort-icon::after { content: '⇅'; }

tbody tr {
  border-bottom: 1px solid #f0f0f0;
  -webkit-transition: background 0.1s;
  transition: background 0.1s;
}

tbody tr:hover { background: #f0f7ff; }

tbody td {
  padding: 8px 10px;
  white-space: nowrap;
  color: #374151;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ステータスバッジ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
}

.badge-unsolved { background: #fee2e2; color: #b91c1c; }
.badge-solved   { background: #d1fae5; color: #065f46; }
.badge-end      { background: #e5e7eb; color: #374151; }
.badge-na       { background: #fef3c7; color: #92400e; }

/* 解決済み行のグレーアウト */
tbody tr.row-resolved { opacity: 0.45; }
tbody tr.row-resolved:hover { background: #f5f5f5; opacity: 0.55; }

/* ===== ローディング ===== */
.loading-row td { text-align: center; padding: 40px; color: #888; }
.empty-row td   { text-align: center; padding: 40px; color: #bbb; }

/* ===== 固定横スクロールバー（常時表示） ===== */
.scroll-bar-fixed {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  overflow-x: auto;
  overflow-y: hidden;
  height: 16px;
  background: #f1f5f9;
  border-top: 1px solid #e2e8f0;
  -webkit-box-shadow: 0 -1px 4px rgba(0,0,0,0.08);
  box-shadow: 0 -1px 4px rgba(0,0,0,0.08);
}

.scroll-bar-fixed::-webkit-scrollbar        { height: 12px; }
.scroll-bar-fixed::-webkit-scrollbar-track  { background: #f1f5f9; }
.scroll-bar-fixed::-webkit-scrollbar-thumb  { background: #94a3b8; border-radius: 6px; }
.scroll-bar-fixed::-webkit-scrollbar-thumb:hover { background: #64748b; }

#scrollMirrorInner { height: 1px; }

/* ===== ページング ===== */
.pagination {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  border-top: 1px solid #f0f0f0;
}

.page-btn {
  padding: 5px 10px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  color: #374151;
}

.page-btn:hover:not(:disabled) {
  background: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
}

.page-btn.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.page-btn:disabled { color: #ccc; cursor: not-allowed; }

.page-info { font-size: 12px; color: #888; margin: 0 8px; }

/* ===== トースト通知 ===== */
.toast-container {
  position: fixed;
  top: 64px;
  right: 20px;
  z-index: 9999;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 8px;
  -webkit-box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  -webkit-animation: fadeIn 0.2s;
  animation: fadeIn 0.2s;
}

.toast.error { background: #dc2626; }

@-webkit-keyframes fadeIn {
  from { opacity: 0; -webkit-transform: translateX(20px); transform: translateX(20px); }
  to   { opacity: 1; -webkit-transform: translateX(0);    transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===== スピナー ===== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  -webkit-animation: spin 0.8s linear infinite;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@-webkit-keyframes spin {
  to { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
